大屏接口
This commit is contained in:
parent
921bfe19a6
commit
7da4f2450e
|
|
@ -21,7 +21,7 @@ public enum DeviceTypeEnum {
|
|||
TOWER_RAKE_MONITOR(117, "组塔倾角监测"),
|
||||
TOWER_WATER_MONITOR(118, "组塔拉力监测"),
|
||||
|
||||
LEAD_STRAIN_MONITOR(120, "牵张引线拉力监测");
|
||||
LEAD_STRAIN_MONITOR(124, "牵张引线拉力监测");
|
||||
|
||||
|
||||
private final Integer code;
|
||||
|
|
|
|||
|
|
@ -20,4 +20,18 @@ public enum ProjectTypeEnum {
|
|||
private final Integer code;
|
||||
|
||||
private final String label;
|
||||
|
||||
|
||||
/**
|
||||
* 根据code获取枚举
|
||||
* @param code 枚举code
|
||||
*/
|
||||
public static ProjectTypeEnum getByCode(Integer code) {
|
||||
for (ProjectTypeEnum item : ProjectTypeEnum.values()) {
|
||||
if (item.getCode().equals(code)) {
|
||||
return item;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.bonus.base.mapper;
|
|||
import com.bonus.base.config.DeviceTypeEnum;
|
||||
import com.bonus.base.domain.TbDevice;
|
||||
import com.bonus.screen.vo.DeviceViewVo;
|
||||
import com.bonus.screen.vo.DeviceWarnRecordVo;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
|
@ -73,5 +75,5 @@ public interface TbDeviceMapper {
|
|||
DeviceTypeEnum towerWaterMonitor,
|
||||
DeviceTypeEnum leadStrainMonitor);
|
||||
|
||||
|
||||
List<DeviceWarnRecordVo> getDeviceModelDetailsPage(@Param("deviceTypeCode") Integer deviceTypeCode);
|
||||
}
|
||||
|
|
@ -3,6 +3,8 @@ package com.bonus.base.mapper;
|
|||
import com.bonus.base.domain.TbArea;
|
||||
import com.bonus.base.domain.TbData;
|
||||
import com.bonus.base.domain.TbProDepart;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -11,6 +13,7 @@ import java.util.List;
|
|||
* @author makejava
|
||||
* @since 2024-09-09 11:09:31
|
||||
*/
|
||||
@Mapper
|
||||
public interface TbProDepartMapper {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -72,7 +72,17 @@ public interface TbProjectMapper {
|
|||
*/
|
||||
ProjectViewVo getProjectView(@Param("powerCode") Integer powerCode, @Param("lineCode") Integer lineCode);
|
||||
|
||||
|
||||
/**
|
||||
* 查询工程区域分布列表--by大屏
|
||||
*/
|
||||
List<ProjectAreaGroupVo> getProjectListGroupArea();
|
||||
|
||||
|
||||
/**
|
||||
* 根据工程类型 / 所属区域 获取工程分布列表--by大屏
|
||||
* @param projectTypeCode 工程类型code
|
||||
* @param areaId 区域ID
|
||||
*/
|
||||
List<ProjectAreaGroupVo> getProjectListGroupAreaByTypeCode(@Param("projectTypeCode") Integer projectTypeCode, @Param("areaId") Integer areaId);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package com.bonus.screen.controller;
|
||||
|
||||
import com.bonus.base.config.ProjectTypeEnum;
|
||||
import com.bonus.base.service.TbUserPostService;
|
||||
import com.bonus.common.core.web.controller.BaseController;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.common.core.web.page.TableDataInfo;
|
||||
|
|
@ -10,8 +11,10 @@ import com.bonus.screen.vo.ProjectViewVo;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -26,6 +29,8 @@ public class ProjectViewController extends BaseController {
|
|||
@Autowired
|
||||
private ProjectViewServiceImpl projectViewService;
|
||||
|
||||
@Resource
|
||||
private TbUserPostService tbUserPostService;
|
||||
|
||||
|
||||
@GetMapping("/getProjectModelData")
|
||||
|
|
@ -55,4 +60,23 @@ public class ProjectViewController extends BaseController {
|
|||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getDeviceModelDetailsPage")
|
||||
public TableDataInfo getDeviceModelDetailsPage(Integer deviceTypeCode) {
|
||||
startPage();
|
||||
List<DeviceWarnRecordVo> list = projectViewService.getDeviceModelDetailsPage(deviceTypeCode);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@GetMapping("/getProjectListGroupAreaByTypeCode")
|
||||
public AjaxResult getProjectListGroupAreaByTypeCode(Integer projectTypeCode, Integer areaId) {
|
||||
return success(projectViewService.getProjectListGroupAreaByTypeCode(projectTypeCode, areaId));
|
||||
}
|
||||
|
||||
@GetMapping("/getAreaList")
|
||||
public AjaxResult getAreaList() {
|
||||
return success(projectViewService.getAreaList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,9 @@ package com.bonus.screen.service.impl;
|
|||
import com.bonus.base.config.DeviceTypeEnum;
|
||||
import com.bonus.base.config.ProjectTypeEnum;
|
||||
import com.bonus.base.mapper.TbDeviceMapper;
|
||||
import com.bonus.base.mapper.TbProDepartMapper;
|
||||
import com.bonus.base.mapper.TbProjectMapper;
|
||||
import com.bonus.common.core.web.domain.AjaxResult;
|
||||
import com.bonus.screen.mapper.TbDeviceDataRecord;
|
||||
import com.bonus.screen.vo.DeviceViewVo;
|
||||
import com.bonus.screen.vo.DeviceWarnRecordVo;
|
||||
|
|
@ -32,6 +34,8 @@ public class ProjectViewServiceImpl {
|
|||
@Autowired
|
||||
private TbDeviceDataRecord tbDeviceDataRecord;
|
||||
|
||||
@Autowired
|
||||
private TbProDepartMapper tbProDepartMapper;
|
||||
|
||||
public ProjectViewVo getProjectView() {
|
||||
return tbProjectMapper.getProjectView(
|
||||
|
|
@ -59,15 +63,42 @@ public class ProjectViewServiceImpl {
|
|||
return tbDeviceDataRecord.getDeviceWarnRecord(deviceWarnRecordVo);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* TODO:待完善
|
||||
* @return 区域工程分布列表
|
||||
*/
|
||||
public List<ProjectAreaGroupVo> getProjectListGroupArea() {
|
||||
List<ProjectAreaGroupVo> projectAreaList = tbProjectMapper.getProjectListGroupArea();
|
||||
if (projectAreaList != null && !projectAreaList.isEmpty()) {
|
||||
Map<Integer, List<ProjectAreaGroupVo>> collect = projectAreaList.stream().collect(
|
||||
Collectors.groupingBy(ProjectAreaGroupVo::getAreaId)
|
||||
);
|
||||
// 过滤重复的区域
|
||||
Map<Integer, String> areaMap = projectAreaList.stream().collect(Collectors.toMap(ProjectAreaGroupVo::getAreaId, ProjectAreaGroupVo::getAreaName));
|
||||
// 循环工程列表,把工程存入相应的区域列表内
|
||||
projectAreaList.forEach(record -> {
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
return projectAreaList;
|
||||
}
|
||||
|
||||
|
||||
public AjaxResult getProjectListGroupAreaByTypeCode(Integer projectTypeCode, Integer areaId) {
|
||||
if (projectTypeCode != null) {
|
||||
if (ProjectTypeEnum.getByCode(projectTypeCode) == null) {
|
||||
// 工程类型CODE未在枚举类中定义
|
||||
return AjaxResult.error("工程类型CODE未在枚举类中定义");
|
||||
}
|
||||
}
|
||||
List<ProjectAreaGroupVo> projectAreaGroupVoList = tbProjectMapper.getProjectListGroupAreaByTypeCode(projectTypeCode, areaId);
|
||||
return AjaxResult.success(projectAreaGroupVoList);
|
||||
}
|
||||
|
||||
public AjaxResult getAreaList() {
|
||||
return AjaxResult.success(tbProDepartMapper.getAreaList(null));
|
||||
}
|
||||
|
||||
|
||||
public List<DeviceWarnRecordVo> getDeviceModelDetailsPage(Integer code) {
|
||||
return tbDeviceMapper.getDeviceModelDetailsPage(code);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -27,6 +27,9 @@ public class DeviceWarnRecordVo implements Serializable {
|
|||
@ApiModelProperty(value = "设备状态")
|
||||
private Integer deviceStatus;
|
||||
|
||||
@ApiModelProperty(value = "设备状态名称")
|
||||
private String deviceStatusName;
|
||||
|
||||
@ApiModelProperty(value = "设备类型Code")
|
||||
private String deviceTypeCode;
|
||||
|
||||
|
|
@ -36,6 +39,12 @@ public class DeviceWarnRecordVo implements Serializable {
|
|||
@ApiModelProperty(value = "工程名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty(value = "边缘代理设备名称")
|
||||
private String bdDeviceName;
|
||||
|
||||
@ApiModelProperty(value = "设备使用人姓名")
|
||||
private String devUserName;
|
||||
|
||||
@ApiModelProperty(value = "告警内容")
|
||||
private String warnContent;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,9 +1,8 @@
|
|||
package com.bonus.screen.vo;
|
||||
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
|
@ -38,4 +37,19 @@ public class ProjectAreaGroupVo implements Serializable {
|
|||
@ApiModelProperty(value = "工程名称")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
private String lon;
|
||||
|
||||
/**
|
||||
* 维度
|
||||
*/
|
||||
private String lat;
|
||||
|
||||
/**
|
||||
* 工程状态 (字典表配置)
|
||||
*/
|
||||
private String proStatus;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -46,7 +46,6 @@
|
|||
#{devStatus,jdbcType=INTEGER}, #{devWarn,jdbcType=INTEGER}, #{delFlag,jdbcType=INTEGER},
|
||||
#{logoUrl,jdbcType=VARCHAR})
|
||||
</insert>
|
||||
|
||||
<insert id="insertSelective" parameterType="com.bonus.base.domain.TbDevice">
|
||||
<!--@mbg.generated-->
|
||||
insert into tb_device
|
||||
|
|
@ -66,7 +65,9 @@
|
|||
<if test="configId != null">
|
||||
config_id,
|
||||
</if>
|
||||
<if test="devStatus != null">
|
||||
dev_status,
|
||||
</if>
|
||||
<if test="devWarn != null">
|
||||
dev_warn,
|
||||
</if>
|
||||
|
|
@ -76,6 +77,9 @@
|
|||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="id != null">
|
||||
#{id,jdbcType=BIGINT},
|
||||
</if>
|
||||
<if test="devType != null and devType != ''">
|
||||
#{devType,jdbcType=VARCHAR},
|
||||
</if>
|
||||
|
|
@ -300,4 +304,24 @@
|
|||
and dev_type = #{devType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getDeviceModelDetailsPage" resultType="com.bonus.screen.vo.DeviceWarnRecordVo">
|
||||
SELECT
|
||||
td.dev_name as deviceName,
|
||||
td.dev_code AS deviceCode,
|
||||
td.dev_type AS deviceTypeName,
|
||||
CASE WHEN td.dev_status = 0 THEN '离线'
|
||||
WHEN td.dev_status = 1 THEN '在线'
|
||||
ELSE '未知状态' END deviceStatusName,
|
||||
tp.pro_name AS projectName,
|
||||
tbdr.dev_name AS bdDeviceName,
|
||||
tbdr.dev_user AS devUserName
|
||||
FROM tb_device td
|
||||
LEFT JOIN tb_bd_device_record tbdr ON tbdr.id = td.bd_id
|
||||
LEFT JOIN tb_project tp ON tbdr.pro_id = tp.id
|
||||
WHERE td.del_flag = 0
|
||||
<if test="deviceTypeCode != null">
|
||||
and td.dev_type = #{deviceTypeCode}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -184,5 +184,27 @@
|
|||
LEFT JOIN
|
||||
tb_project p ON a.id = p.area_id;
|
||||
</select>
|
||||
|
||||
<select id="getProjectListGroupAreaByTypeCode" resultType="com.bonus.screen.vo.ProjectAreaGroupVo">
|
||||
SELECT
|
||||
a.id AS areaId,
|
||||
a.area_name as areaName,
|
||||
p.id AS projectId,
|
||||
p.pro_name AS projectName,
|
||||
p.lon,p.lat
|
||||
FROM
|
||||
tb_project p
|
||||
LEFT JOIN
|
||||
tb_area a ON a.id = p.area_id
|
||||
<where>
|
||||
p.del_flag = 0
|
||||
<if test="projectTypeCode != null">
|
||||
and p.pro_type = #{projectTypeCode}
|
||||
</if>
|
||||
<if test="areaId != null">
|
||||
and p.area_id = #{areaId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue