云前置功能调整
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csdevice.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class IcdNodeParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("设备id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("前置服务器id")
|
||||
private String nodeId;
|
||||
|
||||
@ApiModelProperty("进程号")
|
||||
private Integer processNo;
|
||||
}
|
||||
@@ -5,6 +5,8 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -53,21 +55,25 @@ public class CsLineParam extends BaseEntity {
|
||||
/**
|
||||
* PT一次变比
|
||||
*/
|
||||
@Min(value = 1, message = "PT一次变比必须大于等于1")
|
||||
private Double ptRatio;
|
||||
|
||||
/**
|
||||
* PT二次变比
|
||||
*/
|
||||
@Min(value = 1, message = "PT二次变比必须大于等于1")
|
||||
private Double pt2Ratio;
|
||||
|
||||
/**
|
||||
* CT一次变比
|
||||
*/
|
||||
@Min(value = 1, message = "CT一次变比必须大于等于1")
|
||||
private Double ctRatio;
|
||||
|
||||
/**
|
||||
* CT二次变比
|
||||
*/
|
||||
@Min(value = 1, message = "CT二次变比必须大于等于1")
|
||||
private Double ct2Ratio;
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import cn.afterturn.easypoi.excel.ExcelExportUtil;
|
||||
import cn.afterturn.easypoi.excel.entity.ExportParams;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
@@ -152,6 +153,9 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParam(name = "ids", value = "设备id集合", required = true)
|
||||
public HttpResult<List<CsEquipmentDeliveryDTO>> queryEquipmentById(@RequestParam List<String> ids){
|
||||
String methodDescribe = getMethodDescribe("queryEquipmentById");
|
||||
if (CollectionUtil.isEmpty(ids)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(ids);
|
||||
List<CsEquipmentDeliveryDTO> collect = csEquipmentDeliveryPOS.stream().map(temp -> {
|
||||
CsEquipmentDeliveryDTO csEquipmentDeliveryDTO = new CsEquipmentDeliveryDTO();
|
||||
|
||||
@@ -8,6 +8,7 @@ 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.csdevice.param.IcdNodeParam;
|
||||
import com.njcn.csdevice.pojo.param.NodeParam;
|
||||
import com.njcn.csdevice.pojo.po.Node;
|
||||
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
|
||||
@@ -200,5 +201,15 @@ public class NodeController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateDevNode")
|
||||
@ApiOperation("更新设备前置信息")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<String> updateDevNode(@RequestBody IcdNodeParam param){
|
||||
String methodDescribe = getMethodDescribe("updateDevNode");
|
||||
String result = iNodeService.updateDevNode(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.param.IcdNodeParam;
|
||||
import com.njcn.csdevice.pojo.param.NodeParam;
|
||||
import com.njcn.csdevice.pojo.po.Node;
|
||||
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
|
||||
@@ -84,4 +85,6 @@ public interface INodeService extends IService<Node> {
|
||||
void restartProcess(String nodeId, Integer processNo);
|
||||
|
||||
String updateDevProcessNo(String id, Integer processNo);
|
||||
|
||||
String updateDevNode(IcdNodeParam param);
|
||||
}
|
||||
|
||||
@@ -833,17 +833,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public Boolean updateCldDev(CsEquipmentDeliveryAuditParm param) {
|
||||
//云前置设备判断,修改云前置判断设备是否达到上限
|
||||
if(ObjectUtil.isNotNull(param.getNodeId())){
|
||||
Node node = nodeService.getNodeById(param.getNodeId());
|
||||
List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId());
|
||||
if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) {
|
||||
throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT);
|
||||
}
|
||||
//自动分配进程号
|
||||
int process = findLeastFrequentProcess(devList,node.getMaxProcessNum());
|
||||
param.setNodeProcess(process);
|
||||
}
|
||||
// //云前置设备判断,修改云前置判断设备是否达到上限
|
||||
// if(ObjectUtil.isNotNull(param.getNodeId())){
|
||||
// Node node = nodeService.getNodeById(param.getNodeId());
|
||||
// List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId());
|
||||
// if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT);
|
||||
// }
|
||||
// //自动分配进程号
|
||||
// int process = findLeastFrequentProcess(devList,node.getMaxProcessNum());
|
||||
// param.setNodeProcess(process);
|
||||
// }
|
||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -7,11 +7,9 @@ import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
@@ -54,7 +52,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
@Override
|
||||
@@ -82,14 +79,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
//区分治理装置和云前置装置
|
||||
List<String> zhiLianDevice = new ArrayList<>();
|
||||
List<String> cldDevice = new ArrayList<>();
|
||||
List<CsEquipmentDeliveryDTO> csEquipmentDeliveryPOS = equipmentFeignClient.queryDeviceById(device).getData();
|
||||
if (CollectionUtil.isNotEmpty(csEquipmentDeliveryPOS)) {
|
||||
if (CollectionUtil.isNotEmpty(device)) {
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
|
||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
Optional.ofNullable(vo1)
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryDTO::getId)
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(cldDevice::add)
|
||||
);
|
||||
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
||||
@@ -97,11 +94,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryDTO::getId)
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
}
|
||||
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
@@ -287,14 +283,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
List<String> zhiLianDevice = new ArrayList<>();
|
||||
List<String> cldDevice = new ArrayList<>();
|
||||
List<CsEquipmentDeliveryDTO> csEquipmentDeliveryPOS = equipmentFeignClient.queryDeviceById(device).getData();
|
||||
if (CollectionUtil.isNotEmpty(csEquipmentDeliveryPOS)) {
|
||||
if (CollectionUtil.isNotEmpty(device)) {
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
|
||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
Optional.ofNullable(vo1)
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryDTO::getId)
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(cldDevice::add)
|
||||
);
|
||||
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
||||
@@ -302,10 +298,11 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryDTO::getId)
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
}
|
||||
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
|
||||
@@ -190,7 +190,7 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
} else {
|
||||
if (item.getReceivedCode() == 200) {
|
||||
cldLogsVo.setStatus("补召成功");
|
||||
cldLogsVo.setResult("补召成功");
|
||||
cldLogsVo.setResult(item.getReceivedMsg());
|
||||
} else {
|
||||
cldLogsVo.setStatus("补召失败");
|
||||
cldLogsVo.setResult(item.getReceivedMsg());
|
||||
|
||||
@@ -183,11 +183,11 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
//获取设备信息
|
||||
CsEquipmentDeliveryPO dev = csEquipmentDeliveryService.getDevByLineId(po.getLineId());
|
||||
BZEventMessage.File file = new BZEventMessage.File();
|
||||
BZEventMessage.Event file = new BZEventMessage.Event();
|
||||
file.setGuid(po.getId());
|
||||
file.setTerminalId(po.getDeviceId());
|
||||
file.setMonitorId(po.getLineId());
|
||||
file.setTimeList(Collections.singletonList(po.getStartTime().format(microsecondFormatter)));
|
||||
file.setMonitorIdList(Collections.singletonList(po.getLineId()));
|
||||
file.setTimeInterval(Collections.singletonList(po.getStartTime().format(microsecondFormatter)));
|
||||
file.setDataType(2);
|
||||
//记录发送日志
|
||||
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||
@@ -211,7 +211,7 @@ class IcdServiceImpl implements IcdService {
|
||||
csTerminalReply.setCode("oneFile");
|
||||
csTerminalReplyService.saveOrUpdate(csTerminalReply);
|
||||
//发送消息
|
||||
bzEventMessageTemplate.sendMember(file,dev.getNodeId());
|
||||
bzEventMessageTemplate.sendMember(Collections.singletonList(file),dev.getNodeId());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -421,7 +421,7 @@ class IcdServiceImpl implements IcdService {
|
||||
.collect(Collectors.groupingBy(CsEventPO::getDeviceId));
|
||||
|
||||
nodeToDeviceMap.forEach((nodeId, deviceList) -> {
|
||||
List<BZEventMessage.File> msgList = new ArrayList<>();
|
||||
List<BZEventMessage.Event> msgList = new ArrayList<>();
|
||||
List<CsTerminalLogs> logList = new ArrayList<>();
|
||||
List<CsTerminalReply> replyList = new ArrayList<>();
|
||||
|
||||
@@ -434,11 +434,11 @@ class IcdServiceImpl implements IcdService {
|
||||
.collect(Collectors.groupingBy(CsEventPO::getLineId));
|
||||
|
||||
lineToEventMap.forEach((lineId, eventGroup) -> {
|
||||
BZEventMessage.File event = new BZEventMessage.File();
|
||||
BZEventMessage.Event event = new BZEventMessage.Event();
|
||||
String guid = IdUtil.simpleUUID();
|
||||
event.setGuid(guid);
|
||||
event.setTerminalId(deviceId);
|
||||
event.setMonitorId(lineId);
|
||||
event.setMonitorIdList(Collections.singletonList(lineId));
|
||||
event.setDataType(2);
|
||||
|
||||
List<String> timeList = eventGroup.stream()
|
||||
@@ -447,7 +447,7 @@ class IcdServiceImpl implements IcdService {
|
||||
.map(dt -> dt.format(microsecondFormatter))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
event.setTimeList(timeList);
|
||||
event.setTimeInterval(timeList);
|
||||
msgList.add(event);
|
||||
|
||||
// 记录发送日志
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.NodeMapper;
|
||||
import com.njcn.csdevice.param.IcdNodeParam;
|
||||
import com.njcn.csdevice.pojo.param.NodeParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.Node;
|
||||
@@ -31,6 +32,7 @@ import org.springframework.transaction.annotation.Propagation;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -207,6 +209,46 @@ public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements IN
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String updateDevNode(IcdNodeParam param) {
|
||||
String result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CsEquipmentDeliveryPO::getId,param.getId());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectOne(wrapper);
|
||||
if (Objects.equals(po.getNodeId(),param.getNodeId()) && Objects.equals(po.getNodeProcess(),param.getProcessNo())) {
|
||||
return "前置机修改前后一致,暂不调整";
|
||||
}
|
||||
Node node = getNodeById(param.getNodeId());
|
||||
List<CsEquipmentDeliveryPO> devList = getListByNodeId(param.getNodeId());
|
||||
if (ObjectUtil.isNotEmpty(devList) && devList.size() >= node.getNodeDevNum()) {
|
||||
throw new BusinessException (AlgorithmResponseEnum.OVER_MAX_DEV_COUNT);
|
||||
}
|
||||
|
||||
int oldProcessNo = po.getNodeProcess();
|
||||
po.setNodeId(param.getNodeId());
|
||||
po.setNodeProcess(param.getProcessNo());
|
||||
int count = csEquipmentDeliveryMapper.updateById(po);
|
||||
if (count > 0) {
|
||||
result = "修改成功";
|
||||
//重启前置机进程(两个)
|
||||
//原来的
|
||||
restartProcess(po.getNodeId(), oldProcessNo);
|
||||
//修改后的
|
||||
restartProcess(param.getNodeId(), param.getProcessNo());
|
||||
} else {
|
||||
result = "修改失败";
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据前置机id获取装置数量
|
||||
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
||||
.in(CsEquipmentDeliveryPO::getRunStatus, Arrays.asList(1,2));
|
||||
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验参数,检查是否存在相同编码的字典类型
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user