bug修复

This commit is contained in:
guo 2024-01-29 11:55:51 +08:00
parent e2824b32fa
commit 3a0efb8c25
11 changed files with 39 additions and 20 deletions

View File

@ -23,7 +23,7 @@ public class SectorOneVo {
private String percent;
@ApiModelProperty("枚举类型和字典类型")
@JsonInclude(JsonInclude.Include.NON_NULL)
private Integer enumType;
private String enumType;
@ApiModelProperty(hidden = true)
@JsonIgnore

View File

@ -1,6 +1,7 @@
package com.zhgd.xmgl.base.entity.vo;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.http.HttpUtil;
import com.zhgd.xmgl.enums.BaseEnum;
import com.zhgd.xmgl.modules.basicdata.entity.DictionaryItem;
import io.swagger.annotations.ApiModelProperty;
@ -37,15 +38,15 @@ public class SectorVo {
public static SectorVo getSectorVoByEnum(List<SectorOneVo> list, BaseEnum[] enums) {
SectorVo vo = new SectorVo();
List<SectorOneVo> rtList = new ArrayList<>();
Map<Integer, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEnumType, Function.identity()));
Map<String, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEnumType, Function.identity()));
for (BaseEnum type : enums) {
SectorOneVo vo1 = map.get(type.getValue());
SectorOneVo vo1 = map.get(String.valueOf(type.getValue()));
if (vo1 == null) {
vo1 = new SectorOneVo();
vo1.setCount("0");
}
vo1.setName(type.getDesc());
vo1.setEnumType(type.getValue());
vo1.setEnumType(String.valueOf(type.getValue()));
rtList.add(vo1);
}
vo.setData(rtList);
@ -65,15 +66,15 @@ public class SectorVo {
public static SectorVo getSectorVoByDict(List<SectorOneVo> list, List<DictionaryItem> dictionaryItems, Boolean sorted) {
SectorVo vo = new SectorVo();
List<SectorOneVo> rtList = new ArrayList<>();
Map<Integer, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEnumType, Function.identity()));
Map<String, SectorOneVo> map = list.stream().collect(Collectors.toMap(SectorOneVo::getEnumType, Function.identity()));
for (DictionaryItem type : dictionaryItems) {
SectorOneVo vo1 = map.get(Integer.valueOf(type.getData()));
SectorOneVo vo1 = map.get(type.getData());
if (vo1 == null) {
vo1 = new SectorOneVo();
vo1.setCount("0");
}
vo1.setName(type.getName());
vo1.setEnumType(Integer.valueOf(type.getData()));
vo1.setEnumType(String.valueOf(type.getData()));
rtList.add(vo1);
}
if (Objects.equals(sorted, true)) {
@ -112,7 +113,7 @@ public class SectorVo {
if (d.equals(0.0)) {
one.setPercent("0");
} else {
one.setPercent(NumberUtil.roundStr(Double.valueOf(one.getCount()) / d * 100, 2));
one.setPercent(NumberUtil.roundStr(Double.parseDouble(one.getCount()) / d * 100, 2));
}
}

View File

@ -140,7 +140,7 @@ public class HighSlopeCurrentDataController {
String measurePointNumber = currentDataListQO.getMeasurePointNumber();
IPage<HighSlopeCurrentData> page = highSlopeCurrentDataService.selectHighSlopeCurrentDataList(currentDataListQO.getProjectSn()
, measurePointNumber, sensorSn, currentDataListQO.getHighSlopeEngineeringToMonitorTypeId(), currentDataListQO.getStartTime()
, currentDataListQO.getEndTime(), currentDataListQO.getAlarmState(), currentDataListQO.getPageNo(), currentDataListQO.getPageSize());
, currentDataListQO.getEndTime(), currentDataListQO.getAlarmState(), currentDataListQO.getPageNo(), currentDataListQO.getPageSize(), currentDataListQO.getHighSlopeMonitorTypeId());
currentDataListVO.setData(page);
if (StringUtils.isNotBlank(sensorSn)) {
List<HighSlopeCurrentData> records = page.getRecords();

View File

@ -45,7 +45,8 @@ public class HighSlopeMeasurePointController {
@ApiOperation(value = "高边坡配置-测点管理列表", notes = "高边坡配置-测点管理列表", httpMethod = "POST")
@PostMapping(value = "/selectMeasurePointList")
public Result<IPage<HighSlopeMeasurePoint>> selectListByPageInfo(@RequestBody SelectMeasurePointListQO selectMeasurePointListQO) {
LambdaQueryWrapper<HighSlopeMeasurePoint> wrapper = Wrappers.<HighSlopeMeasurePoint>lambdaQuery().eq(HighSlopeMeasurePoint::getHighSlopeEngineeringToMonitorTypeId, selectMeasurePointListQO.getHighSlopeEngineeringToMonitorTypeId());
LambdaQueryWrapper<HighSlopeMeasurePoint> wrapper = Wrappers.<HighSlopeMeasurePoint>lambdaQuery()
.eq(selectMeasurePointListQO.getHighSlopeEngineeringToMonitorTypeId() != null, HighSlopeMeasurePoint::getHighSlopeEngineeringToMonitorTypeId, selectMeasurePointListQO.getHighSlopeEngineeringToMonitorTypeId());
if (StringUtils.isNotBlank(selectMeasurePointListQO.getMeasurePointNumber())) {
wrapper.like(HighSlopeMeasurePoint::getMeasurePointNumber, selectMeasurePointListQO.getMeasurePointNumber());
}

View File

@ -2,6 +2,7 @@ package com.zhgd.xmgl.modules.highslope.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zhgd.jeecg.common.api.vo.Result;
import com.zhgd.xmgl.modules.highslope.entity.HighSlopePlaneFigure;
@ -53,13 +54,14 @@ public class HighSlopePlaneFigureController {
@ApiOperation(value = "列表查询高边坡-平面图配置信息", notes = "列表查询高边坡-平面图配置信息", httpMethod = "POST")
@ApiImplicitParams({
@ApiImplicitParam(name = "projectSn", value = "项目SN", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "highSlopeEngineeringId", value = "高边坡-工程id", paramType = "body", required = true, dataType = "String"),
@ApiImplicitParam(name = "highSlopeEngineeringId", value = "高边坡-工程id", paramType = "body", required = false, dataType = "String"),
})
@PostMapping(value = "/selectList")
public Result<List<HighSlopePlaneFigure>> selectList(@ApiIgnore @RequestBody Map<String, Object> map) {
QueryWrapper<HighSlopePlaneFigure> queryWrapper = new QueryWrapper<>();
String highSlopeEngineeringId = MapUtils.getString(map, "highSlopeEngineeringId");
queryWrapper.lambda().eq(HighSlopePlaneFigure::getProjectSn, MapUtils.getString(map, "projectSn"))
.eq(HighSlopePlaneFigure::getHighSlopeEngineeringId, MapUtils.getString(map, "highSlopeEngineeringId"));
.eq(StringUtils.isNotBlank(highSlopeEngineeringId), HighSlopePlaneFigure::getHighSlopeEngineeringId, highSlopeEngineeringId);
List<HighSlopePlaneFigure> list = highSlopePlaneFigureService.list(queryWrapper);
for (HighSlopePlaneFigure highSlopePlaneFigure : list) {
LambdaQueryWrapper<HighSlopeMeasurePointToPlaneFigure> wrapper = Wrappers.<HighSlopeMeasurePointToPlaneFigure>lambdaQuery()

View File

@ -32,4 +32,9 @@ public class CurrentDataListQO extends PageQO {
@ApiModelProperty(value = "报警状态 1.正常 2.超报警 3.超控制 4.变化速率报警", required = false)
private Integer alarmState;
@ApiModelProperty(value = "高边坡-监测类型id", required = false)
private Integer highSlopeMonitorTypeId;
}

View File

@ -28,7 +28,7 @@ public interface HighSlopeCurrentDataMapper extends BaseMapper<HighSlopeCurrentD
HighSlopeCurrentData selectNewestHighSlopeCurrentData(@Param("measurePointNumber") String measurePointNumber, @Param("projectSn") String projectSn);
IPage<HighSlopeCurrentData> selectHighSlopeCurrentDataList(@Param("projectSn") String projectSn, @Param("measurePointNumber") String measurePointNumber, @Param("sensorSn") String sensorSn, @Param("highSlopeEngineeringToMonitorTypeId") Long highSlopeEngineeringToMonitorTypeId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("alarmState") Integer alarmState, Page<?> tPage);
IPage<HighSlopeCurrentData> selectHighSlopeCurrentDataList(@Param("projectSn") String projectSn, @Param("measurePointNumber") String measurePointNumber, @Param("sensorSn") String sensorSn, @Param("highSlopeEngineeringToMonitorTypeId") Long highSlopeEngineeringToMonitorTypeId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("alarmState") Integer alarmState, Page<?> tPage, @Param("highSlopeMonitorTypeId") Integer highSlopeMonitorTypeId);
List<HighSlopeCurrentData> selectArticleOneDataList(Set<String> sensorSnList);

View File

@ -104,6 +104,7 @@
left join high_slope_measure_point demp
on des.measure_point_number = demp.measure_point_number
inner join high_slope_engineering dee on demp.high_slope_engineering_id = dee.id
join high_slope_engineering_to_monitor_type hsetmt on hsetmt.high_slope_engineering_id = dee.id
left join high_slope_sensor_type dest on dest.id = des.high_slope_sensor_type_id
<where>
<if test="projectSn != null and projectSn != ''">
@ -127,6 +128,9 @@
<if test="alarmState != null">
and decd.alarm_state = #{alarmState}
</if>
<if test="highSlopeMonitorTypeId != null">
and hsetmt.id = #{highSlopeMonitorTypeId}
</if>
</where>
order by decd.receive_time desc
</select>

View File

@ -2,13 +2,19 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.zhgd.xmgl.modules.highslope.mapper.HighSlopeEngineeringToMonitorTypeMapper">
<select id="countMonitorType" resultType="com.zhgd.xmgl.base.entity.vo.SectorOneVo">
select hsetmt.high_slope_monitor_type_id x,count(*) y
select hsmt.monitor_type_name name,count(*) count, hsmt.monitor_type_code enumType
from high_slope_engineering_to_monitor_type hsetmt
join high_slope_monitor_type hsmt on hsmt.id = hsetmt.high_slope_monitor_type_id
JOIN high_slope_engineering hse ON hse.id = hsetmt.high_slope_engineering_id
join high_slope_measure_point hsmp on hsmp.high_slope_engineering_to_monitor_type_id=hsetmt.id
where 1=1
<if test="highSlopeEngineeringId != null and highSlopeEngineeringId != ''">
and hsetmt.high_slope_engineering_id = #{highSlopeEngineeringId}
</if>
group by x
order by y desc
<if test="projectSn != null and projectSn != ''">
and hse.project_sn = #{projectSn}
</if>
group by enumType
order by count desc
</select>
</mapper>

View File

@ -33,7 +33,7 @@ public interface IHighSlopeCurrentDataService extends IService<HighSlopeCurrentD
*/
void saveBatchHighSlopeCurrentData(JSONArray jsonArray);
IPage<HighSlopeCurrentData> selectHighSlopeCurrentDataList(String projectSn, String measurePointNumber, String sensorSn, Long highSlopeEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState, Integer pageNo, Integer pageSize);
IPage<HighSlopeCurrentData> selectHighSlopeCurrentDataList(String projectSn, String measurePointNumber, String sensorSn, Long highSlopeEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState, Integer pageNo, Integer pageSize, Integer highSlopeMonitorTypeId);
/**
* 获取所有传感器最后一条数据时间

View File

@ -94,8 +94,8 @@ public class HighSlopeCurrentDataServiceImpl extends ServiceImpl<HighSlopeCurren
}
@Override
public IPage<HighSlopeCurrentData> selectHighSlopeCurrentDataList(String projectSn, String measurePointNumber, String sensorSn, Long highSlopeEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState, Integer pageNo, Integer pageSize) {
IPage<HighSlopeCurrentData> page = highSlopeCurrentDataMapper.selectHighSlopeCurrentDataList(projectSn, measurePointNumber, sensorSn, highSlopeEngineeringToMonitorTypeId, startTime, endTime, alarmState, new Page<>(pageNo, pageSize));
public IPage<HighSlopeCurrentData> selectHighSlopeCurrentDataList(String projectSn, String measurePointNumber, String sensorSn, Long highSlopeEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState, Integer pageNo, Integer pageSize, Integer highSlopeMonitorTypeId) {
IPage<HighSlopeCurrentData> page = highSlopeCurrentDataMapper.selectHighSlopeCurrentDataList(projectSn, measurePointNumber, sensorSn, highSlopeEngineeringToMonitorTypeId, startTime, endTime, alarmState, new Page<>(pageNo, pageSize), highSlopeMonitorTypeId);
for (HighSlopeCurrentData currentData : page.getRecords()) {
currentData.setLastTimeData(NumberUtil.sub(Optional.ofNullable(currentData.getData()).orElse(0f), Optional.ofNullable(currentData.getDataThis()).orElse(0f)).floatValue());
}
@ -115,7 +115,7 @@ public class HighSlopeCurrentDataServiceImpl extends ServiceImpl<HighSlopeCurren
@Override
public void exportData(HttpServletResponse response, String projectSn, String measurePointNumber, String sensorSn, Long highSlopeEngineeringToMonitorTypeId, String startTime, String endTime, Integer alarmState) {
try {
List<HighSlopeCurrentData> list = highSlopeCurrentDataMapper.selectHighSlopeCurrentDataList(projectSn, measurePointNumber, sensorSn, highSlopeEngineeringToMonitorTypeId, startTime, endTime, alarmState, new Page<>().setSize(-1)).getRecords();
List<HighSlopeCurrentData> list = highSlopeCurrentDataMapper.selectHighSlopeCurrentDataList(projectSn, measurePointNumber, sensorSn, highSlopeEngineeringToMonitorTypeId, startTime, endTime, alarmState, new Page<>().setSize(-1), null).getRecords();
for (HighSlopeCurrentData currentData : list) {
currentData.setLastTimeData(NumberUtil.sub(Optional.ofNullable(currentData.getData()).orElse(0f), Optional.ofNullable(currentData.getDataThis()).orElse(0f)).floatValue());
currentData.setAlarmStateStr(DataStatusEnum.getStatusNameById(currentData.getAlarmState()));