bug修复

This commit is contained in:
guo 2024-01-30 17:44:52 +08:00
parent e72943f627
commit 9081280f40
4 changed files with 47 additions and 9 deletions

View File

@ -40,7 +40,7 @@
</select>
<select id="countLoadRatioTrend" resultType="com.zhgd.xmgl.base.entity.vo.TrendOneVo">
select date_format(a.recive_time, '%Y-%m-%d %H:00') x,
select date_format(a.recive_time, '%H:00') x,
ifnull(round(avg(a.loading / dpd.max_load * 100), 2), 0) y
from discharging_platform_current_data a
join discharging_platform_dev dpd on a.dev_sn = dpd.dev_sn and a.project_sn = dpd.project_sn
@ -58,7 +58,7 @@
and recive_time >= current_date
</otherwise>
</choose>
group by x
group by date_format(a.recive_time, '%Y-%m-%d %H:00')
</select>
<select id="countDischargingPlatformCurrentData"

View File

@ -144,7 +144,7 @@ public class DischargingPlatformCurrentDataServiceImpl extends ServiceImpl<Disch
@Override
public List<TrendOneVo> countLoadRatioTrend(HashMap<String, Object> paramMap) {
ArrayList<TrendOneVo> list = baseMapper.countLoadRatioTrend(paramMap);
return TrendOneVo.fillTrendVos(list, DateUtils.getDateTimeStrList(100, "yyyy-MM-dd HH:00"), "HH:00");
return TrendOneVo.fillTrendVos(list, DateUtils.getDateTimeStrList(100, "HH:00"), "HH:00");
}
@Override

View File

@ -2,11 +2,9 @@ package com.zhgd.xmgl.task;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.gexin.fastjson.JSON;
import com.zhgd.xmgl.modules.discharging.entity.DischargingPlatformCurrentData;
import com.zhgd.xmgl.modules.discharging.entity.DischargingPlatformDev;
@ -27,10 +25,7 @@ import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.concurrent.CompletableFuture;
@Slf4j
@ -120,6 +115,7 @@ public class DischargingPlatformCurrentDataTask {
data.setXiewenId(dto.getId());
dischargingPlatformCurrentDataMapper.insert(data);
transformAlarms(data, dto);
dischargingPlatformCurrentDataService.addAlarms(data, dev);
}
} else {
@ -131,4 +127,42 @@ public class DischargingPlatformCurrentDataTask {
}
private void transformAlarms(DischargingPlatformCurrentData data, DischargingPlatformCurrentDataDto dto) {
/**
* weightStatus Integer 重量状态 0-正常 1-预警 2-报警
* inclinationXStatus Integer 倾角X状态 0-正常 1-预警 2-报警
* inclinationYStatus Integer 倾角Y状态 0-正常 1-预警 2-报警
*/
if (Objects.equals(dto.getWeightStatus(), 1)) {
data.setIsAlarm(1);
data.setAlarmLevel(3);
data.setAlarmType("重量状态预警");
} else if (Objects.equals(dto.getWeightStatus(), 2)) {
data.setIsAlarm(1);
data.setAlarmLevel(1);
data.setAlarmType("重量状态报警");
}
if (Objects.equals(dto.getInclinationXStatus(), 1)) {
data.setIsAlarm(1);
data.setAlarmLevel(3);
data.setAlarmType("倾角X状态预警");
} else if (Objects.equals(dto.getInclinationXStatus(), 2)) {
data.setIsAlarm(1);
data.setAlarmLevel(1);
data.setAlarmType("倾角X状态报警");
}
if (Objects.equals(dto.getInclinationYStatus(), 1)) {
data.setIsAlarm(1);
data.setAlarmLevel(3);
data.setAlarmType("倾角Y状态预警");
} else if (Objects.equals(dto.getInclinationYStatus(), 2)) {
data.setIsAlarm(1);
data.setAlarmLevel(1);
data.setAlarmType("倾角Y状态报警");
}
}
}

View File

@ -0,0 +1,4 @@
package com.zhgd.mock;
public class MockDataTest {
}