Commit 56a84b52 authored by hezhuozhi's avatar hezhuozhi

Merge remote-tracking branch 'origin/developer' into developer

parents 6df47e10 501f18da
package com.yeejoin.amos.boot.module.jxiop.biz.controller; package com.yeejoin.amos.boot.module.jxiop.biz.controller;
import cn.hutool.core.bean.BeanUtil; import java.text.SimpleDateFormat;
import cn.hutool.core.date.DateUtil; import java.util.Date;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import java.util.List;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.yeejoin.amos.boot.biz.common.controller.BaseController; import com.yeejoin.amos.boot.biz.common.controller.BaseController;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanHealthIndex;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData; import com.yeejoin.amos.boot.module.jxiop.biz.entity.IndicatorData;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.CommonServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl; import com.yeejoin.amos.boot.module.jxiop.biz.service.impl.TdengineTimeServiceImpl;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanHealthIndexMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanHealthIndex; import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.FanWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdMapper2.PvWaringRecordMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.FanWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdengine.PvWarningRecord;
import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper; import com.yeejoin.amos.boot.module.jxiop.biz.tdmapper.IndicatorDataMapper;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.typroject.tyboot.core.foundation.enumeration.UserType;
import org.typroject.tyboot.core.restful.doc.TycloudOperation;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
@RestController @RestController
@RequestMapping(value = "/test") @RequestMapping(value = "/test")
@Api(tags = "测试Api") @Api(tags = "测试Api")
public class TestController extends BaseController { public class TestController extends BaseController {
@Autowired @Autowired
IndicatorDataMapper indicatorDataMapper; IndicatorDataMapper indicatorDataMapper;
@Autowired @Autowired
CommonServiceImpl commonService; CommonServiceImpl commonService;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test1", notes = "test1")
@GetMapping("/test1")
public List<IndicatorData> test1(@RequestParam(value = "startTime") String startTime, @RequestParam(value = "endTime") String endTime, @RequestParam(value = "address") String address, @RequestParam(value = "gatewayId") String gatewayId) {
List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(address, startTime, endTime,gatewayId);
return indicatorData;
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test1", notes = "test1")
@GetMapping("/test1")
public List<IndicatorData> test1(@RequestParam(value = "startTime") String startTime,
@RequestParam(value = "endTime") String endTime, @RequestParam(value = "address") String address,
@RequestParam(value = "gatewayId") String gatewayId) {
List<IndicatorData> indicatorData = indicatorDataMapper.selectDataByAddressAndtime(address, startTime, endTime,
gatewayId);
return indicatorData;
}
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test2", notes = "test1") @ApiOperation(httpMethod = "GET", value = "test2", notes = "test1")
@GetMapping("/test2") @GetMapping("/test2")
public void test2 (@RequestParam(value = "startTime") String startTime, @Param("recDate") String recDate) { public void test2(@RequestParam(value = "startTime") String startTime, @Param("recDate") String recDate) {
// List<FanHealthIndex> infoListByGroupByCD = fanHealthIndexMapper.getInfoListByGroupByCdFan(startTime, recDate); // List<FanHealthIndex> infoListByGroupByCD = fanHealthIndexMapper.getInfoListByGroupByCdFan(startTime, recDate);
// commonService.healthWarningMinuteByFJ(); // commonService.healthWarningMinuteByFJ();
// commonService.healthWarningMinuteByPv(); // commonService.healthWarningMinuteByPv();
// return infoListByGroupByCD; // return infoListByGroupByCD;
} }
@Autowired @Autowired
FanHealthIndexMapper fanHealthIndexMapper; FanHealthIndexMapper fanHealthIndexMapper;
@Autowired @Autowired
TdengineTimeServiceImpl tdengineTimeService; TdengineTimeServiceImpl tdengineTimeService;
@TycloudOperation(ApiLevel = UserType.AGENCY,needAuth = false) @TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "POST", value = "saveTest", notes = "saveTest") @ApiOperation(httpMethod = "POST", value = "saveTest", notes = "saveTest")
@PostMapping("/saveTest") @PostMapping("/saveTest")
public void saveTest () { public void saveTest() {
// QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>(); // QueryWrapper<FanHealthIndex> fanHealthIndexQueryWrapper = new QueryWrapper<>();
// List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper); // List<FanHealthIndex> fanHealthIndices = fanHealthIndexMapper.selectList(fanHealthIndexQueryWrapper);
...@@ -107,6 +113,67 @@ public class TestController extends BaseController { ...@@ -107,6 +113,67 @@ public class TestController extends BaseController {
// list.add(fanHealthIndex); // list.add(fanHealthIndex);
//// commonService.healthWarningMinuteByFJ(); //// commonService.healthWarningMinuteByFJ();
// fanHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "fan_health_index_moment"); // fanHealthIndexMapper.saveBatchHealthIndexList(fanHealthIndices1, "fan_health_index_moment");
} }
@Autowired
private FanWaringRecordMapper fanWaringRecordMapper;
@Autowired
private PvWaringRecordMapper pvWaringRecordMapper;
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test2", notes = "test1")
@GetMapping("/clear-record")
public void clearRecord(@RequestParam(value = "startTime", required = false) String startTime) {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String d = sdf.format(new Date());
LambdaQueryWrapper<FanWarningRecord> wf = new LambdaQueryWrapper<>();
wf.ne(FanWarningRecord::getDisposotionState, "已确认");
List<FanWarningRecord> list = fanWaringRecordMapper.selectList(wf);
if (!list.isEmpty()) {
list.forEach(i -> {
i.setDisposotionState("已确认");
i.setDisposotionDate(d);
});
fanWaringRecordMapper.saveBatchWarningRecords(list);
}
LambdaQueryWrapper<PvWarningRecord> pf = new LambdaQueryWrapper<>();
pf.ne(PvWarningRecord::getDisposotionState, "已确认");
List<PvWarningRecord> list1 = pvWaringRecordMapper.selectList(pf);
if (!list1.isEmpty()) {
list1.forEach(i -> {
i.setDisposotionState("已确认");
i.setDisposotionDate(d);
});
pvWaringRecordMapper.saveBatchWarningRecords(list1);
}
}
@TycloudOperation(ApiLevel = UserType.AGENCY, needAuth = false)
@ApiOperation(httpMethod = "GET", value = "test2", notes = "test1")
@GetMapping("/set-date")
public void clearRecord() {
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String d = sdf.format(new Date());
LambdaQueryWrapper<FanWarningRecord> wf = new LambdaQueryWrapper<>();
wf.isNull(FanWarningRecord::getDisposotionDate);
List<FanWarningRecord> list = fanWaringRecordMapper.selectList(wf);
if (!list.isEmpty()) {
list.forEach(i -> {
i.setDisposotionDate(d);
});
fanWaringRecordMapper.saveBatchWarningRecords(list);
}
LambdaQueryWrapper<PvWarningRecord> pf = new LambdaQueryWrapper<>();
pf.isNull(PvWarningRecord::getDisposotionDate);
List<PvWarningRecord> list1 = pvWaringRecordMapper.selectList(pf);
if (!list1.isEmpty()) {
list1.forEach(i -> {
i.setDisposotionDate(d);
});
pvWaringRecordMapper.saveBatchWarningRecords(list1);
}
}
} }
...@@ -2094,7 +2094,7 @@ public class CommonServiceImpl { ...@@ -2094,7 +2094,7 @@ public class CommonServiceImpl {
fanHealthIndex.setAnomaly(idxBizFanHealthIndex.getANOMALY()); fanHealthIndex.setAnomaly(idxBizFanHealthIndex.getANOMALY());
fanHealthIndex.setRecDate(DateUtil.now()); fanHealthIndex.setRecDate(DateUtil.now());
fanHealthIndex.setArea(idxBizFanHealthIndex.getArae()); fanHealthIndex.setArea(idxBizFanHealthIndex.getArae());
fanHealthIndex.setAnalysisTime(DateUtil.now()); fanHealthIndex.setAnalysisTime(format);
fanHealthIndex.setHealthLevel(fanHealthIndex.getHealthLevel()); fanHealthIndex.setHealthLevel(fanHealthIndex.getHealthLevel());
fanHealthIndex.setKks(idxBizFanHealthIndex.getKks()); fanHealthIndex.setKks(idxBizFanHealthIndex.getKks());
fanHealthIndex.setRecDate(format); fanHealthIndex.setRecDate(format);
......
...@@ -2715,7 +2715,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -2715,7 +2715,7 @@ public class HealthStatusIndicatorServiceImpl {
riskBizInfoVo.setSourceAttribution(stationMap.get(idxBizPvWarningRecord.getGatewayId()).getProjectOrgCode()); riskBizInfoVo.setSourceAttribution(stationMap.get(idxBizPvWarningRecord.getGatewayId()).getProjectOrgCode());
riskBizInfoVo.setSourceAttributionDesc(idxBizPvWarningRecord.getStation()); riskBizInfoVo.setSourceAttributionDesc(idxBizPvWarningRecord.getStation());
riskBizInfoVo.setWarningObjectType("equip"); riskBizInfoVo.setWarningObjectType("equip");
riskBizInfoVo.setWarningTime(DateUtil.now()); riskBizInfoVo.setWarningTime(idxBizPvWarningRecord.getRecDate());
riskBizInfoVo.setBussId(String.valueOf(idxBizPvWarningRecord.getTs())); riskBizInfoVo.setBussId(String.valueOf(idxBizPvWarningRecord.getTs()));
riskBizInfoVo.setWarningObjectLinkUrl(getJumpUrlByInfo(idxBizPvWarningRecord.getKks(), jumpConfigs)); riskBizInfoVo.setWarningObjectLinkUrl(getJumpUrlByInfo(idxBizPvWarningRecord.getKks(), jumpConfigs));
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>(); List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>();
...@@ -2781,7 +2781,7 @@ public class HealthStatusIndicatorServiceImpl { ...@@ -2781,7 +2781,7 @@ public class HealthStatusIndicatorServiceImpl {
riskBizInfoVo.setSourceAttribution(stationMap.get(idxBizFanWarningRecord.getGatewayId()).getProjectOrgCode()); riskBizInfoVo.setSourceAttribution(stationMap.get(idxBizFanWarningRecord.getGatewayId()).getProjectOrgCode());
riskBizInfoVo.setSourceAttributionDesc(idxBizFanWarningRecord.getStation()); riskBizInfoVo.setSourceAttributionDesc(idxBizFanWarningRecord.getStation());
riskBizInfoVo.setWarningObjectType("equip"); riskBizInfoVo.setWarningObjectType("equip");
riskBizInfoVo.setWarningTime(DateUtil.now()); riskBizInfoVo.setWarningTime(idxBizFanWarningRecord.getRecDate());
riskBizInfoVo.setWarningObjectLinkUrl(getJumpUrlByInfo(idxBizFanWarningRecord.getKks(), jumpConfigs)); riskBizInfoVo.setWarningObjectLinkUrl(getJumpUrlByInfo(idxBizFanWarningRecord.getKks(), jumpConfigs));
List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>(); List<RiskDynamicDetailsVo> detailsVos = new ArrayList<>();
RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo(); RiskDynamicDetailsVo dynamicDetailsVo = new RiskDynamicDetailsVo();
......
...@@ -74,7 +74,8 @@ mqtt.client.product.id=mqtt ...@@ -74,7 +74,8 @@ mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
emqx.max-inflight=1000 emqx.max-inflight=1000
emqx.client-user-name=admin
emqx.client-password=public
tdengine-server: tdengine-server:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
......
...@@ -74,7 +74,8 @@ mqtt.client.product.id=mqtt ...@@ -74,7 +74,8 @@ mqtt.client.product.id=mqtt
mqtt.topic=topic_mqtt mqtt.topic=topic_mqtt
spring.mqtt.completionTimeout=3000 spring.mqtt.completionTimeout=3000
emqx.max-inflight=1000 emqx.max-inflight=1000
emqx.client-user-name=admin
emqx.client-password=public
tdengine-server: tdengine-server:
driver-class-name: com.taosdata.jdbc.rs.RestfulDriver driver-class-name: com.taosdata.jdbc.rs.RestfulDriver
......
...@@ -205,7 +205,7 @@ ...@@ -205,7 +205,7 @@
FROM FROM
mcb_warning_question_info question, mcb_warning_question_info question,
mcb_warning_warning_info warning mcb_warning_warning_info warning
<where> where
question.NUM IS NOT NULL question.NUM IS NOT NULL
AND question.NUM = warning.QUESTION_NUM AND question.NUM = warning.QUESTION_NUM
AND question.COMPLETION_STATUS != '1' AND question.COMPLETION_STATUS != '1'
...@@ -222,8 +222,32 @@ ...@@ -222,8 +222,32 @@
#{item} #{item}
</foreach> </foreach>
</if> </if>
</where> ORDER BY question.CREATE_DATE DESC Limit #{offset}, #{size}
ORDER BY question.CREATE_DATE DESC </select>
<select id="overviewQuestionListTotal" resultType="int">
SELECT
count(1)
FROM
mcb_warning_question_info question,
mcb_warning_warning_info warning
where
question.NUM IS NOT NULL
AND question.NUM = warning.QUESTION_NUM
AND question.COMPLETION_STATUS != '1'
AND warning.WARNING_SOURCE_TYPE in (select mcb_data_dictionary.name from mcb_data_dictionary WHERE mcb_data_dictionary.remark = 'OVERVIEW' )
<if test="startTime != null and startTime != ''">
AND question.CREATE_DATE >= #{startTime}
</if>
<if test="endTime != null and endTime != ''">
AND question.CREATE_DATE &lt;= #{endTime}
</if>
<if test="projectOrgCodes != null and projectOrgCodes.size() > 0">
AND question.SOURCE_ATTRIBUTION IN
<foreach collection="projectOrgCodes" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
</select> </select>
<select id="queryQuestionList" resultType="java.util.Map"> <select id="queryQuestionList" resultType="java.util.Map">
......
...@@ -49,9 +49,17 @@ public interface McbWarningMapper extends BaseMapper { ...@@ -49,9 +49,17 @@ public interface McbWarningMapper extends BaseMapper {
List<OverviewQuestionDto> overviewQuestionList( List<OverviewQuestionDto> overviewQuestionList(
@Param("projectOrgCodes") List<String> projectOrgCodes, Integer offset,
@Param("startTime") String startTime, Integer size,
@Param("endTime") String endTime List<String> projectOrgCodes,
String startTime,
String endTime
);
Integer overviewQuestionListTotal(
List<String> projectOrgCodes,
String startTime,
String endTime
); );
/** /**
......
...@@ -104,15 +104,13 @@ public class McbWarningServiceImpl implements IMcbWarningService { ...@@ -104,15 +104,13 @@ public class McbWarningServiceImpl implements IMcbWarningService {
endTime+= " 23:59:59"; endTime+= " 23:59:59";
} }
List<OverviewQuestionDto> list = mcbWarningMapper.overviewQuestionList( (current -1) * size, size ,projectOrgCodes, startTime, endTime);
PageHelper.startPage(current, size); Integer total = mcbWarningMapper.overviewQuestionListTotal(projectOrgCodes, startTime, endTime);
List<OverviewQuestionDto> list = mcbWarningMapper.overviewQuestionList(projectOrgCodes, startTime, endTime);
PageInfo<OverviewQuestionDto> page = new PageInfo(list);
Page<OverviewQuestionDto> pagenew = new Page<>(); Page<OverviewQuestionDto> pagenew = new Page<>();
pagenew.setCurrent(current); pagenew.setCurrent(current);
pagenew.setTotal(page.getTotal()); pagenew.setTotal(total);
pagenew.setSize(size); pagenew.setSize(size);
pagenew.setRecords(page.getList()); pagenew.setRecords(list);
return pagenew; return pagenew;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment