feat(ledger): 添加缺失台账信息的相关接口
This commit is contained in:
@@ -3,8 +3,7 @@ package com.njcn.csdevice.api;
|
|||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.fallback.CsCommTerminalFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsCommTerminalFeignClientFallbackFactory;
|
||||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -31,4 +30,7 @@ public interface CsCommTerminalFeignClient {
|
|||||||
|
|
||||||
@GetMapping("getPqUserIdsByUser")
|
@GetMapping("getPqUserIdsByUser")
|
||||||
HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId);
|
HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId);
|
||||||
|
|
||||||
|
@PostMapping("/getLedgerByLineId")
|
||||||
|
HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
@@ -71,9 +72,9 @@ public interface CsLineFeignClient {
|
|||||||
@PostMapping("/getOverLimitDataByIds")
|
@PostMapping("/getOverLimitDataByIds")
|
||||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||||
|
|
||||||
@PostMapping("/getLineBySensitiveUser")
|
@PostMapping("/getDevBySensitiveUser")
|
||||||
@ApiOperation("根据敏感用户查询监测点")
|
@ApiOperation("根据敏感用户查询装置")
|
||||||
HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list);
|
HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list);
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -51,6 +52,12 @@ public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(List<String> list) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取所有台账信息异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
@@ -117,7 +118,7 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(List<String> list) {
|
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(List<String> list) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -120,4 +120,19 @@ public class CsEquipmentDeliveryDTO {
|
|||||||
* 设备软件信息id
|
* 设备软件信息id
|
||||||
*/
|
*/
|
||||||
private String softinfoId;
|
private String softinfoId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理方法
|
||||||
|
*/
|
||||||
|
private String governMethod;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 敏感用户id
|
||||||
|
*/
|
||||||
|
private String monitorUser;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 治理类型(稳态:harmonic 暂态:event)
|
||||||
|
*/
|
||||||
|
private String governType;
|
||||||
}
|
}
|
||||||
@@ -34,6 +34,12 @@ public class DevDetailDTO {
|
|||||||
@ApiModelProperty(value = "设备名称")
|
@ApiModelProperty(value = "设备名称")
|
||||||
private String equipmentName;
|
private String equipmentName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测点名称")
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "设备通讯状态")
|
@ApiModelProperty(value = "设备通讯状态")
|
||||||
private Integer runStatus;
|
private Integer runStatus;
|
||||||
|
|
||||||
@@ -43,6 +49,12 @@ public class DevDetailDTO {
|
|||||||
@ApiModelProperty(value = "nDid")
|
@ApiModelProperty(value = "nDid")
|
||||||
private String nDid;
|
private String nDid;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "监测对象")
|
||||||
|
private String objType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备治理方案")
|
||||||
|
private String governType;
|
||||||
|
|
||||||
@ApiModelProperty(value = "监测点id集合")
|
@ApiModelProperty(value = "监测点id集合")
|
||||||
private List<String> lineList;
|
private List<String> lineList;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -176,10 +176,4 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "govern_type")
|
@TableField(value = "govern_type")
|
||||||
private String governType;
|
private String governType;
|
||||||
|
|
||||||
/**
|
|
||||||
* 治理报告文件路径
|
|
||||||
*/
|
|
||||||
@TableField(value = "report_file_path")
|
|
||||||
private String reportFilePath;
|
|
||||||
}
|
}
|
||||||
@@ -127,14 +127,7 @@ public class CsLinePO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "monitor_obj")
|
@TableField(value = "monitor_obj")
|
||||||
private String monitorObj;
|
private String monitorObj;
|
||||||
/**
|
|
||||||
* 是否治理(0:未治理 1:已治理)
|
|
||||||
*/
|
|
||||||
@TableField(value = "is_govern")
|
|
||||||
private Integer govern;
|
|
||||||
|
|
||||||
@TableField(value = "monitor_user")
|
|
||||||
private String monitorUser;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 短路容量
|
* 短路容量
|
||||||
|
|||||||
@@ -106,4 +106,13 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value="所属项目名称")
|
@ApiModelProperty(value="所属项目名称")
|
||||||
private String associatedProjectName;
|
private String associatedProjectName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="治理方法")
|
||||||
|
private String governMethod;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="敏感用户id")
|
||||||
|
private String monitorUser;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="治理类型(稳态:harmonic 暂态:event)")
|
||||||
|
private String governType;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -8,17 +8,25 @@ import java.time.LocalDateTime;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class PqSensitiveUserLineVO {
|
public class PqSensitiveUserLineVO {
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
@ApiModelProperty("治理对象")
|
@ApiModelProperty("治理对象")
|
||||||
private String sensitiveUser;
|
private String sensitiveUser;
|
||||||
@ApiModelProperty("监测点ID")
|
@ApiModelProperty("监测点ID")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
@ApiModelProperty("测点名称")
|
@ApiModelProperty("测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
@ApiModelProperty("是否治理")
|
@ApiModelProperty("治理方案")
|
||||||
private String govern;
|
private String govern;
|
||||||
@ApiModelProperty("电压等级")
|
@ApiModelProperty("电压等级")
|
||||||
private double volGrade;
|
private double volGrade;
|
||||||
@ApiModelProperty("监测类型")
|
@ApiModelProperty("监测位置")
|
||||||
private String position;
|
private String position;
|
||||||
@ApiModelProperty("运行状态")
|
@ApiModelProperty("运行状态")
|
||||||
private String runStatus;
|
private String runStatus;
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ 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.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -14,10 +15,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -94,11 +92,17 @@ public class CsCommTerminalController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点id集合,获取所有台账信息
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLedgerByLineId")
|
||||||
|
@ApiOperation("根据监测点id集合获取所有台账信息")
|
||||||
|
@ApiImplicitParam(name = "list", value = "实体", required = true)
|
||||||
|
public HttpResult<List<DevDetailDTO>> getLedgerByLineId(@RequestBody List<String> list) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLedgerByLineId");
|
||||||
|
List<DevDetailDTO> result = commTerminalService.getLedgerByLineId(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -90,14 +90,14 @@ public class CsLedgerController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
// @OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/objTree")
|
// @PostMapping("/objTree")
|
||||||
@ApiOperation("三层对象用户树")
|
// @ApiOperation("三层对象用户树")
|
||||||
public HttpResult<List<CsLedgerVO>> objTree(){
|
// public HttpResult<List<CsLedgerVO>> objTree(){
|
||||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
// String methodDescribe = getMethodDescribe("getProjectTree");
|
||||||
List<CsLedgerVO> list = csLedgerService.objTree();
|
// List<CsLedgerVO> list = csLedgerService.objTree();
|
||||||
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("/add")
|
@PostMapping("/add")
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||||
@@ -295,11 +296,11 @@ public class CslineController extends BaseController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineBySensitiveUser")
|
@PostMapping("/getDevBySensitiveUser")
|
||||||
@ApiOperation("根据敏感用户查询监测点")
|
@ApiOperation("根据敏感用户查询装置")
|
||||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
public HttpResult<List<CsEquipmentDeliveryPO>> getDevBySensitiveUser(@RequestBody List<String> list) {
|
||||||
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
String methodDescribe = getMethodDescribe("getDevBySensitiveUser");
|
||||||
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
List<CsEquipmentDeliveryPO> result = csLinePOService.getDevBySensitiveUser(list);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csdevice.service;
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -14,4 +15,6 @@ public interface CsCommTerminalService {
|
|||||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||||
|
|
||||||
List<String> commGetDevIds(String userId);
|
List<String> commGetDevIds(String userId);
|
||||||
|
|
||||||
|
List<DevDetailDTO> getLedgerByLineId(List<String> id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||||
@@ -86,7 +87,7 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
|||||||
|
|
||||||
List<CsLinePO> getSimpleLine();
|
List<CsLinePO> getSimpleLine();
|
||||||
|
|
||||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list);
|
||||||
|
|
||||||
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
||||||
boolean uploadReport(MultipartFile file, String lineId);
|
boolean uploadReport(MultipartFile file, String lineId);
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
|||||||
List<CsLedgerVO> getztProjectTree();
|
List<CsLedgerVO> getztProjectTree();
|
||||||
|
|
||||||
|
|
||||||
List<CsLedgerVO> objTree();
|
// List<CsLedgerVO> objTree();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备集合获取项目和工程
|
* 根据设备集合获取项目和工程
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
|||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||||
@@ -21,9 +22,7 @@ import com.njcn.web.utils.RequestUtil;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -70,12 +69,9 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
|||||||
if (CollUtil.isEmpty(devIds)) {
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
List<CsEquipmentDeliveryPO> po = csEquipmentDeliveryService.listByIds(devIds);
|
||||||
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
if (CollUtil.isEmpty(po)) {
|
||||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
result = po.stream().map(CsEquipmentDeliveryPO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
|
||||||
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -126,4 +122,91 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
|||||||
}
|
}
|
||||||
return devIds;
|
return devIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<DevDetailDTO> getLedgerByLineId(List<String> id) {
|
||||||
|
List<DevDetailDTO> result = new ArrayList<>();
|
||||||
|
List<CsLedger> lineLedgers = csLedgerService.listByIds(id);
|
||||||
|
Set<String> equipmentIds = new HashSet<>();
|
||||||
|
Set<String> projectIds = new HashSet<>();
|
||||||
|
Set<String> engineeringIds = new HashSet<>();
|
||||||
|
|
||||||
|
if (CollUtil.isEmpty(lineLedgers)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
for (CsLedger item : lineLedgers) {
|
||||||
|
String pids = item.getPids();
|
||||||
|
if (pids == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] pidArr = pids.split(",");
|
||||||
|
if (pidArr.length < 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
engineeringIds.add(pidArr[1]);
|
||||||
|
projectIds.add(pidArr[2]);
|
||||||
|
equipmentIds.add(pidArr[3]);
|
||||||
|
}
|
||||||
|
|
||||||
|
Map<String, CsLinePO> csLinePoMap = csLinePOMapper.selectBatchIds(id)
|
||||||
|
.stream().collect(Collectors.toMap(CsLinePO::getLineId, item -> item));
|
||||||
|
Map<String, CsLedger> equipmentLedgerMap = csLedgerService.listByIds(equipmentIds)
|
||||||
|
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||||
|
Map<String, CsEquipmentDeliveryPO> equipmentDeliveryMap = csEquipmentDeliveryService.listByIds(equipmentIds)
|
||||||
|
.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||||
|
Map<String, CsLedger> projectLedgerMap = csLedgerService.listByIds(projectIds)
|
||||||
|
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||||
|
Map<String, CsLedger> engineeringLedgerMap = csLedgerService.listByIds(engineeringIds)
|
||||||
|
.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||||
|
|
||||||
|
for (CsLedger item : lineLedgers) {
|
||||||
|
String pids = item.getPids();
|
||||||
|
if (pids == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
String[] pidArr = pids.split(",");
|
||||||
|
if (pidArr.length < 4) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
String engineeringId = pidArr[1];
|
||||||
|
String projectId = pidArr[2];
|
||||||
|
String equipmentId = pidArr[3];
|
||||||
|
|
||||||
|
CsLedger engineeringLedger = engineeringLedgerMap.get(engineeringId);
|
||||||
|
CsLedger projectLedger = projectLedgerMap.get(projectId);
|
||||||
|
CsLedger equipmentLedger = equipmentLedgerMap.get(equipmentId);
|
||||||
|
if (engineeringLedger == null || projectLedger == null || equipmentLedger == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
DevDetailDTO dto = new DevDetailDTO();
|
||||||
|
dto.setEngineeringid(engineeringId);
|
||||||
|
dto.setEngineeringName(engineeringLedger.getName());
|
||||||
|
dto.setProjectId(projectId);
|
||||||
|
dto.setProjectName(projectLedger.getName());
|
||||||
|
dto.setEquipmentId(equipmentId);
|
||||||
|
dto.setEquipmentName(equipmentLedger.getName());
|
||||||
|
dto.setLineId(item.getId());
|
||||||
|
dto.setLineName(item.getName());
|
||||||
|
|
||||||
|
if (Objects.isNull(csLinePoMap.get(item.getId()).getRunStatus())) {
|
||||||
|
CsEquipmentDeliveryPO delivery = equipmentDeliveryMap.get(equipmentId);
|
||||||
|
if (delivery != null) {
|
||||||
|
Integer runStatus = delivery.getRunStatus();
|
||||||
|
if (runStatus == 1) {
|
||||||
|
dto.setRunStatus(2);
|
||||||
|
} else if (runStatus == 2) {
|
||||||
|
dto.setRunStatus(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
dto.setRunStatus(csLinePoMap.get(item.getId()).getRunStatus());
|
||||||
|
}
|
||||||
|
dto.setObjType(csLinePoMap.get(item.getId()).getMonitorObj());
|
||||||
|
dto.setGovernType(equipmentDeliveryMap.get(equipmentId).getGovernType());
|
||||||
|
result.add(dto);
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1337,10 +1337,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
result.put("before", new ArrayList<>());
|
result.put("before", new ArrayList<>());
|
||||||
result.put("after", new ArrayList<>());
|
result.put("after", new ArrayList<>());
|
||||||
String sensitiveUserId = param.getSensitiveUserId();
|
String sensitiveUserId = param.getSensitiveUserId();
|
||||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
List<CsEquipmentDeliveryPO> devList = csLineFeignClient.getDevBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||||
if (CollUtil.isEmpty(linePOList)) {
|
if (CollUtil.isEmpty(devList)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
List<String> devIds = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
List<CsLinePO> linePOList = csLineFeignClient.getLinesByDevList(devIds).getData();
|
||||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||||
|
|||||||
@@ -1057,88 +1057,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
// @Override
|
||||||
public List<CsLedgerVO> objTree() {
|
// public List<CsLedgerVO> objTree() {
|
||||||
List<CsLedgerVO> result = new ArrayList<>();
|
// List<CsLedgerVO> result = new ArrayList<>();
|
||||||
String userId = RequestUtil.getUserIndex();
|
// String userId = RequestUtil.getUserIndex();
|
||||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
// UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||||
List<String> devIds;
|
// List<String> devIds;
|
||||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
// if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||||
devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
// devIds = csEquipmentDeliveryMapper.selectList(null).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
} else {
|
// } else {
|
||||||
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
// LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
// lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
// .and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
// .eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||||
List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
// List<CsDeviceUserPO> devList = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
// devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
}
|
// }
|
||||||
if (CollUtil.isEmpty(devIds)) {
|
// if (CollUtil.isEmpty(devIds)) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
// List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
// .eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||||
if (CollUtil.isEmpty(poList)) {
|
// if (CollUtil.isEmpty(poList)) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
// List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
// List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
//
|
||||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
// List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||||
if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
// if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||||
return result;
|
// return result;
|
||||||
}
|
// }
|
||||||
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
// Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||||
|
//
|
||||||
List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
// List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||||
Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
// Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||||
|
//
|
||||||
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
// List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||||
List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
// List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||||
|
//
|
||||||
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
// List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||||
projectList.forEach(pro->{
|
// projectList.forEach(pro->{
|
||||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||||
csLedgerVO.setId(pro.getId());
|
// csLedgerVO.setId(pro.getId());
|
||||||
csLedgerVO.setPid(pro.getPid());
|
// csLedgerVO.setPid(pro.getPid());
|
||||||
csLedgerVO.setLevel(pro.getLevel());
|
// csLedgerVO.setLevel(pro.getLevel());
|
||||||
csLedgerVO.setName(pro.getName());
|
// csLedgerVO.setName(pro.getName());
|
||||||
|
//
|
||||||
List<CsLedgerVO> temObjList = new ArrayList<>();
|
// List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||||
if(lineMap.containsKey(pro.getId())){
|
// if(lineMap.containsKey(pro.getId())){
|
||||||
List<String> ids = lineMap.get(pro.getId());
|
// List<String> ids = lineMap.get(pro.getId());
|
||||||
List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
// List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||||
if(CollUtil.isNotEmpty(objTemIds)){
|
// if(CollUtil.isNotEmpty(objTemIds)){
|
||||||
objTemIds.forEach(it->{
|
// objTemIds.forEach(it->{
|
||||||
CsLedgerVO inner = new CsLedgerVO();
|
// CsLedgerVO inner = new CsLedgerVO();
|
||||||
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
// inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||||
inner.setId(it);
|
// inner.setId(it);
|
||||||
inner.setLevel(2);
|
// inner.setLevel(2);
|
||||||
temObjList.add(inner);
|
// temObjList.add(inner);
|
||||||
});
|
// });
|
||||||
}
|
// }
|
||||||
}
|
// }
|
||||||
csLedgerVO.setChildren(temObjList);
|
// csLedgerVO.setChildren(temObjList);
|
||||||
realProjectList.add(csLedgerVO);
|
// realProjectList.add(csLedgerVO);
|
||||||
});
|
// });
|
||||||
|
//
|
||||||
List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
// List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||||
List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
// List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||||
|
//
|
||||||
List<CsLedgerVO> realGcList = new ArrayList<>();
|
// List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||||
gcList.forEach(gc->{
|
// gcList.forEach(gc->{
|
||||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
// CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||||
csLedgerVO.setId(gc.getId());
|
// csLedgerVO.setId(gc.getId());
|
||||||
csLedgerVO.setPid(gc.getPid());
|
// csLedgerVO.setPid(gc.getPid());
|
||||||
csLedgerVO.setLevel(gc.getLevel());
|
// csLedgerVO.setLevel(gc.getLevel());
|
||||||
csLedgerVO.setName(gc.getName());
|
// csLedgerVO.setName(gc.getName());
|
||||||
|
//
|
||||||
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
// List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||||
csLedgerVO.setChildren(proList);
|
// csLedgerVO.setChildren(proList);
|
||||||
realGcList.add(csLedgerVO);
|
// realGcList.add(csLedgerVO);
|
||||||
});
|
// });
|
||||||
return realGcList;
|
// return realGcList;
|
||||||
}
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||||
|
|||||||
@@ -10,12 +10,16 @@ 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.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.access.api.CsLineLatestDataFeignClient;
|
||||||
|
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.utils.PubUtils;
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
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.CsLineDTO;
|
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||||
@@ -76,6 +80,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
private final CsHarmonicPlanFeignClient csHarmonicPlanFeignClient;
|
||||||
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
private final CsHarmonicPlanLineFeignClient csHarmonicPlanLineFeignClient;
|
||||||
|
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminal;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -220,9 +226,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
.set(CsLinePO::getShortCircuitCapacity,param.getShortCircuitCapacity())
|
||||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||||
.set(CsLinePO::getGovern,param.getGovern())
|
|
||||||
.set(CsLinePO::getPosition,param.getPosition())
|
.set(CsLinePO::getPosition,param.getPosition())
|
||||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
|
||||||
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||||
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
@@ -322,11 +326,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
public List<CsEquipmentDeliveryPO> getDevBySensitiveUser(List<String> list) {
|
||||||
return this.lambdaQuery()
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
.in(CsLinePO::getMonitorUser,list)
|
lambdaQueryWrapper.in(CsEquipmentDeliveryPO::getMonitorUser,list)
|
||||||
.eq(CsLinePO::getStatus, 1)
|
.ne(CsEquipmentDeliveryPO::getRunStatus, DataStateEnum.DELETED.getCode());
|
||||||
.list();
|
return csEquipmentDeliveryMapper.selectList(lambdaQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -339,10 +343,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
List<CsLinePO> poList = getSimpleLine();
|
List<CsLinePO> poList = getSimpleLine();
|
||||||
// 构建基础查询条件
|
// 构建基础查询条件
|
||||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||||
.eq(CsLinePO::getStatus, 1)
|
.eq(CsLinePO::getStatus, 1);
|
||||||
// 关联敏感用户
|
|
||||||
//.isNotNull(CsLinePO::getMonitorUser)
|
|
||||||
.orderByAsc(CsLinePO::getMonitorUser);
|
|
||||||
// 只有当lineList不为空时才添加in条件
|
// 只有当lineList不为空时才添加in条件
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
@@ -357,6 +358,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
if (CollUtil.isEmpty(records)) {
|
if (CollUtil.isEmpty(records)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
List<String> devIds = records.stream().map(CsLinePO::getDeviceId).distinct().collect(Collectors.toList());
|
||||||
|
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||||
|
Map<String, CsEquipmentDeliveryPO> devMap = devList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||||
|
|
||||||
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||||
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
||||||
@@ -366,23 +370,32 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
||||||
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||||
}
|
}
|
||||||
|
// 最新数据时间
|
||||||
|
List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||||
|
Map<String,CsLineLatestData> lineLatestDataMap = new HashMap<>();
|
||||||
|
if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||||
|
lineLatestDataMap = lineLatestDataList.stream().collect(Collectors.toMap(CsLineLatestData::getLineId, item -> item));
|
||||||
|
}
|
||||||
|
|
||||||
PqSensitiveUserLineVO sensitiveUserLineVO;
|
PqSensitiveUserLineVO sensitiveUserLineVO;
|
||||||
|
|
||||||
|
List<String> lineIds = records.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
|
|
||||||
for (CsLinePO record : records) {
|
for (CsLinePO record : records) {
|
||||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
||||||
|
sensitiveUserLineVO.setEngineeringName(devDetailDTOMap.get(record.getLineId()).getEngineeringName());
|
||||||
|
sensitiveUserLineVO.setProjectName(devDetailDTOMap.get(record.getLineId()).getProjectName());
|
||||||
|
sensitiveUserLineVO.setDevName(devDetailDTOMap.get(record.getLineId()).getEquipmentName());
|
||||||
// 治理对象
|
// 治理对象
|
||||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(record.getMonitorUser(), null));
|
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(devMap.get(record.getDeviceId()).getMonitorUser(), null));
|
||||||
// 测点名称
|
// 测点名称
|
||||||
sensitiveUserLineVO.setLineId(record.getLineId());
|
sensitiveUserLineVO.setLineId(record.getLineId());
|
||||||
sensitiveUserLineVO.setLineName(record.getName());
|
sensitiveUserLineVO.setLineName(record.getName());
|
||||||
// 是否治理
|
// 是否治理
|
||||||
if (ObjectUtil.isNotEmpty(record.getGovern())) {
|
String governMethod = devMap.get(record.getDeviceId()).getGovernMethod();
|
||||||
if (record.getGovern().equals(0)) {
|
sensitiveUserLineVO.setGovern(Objects.isNull(governMethod) ? "未治理" : governMethod);
|
||||||
sensitiveUserLineVO.setGovern("未治理");
|
|
||||||
}
|
|
||||||
if (record.getGovern().equals(1)) {
|
|
||||||
sensitiveUserLineVO.setGovern("已治理");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 监测类型
|
// 监测类型
|
||||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||||
@@ -396,22 +409,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||||
}
|
}
|
||||||
// 运行状态
|
// 运行状态
|
||||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
sensitiveUserLineVO.setRunStatus(String.valueOf(devDetailDTOMap.get(record.getLineId()).getRunStatus()));
|
||||||
//获取设备状态
|
|
||||||
int devRunStatus = csEquipmentDeliveryMapper.selectById(record.getDeviceId()).getRunStatus();
|
|
||||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(devRunStatus));
|
|
||||||
}
|
|
||||||
// 报告文件
|
// 报告文件
|
||||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||||
// 最新数据时间
|
//最新数据时间
|
||||||
// List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
sensitiveUserLineVO.setLatestTime(Objects.isNull(lineLatestDataMap.get(record.getLineId()))? null : lineLatestDataMap.get(record.getLineId()).getTimeId());
|
||||||
// if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
|
||||||
// sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
|
|
||||||
// .filter(item -> item.getLineId().equals(record.getLineId()))
|
|
||||||
// .map(CsLineLatestData::getTimeId)
|
|
||||||
// .max(LocalDateTime::compareTo)
|
|
||||||
// .orElse(null));
|
|
||||||
// }
|
|
||||||
list.add(sensitiveUserLineVO);
|
list.add(sensitiveUserLineVO);
|
||||||
}
|
}
|
||||||
result.setRecords(list);
|
result.setRecords(list);
|
||||||
@@ -459,15 +461,6 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||||
}
|
}
|
||||||
lineDetailDataVO.setLineName(csLinePO.getName());
|
lineDetailDataVO.setLineName(csLinePO.getName());
|
||||||
//Device device = deviceMapper.selectById(devId);
|
|
||||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
|
||||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
|
||||||
//lineDetailDataVO.setIp(device.getIp());
|
|
||||||
//lineDetailDataVO.setLoginTime(device.getLoginTime());
|
|
||||||
//lineDetailDataVO.setDevId(device.getId());
|
|
||||||
//lineDetailDataVO.setBusinessType(dicDataFeignClient.getDicDataById(lineDetail.getBusinessType()).getData().getName());
|
|
||||||
//lineDetailDataVO.setLoadType(dicDataFeignClient.getDicDataById(lineDetail.getLoadType()).getData().getName());
|
|
||||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
|
||||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
||||||
|
|||||||
@@ -15,13 +15,13 @@ public class LimitExtentVO {
|
|||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@ApiModelProperty("越限最大值")
|
@ApiModelProperty("越限最大值")
|
||||||
private float maxValue;
|
private Float maxValue;
|
||||||
|
|
||||||
@ApiModelProperty("国际限值")
|
@ApiModelProperty("国际限值")
|
||||||
private float internationalValue;
|
private Float internationalValue;
|
||||||
|
|
||||||
@ApiModelProperty("越限程度")
|
@ApiModelProperty("越限程度")
|
||||||
private float extent;
|
private Float extent;
|
||||||
|
|
||||||
@ApiModelProperty("发生日期")
|
@ApiModelProperty("发生日期")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
|
||||||
@@ -32,8 +32,24 @@ public class LimitExtentVO {
|
|||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
|
||||||
|
public Float getExtent() {
|
||||||
|
if (internationalValue == null || maxValue == null) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
public float getExtent() {
|
|
||||||
if (internationalValue == 0) {
|
if (internationalValue == 0) {
|
||||||
return 0.00F;
|
return 0.00F;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,12 @@ import lombok.Data;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class MainLineStatLimitRateDetailsVO extends RStatLimitRateDPO {
|
public class MainLineStatLimitRateDetailsVO extends RStatLimitRateDPO {
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,6 +8,14 @@ import java.io.Serializable;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class MainLineVO implements Serializable {
|
public class MainLineVO implements Serializable {
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
@ApiModelProperty("监测点ID")
|
@ApiModelProperty("监测点ID")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
|
|||||||
@@ -8,6 +8,18 @@ import java.time.LocalDate;
|
|||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class TotalLimitStatisticsDetailsVO {
|
public class TotalLimitStatisticsDetailsVO {
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,14 @@ import lombok.EqualsAndHashCode;
|
|||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
@Data
|
@Data
|
||||||
public class TotalLimitStatisticsVO extends TotalLimitTotalStatisticsVO {
|
public class TotalLimitStatisticsVO extends TotalLimitTotalStatisticsVO {
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
@ApiModelProperty("监测点ID")
|
@ApiModelProperty("监测点ID")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
|
|||||||
@@ -17,6 +17,18 @@ public class EventStatisticVO {
|
|||||||
|
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
@ApiModelProperty(value = "名称")
|
@ApiModelProperty(value = "名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|||||||
@@ -15,6 +15,15 @@ import java.time.LocalDateTime;
|
|||||||
@Data
|
@Data
|
||||||
public class F47Curve {
|
public class F47Curve {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "设备名称")
|
||||||
|
private String equipmentName;
|
||||||
|
|
||||||
@ApiModelProperty(name = "eventId", value = "暂降id")
|
@ApiModelProperty(name = "eventId", value = "暂降id")
|
||||||
private String eventId;
|
private String eventId;
|
||||||
|
|
||||||
|
|||||||
@@ -10,15 +10,18 @@ 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.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
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.po.CsLinePO;
|
|
||||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||||
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
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;
|
||||||
@@ -50,6 +53,8 @@ public class PqSensitiveUserController extends BaseController {
|
|||||||
|
|
||||||
private final IPqSensitiveUserService pqSensitiveUserService;
|
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getList")
|
@PostMapping("/getList")
|
||||||
@@ -81,9 +86,10 @@ public class PqSensitiveUserController extends BaseController {
|
|||||||
List<PqSensitiveUser> list;
|
List<PqSensitiveUser> list;
|
||||||
//获取用户监测点
|
//获取用户监测点
|
||||||
List<String> keywordsLineIds = new ArrayList<>();
|
List<String> keywordsLineIds = new ArrayList<>();
|
||||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
List<String> devIds = csCommTerminalFeignClient.getDevIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(devIds)) {
|
||||||
keywordsLineIds = poList.stream().map(CsLinePO::getMonitorUser).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
List<CsEquipmentDeliveryDTO> devList = equipmentFeignClient.queryDeviceById(devIds).getData();
|
||||||
|
keywordsLineIds = devList.stream().map(CsEquipmentDeliveryDTO::getMonitorUser).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
|||||||
@@ -279,9 +279,8 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void getSensitiveUserReport(SensitiveUserReportQueryParam queryParam, HttpServletResponse response) {
|
public void getSensitiveUserReport(SensitiveUserReportQueryParam queryParam, HttpServletResponse response) {
|
||||||
|
String devId = queryParam.getSensitiveUserId();
|
||||||
String sensitiveUserId = queryParam.getSensitiveUserId();
|
List<CsLinePO> linePOList = csLineFeignClient.getLinesByDevList(Collections.singletonList(devId)).getData();
|
||||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
|
||||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||||
@@ -332,17 +331,16 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
indexDataList = new LinkedHashSet<>(indexDataList).stream().sorted(Comparator.comparing(ReportTemplateDataVO::getItemName)).collect(Collectors.toList());
|
indexDataList = new LinkedHashSet<>(indexDataList).stream().sorted(Comparator.comparing(ReportTemplateDataVO::getItemName)).collect(Collectors.toList());
|
||||||
Map<String, List<ReportTemplateDataVO>> classMap = indexDataList.stream().collect(Collectors.groupingBy(ReportTemplateDataVO::getResourceId));
|
Map<String, List<ReportTemplateDataVO>> classMap = indexDataList.stream().collect(Collectors.groupingBy(ReportTemplateDataVO::getResourceId));
|
||||||
//定义存放指标的map
|
//定义存放指标的map
|
||||||
if (gridSideLine != null) {
|
|
||||||
lineName2 = gridSideLine.getName();
|
|
||||||
List<ReportTemplateDataVO> afterDataList = fetchDataList(gridSideLine, classMap, queryParam);
|
|
||||||
afterFinalDataList.addAll(afterDataList);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (loadSideLine != null) {
|
if (loadSideLine != null) {
|
||||||
lineName1 = loadSideLine.getName();
|
lineName1 = loadSideLine.getName();
|
||||||
List<ReportTemplateDataVO> beforeDataList = fetchDataList(loadSideLine, classMap, queryParam);
|
List<ReportTemplateDataVO> beforeDataList = fetchDataList(loadSideLine, classMap, queryParam);
|
||||||
beforeFinalDataList.addAll(beforeDataList);
|
beforeFinalDataList.addAll(beforeDataList);
|
||||||
}
|
}
|
||||||
|
if (gridSideLine != null) {
|
||||||
|
lineName2 = gridSideLine.getName();
|
||||||
|
List<ReportTemplateDataVO> afterDataList = fetchDataList(gridSideLine, classMap, queryParam);
|
||||||
|
afterFinalDataList.addAll(afterDataList);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//进行反向赋值到模板
|
//进行反向赋值到模板
|
||||||
//1、根据itemName分组
|
//1、根据itemName分组
|
||||||
@@ -2241,18 +2239,19 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
//根据接线方式获取模板id
|
//根据接线方式获取模板id
|
||||||
int conType = po.getConType();
|
int conType = po.getConType();
|
||||||
DictData dicData;
|
DictData dicData;
|
||||||
//角型
|
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR.getCode()).getData();
|
||||||
if (conType == 1) {
|
// //角型
|
||||||
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR_TRIANGLE.getCode()).getData();
|
// if (conType == 1) {
|
||||||
}
|
// dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR_TRIANGLE.getCode()).getData();
|
||||||
//v型
|
// }
|
||||||
else if (conType == 2){
|
// //v型
|
||||||
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.OPEN_DELTA.getCode()).getData();
|
// else if (conType == 2){
|
||||||
}
|
// dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.OPEN_DELTA.getCode()).getData();
|
||||||
//星型 或 其他
|
// }
|
||||||
else {
|
// //星型 或 其他
|
||||||
dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR.getCode()).getData();
|
// else {
|
||||||
}
|
// dicData = dicDataFeignClient.getDicDataByCode(DicDataEnum.STAR.getCode()).getData();
|
||||||
|
// }
|
||||||
String tempId;
|
String tempId;
|
||||||
Optional<ReportTemplateVO> vo = result.stream().filter(item -> Objects.equals(dicData.getId(),item.getWiringMethod())).findFirst();
|
Optional<ReportTemplateVO> vo = result.stream().filter(item -> Objects.equals(dicData.getId(),item.getWiringMethod())).findFirst();
|
||||||
if (vo.isPresent()) {
|
if (vo.isPresent()) {
|
||||||
|
|||||||
@@ -10,10 +10,11 @@ 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.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
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.po.CsLinePO;
|
|
||||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||||
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||||
@@ -22,6 +23,7 @@ import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
|||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -46,6 +48,7 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
|||||||
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 CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PqSensitiveUserVo> getList(BaseParam param) {
|
public Page<PqSensitiveUserVo> getList(BaseParam param) {
|
||||||
@@ -58,21 +61,28 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
|||||||
Page<PqSensitiveUser> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),lambdaQueryWrapper);
|
Page<PqSensitiveUser> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),lambdaQueryWrapper);
|
||||||
if(CollUtil.isNotEmpty(page.getRecords())){
|
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||||
List<PqSensitiveUserVo> dataGroupEventVOList = new ArrayList<>();
|
List<PqSensitiveUserVo> dataGroupEventVOList = new ArrayList<>();
|
||||||
Map<String,List<CsLinePO>> map = new HashMap<>();
|
Map<String,List<CsEquipmentDeliveryPO>> map = new HashMap<>();
|
||||||
//获取绑定敏感用户的监测点信息
|
//获取绑定敏感用户的监测点信息
|
||||||
List<String> sensitiveUserIds = page.getRecords().stream().map(PqSensitiveUser::getId).collect(Collectors.toList());
|
List<String> sensitiveUserIds = page.getRecords().stream().map(PqSensitiveUser::getId).collect(Collectors.toList());
|
||||||
List<CsLinePO> csLinePOList = csLineFeignClient.getLineBySensitiveUser(sensitiveUserIds).getData();
|
List<CsEquipmentDeliveryPO> devList = csLineFeignClient.getDevBySensitiveUser(sensitiveUserIds).getData();
|
||||||
if (CollUtil.isNotEmpty(csLinePOList)) {
|
if (CollUtil.isNotEmpty(devList)) {
|
||||||
map = csLinePOList.stream().collect(Collectors.groupingBy(CsLinePO::getMonitorUser));
|
map = devList.stream()
|
||||||
|
.filter(po -> po.getMonitorUser() != null)
|
||||||
|
.sorted(Comparator.comparing(CsEquipmentDeliveryPO::getMonitorUser))
|
||||||
|
.collect(Collectors.groupingBy(
|
||||||
|
CsEquipmentDeliveryPO::getMonitorUser,
|
||||||
|
LinkedHashMap::new,
|
||||||
|
Collectors.toList()
|
||||||
|
));
|
||||||
}
|
}
|
||||||
Map<String, List<CsLinePO>> finalMap = map;
|
Map<String, List<CsEquipmentDeliveryPO>> finalMap = map;
|
||||||
page.getRecords().forEach(item->{
|
page.getRecords().forEach(item->{
|
||||||
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
||||||
BeanUtil.copyProperties(item,vo);
|
BeanUtil.copyProperties(item,vo);
|
||||||
if (finalMap.containsKey(item.getId())) {
|
if (finalMap.containsKey(item.getId())) {
|
||||||
vo.setIsMonitor("是");
|
vo.setIsMonitor("是");
|
||||||
List<CsLinePO> list = finalMap.get(item.getId());
|
List<CsEquipmentDeliveryPO> list = finalMap.get(item.getId());
|
||||||
boolean hasGoverned = list.stream().anyMatch(item2 -> item2.getGovern() == 1);
|
boolean hasGoverned = list.stream().anyMatch(item2 -> !Objects.isNull(item2.getGovernMethod()));
|
||||||
vo.setIsGovern(hasGoverned ? "是" : "否");
|
vo.setIsGovern(hasGoverned ? "是" : "否");
|
||||||
} else {
|
} else {
|
||||||
vo.setIsMonitor("否");
|
vo.setIsMonitor("否");
|
||||||
@@ -92,11 +102,15 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
|||||||
@Override
|
@Override
|
||||||
public List<PqSensitiveUserVo> getListByUser(BaseParam param) {
|
public List<PqSensitiveUserVo> getListByUser(BaseParam param) {
|
||||||
List<PqSensitiveUserVo> result = new ArrayList<>();
|
List<PqSensitiveUserVo> result = new ArrayList<>();
|
||||||
//现根据用户获取监测点
|
//现根据用户获取设备
|
||||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
List<String> devIds = csCommTerminalFeignClient.getDevIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||||
|
if (CollUtil.isEmpty(devIds)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
List<CsEquipmentDeliveryDTO> devList = equipmentFeignClient.queryDeviceById(devIds).getData();
|
||||||
//获取敏感用户集合
|
//获取敏感用户集合
|
||||||
List<String> monitorUsers = poList.stream()
|
List<String> monitorUsers = devList.stream()
|
||||||
.map(CsLinePO::getMonitorUser)
|
.map(CsEquipmentDeliveryDTO::getMonitorUser)
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
@@ -104,9 +118,9 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
//根据敏感用户进行监测点分组
|
//根据敏感用户进行监测点分组
|
||||||
Map<String,List<CsLinePO>> map = poList.stream()
|
Map<String,List<CsEquipmentDeliveryDTO>> map = devList.stream()
|
||||||
.filter(po -> po.getMonitorUser() != null)
|
.filter(po -> po.getMonitorUser() != null)
|
||||||
.collect(Collectors.groupingBy(CsLinePO::getMonitorUser));
|
.collect(Collectors.groupingBy(CsEquipmentDeliveryDTO::getMonitorUser));
|
||||||
//查询敏感用户信息集合
|
//查询敏感用户信息集合
|
||||||
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.in(PqSensitiveUser::getId,monitorUsers).orderByAsc(PqSensitiveUser::getSort);
|
lambdaQueryWrapper.in(PqSensitiveUser::getId,monitorUsers).orderByAsc(PqSensitiveUser::getSort);
|
||||||
@@ -119,8 +133,8 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
|||||||
BeanUtil.copyProperties(item,vo);
|
BeanUtil.copyProperties(item,vo);
|
||||||
if (map.containsKey(item.getId())) {
|
if (map.containsKey(item.getId())) {
|
||||||
vo.setIsMonitor("是");
|
vo.setIsMonitor("是");
|
||||||
List<CsLinePO> list = map.get(item.getId());
|
List<CsEquipmentDeliveryDTO> list = map.get(item.getId());
|
||||||
boolean hasGoverned = list.stream().anyMatch(item2 -> item2.getGovern() == 1);
|
boolean hasGoverned = list.stream().anyMatch(item2 -> !Objects.isNull(item2.getGovernMethod()));
|
||||||
vo.setIsGovern(hasGoverned ? "是" : "否");
|
vo.setIsGovern(hasGoverned ? "是" : "否");
|
||||||
} else {
|
} else {
|
||||||
vo.setIsMonitor("否");
|
vo.setIsMonitor("否");
|
||||||
|
|||||||
@@ -12,7 +12,10 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|||||||
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.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csharmonic.mapper.RStatLimitRateDMapper;
|
import com.njcn.csharmonic.mapper.RStatLimitRateDMapper;
|
||||||
import com.njcn.csharmonic.pojo.param.MainLineQueryParam;
|
import com.njcn.csharmonic.pojo.param.MainLineQueryParam;
|
||||||
@@ -48,9 +51,11 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
|||||||
|
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||||
|
|
||||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminal;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<RStatLimitRateDPO> monitorIdsGetLimitRateInfo(String date, List<String> monitorIds) {
|
public List<RStatLimitRateDPO> monitorIdsGetLimitRateInfo(String date, List<String> monitorIds) {
|
||||||
@@ -185,27 +190,22 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
|||||||
}
|
}
|
||||||
List<MainLineVO> list = new ArrayList<>();
|
List<MainLineVO> list = new ArrayList<>();
|
||||||
MainLineVO mainLineVO;
|
MainLineVO mainLineVO;
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminalFeignClient.getLedgerByLineId(keywordsLineIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
for (RStatLimitRateDPO record : records) {
|
for (RStatLimitRateDPO record : records) {
|
||||||
String lineId = record.getLineId();
|
String lineId = record.getLineId();
|
||||||
CsLinePO linePO = csLineFeignClient.getById(lineId).getData();
|
|
||||||
mainLineVO = new MainLineVO();
|
mainLineVO = new MainLineVO();
|
||||||
mainLineVO.setLineId(lineId);
|
mainLineVO.setLineId(lineId);
|
||||||
if (linePO != null) {
|
mainLineVO.setEngineeringName(devDetailDTOMap.get(lineId).getEngineeringName());
|
||||||
mainLineVO.setLineName(linePO.getName());
|
mainLineVO.setProjectName(devDetailDTOMap.get(lineId).getProjectName());
|
||||||
if (ObjectUtil.isNotNull(linePO.getGovern())) {
|
mainLineVO.setDevName(devDetailDTOMap.get(lineId).getEquipmentName());
|
||||||
if (linePO.getGovern().equals(0)) {
|
mainLineVO.setLineName(devDetailDTOMap.get(lineId).getLineName());
|
||||||
mainLineVO.setGovern("未治理");
|
mainLineVO.setGovern(Objects.isNull(devDetailDTOMap.get(lineId).getGovernType()) ? "未治理" : devDetailDTOMap.get(lineId).getGovernType());
|
||||||
}
|
mainLineVO.setObjType(devDetailDTOMap.get(lineId).getObjType());
|
||||||
if (linePO.getGovern().equals(1)) {
|
if (ObjectUtil.isNotNull(devDetailDTOMap.get(lineId).getObjType())) {
|
||||||
mainLineVO.setGovern("已治理");
|
DictData dictData = dicDataFeignClient.getDicDataById(devDetailDTOMap.get(lineId).getObjType()).getData();
|
||||||
}
|
if (dictData != null) {
|
||||||
}
|
mainLineVO.setObjType(dictData.getName());
|
||||||
mainLineVO.setObjType(linePO.getMonitorObj());
|
|
||||||
if (ObjectUtil.isNotNull(linePO.getMonitorObj())) {
|
|
||||||
DictData dictData = dicDataFeignClient.getDicDataById(linePO.getMonitorObj()).getData();
|
|
||||||
if (dictData != null) {
|
|
||||||
mainLineVO.setObjType(dictData.getName());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MainLineStatLimitRateDetailsQueryParam detailsQueryParam = new MainLineStatLimitRateDetailsQueryParam();
|
MainLineStatLimitRateDetailsQueryParam detailsQueryParam = new MainLineStatLimitRateDetailsQueryParam();
|
||||||
@@ -363,9 +363,16 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
|||||||
if (CollUtil.isEmpty(linePOList)) {
|
if (CollUtil.isEmpty(linePOList)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(keywordsLineIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
|
|
||||||
TotalLimitStatisticsVO statisticsVO;
|
TotalLimitStatisticsVO statisticsVO;
|
||||||
for (CsLinePO linePO : linePOList) {
|
for (CsLinePO linePO : linePOList) {
|
||||||
statisticsVO = new TotalLimitStatisticsVO();
|
statisticsVO = new TotalLimitStatisticsVO();
|
||||||
|
statisticsVO.setEngineeringName(devDetailDTOMap.get(linePO.getLineId()).getEngineeringName());
|
||||||
|
statisticsVO.setProjectName(devDetailDTOMap.get(linePO.getLineId()).getProjectName());
|
||||||
|
statisticsVO.setDevName(devDetailDTOMap.get(linePO.getLineId()).getEquipmentName() );
|
||||||
statisticsVO.setLineId(linePO.getLineId());
|
statisticsVO.setLineId(linePO.getLineId());
|
||||||
statisticsVO.setLineName(linePO.getName());
|
statisticsVO.setLineName(linePO.getName());
|
||||||
List<RStatLimitRateDPO> lineRateList = lineMap.get(linePO.getLineId());
|
List<RStatLimitRateDPO> lineRateList = lineMap.get(linePO.getLineId());
|
||||||
@@ -433,8 +440,15 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
|||||||
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDPO::getTime, param.getSearchEndTime())
|
.le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDPO::getTime, param.getSearchEndTime())
|
||||||
.orderByAsc(RStatLimitRateDPO::getTime)
|
.orderByAsc(RStatLimitRateDPO::getTime)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(Collections.singletonList(param.getLineId())).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
|
|
||||||
return list.stream().map(item -> {
|
return list.stream().map(item -> {
|
||||||
MainLineStatLimitRateDetailsVO vo = BeanUtil.copyProperties(item, MainLineStatLimitRateDetailsVO.class);
|
MainLineStatLimitRateDetailsVO vo = BeanUtil.copyProperties(item, MainLineStatLimitRateDetailsVO.class);
|
||||||
|
vo.setEngineeringName(devDetailDTOMap.get(param.getLineId()).getEngineeringName());
|
||||||
|
vo.setProjectName(devDetailDTOMap.get(param.getLineId()).getProjectName());
|
||||||
|
vo.setDevName(devDetailDTOMap.get(param.getLineId()).getEquipmentName());
|
||||||
vo.setLineName(linePO.getName());
|
vo.setLineName(linePO.getName());
|
||||||
Integer allTime = item.getAllTime();
|
Integer allTime = item.getAllTime();
|
||||||
Integer flickerTime = item.getFlickerAllTime();
|
Integer flickerTime = item.getFlickerAllTime();
|
||||||
@@ -549,8 +563,15 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
TotalLimitStatisticsVO statisticsVO;
|
TotalLimitStatisticsVO statisticsVO;
|
||||||
|
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
|
|
||||||
for (CsLinePO linePO : lineList) {
|
for (CsLinePO linePO : lineList) {
|
||||||
statisticsVO = new TotalLimitStatisticsVO();
|
statisticsVO = new TotalLimitStatisticsVO();
|
||||||
|
statisticsVO.setEngineeringName(devDetailDTOMap.get(linePO.getLineId()).getEngineeringName());
|
||||||
|
statisticsVO.setProjectName(devDetailDTOMap.get(linePO.getLineId()).getProjectName());
|
||||||
|
statisticsVO.setDevName(devDetailDTOMap.get(linePO.getLineId()).getEquipmentName());
|
||||||
statisticsVO.setLineId(linePO.getLineId());
|
statisticsVO.setLineId(linePO.getLineId());
|
||||||
statisticsVO.setLineName(linePO.getName());
|
statisticsVO.setLineName(linePO.getName());
|
||||||
List<RStatLimitRateDPO> lineRateList = lineMap.get(linePO.getLineId());
|
List<RStatLimitRateDPO> lineRateList = lineMap.get(linePO.getLineId());
|
||||||
|
|||||||
@@ -12,8 +12,10 @@ import com.baomidou.dynamic.datasource.annotation.DS;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
import com.njcn.csdevice.api.CsOverLimitClient;
|
import com.njcn.csdevice.api.CsOverLimitClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csharmonic.mapper.RStatLimitRateDetailDMapper;
|
import com.njcn.csharmonic.mapper.RStatLimitRateDetailDMapper;
|
||||||
import com.njcn.csharmonic.pojo.param.LimitCalendarQueryParam;
|
import com.njcn.csharmonic.pojo.param.LimitCalendarQueryParam;
|
||||||
@@ -28,8 +30,10 @@ import com.njcn.csharmonic.pojo.vo.LimitTimeProbabilityVO;
|
|||||||
import com.njcn.csharmonic.service.IRStatLimitRateDetailDService;
|
import com.njcn.csharmonic.service.IRStatLimitRateDetailDService;
|
||||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
@@ -45,7 +49,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
|
|
||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
private final CsOverLimitClient overLimitClient;
|
private final CsOverLimitClient overLimitClient;
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminal;
|
||||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||||
|
|
||||||
static Map<String, String> indexMap = new HashMap<>();
|
static Map<String, String> indexMap = new HashMap<>();
|
||||||
@@ -109,59 +113,37 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
if (CollUtil.isNotEmpty(detailList)) {
|
if (CollUtil.isNotEmpty(detailList)) {
|
||||||
List<String> lineIds = detailList.stream().map(RStatLimitRateDetailDPO::getLineId).distinct().collect(Collectors.toList());
|
List<String> lineIds = detailList.stream().map(RStatLimitRateDetailDPO::getLineId).distinct().collect(Collectors.toList());
|
||||||
List<Overlimit> overlimitList = overLimitClient.getOverLimitByLineIds(lineIds).getData();
|
List<Overlimit> overlimitList = overLimitClient.getOverLimitByLineIds(lineIds).getData();
|
||||||
|
Map<String, Overlimit> overLimitMap = overlimitList.stream().collect(Collectors.toMap(Overlimit::getId, item -> item));
|
||||||
|
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
|
|
||||||
Map<String, Pair<Float, RStatLimitRateDetailDPO>> findResult = findMaxValueHandle(detailList);
|
Map<String, Pair<Float, RStatLimitRateDetailDPO>> findResult = findMaxValueHandle(detailList);
|
||||||
// 闪变
|
// 闪变
|
||||||
Pair<Float, RStatLimitRateDetailDPO> flickerResult = findResult.get(flicker.getCode());
|
Pair<Float, RStatLimitRateDetailDPO> flickerResult = findResult.get(flicker.getCode());
|
||||||
setLimitExtentInfo(flicker, flickerResult);
|
setLimitExtentInfo(flicker, flickerResult, devDetailDTOMap);
|
||||||
// 电压偏差
|
// 电压偏差
|
||||||
Pair<Float, RStatLimitRateDetailDPO> voltageDevResult = findResult.get(voltageDev.getCode());
|
Pair<Float, RStatLimitRateDetailDPO> voltageDevResult = findResult.get(voltageDev.getCode());
|
||||||
setLimitExtentInfo(voltageDev, voltageDevResult);
|
setLimitExtentInfo(voltageDev, voltageDevResult, devDetailDTOMap);
|
||||||
// 谐波电压
|
// 谐波电压
|
||||||
String uharmKey = findResult.keySet().stream().filter(code -> code.startsWith("uharm")).findFirst().orElse("uharm");
|
String uharmKey = findResult.keySet().stream().filter(code -> code.startsWith("uharm")).findFirst().orElse("uharm");
|
||||||
Pair<Float, RStatLimitRateDetailDPO> uharmResult = findResult.get(uharmKey);
|
Pair<Float, RStatLimitRateDetailDPO> uharmResult = findResult.get(uharmKey);
|
||||||
setLimitExtentInfo(uharm, uharmResult);
|
setLimitExtentInfo(uharm, uharmResult, devDetailDTOMap);
|
||||||
uharm.setCode(uharmKey);
|
uharm.setCode(uharmKey);
|
||||||
String iharmKey = findResult.keySet().stream().filter(code -> code.startsWith("iharm")).findFirst().orElse("iharm");
|
String iharmKey = findResult.keySet().stream().filter(code -> code.startsWith("iharm")).findFirst().orElse("iharm");
|
||||||
// 谐波电流
|
// 谐波电流
|
||||||
Pair<Float, RStatLimitRateDetailDPO> iharmResult = findResult.get(iharmKey);
|
Pair<Float, RStatLimitRateDetailDPO> iharmResult = findResult.get(iharmKey);
|
||||||
setLimitExtentInfo(iharm, iharmResult);
|
setLimitExtentInfo(iharm, iharmResult, devDetailDTOMap);
|
||||||
iharm.setCode(iharmKey);
|
iharm.setCode(iharmKey);
|
||||||
// 电压三相不平衡
|
// 电压三相不平衡
|
||||||
Pair<Float, RStatLimitRateDetailDPO> ubalanceResult = findResult.get(ubalance.getCode());
|
Pair<Float, RStatLimitRateDetailDPO> ubalanceResult = findResult.get(ubalance.getCode());
|
||||||
setLimitExtentInfo(ubalance, ubalanceResult);
|
setLimitExtentInfo(ubalance, ubalanceResult, devDetailDTOMap);
|
||||||
|
|
||||||
if (CollUtil.isNotEmpty(overlimitList)) {
|
setInternationalValue(flicker, flicker.getLineId(), null, overLimitMap, "getFlicker");
|
||||||
// 取所有监测点中的最大闪变限值,作为闪变国际限值
|
setInternationalValue(uharm, uharm.getLineId(), uharm.getCode(), overLimitMap, null);
|
||||||
float flickerMaxOverlimit = (float) overlimitList.stream().mapToDouble(Overlimit::getFlicker).max().orElse(0.0F);
|
setInternationalValue(iharm, iharm.getLineId(), iharm.getCode(), overLimitMap, null);
|
||||||
float voltageDevMaxOverlimit = (float) overlimitList.stream().mapToDouble(Overlimit::getVoltageDev).max().orElse(0.0F);
|
setInternationalValue(voltageDev, voltageDev.getLineId(), null, overLimitMap, "getVoltageDev");
|
||||||
float ubalanceMaxOverlimit = (float) overlimitList.stream().mapToDouble(Overlimit::getUbalance).max().orElse(0.0F);
|
setInternationalValue(ubalance, ubalance.getLineId(), null, overLimitMap, "getUbalance");
|
||||||
float iharmMaxOverlimit = 0.0F;
|
|
||||||
float uharmMaxOverlimit = 0.0F;
|
|
||||||
for (Overlimit overlimit : overlimitList) {
|
|
||||||
JSONObject entries = JSONUtil.parseObj(overlimit);
|
|
||||||
for (Map.Entry<String, Object> entry : entries.entrySet()) {
|
|
||||||
String key = entry.getKey();
|
|
||||||
if (key.startsWith("uharm")) {
|
|
||||||
Object value = entry.getValue();
|
|
||||||
if (value instanceof Number) {
|
|
||||||
uharmMaxOverlimit = Math.max(uharmMaxOverlimit, ((Number) value).floatValue());
|
|
||||||
}
|
|
||||||
} else if (key.startsWith("iharm")) {
|
|
||||||
Object value = entry.getValue();
|
|
||||||
if (value instanceof Number) {
|
|
||||||
iharmMaxOverlimit = Math.max(iharmMaxOverlimit, ((Number) value).floatValue());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
flicker.setInternationalValue(flickerMaxOverlimit);
|
|
||||||
voltageDev.setInternationalValue(voltageDevMaxOverlimit);
|
|
||||||
ubalance.setInternationalValue(ubalanceMaxOverlimit);
|
|
||||||
iharm.setInternationalValue(iharmMaxOverlimit);
|
|
||||||
uharm.setInternationalValue(uharmMaxOverlimit);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
result.add(flicker);
|
result.add(flicker);
|
||||||
result.add(uharm);
|
result.add(uharm);
|
||||||
@@ -171,6 +153,63 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通用属性值设置方法
|
||||||
|
* @param entity 目标实体对象 (如 flicker, uharm)
|
||||||
|
* @param lineId 线路ID (用于从 Map 中获取数据)
|
||||||
|
* @param code 动态属性编码 (可为 null,若为 null 则使用固定 getterName)
|
||||||
|
* @param overLimitMap 数据源 Map
|
||||||
|
* @param fixedGetter 当 code 为 null 时,指定的固定 Getter 方法名 (如 "getFlicker")
|
||||||
|
*/
|
||||||
|
private void setInternationalValue(Object entity, String lineId, String code,
|
||||||
|
Map<String, Overlimit> overLimitMap, String fixedGetter) {
|
||||||
|
if (Objects.isNull(lineId)) {
|
||||||
|
// 通过反射统一处理实体的setter
|
||||||
|
invokeSetter(entity, "setMaxValue", null);
|
||||||
|
invokeSetter(entity, "setInternationalValue", null);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
Object mapValue = overLimitMap.get(lineId);
|
||||||
|
if (mapValue == null) return;
|
||||||
|
|
||||||
|
try {
|
||||||
|
Object result;
|
||||||
|
if (StringUtils.isNotBlank(code)) {
|
||||||
|
// 1. 动态反射模式:根据 code 截取前缀并拼接 Getter
|
||||||
|
String propertyName = StringUtils.substringBefore(code, "Overtime");
|
||||||
|
String methodName = "get" + StringUtils.capitalize(propertyName);
|
||||||
|
Method method = mapValue.getClass().getMethod(methodName);
|
||||||
|
result = method.invoke(mapValue);
|
||||||
|
} else {
|
||||||
|
// 2. 固定 Getter 模式:直接调用传入的固定方法名
|
||||||
|
Method method = mapValue.getClass().getMethod(fixedGetter);
|
||||||
|
result = method.invoke(mapValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 将获取到的值设置到实体中
|
||||||
|
invokeSetter(entity, "setInternationalValue", result);
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("反射获取或设置属性失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void invokeSetter(Object target, String methodName, Object value) {
|
||||||
|
try {
|
||||||
|
Class<?>[] paramTypes = (value != null) ? new Class[]{value.getClass()} : new Class[0];
|
||||||
|
// 如果 value 是 Float,可能需要匹配 float.class 或包装类,这里简化处理
|
||||||
|
for (Method m : target.getClass().getMethods()) {
|
||||||
|
if (m.getName().equals(methodName) && m.getParameterCount() == 1) {
|
||||||
|
m.invoke(target, value);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("调用 setter 失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public JSONArray limitExtentDayData(LimitExtentDayQueryParam param) {
|
public JSONArray limitExtentDayData(LimitExtentDayQueryParam param) {
|
||||||
List<RStatLimitRateDetailDPO> records = this.page(new Page<>(1, 1),
|
List<RStatLimitRateDetailDPO> records = this.page(new Page<>(1, 1),
|
||||||
@@ -245,7 +284,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
if (StrUtil.isNotBlank(description) && !items.contains(description)) {
|
if (StrUtil.isNotBlank(description) && !items.contains(description)) {
|
||||||
items.add(description);
|
items.add(description);
|
||||||
}
|
}
|
||||||
float maxValue = parseMaxValueFromJsonArray(data);
|
float maxValue = parseMaxValueFromJsonArray(data,null,null);
|
||||||
if (overlimit != null) {
|
if (overlimit != null) {
|
||||||
JSONObject overlimitJSON = JSONUtil.parseObj(overlimit);
|
JSONObject overlimitJSON = JSONUtil.parseObj(overlimit);
|
||||||
String itemKey = StrUtil.sub(key, 0, key.length() - 8);
|
String itemKey = StrUtil.sub(key, 0, key.length() - 8);
|
||||||
@@ -531,17 +570,17 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
/**
|
/**
|
||||||
* 设置LimitExtentVO的最大值和相关信息
|
* 设置LimitExtentVO的最大值和相关信息
|
||||||
*/
|
*/
|
||||||
private void setLimitExtentInfo(LimitExtentVO limitExtentVO, Pair<Float, RStatLimitRateDetailDPO> result) {
|
private void setLimitExtentInfo(LimitExtentVO limitExtentVO, Pair<Float, RStatLimitRateDetailDPO> result, Map<String, DevDetailDTO> devDetailDTOMap) {
|
||||||
float maxValue = result.getKey();
|
float maxValue = result.getKey();
|
||||||
limitExtentVO.setMaxValue(maxValue);
|
limitExtentVO.setMaxValue(maxValue);
|
||||||
RStatLimitRateDetailDPO maxDetail = result.getValue();
|
RStatLimitRateDetailDPO maxDetail = result.getValue();
|
||||||
if (maxDetail != null) {
|
if (maxDetail != null) {
|
||||||
limitExtentVO.setTime(maxDetail.getTime());
|
limitExtentVO.setTime(maxDetail.getTime());
|
||||||
CsLinePO maxLinePO = csLineFeignClient.getById(maxDetail.getLineId()).getData();
|
limitExtentVO.setEngineeringName(devDetailDTOMap.get(maxDetail.getLineId()).getEngineeringName());
|
||||||
if (maxLinePO != null) {
|
limitExtentVO.setProjectName(devDetailDTOMap.get(maxDetail.getLineId()).getProjectName());
|
||||||
limitExtentVO.setLineName(maxLinePO.getName());
|
limitExtentVO.setDevName(devDetailDTOMap.get(maxDetail.getLineId()).getEquipmentName());
|
||||||
limitExtentVO.setLineId(maxLinePO.getLineId());
|
limitExtentVO.setLineName(devDetailDTOMap.get(maxDetail.getLineId()).getLineName());
|
||||||
}
|
limitExtentVO.setLineId(devDetailDTOMap.get(maxDetail.getLineId()).getLineId());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -589,35 +628,35 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
String freqDevOvertime = po.getFreqDevOvertime();
|
String freqDevOvertime = po.getFreqDevOvertime();
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(flickerOvertime)) {
|
if (StrUtil.isNotBlank(flickerOvertime)) {
|
||||||
float dayFlickerMaxValue = parseMaxValueFromJsonArray(flickerOvertime);
|
float dayFlickerMaxValue = parseMaxValueFromJsonArray(flickerOvertime,0.0,20.0);
|
||||||
if (dayFlickerMaxValue > flickerMaxValue) {
|
if (dayFlickerMaxValue > flickerMaxValue) {
|
||||||
flickerMaxValue = dayFlickerMaxValue;
|
flickerMaxValue = dayFlickerMaxValue;
|
||||||
flickerMaxDetail = po;
|
flickerMaxDetail = po;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(voltageDevOvertime)) {
|
if (StrUtil.isNotBlank(voltageDevOvertime)) {
|
||||||
float dayVoltageDevMaxValue = parseMaxValueFromJsonArray(voltageDevOvertime);
|
float dayVoltageDevMaxValue = parseMaxValueFromJsonArray(voltageDevOvertime,-20.0,20.0);
|
||||||
if (dayVoltageDevMaxValue > voltageDevMaxValue) {
|
if (dayVoltageDevMaxValue > voltageDevMaxValue) {
|
||||||
voltageDevMaxValue = dayVoltageDevMaxValue;
|
voltageDevMaxValue = dayVoltageDevMaxValue;
|
||||||
voltageDevMaxDetail = po;
|
voltageDevMaxDetail = po;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(ubalanceOvertime)) {
|
if (StrUtil.isNotBlank(ubalanceOvertime)) {
|
||||||
float dayUbalanceMaxValue = parseMaxValueFromJsonArray(ubalanceOvertime);
|
float dayUbalanceMaxValue = parseMaxValueFromJsonArray(ubalanceOvertime,0.0,40.0);
|
||||||
if (dayUbalanceMaxValue > ubalanceMaxValue) {
|
if (dayUbalanceMaxValue > ubalanceMaxValue) {
|
||||||
ubalanceMaxValue = dayUbalanceMaxValue;
|
ubalanceMaxValue = dayUbalanceMaxValue;
|
||||||
ubalanceMaxDetail = po;
|
ubalanceMaxDetail = po;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(uaberranceOvertime)) {
|
if (StrUtil.isNotBlank(uaberranceOvertime)) {
|
||||||
float dayuaberranceMaxValue = parseMaxValueFromJsonArray(uaberranceOvertime);
|
float dayuaberranceMaxValue = parseMaxValueFromJsonArray(uaberranceOvertime,0.0,30.0);
|
||||||
if (dayuaberranceMaxValue > uaberranceMaxValue) {
|
if (dayuaberranceMaxValue > uaberranceMaxValue) {
|
||||||
uaberranceMaxValue = dayuaberranceMaxValue;
|
uaberranceMaxValue = dayuaberranceMaxValue;
|
||||||
uaberranceMaxDetail = po;
|
uaberranceMaxDetail = po;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (StrUtil.isNotBlank(freqDevOvertime)) {
|
if (StrUtil.isNotBlank(freqDevOvertime)) {
|
||||||
float dayFreqDevMaxValue = parseMaxValueFromJsonArray(freqDevOvertime);
|
float dayFreqDevMaxValue = parseMaxValueFromJsonArray(freqDevOvertime,-7.5,7.5);
|
||||||
if (dayFreqDevMaxValue > freqDevMaxValue) {
|
if (dayFreqDevMaxValue > freqDevMaxValue) {
|
||||||
freqDevMaxValue = dayFreqDevMaxValue;
|
freqDevMaxValue = dayFreqDevMaxValue;
|
||||||
freqDevMaxDetail = po;
|
freqDevMaxDetail = po;
|
||||||
@@ -640,7 +679,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
if (key.startsWith("uharm")) {
|
if (key.startsWith("uharm")) {
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
if (ObjectUtil.isNotEmpty(value)) {
|
if (ObjectUtil.isNotEmpty(value)) {
|
||||||
float timeMaxValue = parseMaxValueFromJsonArray(value);
|
float timeMaxValue = parseMaxValueFromJsonArray(value,0.0,30.0);
|
||||||
// 取次数最大的未当天的最大值
|
// 取次数最大的未当天的最大值
|
||||||
dayUharmMaxValue = Math.max(dayUharmMaxValue, timeMaxValue);
|
dayUharmMaxValue = Math.max(dayUharmMaxValue, timeMaxValue);
|
||||||
dayUharmMaxKey = key;
|
dayUharmMaxKey = key;
|
||||||
@@ -649,7 +688,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
if (key.startsWith("iharm")) {
|
if (key.startsWith("iharm")) {
|
||||||
Object value = entry.getValue();
|
Object value = entry.getValue();
|
||||||
if (ObjectUtil.isNotEmpty(value)) {
|
if (ObjectUtil.isNotEmpty(value)) {
|
||||||
float timeMaxValue = parseMaxValueFromJsonArray(value);
|
float timeMaxValue = parseMaxValueFromJsonArray(value,null,null);
|
||||||
// 取次数最大的为当天的最大值
|
// 取次数最大的为当天的最大值
|
||||||
dayIharmMaxValue = Math.max(dayIharmMaxValue, timeMaxValue);
|
dayIharmMaxValue = Math.max(dayIharmMaxValue, timeMaxValue);
|
||||||
dayIharmMaxKey = key;
|
dayIharmMaxKey = key;
|
||||||
@@ -687,7 +726,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
* @param value JSON数组字符串
|
* @param value JSON数组字符串
|
||||||
* @return 解析出的最大值
|
* @return 解析出的最大值
|
||||||
*/
|
*/
|
||||||
private float parseMaxValueFromJsonArray(Object value) {
|
private float parseMaxValueFromJsonArray(Object value, Double minRange, Double maxRange) {
|
||||||
JSONArray overtimeArray = JSONUtil.parseArray(value);
|
JSONArray overtimeArray = JSONUtil.parseArray(value);
|
||||||
float maxValue = 0.0000F;
|
float maxValue = 0.0000F;
|
||||||
for (Object data : overtimeArray) {
|
for (Object data : overtimeArray) {
|
||||||
@@ -696,11 +735,16 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
float currentValue = (float) StrUtil.split(values, StrUtil.COMMA)
|
float currentValue = (float) StrUtil.split(values, StrUtil.COMMA)
|
||||||
.stream()
|
.stream()
|
||||||
.mapToDouble(Float::parseFloat)
|
.mapToDouble(Float::parseFloat)
|
||||||
|
// 核心修改:在 filter 中判断边界是否为 null
|
||||||
|
.filter(f ->
|
||||||
|
(minRange == null || f >= minRange) &&
|
||||||
|
(maxRange == null || f <= maxRange)
|
||||||
|
)
|
||||||
.max()
|
.max()
|
||||||
.orElse(0.0000F);
|
.orElse(0.0000F);
|
||||||
|
|
||||||
maxValue = Math.max(maxValue, currentValue);
|
maxValue = Math.max(maxValue, currentValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
return maxValue;
|
return maxValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csharmonic.enums.CsEventEnum;
|
import com.njcn.csharmonic.enums.CsEventEnum;
|
||||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||||
@@ -31,7 +32,6 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.IntStream;
|
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
import static com.njcn.csharmonic.enums.CsTransientEnum.*;
|
import static com.njcn.csharmonic.enums.CsTransientEnum.*;
|
||||||
@@ -54,6 +54,7 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
|||||||
private final CsLineFeignClient csLineFeignClient;
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||||
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
|
private final WlRmpEventDetailMapper wlRmpEventDetailMapper;
|
||||||
|
private final CsCommTerminalFeignClient csCommTerminal;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public EventStatisticVO netEventEcharts(EventStatisticParam baseParam) {
|
public EventStatisticVO netEventEcharts(EventStatisticParam baseParam) {
|
||||||
@@ -134,9 +135,15 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
|||||||
)
|
)
|
||||||
));
|
));
|
||||||
|
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminal.getLedgerByLineId(lineIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
|
|
||||||
return csLinePOList.stream()
|
return csLinePOList.stream()
|
||||||
.map(line -> {
|
.map(line -> {
|
||||||
EventStatisticVO vo = new EventStatisticVO();
|
EventStatisticVO vo = new EventStatisticVO();
|
||||||
|
vo.setEngineeringName(devDetailDTOMap.get(line.getLineId()).getEngineeringName());
|
||||||
|
vo.setProjectName(devDetailDTOMap.get(line.getLineId()).getProjectName());
|
||||||
|
vo.setDevName(devDetailDTOMap.get(line.getLineId()).getEquipmentName());
|
||||||
vo.setName(line.getName());
|
vo.setName(line.getName());
|
||||||
vo.setId(line.getLineId());
|
vo.setId(line.getLineId());
|
||||||
Map<String, Long> lineEvents = eventCountByLineAndTag.getOrDefault(line.getLineId(), Collections.emptyMap());
|
Map<String, Long> lineEvents = eventCountByLineAndTag.getOrDefault(line.getLineId(), Collections.emptyMap());
|
||||||
@@ -174,7 +181,8 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
|||||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(monitorIds).getData();
|
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(monitorIds).getData();
|
||||||
Map<String,String> nameMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, CsLinePO::getName));
|
Map<String,String> nameMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, CsLinePO::getName));
|
||||||
|
|
||||||
|
List<DevDetailDTO> devDetailDTOList = csCommTerminalFeignClient.getLedgerByLineId(monitorIds).getData();
|
||||||
|
Map<String, DevDetailDTO> devDetailDTOMap = devDetailDTOList.stream().collect(Collectors.toMap(DevDetailDTO::getLineId, item -> item));
|
||||||
List<F47Curve> f47CurveList = csEventPOList.stream().map(item->{
|
List<F47Curve> f47CurveList = csEventPOList.stream().map(item->{
|
||||||
F47Curve f47Curve = new F47Curve();
|
F47Curve f47Curve = new F47Curve();
|
||||||
f47Curve.setEventId(item.getId());
|
f47Curve.setEventId(item.getId());
|
||||||
@@ -182,6 +190,9 @@ public class EventOverviewServiceImpl implements EventOverviewService {
|
|||||||
f47Curve.setTag(item.getTag());
|
f47Curve.setTag(item.getTag());
|
||||||
f47Curve.setPersistTime(BigDecimal.valueOf(item.getPersistTime()).setScale(3, RoundingMode.HALF_UP));
|
f47Curve.setPersistTime(BigDecimal.valueOf(item.getPersistTime()).setScale(3, RoundingMode.HALF_UP));
|
||||||
f47Curve.setEventValue(BigDecimal.valueOf(item.getAmplitude()));
|
f47Curve.setEventValue(BigDecimal.valueOf(item.getAmplitude()));
|
||||||
|
f47Curve.setEngineeringName(devDetailDTOMap.get(item.getLineId()).getEngineeringName());
|
||||||
|
f47Curve.setProjectName(devDetailDTOMap.get(item.getLineId()).getProjectName());
|
||||||
|
f47Curve.setEquipmentName(devDetailDTOMap.get(item.getLineId()).getEquipmentName());
|
||||||
f47Curve.setLineName(nameMap.getOrDefault(item.getLineId(),"异常测点"));
|
f47Curve.setLineName(nameMap.getOrDefault(item.getLineId(),"异常测点"));
|
||||||
return f47Curve;
|
return f47Curve;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|||||||
Reference in New Issue
Block a user