数据模板解析调整
This commit is contained in:
@@ -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