Commit 2a9b420f authored by wujiang's avatar wujiang

修改时间不对

parent 3db8bc9a
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.eq(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.eq(PvWarningRecord::getDisposotionState, "待确认");
List<PvWarningRecord> list1 = pvWaringRecordMapper.selectList(pf);
if (!list1.isEmpty()) {
list1.forEach(i -> {
i.setDisposotionState("已确认");
i.setDisposotionState(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);
......
...@@ -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
......
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