数据模板解析调整
This commit is contained in:
@@ -1,54 +0,0 @@
|
||||
package com.njcn.access.controller;
|
||||
|
||||
|
||||
import com.njcn.access.pojo.po.CsDeviceOnlineLogs;
|
||||
import com.njcn.access.service.ICsDevModelService;
|
||||
import com.njcn.access.service.ICsDeviceOnlineLogsService;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.web.annotation.ReturnMsg;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 设备状态日志表,记录设备掉线上线的情况 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-09-08
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csDeviceOnlineLogs")
|
||||
@Api(tags = "设备上线日志表")
|
||||
@AllArgsConstructor
|
||||
public class CsDeviceOnlineLogsController extends BaseController {
|
||||
|
||||
private final ICsDeviceOnlineLogsService csDeviceOnlineLogsService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/find")
|
||||
@ApiOperation("find")
|
||||
@ApiImplicitParam(name = "nDid", value = "设备识别码", required = true)
|
||||
public HttpResult<CsDeviceOnlineLogs> devRegister(@RequestParam String nDid){
|
||||
CsDeviceOnlineLogs vo = csDeviceOnlineLogsService.findLastData(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, "123");
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -18,6 +18,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -35,6 +36,7 @@ import java.util.List;
|
||||
@Api(tags = "治理网关信息")
|
||||
@AllArgsConstructor
|
||||
@Validated
|
||||
@ApiIgnore
|
||||
public class CsGatewayController extends BaseController {
|
||||
|
||||
private final ICsGatewayService csGatewayService;
|
||||
|
||||
@@ -30,7 +30,6 @@ import com.njcn.csdevice.api.DataSetFeignClient;
|
||||
import com.njcn.csdevice.api.DevModelFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||
import com.njcn.mq.constant.BusinessTopic;
|
||||
import com.njcn.mq.message.AppAutoDataMessage;
|
||||
import com.njcn.mq.message.AppEventMessage;
|
||||
import com.njcn.mq.message.AppFileMessage;
|
||||
@@ -348,7 +347,6 @@ public class MqttMessageHandler {
|
||||
break;
|
||||
case 2:
|
||||
List<RspDataDto.LdevInfo> ldevInfo = JSON.parseArray(JSON.toJSONString(rspDataDto.getDataArray()), RspDataDto.LdevInfo.class);
|
||||
//fixme 默认第一个监测点是负载侧,第二个是电网测,后期数据错误可以在移动端调整
|
||||
redisUtil.saveByKeyWithExpire(AppRedisKey.LINE_DATA+nDid,ldevInfo,600L);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
//package com.njcn.access.runner;
|
||||
//
|
||||
//import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||
//import com.njcn.access.service.ICsTopicService;
|
||||
//import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
||||
//import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.springframework.boot.ApplicationArguments;
|
||||
//import org.springframework.boot.ApplicationRunner;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import javax.annotation.Resource;
|
||||
//import java.util.List;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
///**
|
||||
// * 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
|
||||
// *
|
||||
// * @author xuyang
|
||||
// * @version 1.0.0
|
||||
// * @createTime 2023/8/28 13:57
|
||||
// */
|
||||
//@Component
|
||||
//@Slf4j
|
||||
//public class AccessApplicationRunner implements ApplicationRunner {
|
||||
//
|
||||
// @Resource
|
||||
// private CsDeviceServiceImpl csDeviceService;
|
||||
//
|
||||
// @Resource
|
||||
// private ICsTopicService csTopicService;
|
||||
//
|
||||
// @Resource
|
||||
// private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
//
|
||||
// @Override
|
||||
// public void run(ApplicationArguments args){
|
||||
// List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
||||
// list.forEach(item->{
|
||||
// String version = csTopicService.getVersion(item.getNdid());
|
||||
// if (!Objects.isNull(version)){
|
||||
// csDeviceService.devAccess(item.getNdid(),version);
|
||||
// }
|
||||
// });
|
||||
// }
|
||||
//
|
||||
//}
|
||||
package com.njcn.access.runner;
|
||||
|
||||
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||
import com.njcn.access.service.ICsTopicService;
|
||||
import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.ApplicationArguments;
|
||||
import org.springframework.boot.ApplicationRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/8/28 13:57
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class AccessApplicationRunner implements ApplicationRunner {
|
||||
|
||||
@Resource
|
||||
private CsDeviceServiceImpl csDeviceService;
|
||||
|
||||
@Resource
|
||||
private ICsTopicService csTopicService;
|
||||
|
||||
@Resource
|
||||
private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
@Override
|
||||
public void run(ApplicationArguments args){
|
||||
List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
||||
list.forEach(item->{
|
||||
String version = csTopicService.getVersion(item.getNdid());
|
||||
if (!Objects.isNull(version)){
|
||||
csDeviceService.devAccess(item.getNdid(),version);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.njcn.access.enums.AccessResponseEnum;
|
||||
import com.njcn.access.enums.DataModel;
|
||||
import com.njcn.access.enums.TypeEnum;
|
||||
import com.njcn.access.mapper.CsDevModelMapper;
|
||||
import com.njcn.access.pojo.dto.data.*;
|
||||
import com.njcn.access.pojo.dto.devModel.*;
|
||||
@@ -34,7 +35,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Date;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
@@ -105,7 +105,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
logDto.setResult(0);
|
||||
logDto.setFailReason(AccessResponseEnum.MODEL_ANALYSIS_ERROR.getMessage());
|
||||
csLogsFeignClient.addUserLog(logDto);
|
||||
throw new BusinessException(AccessResponseEnum.MODEL_ANALYSIS_ERROR);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,6 +208,13 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
eleEpdPqdParam.setPhase(apf.getPhase());
|
||||
}
|
||||
eleEpdPqdParam.setClassId(classId);
|
||||
if (Objects.equals(apf.getHarmStart(),0.5) && Objects.equals(apf.getHarmEnd(),49.5)){
|
||||
eleEpdPqdParam.setHarmStart((int)(apf.getHarmStart()+0.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(apf.getHarmEnd()+49.5));
|
||||
} else {
|
||||
eleEpdPqdParam.setHarmStart((int)(apf.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(apf.getHarmEnd()*1.0));
|
||||
}
|
||||
result.add(eleEpdPqdParam);
|
||||
}
|
||||
});
|
||||
@@ -432,10 +439,10 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
eleEpdPqdParam.setUnit(epd.getUnit());
|
||||
if (Objects.equals(epd.getHarmStart(),0.5) && Objects.equals(epd.getHarmEnd(),49.5)){
|
||||
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()+0.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmStart()+49.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmEnd()+49.5));
|
||||
} else {
|
||||
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmEnd()*1.0));
|
||||
}
|
||||
eleEpdPqdParam.setStatMethod(epd.getStatMethod());
|
||||
eleEpdPqdParam.setDataType(id);
|
||||
@@ -449,7 +456,6 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
List<EpdPqdDto> pqdDto = templateDto.getPqdDto();
|
||||
pqdDto.forEach(pqd->{
|
||||
String id = dicDataFeignClient.getDicDataByCode(item).getData().getId();
|
||||
|
||||
String classId = dicDataFeignClient.getDicDataByCode(DataModel.PQD_DATA).getData().getId();
|
||||
List<EleEpdPqd> list = epdFeignClient.judgeExist(pqd.getName(),id).getData();
|
||||
if (CollectionUtil.isEmpty(list)){
|
||||
@@ -467,10 +473,10 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
eleEpdPqdParam.setUnit(pqd.getUnit());
|
||||
if (Objects.equals(pqd.getHarmStart(),0.5) && Objects.equals(pqd.getHarmEnd(),49.5)){
|
||||
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()+0.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmStart()+49.5));
|
||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmEnd()+49.5));
|
||||
} else {
|
||||
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmStart()*1.0));
|
||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmEnd()*1.0));
|
||||
}
|
||||
eleEpdPqdParam.setDataType(id);
|
||||
eleEpdPqdParam.setClassId(classId);
|
||||
@@ -981,13 +987,12 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
CsLineModel csLineModel = new CsLineModel();
|
||||
csLineModel.setLineId(IdUtil.fastSimpleUUID());
|
||||
csLineModel.setPid(pId);
|
||||
//fixme 默认第一个监测点是负载侧,第二个是电网测,后期数据错误可以在移动端调整
|
||||
if (Objects.equals(item.getClDid(),1)){
|
||||
csLineModel.setName("负载侧监测点");
|
||||
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.LOAD_SIDE.getCode()).getData().getId());
|
||||
} else if (Objects.equals(item.getClDid(),2)){
|
||||
if (Objects.equals(item.getClDid(),1) || Objects.equals(item.getLocation(), TypeEnum.GUID.getCode())){
|
||||
csLineModel.setName("电网侧监测点");
|
||||
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData().getId());
|
||||
} else if (Objects.equals(item.getClDid(),2) || Objects.equals(item.getLocation(), TypeEnum.LOAD.getCode())){
|
||||
csLineModel.setName("负载侧监测点");
|
||||
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.LOAD_SIDE.getCode()).getData().getId());
|
||||
}
|
||||
result.add(csLineModel);
|
||||
});
|
||||
@@ -1019,10 +1024,10 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
||||
showName = "模块4数据";
|
||||
break;
|
||||
case "Ds$Pqd$Stat$01":
|
||||
showName = "负载侧数据";
|
||||
showName = "电网侧数据";
|
||||
break;
|
||||
case "Ds$Pqd$Stat$02":
|
||||
showName = "电网侧数据";
|
||||
showName = "负载侧数据";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
@@ -249,7 +249,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
po.setName(item.getName());
|
||||
po.setPosition(item.getPosition());
|
||||
po.setClDid(0);
|
||||
if (Objects.equals(DicDataEnum.LOAD_SIDE.getCode(),location)){
|
||||
if (Objects.equals(DicDataEnum.GRID_SIDE.getCode(),location)){
|
||||
RspDataDto.LdevInfo po1 = list.stream().filter(s -> Objects.equals(s.getClDid(),1)).findFirst().orElse(null);
|
||||
po.setLineId(devAccessParam.getNDid() + "1");
|
||||
param.setId(devAccessParam.getNDid() + "1");
|
||||
@@ -259,7 +259,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
po.setCtRatio(po1.getCtRatio());
|
||||
po.setConType(po1.getConType());
|
||||
po.setClDid(1);
|
||||
} else if (Objects.equals(DicDataEnum.GRID_SIDE.getCode(),location)){
|
||||
} else if (Objects.equals(DicDataEnum.LOAD_SIDE.getCode(),location)){
|
||||
RspDataDto.LdevInfo po1 = list.stream().filter(s -> Objects.equals(s.getClDid(),2)).findFirst().orElse(null);
|
||||
po.setLineId(devAccessParam.getNDid() + "2");
|
||||
param.setId(devAccessParam.getNDid() + "2");
|
||||
@@ -337,7 +337,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
csLogsFeignClient.addUserLog(logDto);
|
||||
} catch (Exception e) {
|
||||
logDto.setResult(0);
|
||||
logDto.setFailReason(CommonResponseEnum.FAIL.getMessage());
|
||||
logDto.setFailReason(e.getMessage());
|
||||
csLogsFeignClient.addUserLog(logDto);
|
||||
throw new BusinessException(CommonResponseEnum.FAIL);
|
||||
}
|
||||
@@ -363,6 +363,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_1.getCode()));
|
||||
reqAndResParam.setExpire(-1);
|
||||
logger.info("询问主题报文为:" + new Gson().toJson(reqAndResParam));
|
||||
publisher.send("/Pfm/DevTopic/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||
}
|
||||
|
||||
@@ -382,6 +383,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
accessDto.setNdid(nDid);
|
||||
accessDto.setDevType(devType);
|
||||
reqAndResParam.setMsg(accessDto);
|
||||
logger.info("注册报文为:" + new Gson().toJson(reqAndResParam));
|
||||
publisher.send("/Pfm/DevReg/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||
}
|
||||
|
||||
@@ -425,7 +427,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
askDataDto.setEndTime(-1);
|
||||
if (Objects.equals(dataType,AccessEnum.SOFT_INFO.getCode())){
|
||||
askDataDto.setCldid(0);
|
||||
reqAndResParam.setDid(2);
|
||||
reqAndResParam.setDid(0);
|
||||
askDataDto.setDataType(1);
|
||||
} else if (Objects.equals(dataType,AccessEnum.L_DEV_INFO.getCode())){
|
||||
askDataDto.setCldid(-1);
|
||||
@@ -433,7 +435,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
||||
askDataDto.setDataType(2);
|
||||
}
|
||||
reqAndResParam.setMsg(askDataDto);
|
||||
System.out.println("111==:"+new Gson().toJson(reqAndResParam));
|
||||
logger.info("询问设备软件信息(监测点信息):" + new Gson().toJson(reqAndResParam));
|
||||
publisher.send("/Pfm/DevCmd/"+version+"/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).eq(CsLedger::getState,1).one();
|
||||
CsLedger csLedger = new CsLedger();
|
||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
||||
csLedger.setState(1);
|
||||
|
||||
Reference in New Issue
Block a user