数据模板解析调整
This commit is contained in:
@@ -80,6 +80,13 @@ public enum TypeEnum {
|
|||||||
INSET("InSet","内部定值"),
|
INSET("InSet","内部定值"),
|
||||||
CTRL("Ctrl","控制"),
|
CTRL("Ctrl","控制"),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点位置信息
|
||||||
|
*/
|
||||||
|
GUID("guid","电网侧"),
|
||||||
|
LOAD("load","负载侧"),
|
||||||
|
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
private final String code;
|
private final String code;
|
||||||
|
|||||||
@@ -46,4 +46,12 @@ public class ApfDto implements Serializable {
|
|||||||
@ApiModelProperty("数据统计方法(max,min,avg,cp95)")
|
@ApiModelProperty("数据统计方法(max,min,avg,cp95)")
|
||||||
private List<String> statMethod;
|
private List<String> statMethod;
|
||||||
|
|
||||||
|
@SerializedName("HarmStart")
|
||||||
|
@ApiModelProperty("开始次数")
|
||||||
|
private Integer harmStart;
|
||||||
|
|
||||||
|
@SerializedName("HarmEnd")
|
||||||
|
@ApiModelProperty("结束次数")
|
||||||
|
private Integer harmEnd;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,6 +26,10 @@ public class ClDevDto implements Serializable {
|
|||||||
@ApiModelProperty(value = "逻辑子设备型号")
|
@ApiModelProperty(value = "逻辑子设备型号")
|
||||||
private String devType;
|
private String devType;
|
||||||
|
|
||||||
|
@SerializedName("Location")
|
||||||
|
@ApiModelProperty(value = "安装位置")
|
||||||
|
private String location;
|
||||||
|
|
||||||
@SerializedName("DataList")
|
@SerializedName("DataList")
|
||||||
@NotEmpty(message = "数据模型列表,不可为空")
|
@NotEmpty(message = "数据模型列表,不可为空")
|
||||||
private List<String> dataList;
|
private List<String> dataList;
|
||||||
|
|||||||
@@ -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 lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -35,6 +36,7 @@ import java.util.List;
|
|||||||
@Api(tags = "治理网关信息")
|
@Api(tags = "治理网关信息")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
@Validated
|
@Validated
|
||||||
|
@ApiIgnore
|
||||||
public class CsGatewayController extends BaseController {
|
public class CsGatewayController extends BaseController {
|
||||||
|
|
||||||
private final ICsGatewayService csGatewayService;
|
private final ICsGatewayService csGatewayService;
|
||||||
|
|||||||
@@ -30,7 +30,6 @@ import com.njcn.csdevice.api.DataSetFeignClient;
|
|||||||
import com.njcn.csdevice.api.DevModelFeignClient;
|
import com.njcn.csdevice.api.DevModelFeignClient;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.mq.constant.BusinessTopic;
|
|
||||||
import com.njcn.mq.message.AppAutoDataMessage;
|
import com.njcn.mq.message.AppAutoDataMessage;
|
||||||
import com.njcn.mq.message.AppEventMessage;
|
import com.njcn.mq.message.AppEventMessage;
|
||||||
import com.njcn.mq.message.AppFileMessage;
|
import com.njcn.mq.message.AppFileMessage;
|
||||||
@@ -348,7 +347,6 @@ public class MqttMessageHandler {
|
|||||||
break;
|
break;
|
||||||
case 2:
|
case 2:
|
||||||
List<RspDataDto.LdevInfo> ldevInfo = JSON.parseArray(JSON.toJSONString(rspDataDto.getDataArray()), RspDataDto.LdevInfo.class);
|
List<RspDataDto.LdevInfo> ldevInfo = JSON.parseArray(JSON.toJSONString(rspDataDto.getDataArray()), RspDataDto.LdevInfo.class);
|
||||||
//fixme 默认第一个监测点是负载侧,第二个是电网测,后期数据错误可以在移动端调整
|
|
||||||
redisUtil.saveByKeyWithExpire(AppRedisKey.LINE_DATA+nDid,ldevInfo,600L);
|
redisUtil.saveByKeyWithExpire(AppRedisKey.LINE_DATA+nDid,ldevInfo,600L);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1,47 +1,47 @@
|
|||||||
//package com.njcn.access.runner;
|
package com.njcn.access.runner;
|
||||||
//
|
|
||||||
//import com.njcn.access.service.ICsEquipmentDeliveryService;
|
import com.njcn.access.service.ICsEquipmentDeliveryService;
|
||||||
//import com.njcn.access.service.ICsTopicService;
|
import com.njcn.access.service.ICsTopicService;
|
||||||
//import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
import com.njcn.access.service.impl.CsDeviceServiceImpl;
|
||||||
//import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
//import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
//import org.springframework.boot.ApplicationArguments;
|
import org.springframework.boot.ApplicationArguments;
|
||||||
//import org.springframework.boot.ApplicationRunner;
|
import org.springframework.boot.ApplicationRunner;
|
||||||
//import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
//
|
|
||||||
//import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
//import java.util.List;
|
import java.util.List;
|
||||||
//import java.util.Objects;
|
import java.util.Objects;
|
||||||
//
|
|
||||||
///**
|
/**
|
||||||
// * 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
|
* 类的介绍:用来重新发起设备的接入,存在程序意外停止了,缓存失效导致无法更新装置的状态,所以需要在程序启动时发起设备的接入
|
||||||
// *
|
*
|
||||||
// * @author xuyang
|
* @author xuyang
|
||||||
// * @version 1.0.0
|
* @version 1.0.0
|
||||||
// * @createTime 2023/8/28 13:57
|
* @createTime 2023/8/28 13:57
|
||||||
// */
|
*/
|
||||||
//@Component
|
@Component
|
||||||
//@Slf4j
|
@Slf4j
|
||||||
//public class AccessApplicationRunner implements ApplicationRunner {
|
public class AccessApplicationRunner implements ApplicationRunner {
|
||||||
//
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private CsDeviceServiceImpl csDeviceService;
|
private CsDeviceServiceImpl csDeviceService;
|
||||||
//
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private ICsTopicService csTopicService;
|
private ICsTopicService csTopicService;
|
||||||
//
|
|
||||||
// @Resource
|
@Resource
|
||||||
// private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
private ICsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
//
|
|
||||||
// @Override
|
@Override
|
||||||
// public void run(ApplicationArguments args){
|
public void run(ApplicationArguments args){
|
||||||
// List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
List<CsEquipmentDeliveryPO> list = csEquipmentDeliveryService.getAll();
|
||||||
// list.forEach(item->{
|
list.forEach(item->{
|
||||||
// String version = csTopicService.getVersion(item.getNdid());
|
String version = csTopicService.getVersion(item.getNdid());
|
||||||
// if (!Objects.isNull(version)){
|
if (!Objects.isNull(version)){
|
||||||
// csDeviceService.devAccess(item.getNdid(),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.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
import com.njcn.access.enums.AccessResponseEnum;
|
import com.njcn.access.enums.AccessResponseEnum;
|
||||||
import com.njcn.access.enums.DataModel;
|
import com.njcn.access.enums.DataModel;
|
||||||
|
import com.njcn.access.enums.TypeEnum;
|
||||||
import com.njcn.access.mapper.CsDevModelMapper;
|
import com.njcn.access.mapper.CsDevModelMapper;
|
||||||
import com.njcn.access.pojo.dto.data.*;
|
import com.njcn.access.pojo.dto.data.*;
|
||||||
import com.njcn.access.pojo.dto.devModel.*;
|
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.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
@@ -105,7 +105,7 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
logDto.setResult(0);
|
logDto.setResult(0);
|
||||||
logDto.setFailReason(AccessResponseEnum.MODEL_ANALYSIS_ERROR.getMessage());
|
logDto.setFailReason(AccessResponseEnum.MODEL_ANALYSIS_ERROR.getMessage());
|
||||||
csLogsFeignClient.addUserLog(logDto);
|
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.setPhase(apf.getPhase());
|
||||||
}
|
}
|
||||||
eleEpdPqdParam.setClassId(classId);
|
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);
|
result.add(eleEpdPqdParam);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -432,10 +439,10 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
eleEpdPqdParam.setUnit(epd.getUnit());
|
eleEpdPqdParam.setUnit(epd.getUnit());
|
||||||
if (Objects.equals(epd.getHarmStart(),0.5) && Objects.equals(epd.getHarmEnd(),49.5)){
|
if (Objects.equals(epd.getHarmStart(),0.5) && Objects.equals(epd.getHarmEnd(),49.5)){
|
||||||
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()+0.5));
|
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()+0.5));
|
||||||
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmStart()+49.5));
|
eleEpdPqdParam.setHarmEnd((int)(epd.getHarmEnd()+49.5));
|
||||||
} else {
|
} else {
|
||||||
eleEpdPqdParam.setHarmStart((int)(epd.getHarmStart()*1.0));
|
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.setStatMethod(epd.getStatMethod());
|
||||||
eleEpdPqdParam.setDataType(id);
|
eleEpdPqdParam.setDataType(id);
|
||||||
@@ -449,7 +456,6 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
List<EpdPqdDto> pqdDto = templateDto.getPqdDto();
|
List<EpdPqdDto> pqdDto = templateDto.getPqdDto();
|
||||||
pqdDto.forEach(pqd->{
|
pqdDto.forEach(pqd->{
|
||||||
String id = dicDataFeignClient.getDicDataByCode(item).getData().getId();
|
String id = dicDataFeignClient.getDicDataByCode(item).getData().getId();
|
||||||
|
|
||||||
String classId = dicDataFeignClient.getDicDataByCode(DataModel.PQD_DATA).getData().getId();
|
String classId = dicDataFeignClient.getDicDataByCode(DataModel.PQD_DATA).getData().getId();
|
||||||
List<EleEpdPqd> list = epdFeignClient.judgeExist(pqd.getName(),id).getData();
|
List<EleEpdPqd> list = epdFeignClient.judgeExist(pqd.getName(),id).getData();
|
||||||
if (CollectionUtil.isEmpty(list)){
|
if (CollectionUtil.isEmpty(list)){
|
||||||
@@ -467,10 +473,10 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
eleEpdPqdParam.setUnit(pqd.getUnit());
|
eleEpdPqdParam.setUnit(pqd.getUnit());
|
||||||
if (Objects.equals(pqd.getHarmStart(),0.5) && Objects.equals(pqd.getHarmEnd(),49.5)){
|
if (Objects.equals(pqd.getHarmStart(),0.5) && Objects.equals(pqd.getHarmEnd(),49.5)){
|
||||||
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()+0.5));
|
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()+0.5));
|
||||||
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmStart()+49.5));
|
eleEpdPqdParam.setHarmEnd((int)(pqd.getHarmEnd()+49.5));
|
||||||
} else {
|
} else {
|
||||||
eleEpdPqdParam.setHarmStart((int)(pqd.getHarmStart()*1.0));
|
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.setDataType(id);
|
||||||
eleEpdPqdParam.setClassId(classId);
|
eleEpdPqdParam.setClassId(classId);
|
||||||
@@ -981,13 +987,12 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
CsLineModel csLineModel = new CsLineModel();
|
CsLineModel csLineModel = new CsLineModel();
|
||||||
csLineModel.setLineId(IdUtil.fastSimpleUUID());
|
csLineModel.setLineId(IdUtil.fastSimpleUUID());
|
||||||
csLineModel.setPid(pId);
|
csLineModel.setPid(pId);
|
||||||
//fixme 默认第一个监测点是负载侧,第二个是电网测,后期数据错误可以在移动端调整
|
if (Objects.equals(item.getClDid(),1) || Objects.equals(item.getLocation(), TypeEnum.GUID.getCode())){
|
||||||
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)){
|
|
||||||
csLineModel.setName("电网侧监测点");
|
csLineModel.setName("电网侧监测点");
|
||||||
csLineModel.setPosition(dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData().getId());
|
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);
|
result.add(csLineModel);
|
||||||
});
|
});
|
||||||
@@ -1019,10 +1024,10 @@ public class CsDevModelServiceImpl implements ICsDevModelService {
|
|||||||
showName = "模块4数据";
|
showName = "模块4数据";
|
||||||
break;
|
break;
|
||||||
case "Ds$Pqd$Stat$01":
|
case "Ds$Pqd$Stat$01":
|
||||||
showName = "负载侧数据";
|
showName = "电网侧数据";
|
||||||
break;
|
break;
|
||||||
case "Ds$Pqd$Stat$02":
|
case "Ds$Pqd$Stat$02":
|
||||||
showName = "电网侧数据";
|
showName = "负载侧数据";
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
po.setName(item.getName());
|
po.setName(item.getName());
|
||||||
po.setPosition(item.getPosition());
|
po.setPosition(item.getPosition());
|
||||||
po.setClDid(0);
|
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);
|
RspDataDto.LdevInfo po1 = list.stream().filter(s -> Objects.equals(s.getClDid(),1)).findFirst().orElse(null);
|
||||||
po.setLineId(devAccessParam.getNDid() + "1");
|
po.setLineId(devAccessParam.getNDid() + "1");
|
||||||
param.setId(devAccessParam.getNDid() + "1");
|
param.setId(devAccessParam.getNDid() + "1");
|
||||||
@@ -259,7 +259,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
po.setCtRatio(po1.getCtRatio());
|
po.setCtRatio(po1.getCtRatio());
|
||||||
po.setConType(po1.getConType());
|
po.setConType(po1.getConType());
|
||||||
po.setClDid(1);
|
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);
|
RspDataDto.LdevInfo po1 = list.stream().filter(s -> Objects.equals(s.getClDid(),2)).findFirst().orElse(null);
|
||||||
po.setLineId(devAccessParam.getNDid() + "2");
|
po.setLineId(devAccessParam.getNDid() + "2");
|
||||||
param.setId(devAccessParam.getNDid() + "2");
|
param.setId(devAccessParam.getNDid() + "2");
|
||||||
@@ -337,7 +337,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
csLogsFeignClient.addUserLog(logDto);
|
csLogsFeignClient.addUserLog(logDto);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logDto.setResult(0);
|
logDto.setResult(0);
|
||||||
logDto.setFailReason(CommonResponseEnum.FAIL.getMessage());
|
logDto.setFailReason(e.getMessage());
|
||||||
csLogsFeignClient.addUserLog(logDto);
|
csLogsFeignClient.addUserLog(logDto);
|
||||||
throw new BusinessException(CommonResponseEnum.FAIL);
|
throw new BusinessException(CommonResponseEnum.FAIL);
|
||||||
}
|
}
|
||||||
@@ -363,6 +363,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
||||||
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_1.getCode()));
|
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_1.getCode()));
|
||||||
reqAndResParam.setExpire(-1);
|
reqAndResParam.setExpire(-1);
|
||||||
|
logger.info("询问主题报文为:" + new Gson().toJson(reqAndResParam));
|
||||||
publisher.send("/Pfm/DevTopic/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
publisher.send("/Pfm/DevTopic/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -382,6 +383,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
accessDto.setNdid(nDid);
|
accessDto.setNdid(nDid);
|
||||||
accessDto.setDevType(devType);
|
accessDto.setDevType(devType);
|
||||||
reqAndResParam.setMsg(accessDto);
|
reqAndResParam.setMsg(accessDto);
|
||||||
|
logger.info("注册报文为:" + new Gson().toJson(reqAndResParam));
|
||||||
publisher.send("/Pfm/DevReg/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
publisher.send("/Pfm/DevReg/"+nDid, new Gson().toJson(reqAndResParam),1,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -425,7 +427,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
askDataDto.setEndTime(-1);
|
askDataDto.setEndTime(-1);
|
||||||
if (Objects.equals(dataType,AccessEnum.SOFT_INFO.getCode())){
|
if (Objects.equals(dataType,AccessEnum.SOFT_INFO.getCode())){
|
||||||
askDataDto.setCldid(0);
|
askDataDto.setCldid(0);
|
||||||
reqAndResParam.setDid(2);
|
reqAndResParam.setDid(0);
|
||||||
askDataDto.setDataType(1);
|
askDataDto.setDataType(1);
|
||||||
} else if (Objects.equals(dataType,AccessEnum.L_DEV_INFO.getCode())){
|
} else if (Objects.equals(dataType,AccessEnum.L_DEV_INFO.getCode())){
|
||||||
askDataDto.setCldid(-1);
|
askDataDto.setCldid(-1);
|
||||||
@@ -433,7 +435,7 @@ public class CsDeviceServiceImpl implements ICsDeviceService {
|
|||||||
askDataDto.setDataType(2);
|
askDataDto.setDataType(2);
|
||||||
}
|
}
|
||||||
reqAndResParam.setMsg(askDataDto);
|
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);
|
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
|
@Override
|
||||||
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
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();
|
CsLedger csLedger = new CsLedger();
|
||||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
||||||
csLedger.setState(1);
|
csLedger.setState(1);
|
||||||
|
|||||||
@@ -63,7 +63,7 @@ public class StatServiceImpl implements IStatService {
|
|||||||
//1.根据设备网络识别码获取设备id,查询到所用的模板,用来判断模板的类型(治理模板还是电能质量模板)
|
//1.根据设备网络识别码获取设备id,查询到所用的模板,用来判断模板的类型(治理模板还是电能质量模板)
|
||||||
//2.解析appAutoDataMessage的Did,来判断当前数据是治理数据还是电能质量数据
|
//2.解析appAutoDataMessage的Did,来判断当前数据是治理数据还是电能质量数据
|
||||||
//3-1.治理数据则获取治理的dataArray,并且查询治理的监测点
|
//3-1.治理数据则获取治理的dataArray,并且查询治理的监测点
|
||||||
//3-2.电能质量数据则还需要判断Cldid的值,在dataSet里面筛选正确的数据集,查询dataArray(默认Cldid=1为负载侧监测点、Cldid=2为电网侧监测点)
|
//3-2.电能质量数据则还需要判断Cldid的值,在dataSet里面筛选正确的数据集,查询dataArray
|
||||||
//4.查询dataArray数据,查询对应的字典数据,然后将数据组装,录入influxDB
|
//4.查询dataArray数据,查询对应的字典数据,然后将数据组装,录入influxDB
|
||||||
DataArrayParam dataArrayParam = new DataArrayParam();
|
DataArrayParam dataArrayParam = new DataArrayParam();
|
||||||
dataArrayParam.setId(appAutoDataMessage.getId());
|
dataArrayParam.setId(appAutoDataMessage.getId());
|
||||||
@@ -142,9 +142,9 @@ public class StatServiceImpl implements IStatService {
|
|||||||
}
|
}
|
||||||
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
|
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
map.put(0,item.getLineId());
|
map.put(0,item.getLineId());
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
|
||||||
map.put(1,item.getLineId());
|
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
|
||||||
|
map.put(1,item.getLineId());
|
||||||
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
map.put(2,item.getLineId());
|
map.put(2,item.getLineId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -210,7 +210,7 @@ public class StatServiceImpl implements IStatService {
|
|||||||
fields.put(dataArrayList.get(i).getName(),floats.get(i));
|
fields.put(dataArrayList.get(i).getName(),floats.get(i));
|
||||||
fields.put(InfluxDBTableConstant.IS_ABNORMAL,item.getDataTag());
|
fields.put(InfluxDBTableConstant.IS_ABNORMAL,item.getDataTag());
|
||||||
//fixme 这边前置传递的应该是UTC时间,但是前置说是传递的北京时间,讨论了一下没太理解。这边暂时先这样处理,influx入库处理成北京时间,减去8小时。
|
//fixme 这边前置传递的应该是UTC时间,但是前置说是传递的北京时间,讨论了一下没太理解。这边暂时先这样处理,influx入库处理成北京时间,减去8小时。
|
||||||
Point point = influxDbUtils.pointBuilder(tableName, item.getDataTimeSec()-8*3600, TimeUnit.SECONDS, tags, fields);
|
Point point = influxDbUtils.pointBuilder(tableName, item.getDataTimeSec(), TimeUnit.SECONDS, tags, fields);
|
||||||
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||||
batchPoints.point(point);
|
batchPoints.point(point);
|
||||||
records.add(batchPoints.lineProtocol());
|
records.add(batchPoints.lineProtocol());
|
||||||
|
|||||||
@@ -148,9 +148,9 @@ public class CsWaveServiceImpl implements ICsWaveService {
|
|||||||
}
|
}
|
||||||
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
|
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
map.put(0,item.getLineId());
|
map.put(0,item.getLineId());
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
|
||||||
map.put(1,item.getLineId());
|
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
|
||||||
|
map.put(1,item.getLineId());
|
||||||
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
map.put(2,item.getLineId());
|
map.put(2,item.getLineId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ public class EventServiceImpl implements IEventService {
|
|||||||
csEvent.setStartTime(timeFormat(item.getDataTimeSec(),item.getDataTimeUSec()));
|
csEvent.setStartTime(timeFormat(item.getDataTimeSec(),item.getDataTimeUSec()));
|
||||||
csEvent.setTag(item.getName());
|
csEvent.setTag(item.getName());
|
||||||
csEvent.setType(0);
|
csEvent.setType(0);
|
||||||
|
csEvent.setClDid(appEventMessage.getMsg().getClDid());
|
||||||
list1.add(csEvent);
|
list1.add(csEvent);
|
||||||
//参数入库
|
//参数入库
|
||||||
Map<String,String> map = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.ELE_EPD_PQD)), Map.class);
|
Map<String,String> map = new Gson().fromJson(String.valueOf(redisUtil.getObjectByKey(AppRedisKey.ELE_EPD_PQD)), Map.class);
|
||||||
@@ -156,9 +157,9 @@ public class EventServiceImpl implements IEventService {
|
|||||||
}
|
}
|
||||||
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
|
if (Objects.equals(dictData.getCode(), DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
map.put(0,item.getLineId());
|
map.put(0,item.getLineId());
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
|
||||||
map.put(1,item.getLineId());
|
|
||||||
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.GRID_SIDE.getCode())){
|
||||||
|
map.put(1,item.getLineId());
|
||||||
|
} else if (Objects.equals(dictData.getCode(), DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
map.put(2,item.getLineId());
|
map.put(2,item.getLineId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user