Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 814b5757fd | |||
| 9d2b4b97f9 | |||
| ee07f7a5e2 | |||
| 214f297297 | |||
|
|
b908186758 | ||
| 0d1c142885 | |||
| 43b8473976 | |||
| 8c442d8897 | |||
| 066dceaeaf | |||
| 9dca3408ae |
@@ -44,5 +44,8 @@ public interface CsLineFeignClient {
|
|||||||
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
@PostMapping("/getLinesByDevList")
|
@PostMapping("/getLinesByDevList")
|
||||||
HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids);
|
HttpResult<List<CsLinePO>> getLinesByDevList(@RequestBody List<String> ids);
|
||||||
|
|
||||||
|
@PostMapping("/updateLineDataByList")
|
||||||
|
HttpResult<String> updateDataByList(@RequestParam("list") List<String> list, @RequestParam("id") String id, @RequestParam("setId") String setId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsTerminalLogsClientFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csTerminalLogs", fallbackFactory = CsTerminalLogsClientFallbackFactory.class,contextId = "csTerminalLogs")
|
||||||
|
|
||||||
|
public interface CsTerminalLogsFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/updateLaterData")
|
||||||
|
HttpResult<String> updateLaterData(@RequestParam("id") String id, @RequestParam("code") String code);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsTerminalReplyClientFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csTerminalReply", fallbackFactory = CsTerminalReplyClientFallbackFactory.class,contextId = "csTerminalReply")
|
||||||
|
|
||||||
|
public interface CsTerminalReplyFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/updateData")
|
||||||
|
HttpResult<String> updateData(@RequestParam("id") String id,@RequestParam("state") Integer state,@RequestParam("deviceId") String deviceId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,17 +1,10 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
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.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.api.fallback.DataSetFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.DataSetFeignClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|||||||
@@ -28,4 +28,7 @@ public interface DevModelRelationFeignClient {
|
|||||||
@PostMapping("/getModelByType")
|
@PostMapping("/getModelByType")
|
||||||
HttpResult<String> getModelByType(@RequestParam("devId") String devId, @RequestParam("type") Integer type);
|
HttpResult<String> getModelByType(@RequestParam("devId") String devId, @RequestParam("type") Integer type);
|
||||||
|
|
||||||
|
@PostMapping("/updateDataByList")
|
||||||
|
HttpResult<String> updateDataByList(@RequestParam("list") List<String> list, @RequestParam("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -10,10 +10,13 @@ import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
|||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -64,4 +67,10 @@ public interface EquipmentFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getDevByLineId")
|
@PostMapping("/getDevByLineId")
|
||||||
HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId);
|
HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
@PostMapping("/updateCldDevStatus")
|
||||||
|
HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo);
|
||||||
|
|
||||||
|
@PostMapping("/flipCldDevStatus")
|
||||||
|
HttpResult<Boolean> flipCldDevStatus(@RequestParam("devId") String devId, @RequestParam("status") Integer status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.NodeFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/node", fallbackFactory = NodeFallbackFactory.class,contextId = "node")
|
||||||
|
public interface NodeFeignClient {
|
||||||
|
|
||||||
|
@ApiOperation("获取全部前置机")
|
||||||
|
@GetMapping("/nodeAllList")
|
||||||
|
HttpResult<List<Node>> nodeAllList();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -54,4 +54,7 @@ public interface WlRecordFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/findDevBaseDataByLineId")
|
@PostMapping("/findDevBaseDataByLineId")
|
||||||
HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param);
|
HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param);
|
||||||
|
|
||||||
|
@GetMapping("/getTestRecordById")
|
||||||
|
HttpResult<RecordVo.RecordItemVo> getTestRecordById(@RequestParam("testRecordId") @Validated String testRecordId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据装置id集合获取监测点id集合",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据装置id集合获取监测点id集合",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> updateDataByList(List<String> list, String id, String setId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据装置集合修改监测点信息",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.CsTerminalLogsFeignClient;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CsTerminalLogsClientFallbackFactory implements FallbackFactory<CsTerminalLogsFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsTerminalLogsFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new CsTerminalLogsFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> updateLaterData(String id, String code) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","更新最新一组数据的推送状态",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.CsTerminalReplyFeignClient;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class CsTerminalReplyClientFallbackFactory implements FallbackFactory<CsTerminalReplyFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsTerminalReplyFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new CsTerminalReplyFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> updateData(String id, Integer state, String deviceId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","更新推送结果",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -46,6 +46,12 @@ public class DevModelRelationFeignClientFallbackFactory implements FallbackFacto
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据装置类型查询模板",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据装置类型查询模板",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> updateDataByList(List<String> list, String id) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据装置集合修改模板信息",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -89,6 +89,19 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置信息",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置信息",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> updateCldDevStatus(String nodeId, Integer processNo) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","云前置心跳丢失切换设备状态",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<Boolean> flipCldDevStatus(String devId, Integer status) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","云前置设备状态翻转",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.NodeFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class NodeFallbackFactory implements FallbackFactory<NodeFeignClient> {
|
||||||
|
@Override
|
||||||
|
public NodeFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new NodeFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<Node>> nodeAllList() {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","获取全部前置机异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -70,6 +70,12 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置基础数据",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置基础数据",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<RecordVo.RecordItemVo> getTestRecordById(String testRecordId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据测试项ID查询测试项信息",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,6 +58,8 @@ public interface DataParam {
|
|||||||
|
|
||||||
String GOVERNANCE_SYSTEM = "治理系统";
|
String GOVERNANCE_SYSTEM = "治理系统";
|
||||||
|
|
||||||
|
String cldDev = "云前置设备";
|
||||||
|
|
||||||
String EvtParamPhase = "Evt_Param_Phase";
|
String EvtParamPhase = "Evt_Param_Phase";
|
||||||
|
|
||||||
String EvtParamDepth = "Evt_Param_VVaDepth";
|
String EvtParamDepth = "Evt_Param_VVaDepth";
|
||||||
|
|||||||
@@ -35,7 +35,6 @@ public enum AlgorithmResponseEnum {
|
|||||||
CHIRLDREN2_EXIST("A00514","项目下存在设备,不能删除"),
|
CHIRLDREN2_EXIST("A00514","项目下存在设备,不能删除"),
|
||||||
CHIRLDREN3_EXIST("A00516","存在设备使用拓扑图,不能删除"),
|
CHIRLDREN3_EXIST("A00516","存在设备使用拓扑图,不能删除"),
|
||||||
|
|
||||||
|
|
||||||
DATA_ARRAY_MISSING("A00515","详细数据为空"),
|
DATA_ARRAY_MISSING("A00515","详细数据为空"),
|
||||||
UNKNOW_ROLE("A00515","角色无权限操作"),
|
UNKNOW_ROLE("A00515","角色无权限操作"),
|
||||||
DATA_MISSING("A00516","数据缺失"),
|
DATA_MISSING("A00516","数据缺失"),
|
||||||
@@ -48,6 +47,13 @@ public enum AlgorithmResponseEnum {
|
|||||||
RECORD_FILE_LOST("A00516","record.bin文件缺失,请检查上传文件夹"),
|
RECORD_FILE_LOST("A00516","record.bin文件缺失,请检查上传文件夹"),
|
||||||
LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"),
|
LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"),
|
||||||
DEV_OFFLINE("A00516","装置未连接MQTT服务器"),
|
DEV_OFFLINE("A00516","装置未连接MQTT服务器"),
|
||||||
|
OVER_MAX_DEV_COUNT("A00517","前置机超出最大支持装置数"),
|
||||||
|
DEV_OLD_DATA("A00519","进程数修改失败,原进程数下存在装置,请修改装置进程号"),
|
||||||
|
DEV_EXIST_DATA("A00520","删除失败,前置机下存在装置"),
|
||||||
|
|
||||||
|
CLD_MODEL_MISSING("A00521","云前置模板缺失,请检查模板信息"),
|
||||||
|
CLD_MODEL_MORE("A00521","存在多个云前置模板,请检查模板信息"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,48 @@
|
|||||||
|
package com.njcn.csdevice.param;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IcdLedgerParam implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("工程索引")
|
||||||
|
private String engineeringIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目索引")
|
||||||
|
private String projectIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devIndex;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备和mac关系")
|
||||||
|
private Map<String,String> devMacMap;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备mac和设备信息关系")
|
||||||
|
private Map<String, CsEquipmentDeliveryPO> devMap;
|
||||||
|
|
||||||
|
@ApiModelProperty("工程信息")
|
||||||
|
private CsEngineeringAddParm engineering;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目信息")
|
||||||
|
private AppProjectAddParm project;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置信息")
|
||||||
|
private List<CsEquipmentDeliveryAddParm> device;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点信息")
|
||||||
|
private List<CsLineParam> line;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.njcn.csdevice.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotBlank;
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class IcdParam implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("前置id,不传时查询所有的终端台账信息")
|
||||||
|
@NotBlank(message = "前置id不可为空")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端运行状态,不传则查询所有的终端信息 (0:运行;1:检修;2:停运;3:调试;4:退运)")
|
||||||
|
private List<Integer> runFlag;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端型号(集合为空查询所有icd模型)")
|
||||||
|
private List<String> devType;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,7 +5,6 @@ import lombok.Data;
|
|||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -20,16 +19,16 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class AppProjectAddParm {
|
public class AppProjectAddParm {
|
||||||
|
|
||||||
|
|
||||||
private String description;
|
private String description;
|
||||||
|
|
||||||
@ApiModelProperty(value="项目名称")
|
@ApiModelProperty(value="项目名称")
|
||||||
@NotBlank(message="项目名称不能为空!")
|
@NotBlank(message="项目名称不能为空!")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotBlank(message="工程id不能为空!")
|
//@NotBlank(message="工程id不能为空!")
|
||||||
private String engineeringId;
|
private String engineeringId;
|
||||||
|
|
||||||
|
private String icdEngineeringId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 地市Id
|
* 地市Id
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
|||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.Pattern;
|
import javax.validation.constraints.Pattern;
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -17,8 +18,7 @@ import javax.validation.constraints.Pattern;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class CsEquipmentDeliveryAddParm{
|
public class CsEquipmentDeliveryAddParm implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置名称
|
* 装置名称
|
||||||
@@ -39,7 +39,6 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
* 装置mac地址
|
* 装置mac地址
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="装置mac地址")
|
@ApiModelProperty(value="装置mac地址")
|
||||||
// @NotBlank(message="装置mac地址不能为空!")
|
|
||||||
private String mac;
|
private String mac;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -56,56 +55,12 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
@NotBlank(message="装置型号不能为空!")
|
@NotBlank(message="装置型号不能为空!")
|
||||||
private String devModel;
|
private String devModel;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 装置程序版本
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="装置程序版本")
|
|
||||||
// @NotBlank(message="装置程序版本不能为空!")
|
|
||||||
// private String programVersion;
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 调试人员
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="调试人员")
|
|
||||||
// @NotBlank(message="调试人员不能为空!")
|
|
||||||
// private String debugPerson;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 出厂日期
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="出厂日期")
|
|
||||||
// @NotNull(message="出厂日期不能为空!")
|
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
|
||||||
// private Date producteTime;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 检修日期
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="检修日期")
|
|
||||||
// @NotNull(message="检修日期不能为空!")
|
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
|
||||||
// private Date checkTime;
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 调试日期
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="调试日期")
|
|
||||||
// @NotNull(message="调试日期不能为空!")
|
|
||||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
|
||||||
// private Date debugTime;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同号
|
* 合同号
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="合同号")
|
@ApiModelProperty(value="合同号")
|
||||||
private String cntractNo;
|
private String cntractNo;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 营销经理
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="营销经理")
|
|
||||||
// private String salesManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 装置接入方式
|
* 装置接入方式
|
||||||
*/
|
*/
|
||||||
@@ -127,4 +82,19 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
@ApiModelProperty(value="排序")
|
@ApiModelProperty(value="排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="前置机id")
|
||||||
|
private String nodeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="前置机进程号")
|
||||||
|
private Integer nodeProcess;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="模板id")
|
||||||
|
private String modelId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="工程id")
|
||||||
|
private String engineeringId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="项目id")
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -95,4 +95,10 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
|
|
||||||
@ApiModelProperty(value="排序")
|
@ApiModelProperty(value="排序")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="前置机id")
|
||||||
|
private String nodeId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="前置机进程号")
|
||||||
|
private Integer nodeProcess;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.pojo.param;
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
@@ -18,25 +19,71 @@ public class CsLineParam extends BaseEntity {
|
|||||||
|
|
||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="工程id")
|
||||||
|
private String engineeringId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="项目id")
|
||||||
|
private String projectId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置id
|
||||||
|
*/
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置mac
|
||||||
|
*/
|
||||||
|
private String devMac;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电压等级
|
* 电压等级
|
||||||
*/
|
*/
|
||||||
private Double volGrade;
|
private Double volGrade;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PT变比
|
* 接线方式
|
||||||
|
*/
|
||||||
|
private Integer conType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PT一次变比
|
||||||
*/
|
*/
|
||||||
private Double ptRatio;
|
private Double ptRatio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CT变比
|
* PT二次变比
|
||||||
|
*/
|
||||||
|
private Double pt2Ratio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CT一次变比
|
||||||
*/
|
*/
|
||||||
private Double ctRatio;
|
private Double ctRatio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 接线方式
|
* CT二次变比
|
||||||
*/
|
*/
|
||||||
private Integer conType;
|
private Double ct2Ratio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 逻辑子设备id
|
||||||
|
*/
|
||||||
|
private Integer clDid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点线路号
|
||||||
|
*/
|
||||||
|
private Integer lineNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计间隔
|
||||||
|
*/
|
||||||
|
private Integer lineInterval;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 模板id
|
* 模板id
|
||||||
@@ -49,8 +96,7 @@ public class CsLineParam extends BaseEntity {
|
|||||||
private String dataSetId;
|
private String dataSetId;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 统计间隔
|
* 运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)
|
||||||
*/
|
*/
|
||||||
private Integer lineInterval;
|
private Integer runStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.PatternRegex;
|
||||||
|
import com.njcn.web.constant.ValidMessage;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import javax.validation.constraints.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2022/1/14
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@ApiModel
|
||||||
|
public class NodeParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "name",value = "前置服务器名称")
|
||||||
|
@NotBlank(message = "前置机名称不能为空")
|
||||||
|
@Pattern(regexp = PatternRegex.DEV_NAME_REGEX, message = ValidMessage.NAME_FORMAT_ERROR)
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器IP
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "ip",value = "服务器IP")
|
||||||
|
@NotBlank(message = "前置机IP不能为空")
|
||||||
|
@Pattern(regexp = PatternRegex.IP_REGEX, message = ValidMessage.IP_FORMAT_ERROR)
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "remark",value = "描述")
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 前置等级
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "nodeGrade",value = "前置等级")
|
||||||
|
@NotNull(message = "前置机等级不可为空")
|
||||||
|
private Integer nodeGrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置机支持最大装置数
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "nodeDevNum",value = "前置机支持最大装置数")
|
||||||
|
@NotNull(message = "前置机支持最大装置数不可为空")
|
||||||
|
@Min(value = 1, message = "装置数不可小于1")
|
||||||
|
@Max(value = 1000, message = "装置数不可大于1000")
|
||||||
|
private Integer nodeDevNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置机支持最大进程数量
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "nodeDevNum",value = "前置机支持最大进程数量")
|
||||||
|
@NotNull(message = "前置机支持最大进程数量")
|
||||||
|
@Min(value = 1, message = "最大进程数量不可小于1")
|
||||||
|
@Max(value = 10, message = "最大进程数量不可大于10")
|
||||||
|
private Integer maxProcessNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@ApiModelProperty(name = "sort",value = "排序")
|
||||||
|
@NotNull(message = "排序不可为空")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新操作实体
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class NodeUpdateParam extends NodeParam {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表Id
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("id")
|
||||||
|
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||||
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||||
|
private String id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置查询
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public static class NodeQueryParam extends BaseParam {
|
||||||
|
@ApiModelProperty("前置等级")
|
||||||
|
private Integer nodeGrade;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -64,8 +64,6 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "dev_access_method")
|
@TableField(value = "dev_access_method")
|
||||||
private String devAccessMethod;
|
private String devAccessMethod;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同号
|
* 合同号
|
||||||
*/
|
*/
|
||||||
@@ -120,4 +118,16 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "sort")
|
@TableField(value = "sort")
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置服务器IP
|
||||||
|
*/
|
||||||
|
@TableField(value = "node_id")
|
||||||
|
private String nodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置进程号
|
||||||
|
*/
|
||||||
|
@TableField(value = "node_process")
|
||||||
|
private Integer nodeProcess;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -66,12 +66,24 @@ public class CsLinePO extends BaseEntity {
|
|||||||
@TableField(value = "pt_ratio")
|
@TableField(value = "pt_ratio")
|
||||||
private Double ptRatio;
|
private Double ptRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PT2次变比
|
||||||
|
*/
|
||||||
|
@TableField(value = "pt2_ratio")
|
||||||
|
private Double pt2Ratio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* CT变比
|
* CT变比
|
||||||
*/
|
*/
|
||||||
@TableField(value = "ct_ratio")
|
@TableField(value = "ct_ratio")
|
||||||
private Double ctRatio;
|
private Double ctRatio;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* CT2变比
|
||||||
|
*/
|
||||||
|
@TableField(value = "ct2_ratio")
|
||||||
|
private Double ct2Ratio;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态(0:删除 1:正常)
|
* 状态(0:删除 1:正常)
|
||||||
*/
|
*/
|
||||||
@@ -86,9 +98,6 @@ public class CsLinePO extends BaseEntity {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 逻辑子设备id(与模板对应)
|
* 逻辑子设备id(与模板对应)
|
||||||
* 治理监测点 0
|
|
||||||
* 负载监测点 1
|
|
||||||
* 电网监测点 2
|
|
||||||
*/
|
*/
|
||||||
@TableField(value = "clDid")
|
@TableField(value = "clDid")
|
||||||
private Integer clDid;
|
private Integer clDid;
|
||||||
@@ -101,4 +110,16 @@ public class CsLinePO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "line_interval")
|
@TableField(value = "line_interval")
|
||||||
private Integer lineInterval;
|
private Integer lineInterval;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 运行状态
|
||||||
|
*/
|
||||||
|
@TableField(value = "run_status")
|
||||||
|
private Integer runStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点线路号
|
||||||
|
*/
|
||||||
|
@TableField(value = "line_no")
|
||||||
|
private Integer lineNo;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,57 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-09-26
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("cs_terminal_logs")
|
||||||
|
public class CsTerminalLogs extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键id
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置服务器id
|
||||||
|
*/
|
||||||
|
private String nodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进程号
|
||||||
|
*/
|
||||||
|
private Integer nodeProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型(0:新增 1:修改 2:删除)
|
||||||
|
*/
|
||||||
|
private Integer operateType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否推送(0未推送 1已推送)
|
||||||
|
*/
|
||||||
|
private Integer isPush;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,61 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-10-09
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
@TableName("cs_terminal_reply")
|
||||||
|
public class CsTerminalReply extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 消息id
|
||||||
|
*/
|
||||||
|
private String replyId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 操作类型
|
||||||
|
*/
|
||||||
|
private String code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置id
|
||||||
|
*/
|
||||||
|
private String nodeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 进程号
|
||||||
|
*/
|
||||||
|
private Integer processNo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设备id集合
|
||||||
|
*/
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否收到(0:未收到 1:收到)
|
||||||
|
*/
|
||||||
|
private Integer isReceived;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
*
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("pq_node")
|
||||||
|
public class Node extends BaseEntity implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置序号
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 名称
|
||||||
|
*/
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 服务器IP
|
||||||
|
*/
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 描述
|
||||||
|
*/
|
||||||
|
private String remark;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 0-删除;1-正常;默认正常
|
||||||
|
*/
|
||||||
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态 前置等级
|
||||||
|
*/
|
||||||
|
private Integer nodeGrade;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置机支持最大装置数
|
||||||
|
*/
|
||||||
|
private Integer nodeDevNum;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置机支持最大进程数量
|
||||||
|
*/
|
||||||
|
private Integer maxProcessNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/ //台账信息
|
||||||
|
@Data
|
||||||
|
public class CldLedgerVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("工程id")
|
||||||
|
private String engineeringId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "省")
|
||||||
|
private String province;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "市")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程描述")
|
||||||
|
private String engineeringDescription;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "项目信息")
|
||||||
|
private List<AppProjectPO> projectInfoList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备信息")
|
||||||
|
private List<CsEquipmentDeliveryPO> deviceInfoList;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点信息")
|
||||||
|
private List<CsLinePO> lineInfoList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -91,4 +91,7 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
|
|
||||||
private Integer sort;
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="前置服务器id")
|
||||||
|
private String nodeId ;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -23,6 +23,9 @@ public class CsLedgerVO implements Serializable {
|
|||||||
@ApiModelProperty(name = "pid",value = "父id")
|
@ApiModelProperty(name = "pid",value = "父id")
|
||||||
private String pid;
|
private String pid;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "pids",value = "父id集合")
|
||||||
|
private String pids;
|
||||||
|
|
||||||
@ApiModelProperty(name = "name",value = "名称")
|
@ApiModelProperty(name = "name",value = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
//台账信息
|
||||||
|
@Data
|
||||||
|
public class DeviceInfo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("终端索引")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端mac")
|
||||||
|
private String ip;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("前置机序号")
|
||||||
|
private Integer node;
|
||||||
|
|
||||||
|
@ApiModelProperty("开启的进程数")
|
||||||
|
private Integer maxProcessNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("对时启动标志")
|
||||||
|
private boolean rightTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点集合")
|
||||||
|
private List<MonitorInfo> monitorData;
|
||||||
|
|
||||||
|
//终端下的监测点信息
|
||||||
|
@Data
|
||||||
|
public static class MonitorInfo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点索引")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点逻辑号")
|
||||||
|
private String lineNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点电压等级")
|
||||||
|
private String voltageLevel;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点运行状态 0:运行;1:检修;2:停运;3:调试;4:退运")
|
||||||
|
private Integer status;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点接线方式 0-星型 1-角型 2-V型")
|
||||||
|
private String ptType;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置id")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("pt1")
|
||||||
|
private Double pt1;
|
||||||
|
|
||||||
|
@ApiModelProperty("pt2")
|
||||||
|
private Double pt2;
|
||||||
|
|
||||||
|
@ApiModelProperty("ct1")
|
||||||
|
private Double ct1;
|
||||||
|
|
||||||
|
@ApiModelProperty("ct2")
|
||||||
|
private Double ct2;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class NodeProcessDeviceVo implements Serializable {
|
||||||
|
|
||||||
|
private Node node;
|
||||||
|
|
||||||
|
private List<ProcessDevice> processDeviceList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
public static class ProcessDevice implements Serializable{
|
||||||
|
private Integer processNo;
|
||||||
|
private String processState;
|
||||||
|
private List<CsEquipmentDeliveryPO> deviceInfoList;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -153,6 +153,12 @@
|
|||||||
<artifactId>access-api</artifactId>
|
<artifactId>access-api</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>common-mq</artifactId>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -54,7 +54,7 @@ public class DevModelController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/AuditDevModel")
|
@PostMapping("/AuditDevModel")
|
||||||
@ApiOperation("更新/删除出厂设备")
|
@ApiOperation("更新/删除设备模板参数")
|
||||||
@ApiImplicitParam(name = "csDevModelAuditParm", value = "更新/删除设备模板参数", required = true)
|
@ApiImplicitParam(name = "csDevModelAuditParm", value = "更新/删除设备模板参数", required = true)
|
||||||
public HttpResult<Boolean> AuditDevModel(@RequestBody @Validated CsDevModelAuditParm csDevModelAuditParm ){
|
public HttpResult<Boolean> AuditDevModel(@RequestBody @Validated CsDevModelAuditParm csDevModelAuditParm ){
|
||||||
String methodDescribe = getMethodDescribe("AuditDevModel");
|
String methodDescribe = getMethodDescribe("AuditDevModel");
|
||||||
|
|||||||
@@ -93,8 +93,8 @@ public class DevModelRelationController extends BaseController {
|
|||||||
@PostMapping("/getModelByType")
|
@PostMapping("/getModelByType")
|
||||||
@ApiOperation("根据装置类型查询模板")
|
@ApiOperation("根据装置类型查询模板")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "devId", value = "装置id", required = true),
|
@ApiImplicitParam(name = "devId", value = "装置id", required = true),
|
||||||
@ApiImplicitParam(name = "type", value = "模板类型", required = true)
|
@ApiImplicitParam(name = "type", value = "模板类型", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<String> getModelByType(@RequestParam("devId") String devId, @RequestParam("type") Integer type){
|
public HttpResult<String> getModelByType(@RequestParam("devId") String devId, @RequestParam("type") Integer type){
|
||||||
@@ -103,4 +103,18 @@ public class DevModelRelationController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, modelId, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, modelId, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateDataByList")
|
||||||
|
@ApiOperation("根据装置集合修改模板信息")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "list", value = "装置id集合", required = true),
|
||||||
|
@ApiImplicitParam(name = "id", value = "模板id", required = true)
|
||||||
|
})
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<String> updateDataByList(@RequestParam("list") List<String> list, @RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("updateDataByList");
|
||||||
|
csDevModelRelationService.updateDataByList(list,id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,7 +45,6 @@ import java.util.List;
|
|||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
@@ -60,7 +59,6 @@ import java.util.stream.Stream;
|
|||||||
@Api(tags = " 出厂设备")
|
@Api(tags = " 出厂设备")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class EquipmentDeliveryController extends BaseController {
|
public class EquipmentDeliveryController extends BaseController {
|
||||||
|
|
||||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
@@ -85,7 +83,6 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/AuditEquipmentDelivery")
|
@PostMapping("/AuditEquipmentDelivery")
|
||||||
@ApiOperation("删除出厂设备")
|
@ApiOperation("删除出厂设备")
|
||||||
@@ -115,16 +112,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryEquipmentByndid")
|
@PostMapping("/queryEquipmentByndid")
|
||||||
@ApiOperation("通过ndid查询出厂设备")
|
@ApiOperation("通过ndid查询出厂设备")
|
||||||
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
@ApiImplicitParam(name = "ndid", value = "网关识别码", required = true)
|
||||||
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
public HttpResult<CsEquipmentDeliveryVO> queryEquipmentByndid(@RequestParam("ndid")String ndid){
|
||||||
String methodDescribe = getMethodDescribe("queryEquipmentByndid");
|
String methodDescribe = getMethodDescribe("queryEquipmentByndid");
|
||||||
|
CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid (ndid);
|
||||||
CsEquipmentDeliveryVO csEquipmentDeliveryVO = csEquipmentDeliveryService.queryEquipmentByndid (ndid);
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryVO, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csEquipmentDeliveryVO, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -146,11 +140,12 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||||
})
|
})
|
||||||
@DeviceLog(operateType = DeviceOperate.UPDATESTATUSBYNDID)
|
@DeviceLog(operateType = DeviceOperate.UPDATESTATUSBYNDID)
|
||||||
public HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status){
|
public HttpResult<Boolean> updateStatusBynDid(@RequestParam("nDId") String nDid,@RequestParam("status") Integer status){
|
||||||
String methodDescribe = getMethodDescribe("updateStatusBynDid");
|
String methodDescribe = getMethodDescribe("updateStatusBynDid");
|
||||||
csEquipmentDeliveryService.updateStatusBynDid(nDid,status);
|
csEquipmentDeliveryService.updateStatusBynDid(nDid,status);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryEquipmentById")
|
@PostMapping("/queryEquipmentById")
|
||||||
@ApiOperation("设备查询通过id获取")
|
@ApiOperation("设备查询通过id获取")
|
||||||
@@ -217,13 +212,11 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ApiOperation("导出设备模板")
|
@ApiOperation("导出设备模板")
|
||||||
@GetMapping(value = "getExcelTemplate")
|
@GetMapping(value = "getExcelTemplate")
|
||||||
public HttpResult<String> getExcelTemplate(HttpServletResponse response) {
|
public HttpResult<String> getExcelTemplate(HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("getExcelTemplate");
|
String methodDescribe = getMethodDescribe("getExcelTemplate");
|
||||||
|
|
||||||
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息");
|
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息");
|
||||||
exportParams.setStyle(ExcelStyleUtil.class);
|
exportParams.setStyle(ExcelStyleUtil.class);
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
||||||
@@ -256,10 +249,10 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
mqttUserService.insertMqttUser(temp.getNdid());
|
mqttUserService.insertMqttUser(temp.getNdid());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@ApiOperation("联调完成")
|
@ApiOperation("联调完成")
|
||||||
@PostMapping(value = "testcompletion")
|
@PostMapping(value = "testcompletion")
|
||||||
@@ -282,8 +275,8 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/updateSoftInfo")
|
@PostMapping("/updateSoftInfo")
|
||||||
@ApiOperation("更新设备软件信息")
|
@ApiOperation("更新设备软件信息")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "nDid", value = "网络设备码", required = true),
|
@ApiImplicitParam(name = "nDid", value = "网络设备码", required = true),
|
||||||
@ApiImplicitParam(name = "id", value = "软件信息id", required = true)
|
@ApiImplicitParam(name = "id", value = "软件信息id", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<String> updateSoftInfo(@RequestParam("nDid") String nDid,@RequestParam("id") String id){
|
public HttpResult<String> updateSoftInfo(@RequestParam("nDid") String nDid,@RequestParam("id") String id){
|
||||||
@@ -306,7 +299,6 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/rebootDevice")
|
@PostMapping("/rebootDevice")
|
||||||
@ApiOperation("重启设备")
|
@ApiOperation("重启设备")
|
||||||
@@ -348,4 +340,65 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addCldDev")
|
||||||
|
@ApiOperation("新增云前置设备")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||||
|
public HttpResult<CsEquipmentDeliveryPO> addCldDev(@RequestBody @Validated CsEquipmentDeliveryAddParm param){
|
||||||
|
String methodDescribe = getMethodDescribe("addCldDev");
|
||||||
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.saveCld(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/delCldDev")
|
||||||
|
@ApiOperation("删除云前置设备")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
@DeviceLog(operateType = DeviceOperate.DELETE)
|
||||||
|
public HttpResult<Boolean> delCldDev(@RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("delCldDev");
|
||||||
|
boolean result = csEquipmentDeliveryService.delCldDev(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateCldDev")
|
||||||
|
@ApiOperation("修改云前置设备")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
@DeviceLog(operateType = DeviceOperate.UPDATE)
|
||||||
|
public HttpResult<Boolean> updateCldDev(@RequestBody @Validated CsEquipmentDeliveryAuditParm param){
|
||||||
|
String methodDescribe = getMethodDescribe("updateCldDev");
|
||||||
|
boolean result = csEquipmentDeliveryService.updateCldDev(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateCldDevStatus")
|
||||||
|
@ApiOperation("云前置心跳丢失切换设备状态")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "nodeId", value = "前置服务器id", required = true),
|
||||||
|
@ApiImplicitParam(name = "processNo", value = "进程号", required = true)
|
||||||
|
})
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo){
|
||||||
|
String methodDescribe = getMethodDescribe("updateCldDevStatus");
|
||||||
|
csEquipmentDeliveryService.updateCldDevStatus(nodeId,processNo);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/flipCldDevStatus")
|
||||||
|
@ApiOperation("云前置设备状态翻转")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||||
|
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||||
|
})
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
||||||
|
String methodDescribe = getMethodDescribe("flipCldDevStatus");
|
||||||
|
csEquipmentDeliveryService.flipCldDevStatus(devId,status);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.csdevice.controller.icd;
|
||||||
|
|
||||||
|
|
||||||
|
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.csdevice.service.ICsTerminalLogsService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-09-26
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/csTerminalLogs")
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "云前置台账信息日志")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class CsTerminalLogsController extends BaseController {
|
||||||
|
|
||||||
|
private final ICsTerminalLogsService csTerminalLogsService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/pushCldInfo")
|
||||||
|
@ApiOperation("推送日志台账信息")
|
||||||
|
public HttpResult<String> pushCldInfo(){
|
||||||
|
String methodDescribe = getMethodDescribe("pushCldInfo");
|
||||||
|
String result = csTerminalLogsService.pushCldInfo();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateCldInfo")
|
||||||
|
@ApiOperation("更新日志台账信息")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "设备id", required = true),
|
||||||
|
@ApiImplicitParam(name = "code", value = "流程状态", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<String> updateCldInfo(@RequestParam String id, @RequestParam Integer code){
|
||||||
|
String methodDescribe = getMethodDescribe("updateCldInfo");
|
||||||
|
csTerminalLogsService.updateLogs(id,code);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateLaterData")
|
||||||
|
@ApiOperation("更新最新一组数据的推送状态")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "设备id", required = true),
|
||||||
|
@ApiImplicitParam(name = "code", value = "流程状态", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<String> updateLaterData(@RequestParam String id, @RequestParam String code){
|
||||||
|
String methodDescribe = getMethodDescribe("updateLaterData");
|
||||||
|
csTerminalLogsService.updateLaterData(id,code);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,66 @@
|
|||||||
|
package com.njcn.csdevice.controller.icd;
|
||||||
|
|
||||||
|
|
||||||
|
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.csdevice.service.ICsTerminalReplyService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
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 java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-10-09
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RequestMapping("/csTerminalReply")
|
||||||
|
@RestController
|
||||||
|
@Api(tags = "云前置台账信息响应记录")
|
||||||
|
@AllArgsConstructor
|
||||||
|
|
||||||
|
public class CsTerminalReplyController extends BaseController {
|
||||||
|
|
||||||
|
private final ICsTerminalReplyService csTerminalReplyService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryData")
|
||||||
|
@ApiOperation("查询推送结果")
|
||||||
|
public HttpResult<List<String>> queryData(){
|
||||||
|
String methodDescribe = getMethodDescribe("queryData");
|
||||||
|
List<String> result = csTerminalReplyService.queryReplyData();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateData")
|
||||||
|
@ApiOperation("更新推送结果")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "id", value = "参数", required = true),
|
||||||
|
@ApiImplicitParam(name = "state", value = "状态", required = true),
|
||||||
|
@ApiImplicitParam(name = "deviceId", value = "设备id", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<String> updateData(@RequestParam String id,@RequestParam Integer state,@RequestParam String deviceId){
|
||||||
|
String methodDescribe = getMethodDescribe("updateData");
|
||||||
|
csTerminalReplyService.updateReplyData(id,state,deviceId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.njcn.csdevice.controller.icd;
|
||||||
|
|
||||||
|
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.csdevice.param.IcdLedgerParam;
|
||||||
|
import com.njcn.csdevice.param.IcdParam;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||||
|
import com.njcn.csdevice.service.IcdService;
|
||||||
|
import com.njcn.mq.message.CldControlMessage;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
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.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/icd")
|
||||||
|
@Api(tags = "云前置改造")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class IcdController extends BaseController {
|
||||||
|
|
||||||
|
private final IcdService icdService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLedgerInfo")
|
||||||
|
@ApiOperation("获取台账信息")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<DeviceInfo>> getLedgerInfo(@RequestBody @Validated IcdParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("getLedgerInfo");
|
||||||
|
List<DeviceInfo> result = icdService.getLedgerInfo(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addLedgerInfo")
|
||||||
|
@ApiOperation("新增台账信息")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<DeviceInfo>> addLedgerInfo(@RequestBody @Validated IcdLedgerParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("addLedgerInfo");
|
||||||
|
icdService.addLedgerInfo(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLedgerById")
|
||||||
|
@ApiOperation("根据Id获取台账信息")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<CldLedgerVo> getLedgerById(@RequestParam String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getLedgerById");
|
||||||
|
CldLedgerVo vo = icdService.getLedgerById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/restartProcess")
|
||||||
|
@ApiOperation("重启前置机进程")
|
||||||
|
@ApiImplicitParam(name = "message", value = "message", required = true)
|
||||||
|
public HttpResult<String> restartProcess(@RequestBody CldControlMessage message){
|
||||||
|
String methodDescribe = getMethodDescribe("restartProcess");
|
||||||
|
icdService.restartProcess(message);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,178 @@
|
|||||||
|
package com.njcn.csdevice.controller.icd;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
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.pojo.param.NodeParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
|
||||||
|
import com.njcn.csdevice.service.INodeService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前置程序控制器
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Api(tags = "前置机管理")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("node")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class NodeController extends BaseController {
|
||||||
|
|
||||||
|
private final INodeService iNodeService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||||
|
@ApiOperation("新增前置机")
|
||||||
|
@ApiImplicitParam(value = "前置机信息",name = "nodeParam",required = true)
|
||||||
|
@PostMapping("addNode")
|
||||||
|
public HttpResult<Boolean> addNode(@Validated @RequestBody NodeParam nodeParam){
|
||||||
|
String methodDescribe = getMethodDescribe("addNode");
|
||||||
|
boolean result = iNodeService.addNode(nodeParam);
|
||||||
|
if (result){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@ApiOperation("修改前置机")
|
||||||
|
@ApiImplicitParam(value = "前置机信息",name = "updateNodeParam",required = true)
|
||||||
|
@PutMapping("updateNode")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
|
||||||
|
public HttpResult<Boolean> updateNode(@Validated @RequestBody NodeParam.NodeUpdateParam updateNodeParam){
|
||||||
|
String methodDescribe = getMethodDescribe("updateNode");
|
||||||
|
boolean result = iNodeService.updateNode(updateNodeParam);
|
||||||
|
if (result){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除前置
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "删除前置机")
|
||||||
|
@ApiImplicitParam(value = "前置机id",name = "id",required = true)
|
||||||
|
@PostMapping("delNode")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
|
||||||
|
public HttpResult<Boolean> delNode(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id){
|
||||||
|
String methodDescribe = getMethodDescribe("delNode");
|
||||||
|
boolean result = iNodeService.delNode(id);
|
||||||
|
if (result){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 变更前置机状态
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "变更前置机状态")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(value = "前置机id",name = "id",required = true ),
|
||||||
|
@ApiImplicitParam(value = "前置机状态",name = "state",required = true )
|
||||||
|
})
|
||||||
|
@PostMapping("updateNodeState")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
|
||||||
|
public HttpResult<Boolean> updateNodeState(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id,@NotNull(message = "状态不为空") @RequestParam("state")Integer state){
|
||||||
|
String methodDescribe = getMethodDescribe("updateNodeState");
|
||||||
|
boolean result = iNodeService.updateNodeState(id,state);
|
||||||
|
if (result){
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部前置机分页
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取全部前置机")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
|
@PostMapping("nodeList")
|
||||||
|
public HttpResult<Page<Node>> nodeList(@RequestBody NodeParam.NodeQueryParam nodeQueryParam){
|
||||||
|
String methodDescribe = getMethodDescribe("nodeList");
|
||||||
|
Page<Node> page = iNodeService.nodeList(nodeQueryParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取全部前置机不分页
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@ApiOperation("获取全部前置机")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
|
@GetMapping("/nodeAllList")
|
||||||
|
public HttpResult<List<Node>> nodeAllList(){
|
||||||
|
String methodDescribe = getMethodDescribe("nodeAllList");
|
||||||
|
List<Node> resList = iNodeService.nodeAllList();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据id获取前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据id获取前置机")
|
||||||
|
@ApiImplicitParam(value = "前置机id",name = "id",required = true)
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
|
@GetMapping("/getNodeById")
|
||||||
|
public HttpResult<Node> getNodeById(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getNodeById");
|
||||||
|
Node node = iNodeService.getNodeById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, node, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据前置机id获取下面的进程和设备
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@ApiOperation("根据前置机id获取下面的进程和设备")
|
||||||
|
@ApiImplicitParam(value = "前置机id",name = "id",required = true)
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
|
||||||
|
@GetMapping("/getProcessNoAndDeviceById")
|
||||||
|
public HttpResult<NodeProcessDeviceVo> getProcessNoAndDeviceById(@Validated @NotNull(message = "id不可为空") @RequestParam("id")String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getProcessNoAndDeviceById");
|
||||||
|
NodeProcessDeviceVo vo = iNodeService.getProcessNoAndDeviceById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -156,5 +156,14 @@ public class CsLedgerController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, allList, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, allList, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/cldTree")
|
||||||
|
@ApiOperation("云前置树")
|
||||||
|
public HttpResult<CsLedgerVO> cldTree(){
|
||||||
|
String methodDescribe = getMethodDescribe("cldTree");
|
||||||
|
CsLedgerVO vo = csLedgerService.cldTree();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
|
||||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
@@ -16,6 +15,7 @@ import com.njcn.device.biz.utils.COverlimitUtil;
|
|||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -41,9 +41,7 @@ import java.util.List;
|
|||||||
public class CslineController extends BaseController {
|
public class CslineController extends BaseController {
|
||||||
|
|
||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
|
|
||||||
private final OverlimitMapper overlimitMapper;
|
private final OverlimitMapper overlimitMapper;
|
||||||
private final CsLinePOMapper csLinePOMapper;
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryLineById")
|
@PostMapping("/queryLineById")
|
||||||
@@ -92,16 +90,6 @@ public class CslineController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
|
||||||
// @PostMapping("/addLineList")
|
|
||||||
// @ApiOperation("批量新增监测点及绑定关系")
|
|
||||||
// @ApiImplicitParam(name = "list", value = "监测点数据集", required = true)
|
|
||||||
// public HttpResult<String> addLines(@RequestBody List<CsLineParm> list){
|
|
||||||
// String methodDescribe = getMethodDescribe("addLines");
|
|
||||||
// csLinePOService.addLines(list);
|
|
||||||
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
|
||||||
// }
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/findByNdid")
|
@PostMapping("/findByNdid")
|
||||||
@ApiOperation("根据ndid查询监测点")
|
@ApiOperation("根据ndid查询监测点")
|
||||||
@@ -157,14 +145,79 @@ public class CslineController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
// @PostMapping("/getLinesByDevList")
|
||||||
|
// @ApiOperation("根据装置id集合获取监测点id集合")
|
||||||
|
// @ApiImplicitParam(name = "ids", value = "装置id集合", required = true)
|
||||||
|
// public HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids) {
|
||||||
|
// String methodDescribe = getMethodDescribe("getLinesByDevList");
|
||||||
|
// List<CsLinePO> list = csLinePOService.getLinesByDevList(ids);
|
||||||
|
// return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
// }
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLinesByDevList")
|
@PostMapping("/getLinesByDevList")
|
||||||
@ApiOperation("根据装置id集合获取监测点id集合")
|
@ApiOperation("根据装置id集合获取监测点id集合")
|
||||||
@ApiImplicitParam(name = "ids", value = "装置id集合", required = true)
|
@ApiImplicitParam(name = "ids", value = "装置id集合", required = true)
|
||||||
public HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids) {
|
public HttpResult<List<CsLinePO>> getLinesByDevList(@RequestBody List<String> ids) {
|
||||||
String methodDescribe = getMethodDescribe("getLinesByDevList");
|
String methodDescribe = getMethodDescribe("getLinesByDevList");
|
||||||
List<CsLinePO> list = csLinePOService.getLinesByDevList(ids);
|
List<CsLinePO> list = csLinePOService.getLinesByDevList(ids);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addCldLine")
|
||||||
|
@ApiOperation("新增云前置监测点")
|
||||||
|
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||||
|
public HttpResult<List<CsLinePO>> addCldLine(@RequestBody @Validated CsLineParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("addCldLine");
|
||||||
|
csLinePOService.addCldLine(param);
|
||||||
|
//新增监测点限值
|
||||||
|
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||||
|
overlimit.setId(param.getLineId());
|
||||||
|
overlimitMapper.deleteById(param.getLineId());
|
||||||
|
overlimitMapper.insert(overlimit);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateCldLine")
|
||||||
|
@ApiOperation("修改云前置监测点")
|
||||||
|
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||||
|
public HttpResult<List<CsLinePO>> updateCldLine(@RequestBody CsLineParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateCldLine");
|
||||||
|
csLinePOService.updateCldLine(param);
|
||||||
|
//修改监测点限值
|
||||||
|
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||||
|
overlimit.setId(param.getLineId());
|
||||||
|
overlimitMapper.deleteById(param.getLineId());
|
||||||
|
overlimitMapper.insert(overlimit);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/delCldLine")
|
||||||
|
@ApiOperation("删除云前置监测点")
|
||||||
|
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||||
|
public HttpResult<List<CsLinePO>> delCldLine(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("delCldLine");
|
||||||
|
csLinePOService.deleteCldLine(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateLineDataByList")
|
||||||
|
@ApiOperation("根据装置集合修改监测点信息")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "list", value = "装置id集合", required = true),
|
||||||
|
@ApiImplicitParam(name = "id", value = "模板id", required = true),
|
||||||
|
@ApiImplicitParam(name = "setId", value = "数据集id", required = true),
|
||||||
|
})
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<String> updateDataByList(@RequestParam("list") List<String> list, @RequestParam("id") String id, @RequestParam("setId") String setId){
|
||||||
|
String methodDescribe = getMethodDescribe("updateLineDataByList");
|
||||||
|
csLinePOService.updateLineDataByList(list,id,setId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.controller.project;
|
package com.njcn.csdevice.controller.project;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
@@ -68,8 +69,8 @@ public class AppProjectController extends BaseController {
|
|||||||
public HttpResult<Boolean> addAppProject(@Validated AppProjectAddParm appProjectAddParm){
|
public HttpResult<Boolean> addAppProject(@Validated AppProjectAddParm appProjectAddParm){
|
||||||
String methodDescribe = getMethodDescribe("addAppProject");
|
String methodDescribe = getMethodDescribe("addAppProject");
|
||||||
|
|
||||||
Boolean flag = appProjectService.addAppProject(appProjectAddParm);
|
AppProjectPO po = appProjectService.addAppProject(appProjectAddParm);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, ObjectUtil.isNotNull(po), methodDescribe);
|
||||||
}
|
}
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/auditAppProject")
|
@PostMapping("/auditAppProject")
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
|||||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryPageParm;
|
import com.njcn.csdevice.pojo.param.CsEngineeringQueryPageParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||||
import com.njcn.csdevice.service.CsEngineeringService;
|
import com.njcn.csdevice.service.CsEngineeringService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -20,10 +21,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
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.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -42,10 +40,8 @@ import java.util.List;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class EngineeringController extends BaseController {
|
public class EngineeringController extends BaseController {
|
||||||
|
|
||||||
|
|
||||||
private final CsEngineeringService csEngineeringService;
|
private final CsEngineeringService csEngineeringService;
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/addEngineering")
|
@PostMapping("/addEngineering")
|
||||||
@ApiOperation("新增工程")
|
@ApiOperation("新增工程")
|
||||||
@@ -88,4 +84,14 @@ public class EngineeringController extends BaseController {
|
|||||||
IPage<CsEngineeringVO> page = csEngineeringService.queryEngineeringPage(csEngineeringQueryPageParm);
|
IPage<CsEngineeringVO> page = csEngineeringService.queryEngineeringPage(csEngineeringQueryPageParm);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryEngineeringById")
|
||||||
|
@ApiOperation("工程查询通过id获取")
|
||||||
|
@ApiImplicitParam(name = "id", value = "工程id", required = true)
|
||||||
|
public HttpResult<CsEngineeringPO> queryEngineeringById(@RequestParam String id){
|
||||||
|
String methodDescribe = getMethodDescribe("queryEngineeringById");
|
||||||
|
CsEngineeringPO po = csEngineeringService.queryEngineeringById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ public class WlRecordController extends BaseController {
|
|||||||
@GetMapping("/getTestRecordById")
|
@GetMapping("/getTestRecordById")
|
||||||
@ApiOperation("根据测试项ID查询测试项信息")
|
@ApiOperation("根据测试项ID查询测试项信息")
|
||||||
@ApiImplicitParam(name = "testRecordId", value = "测试项ID", required = true)
|
@ApiImplicitParam(name = "testRecordId", value = "测试项ID", required = true)
|
||||||
public HttpResult<RecordVo.RecordItemVo> getTestRecordById(@RequestParam @Validated String testRecordId) {
|
public HttpResult<RecordVo.RecordItemVo> getTestRecordById(@RequestParam("testRecordId") @Validated String testRecordId) {
|
||||||
String methodDescribe = getMethodDescribe("getTestRecordById");
|
String methodDescribe = getMethodDescribe("getTestRecordById");
|
||||||
LogUtil.njcnDebug(log, "{},测试项id为:{}", methodDescribe, testRecordId);
|
LogUtil.njcnDebug(log, "{},测试项id为:{}", methodDescribe, testRecordId);
|
||||||
RecordVo.RecordItemVo result = wlRecordService.getTestRecordById(testRecordId);
|
RecordVo.RecordItemVo result = wlRecordService.getTestRecordById(testRecordId);
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.mapper;
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
@@ -21,6 +22,7 @@ import java.util.List;
|
|||||||
* @author clam
|
* @author clam
|
||||||
* @version V1.0.0
|
* @version V1.0.0
|
||||||
*/
|
*/
|
||||||
|
@DS("master")
|
||||||
public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliveryPO> {
|
public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliveryPO> {
|
||||||
Page<ProjectEquipmentVO> queryProjectEquipmentVO(Page<ProjectEquipmentVO> returnpage,@Param("projectEquipmentQueryParm")ProjectEquipmentQueryParm projectEquipmentQueryParm,@Param("device")List<String> device);
|
Page<ProjectEquipmentVO> queryProjectEquipmentVO(Page<ProjectEquipmentVO> returnpage,@Param("projectEquipmentQueryParm")ProjectEquipmentQueryParm projectEquipmentQueryParm,@Param("device")List<String> device);
|
||||||
|
|
||||||
@@ -32,4 +34,7 @@ public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliver
|
|||||||
//获取符合条件的设备数量
|
//获取符合条件的设备数量
|
||||||
int getCounts(@Param("queryParam") CsEquipmentDeliveryQueryParm queryParam);
|
int getCounts(@Param("queryParam") CsEquipmentDeliveryQueryParm queryParam);
|
||||||
|
|
||||||
|
int getListByNodeProcess(@Param("nodeId")String nodeId,@Param("process")Integer process);
|
||||||
|
|
||||||
|
List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(@Param("nodeId")String nodeId,@Param("process")Integer process);
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsTerminalLogs;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-09-26
|
||||||
|
*/
|
||||||
|
public interface CsTerminalLogsMapper extends BaseMapper<CsTerminalLogs> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-10-09
|
||||||
|
*/
|
||||||
|
public interface CsTerminalReplyMapper extends BaseMapper<CsTerminalReply> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.csdevice.param.IcdParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2022-01-04
|
||||||
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
|
public interface NodeMapper extends BaseMapper<Node> {
|
||||||
|
|
||||||
|
List<DeviceInfo> nodeDeviceList(@Param("nodeDeviceParam") IcdParam icdParam);
|
||||||
|
}
|
||||||
@@ -124,4 +124,29 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getListByNodeProcess" resultType="int">
|
||||||
|
select
|
||||||
|
count(1)
|
||||||
|
from
|
||||||
|
cs_equipment_delivery
|
||||||
|
where
|
||||||
|
node_id = #{nodeId} and run_status != 0
|
||||||
|
<if test="process != null and process !=''">
|
||||||
|
and node_process > #{process}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDataByNodeIdAndProcessNo" resultType="com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from
|
||||||
|
cs_equipment_delivery
|
||||||
|
where
|
||||||
|
node_id = #{nodeId} and run_status != 0
|
||||||
|
<if test="process != null and process !=''">
|
||||||
|
and node_process = #{process}
|
||||||
|
</if>
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
</resultMap>
|
</resultMap>
|
||||||
<select id="getAll" resultType="CsLedgerVO">
|
<select id="getAll" resultType="CsLedgerVO">
|
||||||
select
|
select
|
||||||
id,pid,name,level,sort
|
id,pid,pids,name,level,sort
|
||||||
from
|
from
|
||||||
cs_ledger
|
cs_ledger
|
||||||
where
|
where
|
||||||
|
|||||||
@@ -0,0 +1,43 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.csdevice.mapper.NodeMapper">
|
||||||
|
|
||||||
|
<select id="nodeDeviceList" resultType="com.njcn.csdevice.pojo.vo.DeviceInfo">
|
||||||
|
SELECT
|
||||||
|
pq_device.Id id,
|
||||||
|
pq_device.IP ip,
|
||||||
|
s1.Name devType,
|
||||||
|
pq_device.Port port,
|
||||||
|
pq_line.Name name,
|
||||||
|
sub.Name subName,
|
||||||
|
pq_device.Update_Time updateTime,
|
||||||
|
s2.Name manufacturer,
|
||||||
|
pq_device.Com_Flag status,
|
||||||
|
pq_device.Series series,
|
||||||
|
pq_device_process.process_no processNo,
|
||||||
|
pq_device.Dev_Key devKey,
|
||||||
|
pq_node.max_Process_Num maxProcessNum
|
||||||
|
FROM
|
||||||
|
pq_device
|
||||||
|
LEFT JOIN pq_node ON pq_node.Id = pq_device.Node_Id
|
||||||
|
LEFT JOIN pq_line on pq_device.id = pq_line.id
|
||||||
|
LEFT JOIN pq_line sub on pq_line.pid = sub.id
|
||||||
|
LEFT JOIN pq_device_process on pq_device_process.id = pq_device.id
|
||||||
|
LEFT JOIN pq_dev_type s1 ON pq_device.Dev_Type = s1.id
|
||||||
|
LEFT JOIN sys_dict_data s2 ON pq_device.Manufacturer = s2.id
|
||||||
|
<where>
|
||||||
|
<if test="nodeDeviceParam.ip!=null and nodeDeviceParam.ip != ''">
|
||||||
|
pq_node.ip=#{nodeDeviceParam.ip}
|
||||||
|
</if>
|
||||||
|
<if test="nodeDeviceParam.devId!=null and nodeDeviceParam.devId != ''">
|
||||||
|
pq_device.id=#{nodeDeviceParam.devId}
|
||||||
|
</if>
|
||||||
|
<if test="nodeDeviceParam.runFlag!=null and nodeDeviceParam.runFlag.size()!=0">
|
||||||
|
AND pq_device.Run_Flag in
|
||||||
|
<foreach collection="nodeDeviceParam.runFlag" open="(" close=")" item="item" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -27,8 +27,8 @@ public interface AppProjectService extends IService<AppProjectPO> {
|
|||||||
* @return: java.lang.Boolean
|
* @return: java.lang.Boolean
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2023/3/27
|
* @Date: 2023/3/27
|
||||||
*/
|
*/
|
||||||
Boolean addAppProject(AppProjectAddParm appProjectAddOrAuditParm);
|
AppProjectPO addAppProject(AppProjectAddParm appProjectAddOrAuditParm);
|
||||||
/**
|
/**
|
||||||
* @Description: AuditAppProject
|
* @Description: AuditAppProject
|
||||||
* @Param: [appProjectAuditParm]
|
* @Param: [appProjectAuditParm]
|
||||||
|
|||||||
@@ -55,5 +55,5 @@ public interface CsDevModelRelationService extends IService<CsDevModelRelationPO
|
|||||||
|
|
||||||
String getVersionByDevId(String devId);
|
String getVersionByDevId(String devId);
|
||||||
|
|
||||||
|
void updateDataByList(List<String> list, String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,4 +76,10 @@ public interface CsDevModelService extends IService<CsDevModelPO>{
|
|||||||
*/
|
*/
|
||||||
CsDevModelPO getModelById(String id);
|
CsDevModelPO getModelById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取云前置模板
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CsDevModelPO getCldModel();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -55,4 +55,6 @@ public interface CsEngineeringService extends IService<CsEngineeringPO>{
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CsEngineeringPO> getEngineerings(List<String> list);
|
List<CsEngineeringPO> getEngineerings(List<String> list);
|
||||||
|
|
||||||
|
CsEngineeringPO queryEngineeringById(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@ import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
|||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@@ -32,30 +33,30 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
*/
|
*/
|
||||||
void refreshDeviceDataCache();
|
void refreshDeviceDataCache();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: save
|
* @Description: save
|
||||||
* @Param: [csEquipmentDeliveryAddParm]
|
* @Param: [csEquipmentDeliveryAddParm]
|
||||||
* @return: java.lang.Boolean
|
* @return: java.lang.Boolean
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2023/3/31
|
* @Date: 2023/3/31
|
||||||
*/
|
*/
|
||||||
CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
||||||
/**
|
/**
|
||||||
* @Description: AuditEquipmentDelivery
|
* @Description: AuditEquipmentDelivery
|
||||||
* @Param: [id]
|
* @Param: [id]
|
||||||
* @return: java.lang.Boolean
|
* @return: java.lang.Boolean
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2023/3/31
|
* @Date: 2023/3/31
|
||||||
*/
|
*/
|
||||||
Boolean AuditEquipmentDelivery(String id);
|
Boolean AuditEquipmentDelivery(String id);
|
||||||
/**
|
/**
|
||||||
* @Description: queryEquipmentByndid
|
* @Description: queryEquipmentByndid
|
||||||
* @Param: [ndid]
|
* @Param: [ndid]
|
||||||
* @return: com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO
|
* @return: com.njcn.algorithm.pojo.vo.CsEquipmentDeliveryVO
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2023/3/31
|
* @Date: 2023/3/31
|
||||||
*/
|
*/
|
||||||
CsEquipmentDeliveryVO queryEquipmentByndid(String ndid);
|
CsEquipmentDeliveryVO queryEquipmentByndid(String ndid);
|
||||||
/**
|
/**
|
||||||
* @Description: queryEquipmentByProject
|
* @Description: queryEquipmentByProject
|
||||||
* @Param: [projectEquipmentQueryParm]
|
* @Param: [projectEquipmentQueryParm]
|
||||||
@@ -135,4 +136,53 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
boolean judgeDevModel(String nDid);
|
boolean judgeDevModel(String nDid);
|
||||||
|
|
||||||
CsEquipmentDeliveryPO getDevByLineId(String lineId);
|
CsEquipmentDeliveryPO getDevByLineId(String lineId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增云前置设备
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除云前置设备
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean delCldDev(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新云前置设备
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Boolean updateCldDev(CsEquipmentDeliveryAuditParm param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据前置ip和运行状态获取装置数据
|
||||||
|
* @param id
|
||||||
|
* @param runFlag
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CsEquipmentDeliveryPO> getCldDevByIp(String id, List<Integer> runFlag);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据前置id和进程号修改设备状态;同时修改设备下的监测点的状态
|
||||||
|
*/
|
||||||
|
void updateCldDevStatus(String nodeId, Integer processNo);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备id和状态来修改设备运行状态;同时修改设备下的监测点的状态
|
||||||
|
* @param devId
|
||||||
|
* @param status
|
||||||
|
*/
|
||||||
|
void flipCldDevStatus(String devId, Integer status);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据项目id获取设备列表
|
||||||
|
*/
|
||||||
|
List<CsEquipmentDeliveryPO> getDevListByProjectId(String projectId);
|
||||||
|
|
||||||
|
List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -47,4 +48,19 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
|||||||
void updateIds(CsLineParam csLineParam);
|
void updateIds(CsLineParam csLineParam);
|
||||||
|
|
||||||
List<CsLinePO> getLinesByDevList(List<String> list);
|
List<CsLinePO> getLinesByDevList(List<String> list);
|
||||||
|
|
||||||
|
CsLinePO addCldLine(CsLineParam param);
|
||||||
|
|
||||||
|
void updateCldLine(CsLineParam param);
|
||||||
|
|
||||||
|
void deleteCldLine(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改监测点状态为停运
|
||||||
|
* @param lineList 监测点集合
|
||||||
|
* @param status 运行状态
|
||||||
|
*/
|
||||||
|
void updateCldLineStatus(List<CsLinePO> lineList, Integer status);
|
||||||
|
|
||||||
|
void updateLineDataByList(List<String> list, String id, String setId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -76,4 +76,13 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
|||||||
DevDetailDTO queryDevDetail(String devId);
|
DevDetailDTO queryDevDetail(String devId);
|
||||||
|
|
||||||
List<CsLedgerVO> getztProjectTree();
|
List<CsLedgerVO> getztProjectTree();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据设备集合获取项目和工程
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<CsLedgerVO> getProAndEngineer(List<String> id);
|
||||||
|
|
||||||
|
CsLedgerVO cldTree();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsTerminalLogs;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-09-26
|
||||||
|
*/
|
||||||
|
public interface ICsTerminalLogsService extends IService<CsTerminalLogs> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 更新台账操作日志信息
|
||||||
|
*/
|
||||||
|
void updateLogs(String id, Integer code);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 推送台账操作日志信息
|
||||||
|
*/
|
||||||
|
String pushCldInfo();
|
||||||
|
|
||||||
|
void updateLaterData(String id, String code);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-10-09
|
||||||
|
*/
|
||||||
|
public interface ICsTerminalReplyService extends IService<CsTerminalReply> {
|
||||||
|
|
||||||
|
List<String> queryReplyData();
|
||||||
|
|
||||||
|
void updateReplyData(String id,Integer state,String deviceId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,82 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.pojo.param.NodeParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2022-01-07
|
||||||
|
*/
|
||||||
|
public interface INodeService extends IService<Node> {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
boolean addNode(NodeParam nodeParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
boolean updateNode(NodeParam.NodeUpdateParam nodeParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
boolean delNode(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改前置机状态
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
boolean updateNodeState(String id, Integer state);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询前置机列表
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
Page<Node> nodeList(NodeParam.NodeQueryParam nodeQueryParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询前置机列表不分页
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
List<Node> nodeAllList();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据前置机id获取前置机
|
||||||
|
* @author cdf
|
||||||
|
* @date 2021/6/23
|
||||||
|
*/
|
||||||
|
Node getNodeById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据前置机名称获取详细信息
|
||||||
|
* @param nodeName 前置机名称
|
||||||
|
* @return 前置信息
|
||||||
|
*/
|
||||||
|
Node getNodeByNodeName(String nodeName);
|
||||||
|
|
||||||
|
Node getNodeByIp(String ip);
|
||||||
|
|
||||||
|
NodeProcessDeviceVo getProcessNoAndDeviceById(String id);
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.param.IcdLedgerParam;
|
||||||
|
import com.njcn.csdevice.param.IcdParam;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||||
|
import com.njcn.mq.message.CldControlMessage;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface IcdService {
|
||||||
|
|
||||||
|
List<DeviceInfo> getLedgerInfo(IcdParam param);
|
||||||
|
|
||||||
|
void addLedgerInfo(IcdLedgerParam param);
|
||||||
|
|
||||||
|
CldLedgerVo getLedgerById(String id);
|
||||||
|
|
||||||
|
void restartProcess(CldControlMessage message);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.stream.CollectorUtil;
|
||||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
@@ -55,7 +56,7 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean addAppProject(AppProjectAddParm appProjectAddOrAuditParm) {
|
public AppProjectPO addAppProject(AppProjectAddParm appProjectAddOrAuditParm) {
|
||||||
AppProjectPO appProjectPO = new AppProjectPO ( );
|
AppProjectPO appProjectPO = new AppProjectPO ( );
|
||||||
// Boolean result = checkName (appProjectAddOrAuditParm.getUserId ( ), appProjectAddOrAuditParm.getName ( ));
|
// Boolean result = checkName (appProjectAddOrAuditParm.getUserId ( ), appProjectAddOrAuditParm.getName ( ));
|
||||||
// if (result) {
|
// if (result) {
|
||||||
@@ -109,19 +110,33 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CsLedger csLedger = csLedgerMapper.selectById(appProjectAddOrAuditParm.getEngineeringId());
|
//云协议工程
|
||||||
Optional.ofNullable(csLedger).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ENGINEERING_DATA_ERROR));
|
if (Objects.nonNull(appProjectAddOrAuditParm.getIcdEngineeringId())){
|
||||||
CsLedger csLedger1 = new CsLedger();
|
CsLedger csLedger1 = new CsLedger();
|
||||||
csLedger1.setId(appProjectPO.getId());
|
csLedger1.setId(appProjectPO.getId());
|
||||||
csLedger1.setPid(appProjectAddOrAuditParm.getEngineeringId());
|
csLedger1.setPid(appProjectAddOrAuditParm.getEngineeringId());
|
||||||
csLedger1.setPids(csLedger.getPids()+ ","+appProjectAddOrAuditParm.getEngineeringId());
|
csLedger1.setPids("0,"+appProjectAddOrAuditParm.getEngineeringId());
|
||||||
csLedger1.setLevel(1);
|
csLedger1.setLevel(1);
|
||||||
csLedger1.setName(appProjectPO.getName());
|
csLedger1.setName(appProjectPO.getName());
|
||||||
csLedger1.setState(1);
|
csLedger1.setState(1);
|
||||||
csLedger1.setSort(0);
|
csLedger1.setSort(0);
|
||||||
csLedgerMapper.insert(csLedger1);
|
csLedgerMapper.insert(csLedger1);
|
||||||
|
}
|
||||||
return save;
|
//其他工程
|
||||||
|
else {
|
||||||
|
CsLedger csLedger = csLedgerMapper.selectById(appProjectAddOrAuditParm.getEngineeringId());
|
||||||
|
Optional.ofNullable(csLedger).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.ENGINEERING_DATA_ERROR));
|
||||||
|
CsLedger csLedger1 = new CsLedger();
|
||||||
|
csLedger1.setId(appProjectPO.getId());
|
||||||
|
csLedger1.setPid(appProjectAddOrAuditParm.getEngineeringId());
|
||||||
|
csLedger1.setPids(csLedger.getPids()+ ","+appProjectAddOrAuditParm.getEngineeringId());
|
||||||
|
csLedger1.setLevel(1);
|
||||||
|
csLedger1.setName(appProjectPO.getName());
|
||||||
|
csLedger1.setState(1);
|
||||||
|
csLedger1.setSort(0);
|
||||||
|
csLedgerMapper.insert(csLedger1);
|
||||||
|
}
|
||||||
|
return appProjectPO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Boolean checkName( String name,String id,String engineeringId) {
|
private Boolean checkName( String name,String id,String engineeringId) {
|
||||||
@@ -342,10 +357,14 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<AppProjectPO> getProjectByEngineering(List<String> list) {
|
public List<AppProjectPO> getProjectByEngineering(List<String> list) {
|
||||||
|
List<AppProjectPO> result = new ArrayList<>();
|
||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
||||||
csLedgerQueryWrapper.lambda().in(CsLedger::getPid, list).eq(CsLedger::getState,1);
|
csLedgerQueryWrapper.lambda().in(CsLedger::getPid, list).eq(CsLedger::getState,1);
|
||||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||||
List<String> collect = csLedgers.stream().map(CsLedger::getId).collect(Collectors.toList());
|
if (CollectionUtil.isNotEmpty(csLedgers)) {
|
||||||
return this.lambdaQuery().in(AppProjectPO::getId,collect).list();
|
List<String> collect = csLedgers.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||||
|
result = this.lambdaQuery().in(AppProjectPO::getId,collect).list();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
@@ -101,4 +102,11 @@ public class CsDevModelRelationServiceImpl extends ServiceImpl<CsDevModelRelatio
|
|||||||
public String getVersionByDevId(String devId) {
|
public String getVersionByDevId(String devId) {
|
||||||
return this.baseMapper.getVersionByDevId(devId);
|
return this.baseMapper.getVersionByDevId(devId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateDataByList(List<String> list, String id) {
|
||||||
|
LambdaUpdateWrapper<CsDevModelRelationPO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.in(CsDevModelRelationPO::getDevId,list).set(CsDevModelRelationPO::getModelId,id);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
||||||
@@ -17,6 +19,8 @@ import com.njcn.csdevice.service.ICsDataArrayService;
|
|||||||
import com.njcn.csdevice.service.ICsDataSetService;
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicTreeEnum;
|
||||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -26,6 +30,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -157,4 +162,20 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
return this.lambdaQuery().eq(CsDevModelPO::getId,id).one();
|
return this.lambdaQuery().eq(CsDevModelPO::getId,id).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsDevModelPO getCldModel() {
|
||||||
|
List<CsDevModelPO> list = this.lambdaQuery()
|
||||||
|
.eq(CsDevModelPO::getDevTypeName, DicDataEnum.DEV_CLD.getCode())
|
||||||
|
.eq(CsDevModelPO::getStatus,1)
|
||||||
|
.list();
|
||||||
|
if (CollectionUtil.isEmpty(list)) {
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.CLD_MODEL_MISSING);
|
||||||
|
} else {
|
||||||
|
if (list.size() > 1) {
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.CLD_MODEL_MORE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return list.get(0);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -217,6 +217,11 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
|||||||
return this.lambdaQuery().in(CsEngineeringPO::getId,list).eq(CsEngineeringPO::getStatus,"1").list();
|
return this.lambdaQuery().in(CsEngineeringPO::getId,list).eq(CsEngineeringPO::getStatus,"1").list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsEngineeringPO queryEngineeringById(String id) {
|
||||||
|
return this.lambdaQuery().eq(CsEngineeringPO::getId,id).eq(CsEngineeringPO::getStatus,"1").one();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public String getAreaById(String id){
|
public String getAreaById(String id){
|
||||||
|
|
||||||
|
|||||||
@@ -26,7 +26,9 @@ import com.njcn.csdevice.api.CsLogsFeignClient;
|
|||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||||
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
||||||
|
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
@@ -66,9 +68,8 @@ import java.io.InputStream;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
||||||
* Date: 2023/3/30 16:23【需求编号】
|
* Date: 2023/3/30 16:23【需求编号】
|
||||||
@@ -79,7 +80,6 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
||||||
|
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
private final ICsLedgerService csLedgerService;
|
private final ICsLedgerService csLedgerService;
|
||||||
@@ -98,6 +98,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final MqttUtil mqttUtil;
|
private final MqttUtil mqttUtil;
|
||||||
private final CsLogsFeignClient csLogsFeignClient;
|
private final CsLogsFeignClient csLogsFeignClient;
|
||||||
|
private final INodeService nodeService;
|
||||||
|
private final CsDevModelService csDevModelService;
|
||||||
|
private final CsLedgerMapper csLedgerMapper;
|
||||||
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -143,7 +148,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csEquipmentProcess.setStartTime(LocalDateTime.now());
|
csEquipmentProcess.setStartTime(LocalDateTime.now());
|
||||||
csEquipmentProcess.setProcess(1);
|
csEquipmentProcess.setProcess(1);
|
||||||
csEquipmentProcess.setStatus (1);
|
csEquipmentProcess.setStatus (1);
|
||||||
|
|
||||||
csEquipmentProcessPOService.save(csEquipmentProcess);
|
csEquipmentProcessPOService.save(csEquipmentProcess);
|
||||||
result = this.save (csEquipmentDeliveryPo);
|
result = this.save (csEquipmentDeliveryPo);
|
||||||
if (result) {
|
if (result) {
|
||||||
@@ -153,8 +157,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
// @Transactional(rollbackFor = {Exception.class}, propagation = Propagation.REQUIRED)
|
|
||||||
public Boolean AuditEquipmentDelivery(String id) {
|
public Boolean AuditEquipmentDelivery(String id) {
|
||||||
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, id).one();
|
||||||
//物理删除
|
//物理删除
|
||||||
QueryWrapper<CsEquipmentDeliveryPO> wrapper = new QueryWrapper();
|
QueryWrapper<CsEquipmentDeliveryPO> wrapper = new QueryWrapper();
|
||||||
wrapper.eq ("id", id);
|
wrapper.eq ("id", id);
|
||||||
@@ -186,8 +190,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
/*后续徐那边做处理*/
|
/*后续徐那边做处理*/
|
||||||
// CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.getBaseMapper().selectById(id);
|
// CsEquipmentDeliveryPO csEquipmentDeliveryPO = this.getBaseMapper().selectById(id);
|
||||||
// mqttUserService.deleteUser(csEquipmentDeliveryPO.getNdid());
|
// mqttUserService.deleteUser(csEquipmentDeliveryPO.getNdid());
|
||||||
|
|
||||||
|
|
||||||
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
|
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
|
||||||
if (update) {
|
if (update) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -205,6 +207,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
BeanUtils.copyProperties (csEquipmentDeliveryPO,result);
|
BeanUtils.copyProperties (csEquipmentDeliveryPO,result);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CsEquipmentDeliveryPO queryEquipmentPOByndid(String ndid) {
|
public CsEquipmentDeliveryPO queryEquipmentPOByndid(String ndid) {
|
||||||
QueryWrapper<CsEquipmentDeliveryPO> wrapper = new QueryWrapper();
|
QueryWrapper<CsEquipmentDeliveryPO> wrapper = new QueryWrapper();
|
||||||
wrapper.eq ("ndid", ndid);
|
wrapper.eq ("ndid", ndid);
|
||||||
@@ -220,7 +223,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if(CollectionUtils.isEmpty(device)){
|
if(CollectionUtils.isEmpty(device)){
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device);
|
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device);
|
||||||
list.getRecords().stream().forEach(temp->{
|
list.getRecords().stream().forEach(temp->{
|
||||||
temp.setIsPrimaryUser(csDeviceUserPOService.isPrimaryUser(temp.getEquipmentId()));
|
temp.setIsPrimaryUser(csDeviceUserPOService.isPrimaryUser(temp.getEquipmentId()));
|
||||||
@@ -235,18 +237,16 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
||||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
||||||
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
int countByAccount = this.count(lambdaQueryWrapper);
|
int countByAccount = this.count(lambdaQueryWrapper);
|
||||||
//大于等于1个则表示重复
|
//大于等于1个则表示重复
|
||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
|
|
||||||
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
||||||
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
|
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
|
||||||
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
||||||
@@ -264,7 +264,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||||
@@ -328,75 +327,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @Override
|
|
||||||
// public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
|
||||||
// QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
|
||||||
// if (ObjectUtil.isNotNull(queryParam)) {
|
|
||||||
// //查询参数不为空,进行条件填充
|
|
||||||
// if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
|
||||||
// //部门根据名称模糊查询
|
|
||||||
// queryWrapper
|
|
||||||
// .and(param -> param.like("cs_equipment_delivery.name", queryParam.getSearchValue())
|
|
||||||
// .or().like("cs_equipment_delivery.ndid", queryParam.getSearchValue())
|
|
||||||
// .or().like("cs_equipment_delivery.mac", queryParam.getSearchValue()));
|
|
||||||
// }
|
|
||||||
// //排序
|
|
||||||
// if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
|
||||||
// queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
|
||||||
// } else {
|
|
||||||
// //默认根据创建时间排序
|
|
||||||
// queryWrapper.orderBy(true, false, "create_time");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// if (StrUtil.isNotBlank(queryParam.getDevType()) && !Objects.isNull(queryParam.getDevType())){
|
|
||||||
// queryWrapper.eq("cs_equipment_delivery.dev_type", queryParam.getDevType());
|
|
||||||
// }
|
|
||||||
// if (StrUtil.isNotBlank(queryParam.getDevModel()) && !Objects.isNull(queryParam.getDevModel())){
|
|
||||||
// queryWrapper.eq("cs_equipment_delivery.dev_model", queryParam.getDevModel());
|
|
||||||
// }
|
|
||||||
// if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) && !Objects.isNull(queryParam.getDevAccessMethod())){
|
|
||||||
// queryWrapper.eq("cs_equipment_delivery.dev_access_method", queryParam.getDevAccessMethod());
|
|
||||||
// }
|
|
||||||
// if (!Objects.isNull(queryParam.getStatus())){
|
|
||||||
// queryWrapper.eq("cs_equipment_delivery.status", queryParam.getStatus());
|
|
||||||
// } else {
|
|
||||||
// queryWrapper.in("cs_equipment_delivery.status", Arrays.asList(1,2,3));
|
|
||||||
// }
|
|
||||||
// if (!Objects.isNull(queryParam.getRunStatus())){
|
|
||||||
// queryWrapper.eq("cs_equipment_delivery.run_status", queryParam.getRunStatus());
|
|
||||||
// } else {
|
|
||||||
// queryWrapper.in("cs_equipment_delivery.run_status", Arrays.asList(1,2));
|
|
||||||
// }
|
|
||||||
// if (!Objects.isNull(queryParam.getProcess())){
|
|
||||||
// queryWrapper.eq("cs_equipment_delivery.process", queryParam.getProcess());
|
|
||||||
// }
|
|
||||||
// Page<CsEquipmentDeliveryVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
|
||||||
// page.getRecords().forEach(item->{
|
|
||||||
// if (!Objects.isNull(item.getQrPath())){
|
|
||||||
// item.setQrPath(item.getQrPath());
|
|
||||||
// }
|
|
||||||
// });
|
|
||||||
// //新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
|
||||||
// for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
|
||||||
// if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
|
||||||
// csEquipmentDeliveryVO.setStatus(5);
|
|
||||||
// } else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
|
||||||
// csEquipmentDeliveryVO.setStatus(6);
|
|
||||||
// }
|
|
||||||
// //判断装置是否已经连接上mqtt服务器
|
|
||||||
// String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
|
||||||
// boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
|
||||||
// if (mqttClient) {
|
|
||||||
// csEquipmentDeliveryVO.setConnectStatus("已连接");
|
|
||||||
// } else {
|
|
||||||
// csEquipmentDeliveryVO.setConnectStatus("未连接");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return page;
|
|
||||||
// }
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
||||||
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||||
List<DeviceManagerVO.DataSetVO> dataSetList = new ArrayList<>();
|
List<DeviceManagerVO.DataSetVO> dataSetList = new ArrayList<>();
|
||||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||||
@@ -443,7 +375,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSet = csDataSetService.findDataSetByModelId(modelId,2);
|
dataSet = csDataSetService.findDataSetByModelId(modelId,2);
|
||||||
}
|
}
|
||||||
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||||
}else if(Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode())){
|
} else if(Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode()) || Objects.equals(devTypeCode, DicDataEnum.DEV_CLD.getCode())){
|
||||||
List<CsDataSet> dataSet = new ArrayList<>();
|
List<CsDataSet> dataSet = new ArrayList<>();
|
||||||
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
||||||
if (CollUtil.isNotEmpty(modelId)){
|
if (CollUtil.isNotEmpty(modelId)){
|
||||||
@@ -472,6 +404,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
} else {
|
} else {
|
||||||
CsDataSet item = dataSet.get(0);
|
CsDataSet item = dataSet.get(0);
|
||||||
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
||||||
|
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode());
|
||||||
|
|
||||||
addDataSet(dataSetList, item, "最新数据", "rt");
|
addDataSet(dataSetList, item, "最新数据", "rt");
|
||||||
addDataSet(dataSetList, item, "历史统计数据", "history");
|
addDataSet(dataSetList, item, "历史统计数据", "history");
|
||||||
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
||||||
@@ -491,6 +425,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||||
addDataSet(dataSetList, item, "测试项日志", "items");
|
addDataSet(dataSetList, item, "测试项日志", "items");
|
||||||
}
|
}
|
||||||
|
if (isCLdDevice) {
|
||||||
|
// 云前置数据集
|
||||||
|
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||||
|
}
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
@@ -540,10 +478,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
//如果存在非法数据,将不合格的数据导出
|
//如果存在非法数据,将不合格的数据导出
|
||||||
List<DeviceExcelTemplete> trueCollect = new ArrayList<> ( );
|
List<DeviceExcelTemplete> trueCollect = new ArrayList<> ( );
|
||||||
List<DeviceExcelTemplete.IllegalityDeviceExcelTemplete> falseCollect = new ArrayList<> ( );
|
List<DeviceExcelTemplete.IllegalityDeviceExcelTemplete> falseCollect = new ArrayList<> ( );
|
||||||
|
|
||||||
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
||||||
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
||||||
|
|
||||||
if(!deviceExcelTemplete.getNdid().matches(regex)){
|
if(!deviceExcelTemplete.getNdid().matches(regex)){
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
@@ -551,7 +487,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
|
||||||
if(!Objects.isNull (po)){
|
if(!Objects.isNull (po)){
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
@@ -572,7 +507,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
//设备类型
|
//设备类型
|
||||||
List<SysDicTreePO> children = deviceType.get(0).getChildren();
|
List<SysDicTreePO> children = deviceType.get(0).getChildren();
|
||||||
Map<String, SysDicTreePO> map = children.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
Map<String, SysDicTreePO> map = children.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||||
|
|
||||||
List<SysDicTreePO> collect = children.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevType())).collect(Collectors.toList());
|
List<SysDicTreePO> collect = children.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevType())).collect(Collectors.toList());
|
||||||
SysDicTreePO sysDicTreePO = map.get(deviceExcelTemplete.getDevType());
|
SysDicTreePO sysDicTreePO = map.get(deviceExcelTemplete.getDevType());
|
||||||
if(CollectionUtils.isEmpty(collect)){
|
if(CollectionUtils.isEmpty(collect)){
|
||||||
@@ -583,15 +517,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
continue;
|
continue;
|
||||||
}else {
|
}else {
|
||||||
deviceExcelTemplete.setDevType(map.get(deviceExcelTemplete.getDevType()).getId());
|
deviceExcelTemplete.setDevType(map.get(deviceExcelTemplete.getDevType()).getId());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//设备型号
|
//设备型号
|
||||||
List<SysDicTreePO> children1 = sysDicTreePO.getChildren();
|
List<SysDicTreePO> children1 = sysDicTreePO.getChildren();
|
||||||
Map<String, SysDicTreePO> map2 = children1.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
Map<String, SysDicTreePO> map2 = children1.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||||
|
|
||||||
List<SysDicTreePO> collect2 = children1.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevModel())).collect(Collectors.toList());
|
List<SysDicTreePO> collect2 = children1.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevModel())).collect(Collectors.toList());
|
||||||
|
|
||||||
if(CollectionUtils.isEmpty(collect2)){
|
if(CollectionUtils.isEmpty(collect2)){
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
@@ -602,8 +532,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
deviceExcelTemplete.setDevModel(map2.get(deviceExcelTemplete.getDevModel()).getId());
|
deviceExcelTemplete.setDevModel(map2.get(deviceExcelTemplete.getDevModel()).getId());
|
||||||
trueCollect.add(deviceExcelTemplete);
|
trueCollect.add(deviceExcelTemplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty (trueCollect)) {
|
if (!CollectionUtils.isEmpty (trueCollect)) {
|
||||||
List<CsEquipmentProcessPO> collect1 = new ArrayList<>();
|
List<CsEquipmentProcessPO> collect1 = new ArrayList<>();
|
||||||
@@ -618,7 +546,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csEquipmentDeliveryPO.setStatus(1);
|
csEquipmentDeliveryPO.setStatus(1);
|
||||||
csEquipmentDeliveryPO.setProcess(2);
|
csEquipmentDeliveryPO.setProcess(2);
|
||||||
csEquipmentDeliveryPO.setSort(100);
|
csEquipmentDeliveryPO.setSort(100);
|
||||||
|
|
||||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||||
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
||||||
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
|
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
|
||||||
@@ -630,7 +557,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}).collect (Collectors.toList ( ));
|
}).collect (Collectors.toList ( ));
|
||||||
csEquipmentProcessPOService.saveBatch(collect1,500);
|
csEquipmentProcessPOService.saveBatch(collect1,500);
|
||||||
this.saveOrUpdateBatch (collect, 500);
|
this.saveOrUpdateBatch (collect, 500);
|
||||||
|
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty (falseCollect)) {
|
if (!CollectionUtils.isEmpty (falseCollect)) {
|
||||||
@@ -639,21 +565,21 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace ( );
|
e.printStackTrace ( );
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 物理删除设备相关数据
|
* 物理删除设备相关数据
|
||||||
*
|
*
|
||||||
* 2.删除cs_ledger
|
* 2.删除cs_ledger
|
||||||
* 3.删除cs_dev_model_relation
|
* 3.删除cs_dev_model_relation
|
||||||
* 4.删除cs_line
|
* 4.删除cs_line
|
||||||
* 5.删除cs_line_topology_diagram
|
* 5.删除cs_line_topology_diagram
|
||||||
* 6.删除cs_device_user
|
* 6.删除cs_device_user
|
||||||
* */
|
* */
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void delete(String devId) {
|
public void delete(String devId) {
|
||||||
@@ -713,11 +639,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
@Override
|
@Override
|
||||||
public void deleteTest(String deviceId, Integer type ,String remark) {
|
public void deleteTest(String deviceId, Integer type ,String remark) {
|
||||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||||
|
|
||||||
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
this.lambdaUpdate().eq(CsEquipmentDeliveryPO::getId,deviceId).
|
||||||
// set(CsEquipmentDeliveryPO::getStatus,1).
|
// set(CsEquipmentDeliveryPO::getStatus,1).
|
||||||
// set(CsEquipmentDeliveryPO::getRunStatus,1).
|
// set(CsEquipmentDeliveryPO::getRunStatus,1).
|
||||||
set(CsEquipmentDeliveryPO::getProcess,type).update();
|
set(CsEquipmentDeliveryPO::getProcess,type).update();
|
||||||
this.delete(deviceId);
|
this.delete(deviceId);
|
||||||
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).
|
List<CsEquipmentProcessPO> list = csEquipmentProcessPOService.lambdaQuery().eq(CsEquipmentProcessPO::getDevId, one.getNdid()).
|
||||||
eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
eq(CsEquipmentProcessPO::getProcess, type).orderByDesc(CsEquipmentProcessPO::getStartTime).list();
|
||||||
@@ -735,8 +660,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
boolean result;
|
boolean result;
|
||||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
||||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||||
.set(CsEquipmentDeliveryPO::getSoftinfoId,id);
|
.set(CsEquipmentDeliveryPO::getSoftinfoId,id);
|
||||||
result = this.update(lambdaUpdateWrapper);
|
result = this.update(lambdaUpdateWrapper);
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
@@ -800,6 +725,271 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId,linePO.getDeviceId()).ne(CsEquipmentDeliveryPO::getRunStatus,0).one();
|
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId,linePO.getDeviceId()).ne(CsEquipmentDeliveryPO::getRunStatus,0).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
|
||||||
|
boolean result;
|
||||||
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||||
|
if(Objects.nonNull (one)){
|
||||||
|
throw new BusinessException ("设备名称不能重复");
|
||||||
|
}
|
||||||
|
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||||
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (param.getNdid());
|
||||||
|
if(!Objects.isNull (po)){
|
||||||
|
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||||
|
}
|
||||||
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||||
|
BeanUtils.copyProperties (param,csEquipmentDeliveryPo);
|
||||||
|
csEquipmentDeliveryPo.setStatus(3);
|
||||||
|
csEquipmentDeliveryPo.setRunStatus(1);
|
||||||
|
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||||
|
csEquipmentDeliveryPo.setProcess(4);
|
||||||
|
csEquipmentDeliveryPo.setMac(param.getMac());
|
||||||
|
|
||||||
|
//这边自动分配前置机进程号,需要做判断 1.新增装置时,判断是否已经是最大装置数量;2.根据进程号,选择最少的分配
|
||||||
|
csEquipmentDeliveryPo.setNodeId(param.getNodeId());
|
||||||
|
//判断1
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
//判断2
|
||||||
|
int process = findLeastFrequentProcess(devList,node.getMaxProcessNum());
|
||||||
|
csEquipmentDeliveryPo.setNodeProcess(process);
|
||||||
|
result = this.save(csEquipmentDeliveryPo);
|
||||||
|
|
||||||
|
//新增设备与模板之间的关系 获取云前置模板
|
||||||
|
CsDevModelPO csDevModelPO = csDevModelService.getCldModel();
|
||||||
|
CsDevModelRelationAddParm relationAddParam = new CsDevModelRelationAddParm();
|
||||||
|
relationAddParam.setDevId(csEquipmentDeliveryPo.getId());
|
||||||
|
relationAddParam.setModelId(csDevModelPO.getId());
|
||||||
|
relationAddParam.setDid(1);
|
||||||
|
CsDevModelRelationPO relation = csDevModelRelationService.addDevModelRelation(relationAddParam);
|
||||||
|
|
||||||
|
//新增台账数据
|
||||||
|
CsLedger csLedger = new CsLedger();
|
||||||
|
csLedger.setId(csEquipmentDeliveryPo.getId());
|
||||||
|
csLedger.setPid(param.getProjectId());
|
||||||
|
csLedger.setPids("0," + param.getEngineeringId() + "," + param.getProjectId());
|
||||||
|
csLedger.setLevel(2);
|
||||||
|
csLedger.setName(param.getName());
|
||||||
|
csLedger.setState(1);
|
||||||
|
csLedger.setSort(0);
|
||||||
|
int addLedger = csLedgerMapper.insert(csLedger);
|
||||||
|
|
||||||
|
if (result && ObjectUtil.isNotNull(relation) && addLedger > 0) {
|
||||||
|
refreshDeviceDataCache();
|
||||||
|
}
|
||||||
|
return csEquipmentDeliveryPo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public Boolean delCldDev(String id) {
|
||||||
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, id).one();
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,id);
|
||||||
|
boolean update = this.remove(lambdaQueryWrapper);
|
||||||
|
List<CsLedger> list = csLedgerService.lambdaQuery().eq(CsLedger::getPid, id).list();
|
||||||
|
if(!CollectionUtils.isEmpty(list)){
|
||||||
|
List<String> collect = list.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<CsLinePO> csLinePOLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
csLinePOLambdaQueryWrapper.in(CsLinePO::getLineId,collect);
|
||||||
|
csLinePOService.remove(csLinePOLambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<CsLedger> csLedgerLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
csLedgerLambdaQueryWrapper.clear();
|
||||||
|
csLedgerLambdaQueryWrapper.eq(CsLedger::getId,id);
|
||||||
|
csLedgerService.remove(csLedgerLambdaQueryWrapper);
|
||||||
|
csLedgerLambdaQueryWrapper.clear();
|
||||||
|
csLedgerLambdaQueryWrapper.eq(CsLedger::getPid,id);
|
||||||
|
csLedgerService.remove(csLedgerLambdaQueryWrapper);
|
||||||
|
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
|
||||||
|
if (update) {
|
||||||
|
refreshDeviceDataCache();
|
||||||
|
}
|
||||||
|
//新增操作日志
|
||||||
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
|
csTerminalLogs.setDeviceId(id);
|
||||||
|
csTerminalLogs.setOperateType(2);
|
||||||
|
csTerminalLogs.setIsPush(0);
|
||||||
|
csTerminalLogs.setNodeId(one.getNodeId());
|
||||||
|
csTerminalLogs.setNodeProcess(one.getNodeProcess());
|
||||||
|
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@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);
|
||||||
|
}
|
||||||
|
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||||
|
boolean result;
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,param.getNdid())
|
||||||
|
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
||||||
|
.ne(CsEquipmentDeliveryPO::getId, param.getId());
|
||||||
|
int countByAccount = this.count(lambdaQueryWrapper);
|
||||||
|
//大于等于1个则表示重复
|
||||||
|
if (countByAccount >= 1) {
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, param.getId());
|
||||||
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
||||||
|
.ne(CsEquipmentDeliveryPO::getId, param.getId())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getNdid, param.getNdid())
|
||||||
|
.eq(CsEquipmentDeliveryPO::getName, param.getName())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
|
if(!CollectionUtils.isEmpty (list)){
|
||||||
|
throw new BusinessException ("设备名称不能重复");
|
||||||
|
}
|
||||||
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||||
|
BeanUtils.copyProperties (param, csEquipmentDeliveryPo);
|
||||||
|
String path = this.createPath(param.getNdid());
|
||||||
|
csEquipmentDeliveryPo.setMac(path);
|
||||||
|
result = this.updateById(csEquipmentDeliveryPo);
|
||||||
|
//修改台账树中的设备名称
|
||||||
|
CsLedger csLedger = csLedgerService.findDataById(param.getId());
|
||||||
|
if (!Objects.isNull(csLedger)) {
|
||||||
|
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||||
|
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||||
|
csLedgerParam.setName(param.getName());
|
||||||
|
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||||
|
}
|
||||||
|
if (result) {
|
||||||
|
refreshDeviceDataCache();
|
||||||
|
if (!Objects.equals(po.getUsageStatus(),param.getUsageStatus())) {
|
||||||
|
DeviceLogDTO dto = new DeviceLogDTO();
|
||||||
|
dto.setUserName(RequestUtil.getUsername());
|
||||||
|
dto.setOperate("设备使用状态被修改");
|
||||||
|
dto.setResult(1);
|
||||||
|
dto.setLoginName(RequestUtil.getLoginName());
|
||||||
|
csLogsFeignClient.addUserLog(dto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//新增台账日志
|
||||||
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
|
csTerminalLogs.setDeviceId(csEquipmentDeliveryPo.getId());
|
||||||
|
csTerminalLogs.setOperateType(1);
|
||||||
|
csTerminalLogs.setIsPush(0);
|
||||||
|
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsEquipmentDeliveryPO> getCldDevByIp(String id, List<Integer> runFlag) {
|
||||||
|
//运行状态转换
|
||||||
|
List<Integer> state = new ArrayList<>();
|
||||||
|
if (CollectionUtil.isNotEmpty(runFlag)) {
|
||||||
|
if (runFlag.contains(0)) {
|
||||||
|
state.add(1);
|
||||||
|
}
|
||||||
|
if (runFlag.contains(2)) {
|
||||||
|
state.add(0);
|
||||||
|
}
|
||||||
|
//fixme 目前治理设备只有启用和停用,没有那么多状态,如果前置传递其他状态,先设置一个不存在的状态
|
||||||
|
state.add(9);
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,id)
|
||||||
|
.in(ObjectUtil.isNotEmpty(state),CsEquipmentDeliveryPO::getUsageStatus,state);
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateCldDevStatus(String nodeId, Integer processNo) {
|
||||||
|
//获取需要修改的设备信息
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
||||||
|
.eq(CsEquipmentDeliveryPO::getNodeProcess,processNo)
|
||||||
|
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
||||||
|
.eq(CsEquipmentDeliveryPO::getRunStatus,2);
|
||||||
|
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
||||||
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
|
//修改设备运行状态
|
||||||
|
devList.forEach(item->{item.setRunStatus(1);});
|
||||||
|
this.updateBatchById(devList);
|
||||||
|
//修改监测点运行状态
|
||||||
|
List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
List<CsLinePO> lineList = csLinePOService.getLinesByDevList(devIdList);
|
||||||
|
csLinePOService.updateCldLineStatus(lineList,2);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void flipCldDevStatus(String devId, Integer status) {
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId)
|
||||||
|
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
||||||
|
.ne(CsEquipmentDeliveryPO::getUsageStatus,0);
|
||||||
|
CsEquipmentDeliveryPO po = this.getOne(lambdaQueryWrapper);
|
||||||
|
if (ObjectUtil.isNotNull(po)) {
|
||||||
|
po.setRunStatus(status);
|
||||||
|
this.updateById(po);
|
||||||
|
//修改监测点运行状态
|
||||||
|
List<CsLinePO> lineList = csLinePOService.getLinesByDevList(Collections.singletonList(po.getId()));
|
||||||
|
csLinePOService.updateCldLineStatus(lineList,status==1?2:0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsEquipmentDeliveryPO> getDevListByProjectId(String projectId) {
|
||||||
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
||||||
|
csLedgerQueryWrapper.lambda().eq(CsLedger::getPid, projectId).eq(CsLedger::getState,1);
|
||||||
|
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||||
|
if (CollectionUtil.isEmpty(csLedgers)) {
|
||||||
|
return new ArrayList<>();
|
||||||
|
}
|
||||||
|
List<String> collect = csLedgers.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||||
|
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId,collect).list();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsEquipmentDeliveryPO> getDataByNodeIdAndProcessNo(String nodeId, Integer processNo) {
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeId,nodeId)
|
||||||
|
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||||
|
.eq(CsEquipmentDeliveryPO::getDevAccessMethod,"CLD");
|
||||||
|
if (ObjectUtil.isNotNull(processNo)) {
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNodeProcess,processNo);
|
||||||
|
}
|
||||||
|
return this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
//根据前置机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 this.list(lambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int findLeastFrequentProcess(List<CsEquipmentDeliveryPO> items, Integer process) {
|
||||||
|
Map<Integer, Long> processCounts = items.stream()
|
||||||
|
.collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess, Collectors.counting()));
|
||||||
|
for (int i = 1; i <= process; i++) {
|
||||||
|
processCounts.putIfAbsent(i, 0L);
|
||||||
|
}
|
||||||
|
//如果列表为空,默认返回1
|
||||||
|
return processCounts.entrySet().stream()
|
||||||
|
.min(Comparator.comparingLong(Map.Entry::getValue))
|
||||||
|
.map(Map.Entry::getKey)
|
||||||
|
.orElse(1);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ndid生成二维码
|
* 根据ndid生成二维码
|
||||||
* @param ndid
|
* @param ndid
|
||||||
@@ -819,7 +1009,6 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
return filePath;
|
return filePath;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public InputStream bufferedImageToInputStream(BufferedImage image) {
|
public InputStream bufferedImageToInputStream(BufferedImage image) {
|
||||||
@@ -833,6 +1022,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*将ndid转成mac地址*/
|
/*将ndid转成mac地址*/
|
||||||
public String createPath(String nDid) {
|
public String createPath(String nDid) {
|
||||||
// 使用StringBuilder来构建新的字符串
|
// 使用StringBuilder来构建新的字符串
|
||||||
@@ -854,4 +1044,4 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
return output.toString();
|
return output.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -7,9 +7,11 @@ import cn.hutool.core.util.IdUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
import com.njcn.csdevice.mapper.*;
|
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.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
@@ -18,7 +20,10 @@ import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
|||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.pojo.po.Area;
|
import com.njcn.system.pojo.po.Area;
|
||||||
|
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -49,6 +54,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getLedgerTree() {
|
public List<CsLedgerVO> getLedgerTree() {
|
||||||
@@ -72,6 +79,29 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
/*获取用户工程,设备信息过滤*/
|
/*获取用户工程,设备信息过滤*/
|
||||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
|
//区分治理装置和云前置装置
|
||||||
|
List<String> zhiLianDevice = new ArrayList<>();
|
||||||
|
List<String> cldDevice = new ArrayList<>();
|
||||||
|
List<CsEquipmentDeliveryDTO> csEquipmentDeliveryPOS = equipmentFeignClient.queryDeviceById(device).getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(csEquipmentDeliveryPOS)) {
|
||||||
|
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)
|
||||||
|
.forEach(cldDevice::add)
|
||||||
|
);
|
||||||
|
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
||||||
|
Optional.ofNullable(vo2)
|
||||||
|
.map(DictTreeVO::getId)
|
||||||
|
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||||
|
.map(CsEquipmentDeliveryDTO::getId)
|
||||||
|
.forEach(zhiLianDevice::add)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
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());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
|
||||||
@@ -85,7 +115,20 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
));
|
));
|
||||||
|
|
||||||
List<CsLedgerVO> deviceList = allList.stream()
|
List<CsLedgerVO> deviceList = allList.stream()
|
||||||
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
.filter(item -> zhiLianDevice.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
|
.peek(item -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
|
item.setComFlag(po.getRunStatus());
|
||||||
|
item.setNDId(po.getNdid());
|
||||||
|
item.setType("device");
|
||||||
|
item.setProcess(po.getProcess());
|
||||||
|
})
|
||||||
|
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||||
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<CsLedgerVO> cldDeviceList = allList.stream()
|
||||||
|
.filter(item -> cldDevice.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
.peek(item -> {
|
.peek(item -> {
|
||||||
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
item.setComFlag(po.getRunStatus());
|
item.setComFlag(po.getRunStatus());
|
||||||
@@ -116,11 +159,35 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
checkDevSetData(deviceList);
|
checkDevSetData(deviceList);
|
||||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
List<CsLedgerVO> engineeringList1 = new ArrayList<>();
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
List<CsLedgerVO> projectList1 = new ArrayList<>();
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
List<String> dev = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
engineeringList = engineeringList.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
List<CsLedgerVO> ledger1 = getProAndEngineer(dev);
|
||||||
|
if (CollectionUtil.isNotEmpty(ledger1)) {
|
||||||
|
deviceList.forEach(dev1 -> dev1.setChildren(getChildren(dev1, finalLineList)));
|
||||||
|
engineeringList1 = ledger1.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList1 = ledger1.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList1.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
|
List<CsLedgerVO> finalProjectList = projectList1;
|
||||||
|
engineeringList1.forEach(eng -> eng.setChildren(getChildren(eng, finalProjectList)));
|
||||||
|
}
|
||||||
|
|
||||||
|
checkDevSetData(cldDeviceList);
|
||||||
|
List<CsLedgerVO> engineeringList2 = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> projectList2 = new ArrayList<>();
|
||||||
|
List<String> dev2 = cldDeviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
|
List<CsLedgerVO> ledger2 = getProAndEngineer(dev2);
|
||||||
|
if (CollectionUtil.isNotEmpty(ledger2)) {
|
||||||
|
cldDeviceList.forEach(dev1 -> dev1.setChildren(getChildren(dev1, finalLineList)));
|
||||||
|
engineeringList2 = ledger2.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList2 = ledger2.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList2.forEach(pro -> pro.setChildren(getChildren(pro, cldDeviceList)));
|
||||||
|
List<CsLedgerVO> finalProjectList = projectList2;
|
||||||
|
engineeringList2.forEach(eng -> eng.setChildren(getChildren(eng, finalProjectList)));
|
||||||
|
}
|
||||||
|
|
||||||
//获取便携式设备树
|
//获取便携式设备树
|
||||||
CsLedgerVO portable = new CsLedgerVO();
|
CsLedgerVO portable = new CsLedgerVO();
|
||||||
portable.setLevel(0);
|
portable.setLevel(0);
|
||||||
@@ -150,7 +217,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
portables.forEach(dev3 -> dev3.setChildren(getChildren(dev3, finalLineList)));
|
||||||
checkDevSetData(portables);
|
checkDevSetData(portables);
|
||||||
portable.setChildren(portables);
|
portable.setChildren(portables);
|
||||||
|
|
||||||
@@ -159,7 +226,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
government.setName(DataParam.governmentDev);
|
government.setName(DataParam.governmentDev);
|
||||||
government.setPid("0");
|
government.setPid("0");
|
||||||
government.setId(IdUtil.simpleUUID());
|
government.setId(IdUtil.simpleUUID());
|
||||||
government.setChildren(engineeringList);
|
government.setChildren(engineeringList1);
|
||||||
|
|
||||||
|
//获取云前置设备树
|
||||||
|
CsLedgerVO cld = new CsLedgerVO();
|
||||||
|
cld.setLevel(0);
|
||||||
|
cld.setName(DataParam.cldDev);
|
||||||
|
cld.setPid("0");
|
||||||
|
cld.setId(IdUtil.simpleUUID());
|
||||||
|
cld.setChildren(engineeringList2);
|
||||||
|
|
||||||
List<CsLedgerVO> tree = new ArrayList<>();
|
List<CsLedgerVO> tree = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(portables)) {
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
tree.add(portable);
|
tree.add(portable);
|
||||||
@@ -167,6 +243,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
if (CollUtil.isNotEmpty(deviceList)) {
|
if (CollUtil.isNotEmpty(deviceList)) {
|
||||||
tree.add(government);
|
tree.add(government);
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(cldDeviceList)) {
|
||||||
|
tree.add(cld);
|
||||||
|
}
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||||
@@ -205,6 +284,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
/*获取用户工程,设备信息过滤*/
|
/*获取用户工程,设备信息过滤*/
|
||||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
|
|
||||||
|
List<String> zhiLianDevice = new ArrayList<>();
|
||||||
|
List<String> cldDevice = new ArrayList<>();
|
||||||
|
List<CsEquipmentDeliveryDTO> csEquipmentDeliveryPOS = equipmentFeignClient.queryDeviceById(device).getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(csEquipmentDeliveryPOS)) {
|
||||||
|
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)
|
||||||
|
.forEach(cldDevice::add)
|
||||||
|
);
|
||||||
|
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
||||||
|
Optional.ofNullable(vo2)
|
||||||
|
.map(DictTreeVO::getId)
|
||||||
|
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||||
|
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||||
|
.map(CsEquipmentDeliveryDTO::getId)
|
||||||
|
.forEach(zhiLianDevice::add)
|
||||||
|
);
|
||||||
|
}
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
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());
|
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
|
||||||
@@ -217,8 +318,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
csEquipmentDeliveryMapper::selectById
|
csEquipmentDeliveryMapper::selectById
|
||||||
));
|
));
|
||||||
|
|
||||||
|
//获取治理设备
|
||||||
List<CsLedgerVO> deviceList = allList.stream()
|
List<CsLedgerVO> deviceList = allList.stream()
|
||||||
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
.filter(item -> zhiLianDevice.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
.peek(item -> {
|
.peek(item -> {
|
||||||
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
item.setComFlag(po.getRunStatus());
|
item.setComFlag(po.getRunStatus());
|
||||||
@@ -230,9 +332,45 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<CsLedgerVO> engineeringList1 = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> projectList1 = new ArrayList<>();
|
||||||
checkDevSetData(deviceList);
|
checkDevSetData(deviceList);
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
List<String> dev = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
List<CsLedgerVO> ledger1 = getProAndEngineer(dev);
|
||||||
|
if (CollectionUtil.isNotEmpty(ledger1)) {
|
||||||
|
engineeringList1 = ledger1.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList1 = ledger1.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList1.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
|
List<CsLedgerVO> finalProjectList = projectList1;
|
||||||
|
engineeringList1.forEach(eng -> eng.setChildren(getChildren(eng, finalProjectList)));
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取云前置设备
|
||||||
|
List<CsLedgerVO> cldDevList = allList.stream()
|
||||||
|
.filter(item -> cldDevice.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
|
.peek(item -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
|
item.setComFlag(po.getRunStatus());
|
||||||
|
item.setNDId(po.getNdid());
|
||||||
|
item.setType("device");
|
||||||
|
item.setProcess(po.getProcess());
|
||||||
|
})
|
||||||
|
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||||
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
checkDevSetData(cldDevList);
|
||||||
|
List<CsLedgerVO> engineeringList2 = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> projectList2 = new ArrayList<>();
|
||||||
|
|
||||||
|
List<String> dev2 = cldDevList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
|
List<CsLedgerVO> ledger2 = getProAndEngineer(dev2);
|
||||||
|
if (CollectionUtil.isNotEmpty(ledger2)) {
|
||||||
|
engineeringList2 = ledger2.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList2 = ledger2.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
|
projectList2.forEach(pro -> pro.setChildren(getChildren(pro, cldDevList)));
|
||||||
|
List<CsLedgerVO> finalProjectList = projectList2;
|
||||||
|
engineeringList2.forEach(eng -> eng.setChildren(getChildren(eng, finalProjectList)));
|
||||||
|
}
|
||||||
|
|
||||||
//获取便携式设备树
|
//获取便携式设备树
|
||||||
CsLedgerVO portable = new CsLedgerVO();
|
CsLedgerVO portable = new CsLedgerVO();
|
||||||
@@ -272,7 +410,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
government.setName(DataParam.governmentDev);
|
government.setName(DataParam.governmentDev);
|
||||||
government.setPid("0");
|
government.setPid("0");
|
||||||
government.setId(IdUtil.simpleUUID());
|
government.setId(IdUtil.simpleUUID());
|
||||||
government.setChildren(engineeringList);
|
government.setChildren(engineeringList1);
|
||||||
|
|
||||||
|
//获取云前置设备树
|
||||||
|
CsLedgerVO cld = new CsLedgerVO();
|
||||||
|
cld.setLevel(0);
|
||||||
|
cld.setName(DataParam.cldDev);
|
||||||
|
cld.setPid("0");
|
||||||
|
cld.setId(IdUtil.simpleUUID());
|
||||||
|
cld.setChildren(engineeringList2);
|
||||||
|
|
||||||
List<CsLedgerVO> tree = new ArrayList<>();
|
List<CsLedgerVO> tree = new ArrayList<>();
|
||||||
if (CollUtil.isNotEmpty(portables)) {
|
if (CollUtil.isNotEmpty(portables)) {
|
||||||
tree.add(portable);
|
tree.add(portable);
|
||||||
@@ -280,6 +427,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
if (CollUtil.isNotEmpty(deviceList)) {
|
if (CollUtil.isNotEmpty(deviceList)) {
|
||||||
tree.add(government);
|
tree.add(government);
|
||||||
}
|
}
|
||||||
|
if (CollUtil.isNotEmpty(cldDevList)) {
|
||||||
|
tree.add(cld);
|
||||||
|
}
|
||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -474,6 +624,111 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
return tree;
|
return tree;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||||
|
List<CsLedgerVO> result = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||||
|
Set<String> idSet = new HashSet<>(id);
|
||||||
|
if (CollectionUtil.isNotEmpty(id)) {
|
||||||
|
id.forEach(item->{
|
||||||
|
allList.forEach(item2->{
|
||||||
|
if (Objects.equals(item2.getId(),item)) {
|
||||||
|
idSet.addAll(Arrays.asList(item2.getPids().split( ",")));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(idSet)) {
|
||||||
|
idSet.forEach(item->{
|
||||||
|
allList.forEach(item2->{
|
||||||
|
if (Objects.equals(item2.getId(),item)) {
|
||||||
|
result.add(item2);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsLedgerVO cldTree() {
|
||||||
|
|
||||||
|
List<CsLedgerVO> engineerTree = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> projectTree = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> deviceTree = new ArrayList<>();
|
||||||
|
List<CsLedgerVO> lineTree = new ArrayList<>();
|
||||||
|
|
||||||
|
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||||
|
if (CollectionUtil.isNotEmpty(allList)) {
|
||||||
|
//工程集合
|
||||||
|
List<CsLedgerVO> tree1 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).collect(Collectors.toList());
|
||||||
|
//项目集合
|
||||||
|
List<CsLedgerVO> tree2 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).collect(Collectors.toList());
|
||||||
|
//设备集合
|
||||||
|
List<CsLedgerVO> tree3 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).collect(Collectors.toList());
|
||||||
|
//监测点集合
|
||||||
|
List<CsLedgerVO> tree4 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//筛选出云前置设备
|
||||||
|
if (CollectionUtil.isNotEmpty(tree3)) {
|
||||||
|
Set<String> list1 = new HashSet<>();
|
||||||
|
List<String> devList = tree3.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devList);
|
||||||
|
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||||
|
|
||||||
|
//list1是 cld设备
|
||||||
|
devs.forEach(item->{
|
||||||
|
if (item.getDevType().equals(vo1.getId())) {
|
||||||
|
list1.add(item.getId());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//list2是 非cld设备
|
||||||
|
Set<String> list2 = devList.stream().filter(item -> !list1.contains(item)).collect(Collectors.toSet());
|
||||||
|
List<CsLedgerVO> tree5 = tree3.stream().filter(vo -> list2.contains(vo.getId())).collect(Collectors.toList());
|
||||||
|
Set<String> list3 = tree5.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet());
|
||||||
|
projectTree = tree2.stream().filter(vo -> !list3.contains(vo.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
|
||||||
|
List<CsLedgerVO> tree6 = tree2.stream().filter(vo -> list3.contains(vo.getId())).collect(Collectors.toList());
|
||||||
|
Set<String> proList = tree6.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet());
|
||||||
|
engineerTree = tree1.stream().filter(vo -> !proList.contains(vo.getId())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(list1)) {
|
||||||
|
deviceTree = tree3.stream().filter(vo -> list1.contains(vo.getId())).collect(Collectors.toList());
|
||||||
|
lineTree = tree4.stream().filter(vo -> list1.contains(vo.getPid())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(deviceTree)) {
|
||||||
|
List<CsLedgerVO> finalLineTree = lineTree;
|
||||||
|
deviceTree.forEach(item->{
|
||||||
|
item.setChildren(getChildren(item, finalLineTree));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(projectTree)) {
|
||||||
|
List<CsLedgerVO> finalDeviceTree = deviceTree;
|
||||||
|
projectTree.forEach(item->{
|
||||||
|
item.setChildren(getChildren(item, finalDeviceTree));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(engineerTree)) {
|
||||||
|
List<CsLedgerVO> finalProjectTree = projectTree;
|
||||||
|
engineerTree.forEach(item->{
|
||||||
|
item.setChildren(getChildren(item, finalProjectTree));
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
CsLedgerVO government = new CsLedgerVO();
|
||||||
|
government.setLevel(0);
|
||||||
|
government.setName(DataParam.cldDev);
|
||||||
|
government.setPid("0");
|
||||||
|
government.setId(IdUtil.simpleUUID());
|
||||||
|
government.setChildren(engineerTree);
|
||||||
|
|
||||||
|
return government;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取子节点
|
* 获取子节点
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -1,20 +1,28 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||||
|
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.service.CsDevModelService;
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -29,7 +37,12 @@ import java.util.stream.Collectors;
|
|||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> implements CsLinePOService{
|
public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> implements CsLinePOService{
|
||||||
|
|
||||||
private final CsLedgerMapper csLedgerMapper;
|
private final CsLedgerMapper csLedgerMapper;
|
||||||
|
private final CsDevModelService csDevModelService;
|
||||||
|
private final ICsDataSetService csDataSetService;
|
||||||
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLinePO> getLineByDev(List<String> list) {
|
public List<CsLinePO> getLineByDev(List<String> list) {
|
||||||
@@ -88,6 +101,116 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
return this.lambdaQuery().in(CsLinePO::getDeviceId,list).eq(CsLinePO::getStatus,1).list();
|
return this.lambdaQuery().in(CsLinePO::getDeviceId,list).eq(CsLinePO::getStatus,1).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public CsLinePO addCldLine(CsLineParam param) {
|
||||||
|
String lineId = param.getDevMac().replace(":","") + param.getLineNo();
|
||||||
|
CsLinePO po = new CsLinePO();
|
||||||
|
//1.新增监测点信息
|
||||||
|
BeanUtils.copyProperties(param,po);
|
||||||
|
po.setStatus(1);
|
||||||
|
po.setRunStatus(2);
|
||||||
|
po.setLineId(param.getDevMac().replace(":","") + param.getLineNo());
|
||||||
|
//模板id
|
||||||
|
CsDevModelPO po1 = csDevModelService.getCldModel();
|
||||||
|
po.setDataModelId(po1.getId());
|
||||||
|
//设备id
|
||||||
|
po.setDeviceId(param.getDevId());
|
||||||
|
//数据集id
|
||||||
|
List<CsDataSet> list = csDataSetService.findDataSetByModelId(po1.getId());
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
po.setDataSetId(list.get(0).getId());
|
||||||
|
po.setClDid(list.get(0).getClDev());
|
||||||
|
}
|
||||||
|
//监测位置
|
||||||
|
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||||
|
po.setPosition(data.getId());
|
||||||
|
this.save(po);
|
||||||
|
|
||||||
|
//2.新增台账树信息
|
||||||
|
CsLedger csLedger = new CsLedger();
|
||||||
|
csLedger.setId(lineId);
|
||||||
|
csLedger.setPid(param.getDevId());
|
||||||
|
csLedger.setPids("0," + param.getEngineeringId() + "," + param.getProjectId() + "," + param.getDevId());
|
||||||
|
csLedger.setName(param.getName());
|
||||||
|
csLedger.setLevel(3);
|
||||||
|
csLedger.setState(1);
|
||||||
|
csLedger.setSort(0);
|
||||||
|
csLedgerMapper.insert(csLedger);
|
||||||
|
return po;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void updateCldLine(CsLineParam param) {
|
||||||
|
LambdaQueryWrapper<CsLinePO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsLinePO::getDeviceId,param.getDevId())
|
||||||
|
.ne(CsLinePO::getLineId,param.getLineId())
|
||||||
|
.eq(CsLinePO::getLineNo,param.getLineNo())
|
||||||
|
.eq(CsLinePO::getStatus,1);
|
||||||
|
List<CsLinePO> lineList = this.list(wrapper);
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
throw new BusinessException("监测点线路号重复,请调整!");
|
||||||
|
}
|
||||||
|
LambdaUpdateWrapper<CsLinePO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
lambdaUpdateWrapper.eq(CsLinePO::getLineId,param.getLineId())
|
||||||
|
.eq(CsLinePO::getStatus,1)
|
||||||
|
.set(CsLinePO::getName,param.getName())
|
||||||
|
.set(CsLinePO::getLineNo,param.getLineNo())
|
||||||
|
.set(CsLinePO::getConType,param.getConType())
|
||||||
|
.set(CsLinePO::getLineInterval,param.getLineInterval())
|
||||||
|
.set(CsLinePO::getPtRatio,param.getPtRatio())
|
||||||
|
.set(CsLinePO::getPt2Ratio,param.getPt2Ratio())
|
||||||
|
.set(CsLinePO::getCtRatio,param.getCtRatio())
|
||||||
|
.set(CsLinePO::getCt2Ratio,param.getCt2Ratio())
|
||||||
|
.set(CsLinePO::getVolGrade,param.getVolGrade())
|
||||||
|
.set(CsLinePO::getRunStatus,param.getRunStatus());
|
||||||
|
this.update(lambdaUpdateWrapper);
|
||||||
|
|
||||||
|
//修改台账树中监测点的名称
|
||||||
|
QueryWrapper<CsLedger> queryWrapper = new QueryWrapper();
|
||||||
|
queryWrapper.eq("state",1).eq("id",param.getLineId());
|
||||||
|
CsLedger csLedger = csLedgerMapper.selectOne(queryWrapper);
|
||||||
|
csLedger.setName(param.getName());
|
||||||
|
csLedgerMapper.updateById(csLedger);
|
||||||
|
|
||||||
|
//新增台账日志
|
||||||
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
|
csTerminalLogs.setDeviceId(param.getDevId());
|
||||||
|
csTerminalLogs.setOperateType(1);
|
||||||
|
csTerminalLogs.setIsPush(0);
|
||||||
|
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void deleteCldLine(String id) {
|
||||||
|
CsLinePO po = this.getById(id);
|
||||||
|
|
||||||
|
this.removeById(id);
|
||||||
|
csLedgerMapper.deleteById(id);
|
||||||
|
|
||||||
|
//新增台账日志
|
||||||
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
|
csTerminalLogs.setDeviceId(po.getDeviceId());
|
||||||
|
csTerminalLogs.setOperateType(1);
|
||||||
|
csTerminalLogs.setIsPush(0);
|
||||||
|
csTerminalLogsMapper.insert(csTerminalLogs);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateCldLineStatus(List<CsLinePO> lineList, Integer status) {
|
||||||
|
lineList.forEach(item->{item.setRunStatus(status);});
|
||||||
|
this.updateBatchById(lineList);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLineDataByList(List<String> list, String id, String setId) {
|
||||||
|
LambdaUpdateWrapper<CsLinePO> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.in(CsLinePO::getDeviceId,list).set(CsLinePO::getDataModelId,id).set(CsLinePO::getDataSetId,setId);
|
||||||
|
this.update(updateWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||||
// *
|
// *
|
||||||
|
|||||||
@@ -0,0 +1,287 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||||
|
import com.njcn.csdevice.mapper.CsTerminalReplyMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
|
import com.njcn.csdevice.service.ICsTerminalLogsService;
|
||||||
|
import com.njcn.csdevice.service.INodeService;
|
||||||
|
import com.njcn.mq.message.CldControlMessage;
|
||||||
|
import com.njcn.mq.message.CldUpdateLedgerMessage;
|
||||||
|
import com.njcn.mq.template.CldControlMessageTemplate;
|
||||||
|
import com.njcn.mq.template.CldUpdateLedgerMessageTemplate;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-09-26
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsTerminalLogsServiceImpl extends ServiceImpl<CsTerminalLogsMapper, CsTerminalLogs> implements ICsTerminalLogsService {
|
||||||
|
|
||||||
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
private final INodeService nodeService;
|
||||||
|
private final CldUpdateLedgerMessageTemplate template;
|
||||||
|
private final CldControlMessageTemplate controlMessageTemplate;
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final CsTerminalReplyMapper csTerminalReplyMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLogs(String id, Integer code) {
|
||||||
|
LambdaUpdateWrapper<CsTerminalLogs> wrapper = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper.set(CsTerminalLogs::getIsPush, 0)
|
||||||
|
.eq(CsTerminalLogs::getDeviceId, id);
|
||||||
|
this.update(wrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
|
public String pushCldInfo() {
|
||||||
|
LambdaQueryWrapper<CsTerminalLogs> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsTerminalLogs::getIsPush, 0);
|
||||||
|
List<CsTerminalLogs> list = this.list(wrapper);
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
//新增台账集合
|
||||||
|
List<String> addList = new ArrayList<>();
|
||||||
|
//修改台账集合
|
||||||
|
List<String> updateList = new ArrayList<>();
|
||||||
|
//删除台账集合
|
||||||
|
List<String> deleteList = new ArrayList<>();
|
||||||
|
|
||||||
|
//根据设备分组,判断设备的操作,整合
|
||||||
|
Map<String,List<CsTerminalLogs>> map = list.stream().collect(Collectors.groupingBy(CsTerminalLogs::getDeviceId));
|
||||||
|
map.forEach((k,v)->{
|
||||||
|
List<Integer> operateTypeList = v.stream().map(CsTerminalLogs::getOperateType).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
if (operateTypeList.size() == 3) {
|
||||||
|
//啥也不用干
|
||||||
|
//deleteList.add(k);
|
||||||
|
} else if (operateTypeList.size() == 2 && operateTypeList.contains(0) && operateTypeList.contains(1)) {
|
||||||
|
addList.add(k);
|
||||||
|
} else if (operateTypeList.size() == 2 && operateTypeList.contains(0) && operateTypeList.contains(2)) {
|
||||||
|
//啥也不用干
|
||||||
|
} else if (operateTypeList.size() == 2 && operateTypeList.contains(1) && operateTypeList.contains(2)) {
|
||||||
|
deleteList.add(k);
|
||||||
|
} else if (operateTypeList.size() == 1 && operateTypeList.contains(0)) {
|
||||||
|
addList.add(k);
|
||||||
|
} else if (operateTypeList.size() == 1 && operateTypeList.contains(1)) {
|
||||||
|
updateList.add(k);
|
||||||
|
} else if (operateTypeList.size() == 1 && operateTypeList.contains(2)) {
|
||||||
|
deleteList.add(k);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//整合后 所有设备的id
|
||||||
|
List<String> devList = Stream.of(addList, updateList, deleteList).flatMap(List::stream).collect(Collectors.toList());
|
||||||
|
//获取设备集合
|
||||||
|
List<CsEquipmentDeliveryPO> deviceList = csEquipmentDeliveryService.listByIds(devList);
|
||||||
|
//按照前置机id分组
|
||||||
|
Map<String,List<CsEquipmentDeliveryPO>> nodeMap = deviceList.stream().collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||||
|
nodeMap.forEach((k,v)->{
|
||||||
|
int maxProcessNum = nodeService.getNodeById(k).getMaxProcessNum();
|
||||||
|
//按照进程号分组
|
||||||
|
Map<Integer,List<CsEquipmentDeliveryPO>> nodeProcessMap = v.stream().collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess));
|
||||||
|
nodeProcessMap.forEach((k1,v1)->{
|
||||||
|
if (v1.size() > 10) {
|
||||||
|
//一个进程下修改的设备数量超过10台,重启该进程号下的前置
|
||||||
|
CldControlMessage cldControlMessage = new CldControlMessage();
|
||||||
|
cldControlMessage.setGuid(IdUtil.simpleUUID());
|
||||||
|
cldControlMessage.setCode("set_process");
|
||||||
|
cldControlMessage.setProcessNo(k1);
|
||||||
|
cldControlMessage.setFun("delete");
|
||||||
|
cldControlMessage.setProcessNum(maxProcessNum);
|
||||||
|
controlMessageTemplate.sendMember(cldControlMessage,k);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(addList)) {
|
||||||
|
sendMessage(addList, deviceList, "add_terminal");
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(updateList)) {
|
||||||
|
sendMessage(updateList, deviceList, "ledger_modify");
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(deleteList)) {
|
||||||
|
sendDeleteMessage(deleteList, list, "delete_terminal");
|
||||||
|
}
|
||||||
|
|
||||||
|
//推送完将数据改成推送
|
||||||
|
LambdaUpdateWrapper<CsTerminalLogs> wrapper2 = new LambdaUpdateWrapper<>();
|
||||||
|
wrapper2.set(CsTerminalLogs::getIsPush, 1);
|
||||||
|
this.update(wrapper2);
|
||||||
|
} else {
|
||||||
|
return "暂无需要推送的数据";
|
||||||
|
}
|
||||||
|
return "成功";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateLaterData(String id, String code) {
|
||||||
|
int operateType;
|
||||||
|
if (Objects.equals(code, "add_terminal")) {
|
||||||
|
operateType = 0;
|
||||||
|
} else if (Objects.equals(code, "ledger_modify")) {
|
||||||
|
operateType = 1;
|
||||||
|
} else{
|
||||||
|
operateType = 2;
|
||||||
|
}
|
||||||
|
//找出最新的数据,将状态改为未推送,下次可以再次推送
|
||||||
|
this.lambdaUpdate()
|
||||||
|
.eq(CsTerminalLogs::getDeviceId, id)
|
||||||
|
.eq(CsTerminalLogs::getOperateType, operateType)
|
||||||
|
.orderByDesc(CsTerminalLogs::getCreateTime)
|
||||||
|
.last("LIMIT 1")
|
||||||
|
.set(CsTerminalLogs::getIsPush, 0)
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendMessage(List<String> addList, List<CsEquipmentDeliveryPO> deviceList, String type) {
|
||||||
|
List<CsEquipmentDeliveryPO> filteredList = deviceList.stream().filter(device -> addList.contains(device.getId())).collect(Collectors.toList());
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> lineList = csLinePOService.getLinesByDevList(addList);
|
||||||
|
|
||||||
|
Map<String,List<CsEquipmentDeliveryPO>> nodeMap1 = filteredList.stream().collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeId));
|
||||||
|
nodeMap1.forEach((k,v)->{
|
||||||
|
CldUpdateLedgerMessage message = new CldUpdateLedgerMessage();
|
||||||
|
message.setCode(type);
|
||||||
|
//按照进程号分组
|
||||||
|
Map<Integer,List<CsEquipmentDeliveryPO>> nodeProcessMap1 = v.stream().collect(Collectors.groupingBy(CsEquipmentDeliveryPO::getNodeProcess));
|
||||||
|
for (Map.Entry<Integer, List<CsEquipmentDeliveryPO>> entry : nodeProcessMap1.entrySet()) {
|
||||||
|
Integer k1 = entry.getKey();
|
||||||
|
List<CsEquipmentDeliveryPO> v1 = entry.getValue();
|
||||||
|
String guid = IdUtil.simpleUUID();
|
||||||
|
message.setGuid(guid);
|
||||||
|
message.setProcessNo(String.valueOf(k1));
|
||||||
|
List<CldUpdateLedgerMessage.CldDeviceDto> list1 = new ArrayList<>();
|
||||||
|
v1.forEach(item -> {
|
||||||
|
CldUpdateLedgerMessage.CldDeviceDto deviceDto = new CldUpdateLedgerMessage.CldDeviceDto();
|
||||||
|
deviceDto.setId(item.getId());
|
||||||
|
deviceDto.setNode(item.getNodeProcess());
|
||||||
|
deviceDto.setName(item.getName());
|
||||||
|
deviceDto.setIp(item.getMac());
|
||||||
|
deviceDto.setDevType(dictTreeFeignClient.queryById(item.getDevModel()).getData().getName());
|
||||||
|
Node node = nodeService.getNodeById(item.getNodeId());
|
||||||
|
if (node != null) {
|
||||||
|
deviceDto.setMaxProcessNum(node.getMaxProcessNum());
|
||||||
|
}
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
List<CldUpdateLedgerMessage.CldMonitorDto> list2 = new ArrayList<>();
|
||||||
|
lineList.forEach(item2 -> {
|
||||||
|
if (Objects.equals(item.getId(), item2.getDeviceId())) {
|
||||||
|
CldUpdateLedgerMessage.CldMonitorDto cldLineDto = new CldUpdateLedgerMessage.CldMonitorDto();
|
||||||
|
cldLineDto.setId(item2.getLineId());
|
||||||
|
cldLineDto.setName(item.getName());
|
||||||
|
cldLineDto.setLineNo(String.valueOf(item2.getLineNo()));
|
||||||
|
cldLineDto.setVoltageLevel(item2.getVolGrade() + "kV");
|
||||||
|
cldLineDto.setStatus(item.getRunStatus());
|
||||||
|
cldLineDto.setPtType(String.valueOf(item2.getConType()));
|
||||||
|
cldLineDto.setDeviceId(item2.getDeviceId());
|
||||||
|
cldLineDto.setPt1(item2.getPtRatio());
|
||||||
|
cldLineDto.setPt2(item2.getPt2Ratio());
|
||||||
|
cldLineDto.setCt1(item2.getCtRatio());
|
||||||
|
cldLineDto.setCt2(item2.getCt2Ratio());
|
||||||
|
list2.add(cldLineDto);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
deviceDto.setMonitorData(list2);
|
||||||
|
}
|
||||||
|
list1.add(deviceDto);
|
||||||
|
|
||||||
|
//存储发送的数据记录,用于后面响应校验
|
||||||
|
CsTerminalReply csFmTerminalReply = new CsTerminalReply();
|
||||||
|
csFmTerminalReply.setReplyId(guid);
|
||||||
|
csFmTerminalReply.setCode(type);
|
||||||
|
csFmTerminalReply.setNodeId(k);
|
||||||
|
csFmTerminalReply.setProcessNo(k1);
|
||||||
|
csFmTerminalReply.setDeviceId(item.getId());
|
||||||
|
csFmTerminalReply.setIsReceived(0);
|
||||||
|
csTerminalReplyMapper.insert(csFmTerminalReply);
|
||||||
|
});
|
||||||
|
message.setData(list1);
|
||||||
|
template.sendMember(message, k);
|
||||||
|
|
||||||
|
//缓存本次发送数据GUID的集合,用于查询数据
|
||||||
|
Object object = redisUtil.getObjectByKey(RequestUtil.getUserIndex()+"reply");
|
||||||
|
if (object != null) {
|
||||||
|
String value = object + "," + guid;
|
||||||
|
redisUtil.saveByKeyWithExpire(RequestUtil.getUserIndex()+"reply", value, 60L);
|
||||||
|
} else {
|
||||||
|
redisUtil.saveByKeyWithExpire(RequestUtil.getUserIndex()+"reply", guid, 60L);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void sendDeleteMessage(List<String> list, List<CsTerminalLogs> csTerminalLogs, String type) {
|
||||||
|
List<CsTerminalLogs> filteredList = csTerminalLogs.stream().filter(device -> list.contains(device.getDeviceId()) && Objects.equals(device.getOperateType(),2)).collect(Collectors.toList());
|
||||||
|
Map<String,List<CsTerminalLogs>> nodeMap1 = filteredList.stream().collect(Collectors.groupingBy(CsTerminalLogs::getNodeId));
|
||||||
|
nodeMap1.forEach((k,v)->{
|
||||||
|
CldUpdateLedgerMessage message = new CldUpdateLedgerMessage();
|
||||||
|
message.setCode(type);
|
||||||
|
//按照进程号分组
|
||||||
|
Map<Integer,List<CsTerminalLogs>> nodeProcessMap1 = v.stream().collect(Collectors.groupingBy(CsTerminalLogs::getNodeProcess));
|
||||||
|
nodeProcessMap1.forEach((k1,v1)->{
|
||||||
|
String guid = IdUtil.simpleUUID();
|
||||||
|
message.setGuid(guid);
|
||||||
|
message.setProcessNo(String.valueOf(k1));
|
||||||
|
List<CldUpdateLedgerMessage.CldDeviceDto> list1 = new ArrayList<>();
|
||||||
|
v1.forEach(item->{
|
||||||
|
CldUpdateLedgerMessage.CldDeviceDto deviceDto = new CldUpdateLedgerMessage.CldDeviceDto();
|
||||||
|
deviceDto.setId(item.getDeviceId());
|
||||||
|
deviceDto.setNode(item.getNodeProcess());
|
||||||
|
Node node = nodeService.getNodeById(item.getNodeId());
|
||||||
|
if (node != null) {
|
||||||
|
deviceDto.setMaxProcessNum(node.getMaxProcessNum());
|
||||||
|
}
|
||||||
|
list1.add(deviceDto);
|
||||||
|
|
||||||
|
//存储发送的数据记录,用于后面响应校验
|
||||||
|
CsTerminalReply csFmTerminalReply = new CsTerminalReply();
|
||||||
|
csFmTerminalReply.setReplyId(guid);
|
||||||
|
csFmTerminalReply.setCode(type);
|
||||||
|
csFmTerminalReply.setNodeId(k);
|
||||||
|
csFmTerminalReply.setProcessNo(k1);
|
||||||
|
csFmTerminalReply.setDeviceId(item.getDeviceId());
|
||||||
|
csFmTerminalReply.setIsReceived(0);
|
||||||
|
csTerminalReplyMapper.insert(csFmTerminalReply);
|
||||||
|
});
|
||||||
|
message.setData(list1);
|
||||||
|
template.sendMember(message,k);
|
||||||
|
|
||||||
|
//缓存本次发送数据GUID的集合,用于查询数据
|
||||||
|
Object object = redisUtil.getObjectByKey(RequestUtil.getUserIndex()+"reply");
|
||||||
|
if (object != null) {
|
||||||
|
String value = object + "," + guid;
|
||||||
|
redisUtil.saveByKeyWithExpire(RequestUtil.getUserIndex()+"reply", value, 60L);
|
||||||
|
} else {
|
||||||
|
redisUtil.saveByKeyWithExpire(RequestUtil.getUserIndex()+"reply", guid, 60L);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.mapper.CsTerminalReplyMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsTerminalReply;
|
||||||
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
|
import com.njcn.csdevice.service.ICsTerminalLogsService;
|
||||||
|
import com.njcn.csdevice.service.ICsTerminalReplyService;
|
||||||
|
import com.njcn.csdevice.service.INodeService;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-10-09
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMapper, CsTerminalReply> implements ICsTerminalReplyService {
|
||||||
|
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final INodeService nodeService;
|
||||||
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
private final ICsTerminalLogsService csTerminalLogsService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> queryReplyData() {
|
||||||
|
List<String> result = new ArrayList<>();
|
||||||
|
Object object = redisUtil.getObjectByKey(RequestUtil.getUserIndex()+"reply");
|
||||||
|
if (object != null) {
|
||||||
|
List<String> redisList = Stream.of(object.toString().split(",")).collect(Collectors.toList());
|
||||||
|
List<CsTerminalReply> list = this.lambdaQuery().in(CsTerminalReply::getReplyId,redisList).orderByAsc(CsTerminalReply::getCreateTime).list();
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
Map<Integer,List<CsTerminalReply>> map = list.stream().collect(Collectors.groupingBy(CsTerminalReply::getIsReceived));
|
||||||
|
List<CsTerminalReply> list1 = map.get(1);
|
||||||
|
if (CollectionUtil.isEmpty(list1)) {
|
||||||
|
String key = "更新失败,未收到前置应答,请查看应答报文是否发送";
|
||||||
|
result.add(key);
|
||||||
|
//将cs_terminal_logs数据置为未发送
|
||||||
|
list.forEach(item->{
|
||||||
|
csTerminalLogsService.updateLaterData(item.getDeviceId(),item.getCode());
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
list.forEach(item->{
|
||||||
|
String key;
|
||||||
|
String code;
|
||||||
|
if (Objects.equals(item.getCode(), "add_terminal")) {
|
||||||
|
code = "新增";
|
||||||
|
} else if (Objects.equals(item.getCode(), "ledger_modify")) {
|
||||||
|
code = "修改";
|
||||||
|
} else {
|
||||||
|
code = "删除";
|
||||||
|
}
|
||||||
|
String nodeName = nodeService.getNodeById(item.getNodeId()).getName();
|
||||||
|
List<CsEquipmentDeliveryPO> devList1 = csEquipmentDeliveryService.getAll();
|
||||||
|
List<CsEquipmentDeliveryPO> devList2 = devList1.stream().filter(item1 -> Objects.equals(item1.getId(), item.getDeviceId())).collect(Collectors.toList());
|
||||||
|
List<String> devNameList = devList2.stream().map(CsEquipmentDeliveryPO::getName).collect(Collectors.toList());
|
||||||
|
String devNameListString = devNameList.toString();
|
||||||
|
if (item.getIsReceived() == 0) {
|
||||||
|
key = nodeName + item.getProcessNo() + "号进程下," + devNameListString + code + "数据失败";
|
||||||
|
//将cs_terminal_logs数据置为未发送
|
||||||
|
csTerminalLogsService.updateLaterData(item.getDeviceId(),item.getCode());
|
||||||
|
} else {
|
||||||
|
key = nodeName + item.getProcessNo() + "号进程下," + devNameListString + code + "数据成功";
|
||||||
|
}
|
||||||
|
result.add(key);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateReplyData(String id,Integer state,String deviceId) {
|
||||||
|
this.lambdaUpdate().set(CsTerminalReply::getIsReceived,state)
|
||||||
|
.eq(CsTerminalReply::getDeviceId,deviceId)
|
||||||
|
.eq(CsTerminalReply::getReplyId,id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,366 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.njcn.access.utils.ChannelObjectUtil;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.param.IcdLedgerParam;
|
||||||
|
import com.njcn.csdevice.param.IcdParam;
|
||||||
|
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||||
|
import com.njcn.csdevice.service.*;
|
||||||
|
import com.njcn.mq.message.CldControlMessage;
|
||||||
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class IcdServiceImpl implements IcdService {
|
||||||
|
|
||||||
|
private final INodeService nodeService;
|
||||||
|
private final ChannelObjectUtil channelObjectUtil;
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
|
private final CsEngineeringService csEngineeringService;
|
||||||
|
private final AppProjectService appProjectService;
|
||||||
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
private final ICsLedgerService csLedgerService;
|
||||||
|
private final ICsTerminalLogsService csTerminalLogsService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DeviceInfo> getLedgerInfo(IcdParam param) {
|
||||||
|
//获取装置型号
|
||||||
|
Map<String,SysDicTreePO> sysDicTreeMap = new HashMap<>();
|
||||||
|
List<SysDicTreePO> dictTreeList = channelObjectUtil.objectToList(redisUtil.getObjectByKey(AppRedisKey.DICT_TREE),SysDicTreePO.class);
|
||||||
|
SysDicTreePO po = dictTreeList.stream().filter(item -> Objects.equals(item.getCode(), DicDataEnum.DEV_CLD.getCode())).findFirst().orElse(null);
|
||||||
|
if (ObjectUtil.isNotNull(po)) {
|
||||||
|
String id = po.getId();
|
||||||
|
List<SysDicTreePO> cldDevType = dictTreeList.stream().filter(item->Objects.equals(item.getPid(),id)).collect(Collectors.toList());
|
||||||
|
sysDicTreeMap = cldDevType.stream().collect(Collectors.toMap(SysDicTreePO::getId, Function.identity()));
|
||||||
|
}
|
||||||
|
|
||||||
|
List<DeviceInfo> result = new ArrayList<>();
|
||||||
|
//根据ip获取前置机信息
|
||||||
|
Node node = nodeService.getNodeById(param.getId());
|
||||||
|
if (ObjectUtil.isNotNull(node)) {
|
||||||
|
//根据前置机ip获取装置信息
|
||||||
|
List<CsEquipmentDeliveryPO> poList = csEquipmentDeliveryService.getCldDevByIp(node.getId(),param.getRunFlag());
|
||||||
|
if (CollectionUtil.isNotEmpty(poList)) {
|
||||||
|
//获取监测点集合
|
||||||
|
List<String> devList = poList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
List<CsLinePO> lineList = csLinePOService.getLinesByDevList(devList);
|
||||||
|
Map<String,List<CsLinePO>> lineMap = lineList.stream().collect(Collectors.groupingBy(CsLinePO::getDeviceId));
|
||||||
|
//组装返回结构体
|
||||||
|
Map<String, SysDicTreePO> finalSysDicTreeMap = sysDicTreeMap;
|
||||||
|
poList.forEach(dev->{
|
||||||
|
DeviceInfo detail = new DeviceInfo();
|
||||||
|
detail.setId(dev.getId());
|
||||||
|
detail.setName(dev.getName());
|
||||||
|
detail.setIp(dev.getMac());
|
||||||
|
detail.setDevType(Objects.isNull(finalSysDicTreeMap.get(dev.getDevModel())) ? "/":finalSysDicTreeMap.get(dev.getDevModel()).getCode());
|
||||||
|
detail.setNode(dev.getNodeProcess());
|
||||||
|
detail.setMaxProcessNum(node.getMaxProcessNum());
|
||||||
|
|
||||||
|
// 只获取当前设备的监测点数据
|
||||||
|
List<CsLinePO> lines = lineMap.get(dev.getId());
|
||||||
|
if (CollectionUtil.isNotEmpty(lines)) {
|
||||||
|
List<DeviceInfo.MonitorInfo> monitorInfos = new ArrayList<>();
|
||||||
|
lines.forEach(line->{
|
||||||
|
DeviceInfo.MonitorInfo monitorInfo = new DeviceInfo.MonitorInfo();
|
||||||
|
monitorInfo.setDeviceId(dev.getId());
|
||||||
|
monitorInfo.setId(line.getLineId());
|
||||||
|
monitorInfo.setName(line.getName());
|
||||||
|
monitorInfo.setLineNo(String.valueOf(line.getLineNo()));
|
||||||
|
monitorInfo.setVoltageLevel(line.getVolGrade() + "kV");
|
||||||
|
monitorInfo.setStatus(line.getRunStatus());
|
||||||
|
monitorInfo.setPtType(String.valueOf(line.getConType()));
|
||||||
|
monitorInfo.setPt1(line.getPtRatio());
|
||||||
|
monitorInfo.setPt2(line.getPt2Ratio());
|
||||||
|
monitorInfo.setCt1(line.getCtRatio());
|
||||||
|
monitorInfo.setCt2(line.getCt2Ratio());
|
||||||
|
monitorInfos.add(monitorInfo);
|
||||||
|
});
|
||||||
|
detail.setMonitorData(monitorInfos);
|
||||||
|
}
|
||||||
|
result.add(detail);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void addLedgerInfo(IcdLedgerParam param) {
|
||||||
|
// 第一种:全流程创建
|
||||||
|
if (isAllIndicesNull(param)) {
|
||||||
|
handleFullProcessCreation(param);
|
||||||
|
}
|
||||||
|
// 第二种:从工程创建
|
||||||
|
else if (ObjectUtil.isNotNull(param.getEngineeringIndex())) {
|
||||||
|
handleFromEngineeringCreation(param);
|
||||||
|
}
|
||||||
|
// 第三种:从项目创建
|
||||||
|
else if (ObjectUtil.isNotNull(param.getProjectIndex())) {
|
||||||
|
handleFromProjectCreation(param);
|
||||||
|
}
|
||||||
|
// 第四种:从设备创建
|
||||||
|
else if (ObjectUtil.isNotNull(param.getDevIndex())) {
|
||||||
|
handleFromDeviceCreation(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CldLedgerVo getLedgerById(String id) {
|
||||||
|
CldLedgerVo vo = new CldLedgerVo();
|
||||||
|
CsLedger csLedger = csLedgerService.findDataById(id);
|
||||||
|
if (ObjectUtil.isNull(csLedger)) {
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
Integer level = csLedger.getLevel();
|
||||||
|
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
|
||||||
|
// 设置工程信息(所有级别都需要)
|
||||||
|
setEngineeringInfo(vo, level, pids, id);
|
||||||
|
// 根据级别设置不同的业务数据
|
||||||
|
switch (level) {
|
||||||
|
case 0:
|
||||||
|
handleLevel0(vo, id);
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
handleLevel1(vo, id, pids);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
handleLevel2(vo, id, pids);
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
handleLevel3(vo, id, pids);
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
log.warn("Unknown ledger level: {}", level);
|
||||||
|
}
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void restartProcess(CldControlMessage message) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 设置工程信息
|
||||||
|
*/
|
||||||
|
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id) {
|
||||||
|
String engineeringId;
|
||||||
|
|
||||||
|
if (level == 0) {
|
||||||
|
// 0级本身就是工程
|
||||||
|
engineeringId = id;
|
||||||
|
} else if (level >= 1 && pids.length > 1) {
|
||||||
|
// 1-3级的工程ID在pids[1]位置
|
||||||
|
engineeringId = pids[1];
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
CsEngineeringPO po = csEngineeringService.queryEngineeringById(engineeringId);
|
||||||
|
if (po != null) {
|
||||||
|
vo.setEngineeringId(po.getId());
|
||||||
|
vo.setEngineeringName(po.getName());
|
||||||
|
vo.setProvince(po.getProvince());
|
||||||
|
vo.setCity(po.getCity());
|
||||||
|
vo.setEngineeringDescription(po.getDescription());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理0级数据(工程级别)
|
||||||
|
*/
|
||||||
|
private void handleLevel0(CldLedgerVo vo, String id) {
|
||||||
|
List<AppProjectPO> projectInfoList = appProjectService.getProjectByEngineering(Collections.singletonList(id));
|
||||||
|
vo.setProjectInfoList(projectInfoList);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理1级数据(项目级别)
|
||||||
|
*/
|
||||||
|
private void handleLevel1(CldLedgerVo vo, String id, String[] pids) {
|
||||||
|
// 设置项目信息
|
||||||
|
List<AppProjectPO> appProjectPOS = appProjectService.listByIds(Collections.singletonList(id));
|
||||||
|
vo.setProjectInfoList(appProjectPOS);
|
||||||
|
// 设置设备信息
|
||||||
|
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getDevListByProjectId(id);
|
||||||
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
|
vo.setDeviceInfoList(devList);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理2级数据(设备级别)
|
||||||
|
*/
|
||||||
|
private void handleLevel2(CldLedgerVo vo, String id, String[] pids) {
|
||||||
|
// 设置项目信息(项目ID在pids[2]位置)
|
||||||
|
if (pids.length > 2) {
|
||||||
|
String projectId = pids[2];
|
||||||
|
List<AppProjectPO> project = appProjectService.listByIds(Collections.singletonList(projectId));
|
||||||
|
vo.setProjectInfoList(project);
|
||||||
|
}
|
||||||
|
// 设置设备信息
|
||||||
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(id));
|
||||||
|
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||||
|
// 设置线路信息
|
||||||
|
List<CsLinePO> list = csLinePOService.queryByDevId(id);
|
||||||
|
vo.setLineInfoList(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理3级数据(线路级别)
|
||||||
|
*/
|
||||||
|
private void handleLevel3(CldLedgerVo vo, String id, String[] pids) {
|
||||||
|
// 设置项目信息(项目ID在pids[2]位置)
|
||||||
|
if (pids.length > 2) {
|
||||||
|
String projectId = pids[2];
|
||||||
|
List<AppProjectPO> appProjectPOS = appProjectService.listByIds(Collections.singletonList(projectId));
|
||||||
|
vo.setProjectInfoList(appProjectPOS);
|
||||||
|
}
|
||||||
|
// 设置设备信息(设备ID在pids[3]位置)
|
||||||
|
if (pids.length > 3) {
|
||||||
|
String deviceId = pids[3];
|
||||||
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId));
|
||||||
|
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||||
|
}
|
||||||
|
// 设置线路信息
|
||||||
|
List<CsLinePO> line = csLinePOService.listByIds(Collections.singletonList(id));
|
||||||
|
vo.setLineInfoList(line);
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean isAllIndicesNull(IcdLedgerParam param) {
|
||||||
|
return ObjectUtil.isNull(param.getEngineeringIndex())
|
||||||
|
&& ObjectUtil.isNull(param.getProjectIndex())
|
||||||
|
&& ObjectUtil.isNull(param.getDevIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleFullProcessCreation(@NotNull IcdLedgerParam param) {
|
||||||
|
if (ObjectUtil.isNotNull(param.getEngineering())) {
|
||||||
|
CsEngineeringPO po1 = csEngineeringService.addEngineering(param.getEngineering());
|
||||||
|
param.setEngineeringIndex(po1.getId());
|
||||||
|
createProjectAndDevices(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleFromEngineeringCreation(IcdLedgerParam param) {
|
||||||
|
createProjectAndDevices(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleFromProjectCreation(IcdLedgerParam param) {
|
||||||
|
saveDevicesAndLines(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void handleFromDeviceCreation(IcdLedgerParam param) {
|
||||||
|
saveLines(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void createProjectAndDevices(IcdLedgerParam param) {
|
||||||
|
AppProjectAddParm project = param.getProject();
|
||||||
|
if (ObjectUtil.isNotNull(project)) {
|
||||||
|
project.setEngineeringId(param.getEngineeringIndex());
|
||||||
|
project.setIcdEngineeringId(param.getEngineeringIndex());
|
||||||
|
AppProjectPO po2 = appProjectService.addAppProject(project);
|
||||||
|
param.setProjectIndex(po2.getId());
|
||||||
|
}
|
||||||
|
saveDevicesAndLines(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveDevicesAndLines(IcdLedgerParam param) {
|
||||||
|
List<CsEquipmentDeliveryAddParm> devList = param.getDevice();
|
||||||
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
|
Map<String,String> devMacMap = new HashMap<>();
|
||||||
|
Map<String, CsEquipmentDeliveryPO> devMap = new HashMap<>();
|
||||||
|
for (CsEquipmentDeliveryAddParm dev : devList) {
|
||||||
|
dev.setEngineeringId(param.getEngineeringIndex());
|
||||||
|
dev.setProjectId(param.getProjectIndex());
|
||||||
|
CsEquipmentDeliveryPO po3 = csEquipmentDeliveryService.saveCld(dev);
|
||||||
|
devMacMap.put(dev.getMac(),po3.getId());
|
||||||
|
devMap.put(dev.getMac(),po3);
|
||||||
|
}
|
||||||
|
param.setDevMacMap(devMacMap);
|
||||||
|
param.setDevMap(devMap);
|
||||||
|
}
|
||||||
|
saveLines(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void saveLines(IcdLedgerParam param) {
|
||||||
|
List<CsLinePO> list = new ArrayList<>();
|
||||||
|
List<CsLineParam> lineList = param.getLine();
|
||||||
|
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||||
|
boolean result = checkAndAlertDuplicates(lineList);
|
||||||
|
if (result) {
|
||||||
|
throw new BusinessException("监测点线路号重复,请调整!");
|
||||||
|
}
|
||||||
|
for (CsLineParam line : lineList) {
|
||||||
|
line.setEngineeringId(param.getEngineeringIndex());
|
||||||
|
line.setProjectId(param.getProjectIndex());
|
||||||
|
if (Objects.isNull(param.getDevIndex())) {
|
||||||
|
line.setDevId(param.getDevMacMap().get(line.getDevMac()));
|
||||||
|
} else {
|
||||||
|
LambdaQueryWrapper<CsLinePO> wrapper = new LambdaQueryWrapper<>();
|
||||||
|
wrapper.eq(CsLinePO::getDeviceId,param.getDevIndex()).eq(CsLinePO::getLineNo,line.getLineNo()).eq(CsLinePO::getStatus,1);
|
||||||
|
CsLinePO po4 = csLinePOService.getOne(wrapper);
|
||||||
|
if (ObjectUtil.isNotNull(po4)) {
|
||||||
|
throw new BusinessException("监测点线路号重复,请调整!");
|
||||||
|
}
|
||||||
|
line.setDevId(param.getDevIndex());
|
||||||
|
}
|
||||||
|
CsLinePO po = csLinePOService.addCldLine(line);
|
||||||
|
list.add(po);
|
||||||
|
}
|
||||||
|
|
||||||
|
//新增台账日志
|
||||||
|
CsTerminalLogs csTerminalLogs = new CsTerminalLogs();
|
||||||
|
if (ObjectUtil.isNotNull(param.getDevIndex()) && StringUtil.isNotBlank(param.getDevIndex())) {
|
||||||
|
csTerminalLogs.setDeviceId(param.getDevIndex());
|
||||||
|
} else {
|
||||||
|
csTerminalLogs.setDeviceId(param.getDevMacMap().get(lineList.get(0).getDevMac()));
|
||||||
|
}
|
||||||
|
csTerminalLogs.setOperateType(0);
|
||||||
|
csTerminalLogs.setIsPush(0);
|
||||||
|
csTerminalLogsService.save(csTerminalLogs);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//判断相同设备不能存在相同的线路号监测点
|
||||||
|
public boolean checkAndAlertDuplicates(List<CsLineParam> devices) {
|
||||||
|
// 使用Set来记录已经出现过的devMac+clDid组合
|
||||||
|
Set<String> seenCombinations = new HashSet<>();
|
||||||
|
List<CsLineParam> duplicates = new ArrayList<>();
|
||||||
|
|
||||||
|
for (CsLineParam device : devices) {
|
||||||
|
String combination = device.getDevMac() + "-" + device.getLineNo();
|
||||||
|
if (seenCombinations.contains(combination)) {
|
||||||
|
// 发现重复,添加到重复列表
|
||||||
|
duplicates.add(device);
|
||||||
|
} else {
|
||||||
|
seenCombinations.add(combination);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return !duplicates.isEmpty();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,188 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
|
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.pojo.param.NodeParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
|
import com.njcn.csdevice.pojo.vo.NodeProcessDeviceVo;
|
||||||
|
import com.njcn.csdevice.service.INodeService;
|
||||||
|
import com.njcn.db.constant.DbConstant;
|
||||||
|
import com.njcn.device.biz.enums.DeviceResponseEnum;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.transaction.annotation.Propagation;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @since 2022-01-07
|
||||||
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class NodeServiceImpl extends ServiceImpl<NodeMapper, Node> implements INodeService {
|
||||||
|
|
||||||
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean addNode(NodeParam nodeParam) {
|
||||||
|
checkNode(nodeParam, false);
|
||||||
|
Node node = new Node();
|
||||||
|
BeanUtils.copyProperties(nodeParam, node);
|
||||||
|
node.setState(DataStateEnum.ENABLE.getCode());
|
||||||
|
this.save(node);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateNode(NodeParam.NodeUpdateParam nodeParam) {
|
||||||
|
//修改最大进程时,需要判断,如果进程数减少,需要先将少的进程数下面的测点分配到其他进程下面
|
||||||
|
int count = csEquipmentDeliveryMapper.getListByNodeProcess(nodeParam.getId(),nodeParam.getMaxProcessNum());
|
||||||
|
if (count > 0) {
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.DEV_OLD_DATA);
|
||||||
|
}
|
||||||
|
checkNode(nodeParam, true);
|
||||||
|
Node node = new Node();
|
||||||
|
BeanUtils.copyProperties(nodeParam, node);
|
||||||
|
this.updateById(node);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean delNode(String id) {
|
||||||
|
//删除前置机,如果前置机下有设备,不允许删除
|
||||||
|
int count = csEquipmentDeliveryMapper.getListByNodeProcess(id,null);
|
||||||
|
if (count > 0) {
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.DEV_EXIST_DATA);
|
||||||
|
}
|
||||||
|
return this.removeById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean updateNodeState(String id, Integer state) {
|
||||||
|
Node node = new Node();
|
||||||
|
node.setId(id);
|
||||||
|
node.setState(state);
|
||||||
|
return this.updateById(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<Node> nodeList(NodeParam.NodeQueryParam nodeQueryParam) {
|
||||||
|
QueryWrapper<Node> queryWrapper = new QueryWrapper<>();
|
||||||
|
//查询参数不为空,进行条件填充
|
||||||
|
if (Objects.nonNull(nodeQueryParam)) {
|
||||||
|
if(Objects.nonNull(nodeQueryParam.getNodeGrade()) ){
|
||||||
|
queryWrapper.eq("pq_node.node_grade",nodeQueryParam.getNodeGrade());
|
||||||
|
}
|
||||||
|
if(Objects.nonNull(nodeQueryParam.getSearchState()) ){
|
||||||
|
queryWrapper.eq("pq_node.state",nodeQueryParam.getSearchState());
|
||||||
|
}
|
||||||
|
//模糊值查询
|
||||||
|
if (StrUtil.isNotBlank(nodeQueryParam.getSearchValue())) {
|
||||||
|
//仅提供名称、ip模糊查询
|
||||||
|
queryWrapper.and(param -> param.like("pq_node.name", nodeQueryParam.getSearchValue())
|
||||||
|
.or().like("pq_node.ip", nodeQueryParam.getSearchValue()));
|
||||||
|
}
|
||||||
|
//排序字段不为空
|
||||||
|
if (ObjectUtil.isAllNotEmpty(nodeQueryParam.getSortBy(), nodeQueryParam.getOrderBy())) {
|
||||||
|
queryWrapper.orderBy(true, nodeQueryParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(nodeQueryParam.getSortBy()));
|
||||||
|
} else {
|
||||||
|
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||||
|
queryWrapper.orderBy(true, true, "pq_node.sort");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return this.page(new Page<>(PageFactory.getPageNum(nodeQueryParam), PageFactory.getPageSize(nodeQueryParam)), queryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Node> nodeAllList(){
|
||||||
|
LambdaQueryWrapper<Node> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
nodeLambdaQueryWrapper.eq(Node::getState,DataStateEnum.ENABLE.getCode()).orderByAsc(Node::getState);
|
||||||
|
return this.list(nodeLambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(propagation = Propagation.NOT_SUPPORTED)
|
||||||
|
public Node getNodeById(String id) {
|
||||||
|
return this.getById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Node getNodeByNodeName(String nodeName) {
|
||||||
|
LambdaQueryWrapper<Node> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
nodeLambdaQueryWrapper.eq(Node::getName, nodeName)
|
||||||
|
.eq(Node::getState, DataStateEnum.ENABLE.getCode());
|
||||||
|
return this.baseMapper.selectOne(nodeLambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Node getNodeByIp(String ip) {
|
||||||
|
LambdaQueryWrapper<Node> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
nodeLambdaQueryWrapper.eq(Node::getIp, ip)
|
||||||
|
.eq(Node::getState, DataStateEnum.ENABLE.getCode());
|
||||||
|
return this.baseMapper.selectOne(nodeLambdaQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public NodeProcessDeviceVo getProcessNoAndDeviceById(String id) {
|
||||||
|
NodeProcessDeviceVo nodeProcessDeviceVo = new NodeProcessDeviceVo();
|
||||||
|
Node node = this.getById(id);
|
||||||
|
nodeProcessDeviceVo.setNode(node);
|
||||||
|
List<NodeProcessDeviceVo.ProcessDevice> processDeviceList = new ArrayList<>();
|
||||||
|
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryMapper.getDataByNodeIdAndProcessNo(id,null);
|
||||||
|
for (int i = 1; i <= node.getMaxProcessNum(); i++) {
|
||||||
|
int finalI = i;
|
||||||
|
NodeProcessDeviceVo.ProcessDevice processDevice = new NodeProcessDeviceVo.ProcessDevice();
|
||||||
|
processDevice.setProcessNo(i);
|
||||||
|
processDevice.setDeviceInfoList(devList.stream().filter(dev -> Objects.equals(dev.getNodeProcess(), finalI)).collect(Collectors.toList()));
|
||||||
|
processDeviceList.add(processDevice);
|
||||||
|
}
|
||||||
|
nodeProcessDeviceVo.setProcessDeviceList(processDeviceList);
|
||||||
|
return nodeProcessDeviceVo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验参数,检查是否存在相同编码的字典类型
|
||||||
|
*/
|
||||||
|
private void checkNode(NodeParam nodeParam, boolean isExcludeSelf) {
|
||||||
|
LambdaQueryWrapper<Node> nodeLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
nodeLambdaQueryWrapper
|
||||||
|
.eq(Node::getIp, nodeParam.getIp())
|
||||||
|
.eq(Node::getState, DataStateEnum.ENABLE.getCode());
|
||||||
|
//更新的时候,需排除当前记录
|
||||||
|
if (isExcludeSelf) {
|
||||||
|
if (nodeParam instanceof NodeParam.NodeUpdateParam) {
|
||||||
|
nodeLambdaQueryWrapper.ne(Node::getId, ((NodeParam.NodeUpdateParam) nodeParam).getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
int countByAccount = this.count(nodeLambdaQueryWrapper);
|
||||||
|
//大于等于1个则表示重复
|
||||||
|
if (countByAccount >= 1) {
|
||||||
|
throw new BusinessException(DeviceResponseEnum.NODE_IP_SAME);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
@@ -23,6 +24,7 @@ import java.time.LocalDate;
|
|||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -59,6 +61,10 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
//获取监测点信息
|
//获取监测点信息
|
||||||
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
||||||
csLinePOList.forEach(item->{
|
csLinePOList.forEach(item->{
|
||||||
|
//没有统计间隔就计算下一次监测点
|
||||||
|
if (Objects.isNull(item.getLineInterval())) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
//应收数据
|
//应收数据
|
||||||
int dueCount = 1440 / item.getLineInterval();
|
int dueCount = 1440 / item.getLineInterval();
|
||||||
Integer process = devMap.get(item.getDeviceId()).getProcess();
|
Integer process = devMap.get(item.getDeviceId()).getProcess();
|
||||||
@@ -69,9 +75,15 @@ public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMa
|
|||||||
if (item.getClDid() == 0) {
|
if (item.getClDid() == 0) {
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
}
|
}
|
||||||
//电能质量监测点
|
|
||||||
else {
|
else {
|
||||||
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"pqd_data","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
//云前置监测点
|
||||||
|
if (ObjectUtil.isNotNull(item.getLineNo())) {
|
||||||
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"data_v","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
|
}
|
||||||
|
//治理、无线监测点
|
||||||
|
else {
|
||||||
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"pqd_data","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
data.setLineIndex(item.getLineId());
|
data.setLineIndex(item.getLineId());
|
||||||
|
|||||||
@@ -170,6 +170,8 @@ public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateD
|
|||||||
long differ = DateUtil.between(date, newDate, DateUnit.MINUTE);
|
long differ = DateUtil.between(date, newDate, DateUnit.MINUTE);
|
||||||
if (online.equals(type)) {
|
if (online.equals(type)) {
|
||||||
minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ;
|
minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ;
|
||||||
|
} else {
|
||||||
|
minute = (int) differ;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
List<PqsCommunicateDto> communicateDataOld = pqsCommunicateService.getRawDataEnd(lineParam);
|
List<PqsCommunicateDto> communicateDataOld = pqsCommunicateService.getRawDataEnd(lineParam);
|
||||||
|
|||||||
@@ -1,13 +1,9 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.njcn.csdevice.mapper.*;
|
import com.njcn.csdevice.mapper.*;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
|
||||||
import com.njcn.csdevice.service.CsLinePOService;
|
|
||||||
import com.njcn.csdevice.service.CsMarketDataService;
|
|
||||||
import com.njcn.csdevice.service.RoleEngineerDevService;
|
import com.njcn.csdevice.service.RoleEngineerDevService;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
@@ -16,7 +12,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
@@ -99,7 +94,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())||Objects.equals(role,"bxs_user")){
|
||||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -201,7 +196,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
|||||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())||Objects.equals(role,"bxs_user")){
|
||||||
csLedgerQueryWrapper.clear();
|
csLedgerQueryWrapper.clear();
|
||||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
|||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -23,10 +24,9 @@ import java.util.stream.Stream;
|
|||||||
public class InfluxDbParamUtil {
|
public class InfluxDbParamUtil {
|
||||||
|
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
private final EquipmentFeignClient equipmentFeignClient;
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
/*表名换成了id本方法做转换*/
|
/*表名换成了id本方法做转换*/
|
||||||
public String getTableNameByClassId(String classId){
|
public String getTableNameByClassId(String classId){
|
||||||
@@ -50,6 +50,11 @@ public class InfluxDbParamUtil {
|
|||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryDTOList.get(0).getDevType())){
|
if(DataParam.portableDevType.equals(csEquipmentDeliveryDTOList.get(0).getDevType())){
|
||||||
return finalCsLinePOList.get(0).getClDid()+"";
|
return finalCsLinePOList.get(0).getClDid()+"";
|
||||||
}
|
}
|
||||||
|
//如果是云前置设备,直接返回clDid
|
||||||
|
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryDTOList.get(0).getDevType()).getData().getCode());
|
||||||
|
if(isCLdDevice){
|
||||||
|
// return String.valueOf(finalCsLinePOList.get(0).getLineNo());
|
||||||
|
}
|
||||||
//之后的逻辑还是按照原来的不变
|
//之后的逻辑还是按照原来的不变
|
||||||
String position = csLineFeignClient.getPositionById(lineId).getData();
|
String position = csLineFeignClient.getPositionById(lineId).getData();
|
||||||
if (Objects.isNull(position)){
|
if (Objects.isNull(position)){
|
||||||
|
|||||||
@@ -1,19 +1,32 @@
|
|||||||
package com.njcn;
|
package com.njcn;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
import com.njcn.csdevice.CsDeviceBootApplication;
|
import com.njcn.csdevice.CsDeviceBootApplication;
|
||||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
import com.njcn.csdevice.service.DeviceFtpService;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.service.ICsCommunicateService;
|
import com.njcn.csdevice.service.*;
|
||||||
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
|
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||||
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.RequiredArgsConstructor;
|
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.influxdb.InfluxDB;
|
||||||
|
import org.influxdb.dto.BatchPoints;
|
||||||
|
import org.influxdb.dto.Point;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.junit.runner.RunWith;
|
import org.junit.runner.RunWith;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.boot.test.context.SpringBootTest;
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
import org.springframework.test.context.junit4.SpringRunner;
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
import org.springframework.test.context.web.WebAppConfiguration;
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
@@ -33,6 +46,9 @@ public class AppTest{
|
|||||||
@Autowired
|
@Autowired
|
||||||
private ICsCommunicateService csCommunicateService;
|
private ICsCommunicateService csCommunicateService;
|
||||||
|
|
||||||
|
private final IRStatIntegrityDService statIntegrityDService;
|
||||||
|
private final IRStatOnlineRateDService statOnlineRateDService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rigorous Test :-)
|
* Rigorous Test :-)
|
||||||
@@ -62,15 +78,35 @@ public class AppTest{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void test1() {
|
||||||
|
}
|
||||||
|
|
||||||
@SneakyThrows
|
@SneakyThrows
|
||||||
@Test
|
@Test
|
||||||
public void writeData() {
|
public void writeData() {
|
||||||
PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto();
|
PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto();
|
||||||
pqsCommunicateDto.setTime("2024-01-01 00:00:00");
|
pqsCommunicateDto.setTime("2025-08-04 18:00:00");
|
||||||
pqsCommunicateDto.setDevId("da7aa071bf89864bedea8833133676b7");
|
pqsCommunicateDto.setDevId("da7aa071bf89864bedea8833133676b7");
|
||||||
pqsCommunicateDto.setType(1);
|
pqsCommunicateDto.setType(0);
|
||||||
pqsCommunicateDto.setDescription("通讯连接");
|
pqsCommunicateDto.setDescription("通讯中断");
|
||||||
csCommunicateService.insertion(pqsCommunicateDto);
|
csCommunicateService.insertion(pqsCommunicateDto);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
InfluxDbUtils influxDbUtils = new InfluxDbUtils("admin", "123456", "http://192.168.1.24:8086", "pqsbase_zl", "");
|
||||||
|
Map<String, String> tags = new HashMap<>();
|
||||||
|
tags.put("dev_id","da7aa071bf89864bedea8833133676b7");
|
||||||
|
Map<String,Object> fields = new HashMap<>();
|
||||||
|
fields.put("type",1);
|
||||||
|
fields.put("description","通讯正常");
|
||||||
|
long time = LocalDateTime.parse("2025-08-02 18:00:00", DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||||
|
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||||
|
batchPoints.point(point);
|
||||||
|
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, Collections.singletonList(batchPoints.lineProtocol()));
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,8 +1,13 @@
|
|||||||
package com.njcn;
|
package com.njcn;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.njcn.access.utils.MqttUtil;
|
||||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
import com.njcn.csdevice.service.DeviceFtpService;
|
import com.njcn.csdevice.service.DeviceFtpService;
|
||||||
|
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||||
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
import com.njcn.influx.imapper.EvtDataMapper;
|
import com.njcn.influx.imapper.EvtDataMapper;
|
||||||
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
@@ -12,9 +17,11 @@ import com.njcn.oss.utils.FileStorageUtil;
|
|||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.autoconfigure.gson.GsonAutoConfiguration;
|
||||||
|
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
|
import java.time.LocalDate;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
@@ -33,6 +40,28 @@ public class DownloadFileTest extends BaseJunitTest{
|
|||||||
private PqsCommunicateMapper pqsCommunicateMapper;
|
private PqsCommunicateMapper pqsCommunicateMapper;
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IRStatIntegrityDService statIntegrityDService;
|
||||||
|
@Autowired
|
||||||
|
private IRStatOnlineRateDService statOnlineRateDService;
|
||||||
|
@Autowired
|
||||||
|
private MqttUtil mqttUtil;
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void test() {
|
||||||
|
String nDId = "00B78D016AB5";
|
||||||
|
String clientName = "NJCN-" + nDId.substring(nDId.length() - 6);
|
||||||
|
long startTime = System.currentTimeMillis();
|
||||||
|
for (int i = 0; i < 200; i++) {
|
||||||
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
System.out.println("当前第"+i+"次,结果为:" + mqttClient);
|
||||||
|
}
|
||||||
|
long end = System.currentTimeMillis();
|
||||||
|
System.out.println("时间差==:" + (end - startTime) + "ms");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* inflxudb写入
|
* inflxudb写入
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -17,7 +17,9 @@ public enum CsHarmonicResponseEnum {
|
|||||||
CS_DEVICE_COMMON_ERROR("A00600","治理稳态模块异常"),
|
CS_DEVICE_COMMON_ERROR("A00600","治理稳态模块异常"),
|
||||||
BIND_TARGET_ERROR("A00601","指标参数绑定异常"),
|
BIND_TARGET_ERROR("A00601","指标参数绑定异常"),
|
||||||
MAKE_UP_ERROR("A00602","补招失败"),
|
MAKE_UP_ERROR("A00602","补招失败"),
|
||||||
RECORD_MISSING("A00602","record.bin文件缺失,补召失败")
|
RECORD_MISSING("A00602","record.bin文件缺失,补召失败"),
|
||||||
|
|
||||||
|
EVENT_FILE_NOT_SAME("A00603","cfg、dat文件名称不一致"),
|
||||||
|
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.csharmonic.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class CldEventParam implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String monitorId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点序号")
|
||||||
|
private Integer cpuNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂降触发时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("幅值")
|
||||||
|
private Double amplitude;
|
||||||
|
|
||||||
|
@ApiModelProperty("持续时间")
|
||||||
|
private Double duration;
|
||||||
|
|
||||||
|
@ApiModelProperty("暂态类型 0-未知 1-暂降 2-暂升 3-中断 4-瞬态")
|
||||||
|
private Integer eventType;
|
||||||
|
|
||||||
|
@ApiModelProperty("相别")
|
||||||
|
private String phase;
|
||||||
|
|
||||||
|
@ApiModelProperty("文件路径")
|
||||||
|
private String wavePath;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ import java.util.List;
|
|||||||
@Data
|
@Data
|
||||||
public class ZuTaiDTO {
|
public class ZuTaiDTO {
|
||||||
|
|
||||||
@SerializedName("done_json")
|
@SerializedName("json")
|
||||||
private List<Detail> doneJson;
|
private List<Detail> json;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class Detail{
|
public static class Detail{
|
||||||
@@ -37,12 +37,12 @@ public class ZuTaiDTO {
|
|||||||
private Boolean display;
|
private Boolean display;
|
||||||
|
|
||||||
@SerializedName("lineId")
|
@SerializedName("lineId")
|
||||||
private List<String> lineId;
|
private String lineId;
|
||||||
|
|
||||||
@SerializedName("UID")
|
@SerializedName("UID")
|
||||||
private List<String> uId;
|
private List<String> uId;
|
||||||
|
|
||||||
@SerializedName("UName")
|
@SerializedName("UIDName")
|
||||||
private String target;
|
private String target;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -117,4 +117,10 @@ public class CsEventPO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "persist_time")
|
@TableField(value = "persist_time")
|
||||||
private Double persistTime;
|
private Double persistTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂降幅值
|
||||||
|
*/
|
||||||
|
@TableField(value = "amplitude")
|
||||||
|
private Double amplitude;
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.njcn.csharmonic.pojo.vo;
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.shaded.com.google.gson.annotations.SerializedName;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -31,7 +33,9 @@ public class CsPageVO {
|
|||||||
private String pid;
|
private String pid;
|
||||||
|
|
||||||
@ApiModelProperty(value="前端使用")
|
@ApiModelProperty(value="前端使用")
|
||||||
private String kid;
|
@JsonProperty("kId")
|
||||||
|
private String kId;
|
||||||
|
|
||||||
@ApiModelProperty(value="组态项目名称")
|
@ApiModelProperty(value="组态项目名称")
|
||||||
private String configurationName;
|
private String configurationName;
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,6 @@ public class EventDetailVO {
|
|||||||
@ApiModelProperty("子模块编号")
|
@ApiModelProperty("子模块编号")
|
||||||
private String moduleNo;
|
private String moduleNo;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty("逻辑子设备编码")
|
@ApiModelProperty("逻辑子设备编码")
|
||||||
private Integer clDid;
|
private Integer clDid;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FrontWarnVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("前置id")
|
||||||
|
private String frontId;
|
||||||
|
|
||||||
|
@ApiModelProperty("前置ip")
|
||||||
|
private String frontIp;
|
||||||
|
|
||||||
|
@ApiModelProperty("前置进程号")
|
||||||
|
private Integer processNo;
|
||||||
|
|
||||||
|
@ApiModelProperty("事件发生时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("告警描述")
|
||||||
|
private String tag;
|
||||||
|
|
||||||
|
@ApiModelProperty("告警码")
|
||||||
|
private Integer code;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
|
import com.njcn.csharmonic.param.CldEventParam;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
@@ -42,7 +43,6 @@ public class CsEventController extends BaseController {
|
|||||||
|
|
||||||
private final CsEventPOService csEventPOService;
|
private final CsEventPOService csEventPOService;
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/queryEventList")
|
@PostMapping("/queryEventList")
|
||||||
@ApiOperation("暂降事件列表查询")
|
@ApiOperation("暂降事件列表查询")
|
||||||
@@ -53,7 +53,6 @@ public class CsEventController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/pageQueryByLineId")
|
@PostMapping("/pageQueryByLineId")
|
||||||
@ApiOperation("根据监测点分页查询暂降事件")
|
@ApiOperation("根据监测点分页查询暂降事件")
|
||||||
@@ -121,4 +120,14 @@ public class CsEventController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/addCldEvent")
|
||||||
|
@ApiOperation("新增云前置事件")
|
||||||
|
@ApiImplicitParam(name = "param", value = "事件信息", required = true)
|
||||||
|
public HttpResult<String> addCldEvent(@RequestBody CldEventParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("addCldEvent");
|
||||||
|
csEventPOService.addCldEvent(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,9 +8,11 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
@@ -76,6 +78,16 @@ public class EventUserController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/frontWarnInfo")
|
||||||
|
@ApiOperation("前置告警信息")
|
||||||
|
@ApiImplicitParam(name = "baseParam", value = "基础查询数据", required = true)
|
||||||
|
public HttpResult<Page<CsEventPO>> frontWarnInfo(@RequestBody BaseParam baseParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("frontWarnInfo");
|
||||||
|
Page<CsEventPO> list = csEventUserPOService.getFrontWarnInfo(baseParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/updateStatus")
|
@PostMapping("/updateStatus")
|
||||||
@ApiOperation("已读事件")
|
@ApiOperation("已读事件")
|
||||||
@@ -86,5 +98,4 @@ public class EventUserController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -44,7 +44,6 @@ public class RealDataController extends BaseController {
|
|||||||
public HttpResult<Boolean> getRealData(@RequestParam("lineId") String lineId) {
|
public HttpResult<Boolean> getRealData(@RequestParam("lineId") String lineId) {
|
||||||
String methodDescribe = getMethodDescribe("getRealData");
|
String methodDescribe = getMethodDescribe("getRealData");
|
||||||
boolean result = realDataService.getBaseRealData(lineId);
|
boolean result = realDataService.getBaseRealData(lineId);
|
||||||
redisUtil.saveByKeyWithExpire("rtDataUserId:"+lineId, RequestUtil.getUserIndex(),600L);
|
|
||||||
if (result) {
|
if (result) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
} else {
|
} else {
|
||||||
@@ -69,5 +68,4 @@ public class RealDataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -122,17 +122,15 @@
|
|||||||
select DISTINCT b.id id,
|
select DISTINCT b.id id,
|
||||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
b.device_id deviceId,b.line_id lineId,b.code code,
|
||||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
|
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
<if test="csEventUserQueryPage!=null and (csEventUserQueryPage.type == 0 or csEventUserQueryPage.type == 1 )">
|
||||||
,d.name lineName
|
,d.name lineName
|
||||||
</if>
|
</if>
|
||||||
from cs_event b
|
from cs_event b
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
<if test="csEventUserQueryPage!=null and (csEventUserQueryPage.type == 0 or csEventUserQueryPage.type == 1 )">
|
||||||
inner join cs_equipment_delivery c on b.device_id=c.id inner join cs_line d on d.device_id=b.device_id and d.clDid=b.cl_did
|
inner join cs_line d on d.line_id=b.line_id
|
||||||
</if>
|
</if>
|
||||||
where 1=1
|
where 1=1
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
|
||||||
and b.process=c.process
|
|
||||||
</if>
|
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -1,12 +1,13 @@
|
|||||||
package com.njcn.csharmonic.service;
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
|
import com.njcn.csharmonic.param.CldEventParam;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
@@ -56,4 +57,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
|||||||
|
|
||||||
List<CsEventPO> queryByModelId(DataParam param);
|
List<CsEventPO> queryByModelId(DataParam param);
|
||||||
|
|
||||||
|
void addCldEvent(CldEventParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,13 @@
|
|||||||
package com.njcn.csharmonic.service;
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -29,4 +31,6 @@ public interface CsEventUserPOService extends IService<CsEventUserPO>{
|
|||||||
Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage);
|
Page<EventDetailVO> queryEventpage(CsEventUserQueryPage csEventUserQueryPage);
|
||||||
|
|
||||||
Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage);
|
Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage);
|
||||||
|
|
||||||
|
Page<CsEventPO> getFrontWarnInfo(BaseParam baseParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,5 +16,4 @@ public interface RealDataService {
|
|||||||
* @param lineId
|
* @param lineId
|
||||||
*/
|
*/
|
||||||
boolean getHarmRealData(String lineId,Integer target);
|
boolean getHarmRealData(String lineId,Integer target);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import cn.hutool.core.util.ZipUtil;
|
import cn.hutool.core.util.ZipUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -19,6 +20,7 @@ import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
|||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||||
|
import com.njcn.csharmonic.param.CldEventParam;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.param.DataParam;
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
@@ -33,10 +35,14 @@ import com.njcn.event.file.pojo.bo.WaveDataDetail;
|
|||||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||||
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
import com.njcn.event.file.pojo.enums.WaveFileResponseEnum;
|
||||||
import com.njcn.event.file.utils.WaveUtil;
|
import com.njcn.event.file.utils.WaveUtil;
|
||||||
|
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||||
import com.njcn.influx.service.EvtDataService;
|
import com.njcn.influx.service.EvtDataService;
|
||||||
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
import com.njcn.minioss.config.MinIossProperties;
|
import com.njcn.minioss.config.MinIossProperties;
|
||||||
|
import com.njcn.minioss.util.MinIoUtils;
|
||||||
import com.njcn.oss.constant.GeneralConstant;
|
import com.njcn.oss.constant.GeneralConstant;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.system.api.EleEvtFeignClient;
|
import com.njcn.system.api.EleEvtFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
@@ -47,17 +53,24 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.io.FilenameUtils;
|
import org.apache.commons.io.FilenameUtils;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
import org.influxdb.InfluxDB;
|
||||||
|
import org.influxdb.dto.BatchPoints;
|
||||||
|
import org.influxdb.dto.Point;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
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 javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import java.io.File;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -74,23 +87,17 @@ import java.util.stream.Stream;
|
|||||||
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService {
|
public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO> implements CsEventPOService {
|
||||||
|
|
||||||
private final EvtDataService evtDataService;
|
private final EvtDataService evtDataService;
|
||||||
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
|
|
||||||
private final WaveFileComponent waveFileComponent;
|
private final WaveFileComponent waveFileComponent;
|
||||||
|
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
|
||||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
|
|
||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
|
|
||||||
private final CsEventUserPOService csEventUserPOService;
|
private final CsEventUserPOService csEventUserPOService;
|
||||||
|
|
||||||
private final EleEvtFeignClient eleEvtFeignClient;
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
|
|
||||||
private final WavePicComponent wavePicComponent;
|
private final WavePicComponent wavePicComponent;
|
||||||
private final MinIossProperties minIossProperties;
|
private final MinIossProperties minIossProperties;
|
||||||
|
private final InfluxDbUtils influxDbUtils;
|
||||||
|
private final MinIoUtils minIoUtils;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
public List<EventDetailVO> queryEventList(CsEventUserQueryParam csEventUserQueryParam) {
|
||||||
@@ -245,6 +252,84 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void addCldEvent(CldEventParam param) {
|
||||||
|
//校验是新增时间还是更新文件信息
|
||||||
|
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEventPO::getLineId,param.getMonitorId()).eq(CsEventPO::getStartTime,param.getStartTime());
|
||||||
|
CsEventPO event = this.getOne(lambdaQueryWrapper);
|
||||||
|
if (Objects.isNull(event)) {
|
||||||
|
//首次录入
|
||||||
|
//根据监测点获取装置信息
|
||||||
|
CsLinePO po = csLineFeignClient.getById(param.getMonitorId()).getData();
|
||||||
|
CsEventPO eventPo = new CsEventPO();
|
||||||
|
String uuid = IdUtil.simpleUUID();
|
||||||
|
eventPo.setId(uuid);
|
||||||
|
eventPo.setLineId(param.getMonitorId());
|
||||||
|
eventPo.setDeviceId(po.getDeviceId());
|
||||||
|
LocalDateTime time = LocalDateTime.parse(param.getStartTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_MS_PATTERN));
|
||||||
|
eventPo.setStartTime(time);
|
||||||
|
eventPo.setTag(getTag(param.getEventType()));
|
||||||
|
eventPo.setType(0);
|
||||||
|
eventPo.setClDid(Integer.parseInt(param.getMonitorId().substring(param.getMonitorId().length() - 1)));
|
||||||
|
eventPo.setLevel(2);
|
||||||
|
eventPo.setProcess(4);
|
||||||
|
eventPo.setPersistTime(param.getDuration());
|
||||||
|
eventPo.setAmplitude(param.getAmplitude() * 100);
|
||||||
|
this.baseMapper.insert(eventPo);
|
||||||
|
//influxDB数据录入
|
||||||
|
List<String> records = new ArrayList<String>();
|
||||||
|
Map<String, String> tags = new HashMap<>();
|
||||||
|
tags.put(InfluxDBTableConstant.UUID,uuid);
|
||||||
|
Map<String,Object> fields = new HashMap<>();
|
||||||
|
fields.put("Evt_Param_Phase",param.getPhase());
|
||||||
|
fields.put("Evt_Param_Tm",param.getDuration());
|
||||||
|
fields.put("Evt_Param_VVaDepth",param.getAmplitude() * 100);
|
||||||
|
Point point = influxDbUtils.pointBuilder("evt_data", time.atZone(ZoneId.systemDefault()).toInstant().toEpochMilli()/1000, TimeUnit.SECONDS, tags, fields);
|
||||||
|
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||||
|
batchPoints.point(point);
|
||||||
|
records.add(batchPoints.lineProtocol());
|
||||||
|
if (CollectionUtil.isNotEmpty(records)) {
|
||||||
|
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, records);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (StrUtil.isNotBlank(param.getWavePath())) {
|
||||||
|
//更新文件信息
|
||||||
|
//先校验两份文件的名称是否一致
|
||||||
|
this.lambdaUpdate()
|
||||||
|
.eq(CsEventPO::getLineId,param.getMonitorId())
|
||||||
|
.eq(CsEventPO::getStartTime,param.getStartTime())
|
||||||
|
.set(CsEventPO::getWavePath,param.getWavePath())
|
||||||
|
.update();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTag(Integer type) {
|
||||||
|
String tag;
|
||||||
|
switch (type) {
|
||||||
|
case 1:
|
||||||
|
tag = "Evt_Sys_DipStr";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
tag = "Evt_Sys_SwlStr";
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
tag = "Evt_Sys_IntrStr";
|
||||||
|
break;
|
||||||
|
case 4:
|
||||||
|
tag = "Transient";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
tag = "Un_Know";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return tag;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return WaveDataDTO
|
* @return WaveDataDTO
|
||||||
@@ -264,6 +349,16 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
|
||||||
}
|
}
|
||||||
String cfgPath = waveName.concat(GeneralConstant.CFG), datPath = waveName.concat(GeneralConstant.DAT);
|
String cfgPath = waveName.concat(GeneralConstant.CFG), datPath = waveName.concat(GeneralConstant.DAT);
|
||||||
|
//不同设备,波形文件后缀大小写不一致,针对大小写判断文件是否存在
|
||||||
|
boolean result1 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), cfgPath);
|
||||||
|
if (!result1) {
|
||||||
|
cfgPath = waveName.concat(GeneralConstant.CFG_LOWER);
|
||||||
|
}
|
||||||
|
boolean result2 = minIoUtils.checkFileIsExist(minIossProperties.getBucket(), datPath);
|
||||||
|
if (!result2) {
|
||||||
|
datPath = waveName.concat(GeneralConstant.DAT_LOWER);
|
||||||
|
}
|
||||||
|
|
||||||
System.out.println("波形路径-------------------" + cfgPath);
|
System.out.println("波形路径-------------------" + cfgPath);
|
||||||
try (
|
try (
|
||||||
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
|
||||||
|
|||||||
@@ -1,44 +1,49 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.constant.LogInfo;
|
import com.njcn.common.pojo.constant.LogInfo;
|
||||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
|
import com.njcn.csdevice.api.NodeFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.Node;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||||
|
import com.njcn.csharmonic.mapper.CsEventUserPOMapper;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
|
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import com.njcn.csharmonic.service.CsEventPOService;
|
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||||
import com.njcn.influx.service.EvtDataService;
|
import com.njcn.influx.service.EvtDataService;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EleEvtFeignClient;
|
import com.njcn.system.api.EleEvtFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
|
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import com.njcn.system.pojo.po.EleEvtParm;
|
import com.njcn.system.pojo.po.EleEvtParm;
|
||||||
import com.njcn.user.enums.AppRoleEnum;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
|
||||||
import com.njcn.csharmonic.mapper.CsEventUserPOMapper;
|
|
||||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.util.StringUtils;
|
import org.springframework.util.StringUtils;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -57,6 +62,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
private final EpdFeignClient epdFeignClient;
|
private final EpdFeignClient epdFeignClient;
|
||||||
private final EleEvtFeignClient eleEvtFeignClient;
|
private final EleEvtFeignClient eleEvtFeignClient;
|
||||||
private final CsEventPOMapper csEventPOMapper;
|
private final CsEventPOMapper csEventPOMapper;
|
||||||
|
private final NodeFeignClient nodeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
|
public Integer queryEventCount(CsEventUserQueryParam csEventUserQueryParam) {
|
||||||
@@ -369,8 +375,6 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
@Override
|
@Override
|
||||||
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
|
public Page<EventDetailVO> queryEventPageWeb(CsEventUserQueryPage csEventUserQueryPage) {
|
||||||
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
|
Page<EventDetailVO> returnpage = new Page<> (csEventUserQueryPage.getPageNum ( ), csEventUserQueryPage.getPageSize ( ));
|
||||||
|
|
||||||
|
|
||||||
List<CsLedgerVO> data = csLedgerFeignClient.getDeviceTree().getData();
|
List<CsLedgerVO> data = csLedgerFeignClient.getDeviceTree().getData();
|
||||||
List<String> devIds = new ArrayList<>();
|
List<String> devIds = new ArrayList<>();
|
||||||
data = data.stream().filter(temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceTypeName() )||
|
data = data.stream().filter(temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceTypeName() )||
|
||||||
@@ -384,12 +388,16 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
if(!CollectionUtils.isEmpty(governmentDevTree)){
|
if(!CollectionUtils.isEmpty(governmentDevTree)){
|
||||||
governmentDevTree = governmentDevTree.get(0).getChildren();
|
governmentDevTree = governmentDevTree.get(0).getChildren();
|
||||||
}
|
}
|
||||||
|
List<CsLedgerVO> cldDevTree = data.stream().filter(temp -> Objects.equals(temp.getName(), DataParam.cldDev)).collect(Collectors.toList());
|
||||||
|
if(!CollectionUtils.isEmpty(cldDevTree)){
|
||||||
|
cldDevTree = cldDevTree.get(0).getChildren();
|
||||||
|
}
|
||||||
|
|
||||||
//便携式就1层下边就是设备
|
//便携式就1层下边就是设备
|
||||||
List<String> portableDevIds = portableDevTree.stream().filter(
|
List<String> portableDevIds = portableDevTree.stream().filter(
|
||||||
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
temp -> StringUtils.isEmpty(csEventUserQueryPage.getDeviceId()) ||
|
||||||
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
|
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
|
||||||
).map(CsLedgerVO::getId).collect(Collectors.toList());
|
).map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
List<String> governmentDevIds = governmentDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
||||||
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
||||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||||
@@ -402,16 +410,27 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
).
|
).
|
||||||
map(CsLedgerVO::getId).
|
map(CsLedgerVO::getId).
|
||||||
collect(Collectors.toList());
|
collect(Collectors.toList());
|
||||||
|
List<String> cldDevIds = cldDevTree.stream().filter(temp->StringUtils.isEmpty(csEventUserQueryPage.getEngineeringid())||
|
||||||
|
Objects.equals(temp.getId(), csEventUserQueryPage.getEngineeringid()))
|
||||||
|
.map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||||
|
temp->StringUtils.isEmpty(csEventUserQueryPage.getProjectId())||
|
||||||
|
Objects.equals(temp.getId(), csEventUserQueryPage.getProjectId())
|
||||||
|
).
|
||||||
|
map(CsLedgerVO::getChildren).flatMap(Collection::stream).filter(
|
||||||
|
temp->StringUtils.isEmpty(csEventUserQueryPage.getDeviceId())||
|
||||||
|
Objects.equals(temp.getId(), csEventUserQueryPage.getDeviceId())
|
||||||
|
).
|
||||||
|
map(CsLedgerVO::getId).
|
||||||
|
collect(Collectors.toList());
|
||||||
|
|
||||||
devIds.addAll(portableDevIds);
|
devIds.addAll(portableDevIds);
|
||||||
devIds.addAll(governmentDevIds);
|
devIds.addAll(governmentDevIds);
|
||||||
|
devIds.addAll(cldDevIds);
|
||||||
|
|
||||||
if (CollectionUtils.isEmpty(devIds)){
|
if (CollectionUtils.isEmpty(devIds)){
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
|
returnpage = this.getBaseMapper().queryEventPageWeb(returnpage,csEventUserQueryPage,devIds);
|
||||||
|
|
||||||
returnpage.getRecords().forEach(temp->{
|
returnpage.getRecords().forEach(temp->{
|
||||||
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
|
DevDetailDTO devDetail = csLedgerFeignClient.queryDevDetail(temp.getDeviceId()).getData();
|
||||||
temp.setEquipmentName(devDetail.getEquipmentName());
|
temp.setEquipmentName(devDetail.getEquipmentName());
|
||||||
@@ -420,13 +439,19 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
temp.setEngineeringid(devDetail.getEngineeringid());
|
temp.setEngineeringid(devDetail.getEngineeringid());
|
||||||
temp.setEngineeringName(devDetail.getEngineeringName());
|
temp.setEngineeringName(devDetail.getEngineeringName());
|
||||||
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
||||||
temp.setShowName(ele.getShowName());
|
if (Objects.isNull(ele)) {
|
||||||
temp.setCode(ele.getDefaultValue());
|
temp.setShowName(temp.getTag());
|
||||||
if (temp.getLineId().endsWith("0")) {
|
temp.setCode(temp.getCode());
|
||||||
temp.setModuleNo("模块" + temp.getClDid());
|
} else {
|
||||||
|
temp.setShowName(ele.getShowName());
|
||||||
|
temp.setCode(ele.getDefaultValue());
|
||||||
|
}
|
||||||
|
if (ObjectUtil.isNotNull(temp.getLineId())) {
|
||||||
|
if (temp.getLineId().endsWith("0")) {
|
||||||
|
temp.setModuleNo("模块" + temp.getClDid());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(Objects.equals(csEventUserQueryPage.getType(),"0")){
|
if(Objects.equals(csEventUserQueryPage.getType(),"0")){
|
||||||
|
|
||||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
||||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||||
for (EleEvtParm eleEvtParm : data1) {
|
for (EleEvtParm eleEvtParm : data1) {
|
||||||
@@ -434,32 +459,23 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
||||||
if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
|
if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
|
||||||
continue;
|
continue;
|
||||||
// eventDataSetDTO.setValue(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
|
|
||||||
}
|
}
|
||||||
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
|
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
|
||||||
if (evtData == null) {
|
if (evtData == null) {
|
||||||
eventDataSetDTO.setValue("-");
|
eventDataSetDTO.setValue("-");
|
||||||
}else {
|
}else {
|
||||||
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
|
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
|
||||||
|
|
||||||
}
|
}
|
||||||
// if (Objects.equals(eventDataSetDTO.getName(),"Evt_Param_Position")) {
|
|
||||||
// eventDataSetDTO.setValue(Objects.equals(temp.getLocation(),"grid")?"电网侧":"负载侧");
|
|
||||||
// }
|
|
||||||
eventDataSetDTOS.add(eventDataSetDTO);
|
eventDataSetDTOS.add(eventDataSetDTO);
|
||||||
}
|
}
|
||||||
temp.setDataSet(eventDataSetDTOS);
|
temp.setDataSet(eventDataSetDTOS);
|
||||||
|
|
||||||
List<EventDataSetDTO> evtParamVVaDepth = eventDataSetDTOS.stream().
|
List<EventDataSetDTO> evtParamVVaDepth = eventDataSetDTOS.stream().
|
||||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_VVaDepth")).
|
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_VVaDepth")).
|
||||||
collect(Collectors.toList());
|
collect(Collectors.toList());
|
||||||
|
|
||||||
if(CollectionUtil.isEmpty(evtParamVVaDepth)){
|
if(CollectionUtil.isEmpty(evtParamVVaDepth)){
|
||||||
temp.setEvtParamVVaDepth("-");
|
temp.setEvtParamVVaDepth("-");
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
temp.setEvtParamVVaDepth(evtParamVVaDepth.get(0).getValue()+(Objects.isNull(evtParamVVaDepth.get(0).getUnit())?"":evtParamVVaDepth.get(0).getUnit()));
|
temp.setEvtParamVVaDepth(evtParamVVaDepth.get(0).getValue()+(Objects.isNull(evtParamVVaDepth.get(0).getUnit())?"":evtParamVVaDepth.get(0).getUnit()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EventDataSetDTO> evtParamPosition = eventDataSetDTOS.stream().
|
List<EventDataSetDTO> evtParamPosition = eventDataSetDTOS.stream().
|
||||||
@@ -467,9 +483,7 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
collect(Collectors.toList());
|
collect(Collectors.toList());
|
||||||
if(CollectionUtil.isEmpty(evtParamPosition)){
|
if(CollectionUtil.isEmpty(evtParamPosition)){
|
||||||
temp.setEvtParamPosition("-");
|
temp.setEvtParamPosition("-");
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
//temp.setEvtParamPosition(evtParamPosition.get(0).getValue()+(Objects.isNull(evtParamPosition.get(0).getUnit())?"":evtParamPosition.get(0).getUnit()));
|
|
||||||
temp.setEvtParamPosition(evtParamPosition.get(0).getValue());
|
temp.setEvtParamPosition(evtParamPosition.get(0).getValue());
|
||||||
}
|
}
|
||||||
if (Objects.equals(temp.getEvtParamPosition(),"-")) {
|
if (Objects.equals(temp.getEvtParamPosition(),"-")) {
|
||||||
@@ -483,10 +497,8 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
collect(Collectors.toList());
|
collect(Collectors.toList());
|
||||||
if(CollectionUtil.isEmpty(evtParamTm)){
|
if(CollectionUtil.isEmpty(evtParamTm)){
|
||||||
temp.setEvtParamTm("-");
|
temp.setEvtParamTm("-");
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
temp.setEvtParamTm(evtParamTm.get(0).getValue()+(Objects.isNull(evtParamTm.get(0).getUnit())?"":evtParamTm.get(0).getUnit()));
|
temp.setEvtParamTm(evtParamTm.get(0).getValue()+(Objects.isNull(evtParamTm.get(0).getUnit())?"":evtParamTm.get(0).getUnit()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
|
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
|
||||||
@@ -494,19 +506,44 @@ public class CsEventUserPOServiceImpl extends ServiceImpl<CsEventUserPOMapper, C
|
|||||||
collect(Collectors.toList());
|
collect(Collectors.toList());
|
||||||
if(CollectionUtil.isEmpty(evtParamPhase)){
|
if(CollectionUtil.isEmpty(evtParamPhase)){
|
||||||
temp.setEvtParamPhase("-");
|
temp.setEvtParamPhase("-");
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
temp.setEvtParamPhase(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
|
temp.setEvtParamPhase(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<CsEventPO> getFrontWarnInfo(BaseParam baseParam) {
|
||||||
|
Page<CsEventPO> page = new Page<>(baseParam.getPageNum(), baseParam.getPageSize());
|
||||||
|
List<Node> nodeList = nodeFeignClient.nodeAllList().getData();
|
||||||
|
Map<String, Node> nodeMap = nodeList.stream().collect(Collectors.toMap(Node::getId, Function.identity()));
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||||
|
if (ObjectUtil.isNotNull(baseParam.getSearchValue()) || StringUtil.isNotBlank(baseParam.getSearchValue())) {
|
||||||
|
nodeList = nodeList.stream().filter(item-> item.getName().contains(baseParam.getSearchValue()) || item.getIp().contains(baseParam.getSearchValue())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(nodeList)) {
|
||||||
|
List<String> nodeIds = nodeList.stream().map(Node::getId).collect(Collectors.toList());
|
||||||
|
LambdaQueryWrapper<CsEventPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.in(CsEventPO::getDeviceId, nodeIds)
|
||||||
|
.between(CsEventPO::getStartTime,
|
||||||
|
DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime())).toString(),
|
||||||
|
DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime())).toString())
|
||||||
|
.eq(CsEventPO::getType, 4)
|
||||||
|
.orderByDesc(CsEventPO::getStartTime);
|
||||||
|
page = csEventPOMapper.selectPage(page, queryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<CsEventPO> records = page.getRecords();
|
||||||
|
if (CollUtil.isNotEmpty(records)) {
|
||||||
|
page.getRecords().forEach(item->{
|
||||||
|
//这边将前置名称放进lineId字段;将前置IP放进wavePath字段;进程号使用clDid
|
||||||
|
item.setLineId(nodeMap.get(item.getDeviceId()).getName());
|
||||||
|
item.setWavePath(nodeMap.get(item.getDeviceId()).getIp());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -123,7 +123,7 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
|||||||
CsPageVO csPageVO = new CsPageVO();
|
CsPageVO csPageVO = new CsPageVO();
|
||||||
CsConfigurationPO csConfigurationPO = csConfigurationMapper.selectById(temp.getPid());
|
CsConfigurationPO csConfigurationPO = csConfigurationMapper.selectById(temp.getPid());
|
||||||
BeanUtils.copyProperties(temp, csPageVO);
|
BeanUtils.copyProperties(temp, csPageVO);
|
||||||
csPageVO.setKid(temp.getKId());
|
csPageVO.setKId(temp.getKId());
|
||||||
csPageVO.setConfigurationName(csConfigurationPO.getName());
|
csPageVO.setConfigurationName(csConfigurationPO.getName());
|
||||||
InputStream fileStream = fileStorageUtil.getFileStream(temp.getPath());
|
InputStream fileStream = fileStorageUtil.getFileStream(temp.getPath());
|
||||||
String text = new BufferedReader(
|
String text = new BufferedReader(
|
||||||
|
|||||||
@@ -53,11 +53,13 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Duration;
|
import java.time.Duration;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.time.temporal.ChronoUnit;
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -94,7 +96,7 @@ public class DataServiceImpl implements IDataService {
|
|||||||
public List<RealTimeDataVo> getRealTimeData(DataParam param) {
|
public List<RealTimeDataVo> getRealTimeData(DataParam param) {
|
||||||
List<RealTimeDataVo> result = new ArrayList<>();
|
List<RealTimeDataVo> result = new ArrayList<>();
|
||||||
//获取监测点使用的数据集
|
//获取监测点使用的数据集
|
||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(param.getLineId())).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Collections.singletonList(param.getLineId())).getData();
|
||||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||||
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
||||||
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
||||||
@@ -639,6 +641,23 @@ public class DataServiceImpl implements IDataService {
|
|||||||
|
|
||||||
//数据格式处理
|
//数据格式处理
|
||||||
public List<RealTimeDataVo> channelData(List<RealTimeDataVo> list) {
|
public List<RealTimeDataVo> channelData(List<RealTimeDataVo> list) {
|
||||||
|
AtomicReference<Instant> time = new AtomicReference<>();
|
||||||
|
list.forEach(item->{
|
||||||
|
if (Objects.equals(item.getName(),"Pq_Freq")) {
|
||||||
|
time.set(item.getTime());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
if (Objects.nonNull(time.get())) {
|
||||||
|
list.forEach(item->{
|
||||||
|
if (ObjectUtil.isNotNull(item.getTime()) && item.getTime().isBefore(time.get())) {
|
||||||
|
item.setAvgValue(3.14159);
|
||||||
|
item.setValueA(3.14159);
|
||||||
|
item.setValueB(3.14159);
|
||||||
|
item.setValueC(3.14159);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
List<RealTimeDataVo> result = new ArrayList<>();
|
List<RealTimeDataVo> result = new ArrayList<>();
|
||||||
//将list 排序,并按照排序后的结果进行有序分组
|
//将list 排序,并按照排序后的结果进行有序分组
|
||||||
LinkedHashMap<String, List<RealTimeDataVo>> map = list.stream().sorted(Comparator.comparing(RealTimeDataVo::getSort)).collect(Collectors.groupingBy(RealTimeDataVo::getName, LinkedHashMap::new, Collectors.toList()));
|
LinkedHashMap<String, List<RealTimeDataVo>> map = list.stream().sorted(Comparator.comparing(RealTimeDataVo::getSort)).collect(Collectors.groupingBy(RealTimeDataVo::getName, LinkedHashMap::new, Collectors.toList()));
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user