Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 349ee472d9 | |||
| 844f30965e | |||
| 6e0a36fd80 | |||
| bd1fb82532 |
@@ -1,11 +1,7 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
|||||||
@@ -1,22 +1,14 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import springfox.documentation.annotations.ApiIgnore;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -72,5 +64,5 @@ public interface EquipmentFeignClient {
|
|||||||
HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo);
|
HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo);
|
||||||
|
|
||||||
@PostMapping("/flipCldDevStatus")
|
@PostMapping("/flipCldDevStatus")
|
||||||
HttpResult<Boolean> flipCldDevStatus(@RequestParam("devId") String devId, @RequestParam("status") Integer status);
|
HttpResult<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ 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.IntegrityClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.IntegrityClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,6 +19,6 @@ import java.util.List;
|
|||||||
public interface IntegrityFeignClient {
|
public interface IntegrityFeignClient {
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
HttpResult<List<RStatIntegrityD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
|
HttpResult<List<RStatIntegrityD>> list(@RequestBody @Validated IcdBzParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,11 +3,12 @@ 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.onlineRateClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.onlineRateClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -18,6 +19,6 @@ import java.util.List;
|
|||||||
public interface OnlineRateFeignClient {
|
public interface OnlineRateFeignClient {
|
||||||
|
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
HttpResult<List<RStatOnlineRateD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
|
HttpResult<List<RStatOnlineRateD>> list(@RequestBody @Validated IcdBzParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,7 +97,7 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<Boolean> flipCldDevStatus(String devId, Integer status) {
|
public HttpResult<Boolean> flipCldDevStatus(String date, String devId, Integer status) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","云前置设备状态翻转",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","云前置设备状态翻转",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.IntegrityFeignClient;
|
import com.njcn.csdevice.api.IntegrityFeignClient;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -26,9 +27,8 @@ public class IntegrityClientFallbackFactory implements FallbackFactory<Integrity
|
|||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new IntegrityFeignClient() {
|
return new IntegrityFeignClient() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<RStatIntegrityD>> list(List<String> list, String startTime, String endTime) {
|
public HttpResult<List<RStatIntegrityD>> list(IcdBzParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.OnlineRateFeignClient;
|
import com.njcn.csdevice.api.OnlineRateFeignClient;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -28,7 +29,7 @@ public class onlineRateClientFallbackFactory implements FallbackFactory<OnlineRa
|
|||||||
return new OnlineRateFeignClient() {
|
return new OnlineRateFeignClient() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<List<RStatOnlineRateD>> list(List<String> list, String startTime, String endTime) {
|
public HttpResult<List<RStatOnlineRateD>> list(IcdBzParam param) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -97,4 +97,7 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
|||||||
@ApiModelProperty(value="项目id")
|
@ApiModelProperty(value="项目id")
|
||||||
private String projectId;
|
private String projectId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="日志等级(NORMAL、DEBUG、WARN、ERROR)")
|
||||||
|
private String devLogLevel;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -101,4 +101,7 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
|
|
||||||
@ApiModelProperty(value="前置机进程号")
|
@ApiModelProperty(value="前置机进程号")
|
||||||
private Integer nodeProcess;
|
private Integer nodeProcess;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="日志等级(NORMAL、DEBUG、WARN、ERROR)")
|
||||||
|
private String devLogLevel;
|
||||||
}
|
}
|
||||||
@@ -56,6 +56,8 @@ public class CsLedgerParam extends BaseEntity {
|
|||||||
@NotBlank(message = "台账表Id不能为空")
|
@NotBlank(message = "台账表Id不能为空")
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
private String pids;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -145,6 +145,14 @@ public class CsLineParam extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String position;
|
private String position;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||||
|
*/
|
||||||
|
private String lineLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是主要监测点(0: 不是 1:是)
|
||||||
|
*/
|
||||||
|
private Integer isImportant;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -130,4 +130,10 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "node_process")
|
@TableField(value = "node_process")
|
||||||
private Integer nodeProcess;
|
private Integer nodeProcess;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||||
|
*/
|
||||||
|
@TableField(value = "dev_log_level")
|
||||||
|
private String devLogLevel;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -165,4 +165,16 @@ public class CsLinePO extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@TableField(value = "report_file_path")
|
@TableField(value = "report_file_path")
|
||||||
private String reportFilePath;
|
private String reportFilePath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||||
|
*/
|
||||||
|
@TableField(value = "line_log_level")
|
||||||
|
private String lineLogLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是主要监测点(0: 不是 1:是)
|
||||||
|
*/
|
||||||
|
@TableField(value = "is_important")
|
||||||
|
private Integer isImportant;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,7 +6,9 @@ import lombok.Data;
|
|||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
//台账信息
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/ //台账信息
|
||||||
@Data
|
@Data
|
||||||
public class DeviceInfo implements Serializable {
|
public class DeviceInfo implements Serializable {
|
||||||
|
|
||||||
@@ -31,6 +33,9 @@ public class DeviceInfo implements Serializable {
|
|||||||
@ApiModelProperty("对时启动标志")
|
@ApiModelProperty("对时启动标志")
|
||||||
private boolean rightTime;
|
private boolean rightTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端日志等级")
|
||||||
|
private String devLogLevel;
|
||||||
|
|
||||||
@ApiModelProperty("监测点集合")
|
@ApiModelProperty("监测点集合")
|
||||||
private List<MonitorInfo> monitorData;
|
private List<MonitorInfo> monitorData;
|
||||||
|
|
||||||
@@ -70,6 +75,9 @@ public class DeviceInfo implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("ct2")
|
@ApiModelProperty("ct2")
|
||||||
private Double ct2;
|
private Double ct2;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点日志等级")
|
||||||
|
private String lineLogLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -20,8 +20,14 @@ public class EngineeringProjectRelationVo implements Serializable {
|
|||||||
@ApiModelProperty("工程名称")
|
@ApiModelProperty("工程名称")
|
||||||
private String engineeringName;
|
private String engineeringName;
|
||||||
|
|
||||||
@ApiModelProperty("区域")
|
@ApiModelProperty("省ID")
|
||||||
private String engineeringArea;
|
private String provinceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("市ID")
|
||||||
|
private String cityId;
|
||||||
|
|
||||||
|
@ApiModelProperty("区域名称")
|
||||||
|
private String engineeringAreaName;
|
||||||
|
|
||||||
@ApiModelProperty("工程备注")
|
@ApiModelProperty("工程备注")
|
||||||
private String engineeringRemark;
|
private String engineeringRemark;
|
||||||
@@ -51,6 +57,9 @@ public class EngineeringProjectRelationVo implements Serializable {
|
|||||||
@ApiModelProperty("项目排序")
|
@ApiModelProperty("项目排序")
|
||||||
private Integer projectSort;
|
private Integer projectSort;
|
||||||
|
|
||||||
|
@ApiModelProperty("拓扑图id")
|
||||||
|
private String topologyInfoId;
|
||||||
|
|
||||||
@ApiModelProperty("拓扑图信息")
|
@ApiModelProperty("拓扑图信息")
|
||||||
private String topologyInfo;
|
private String topologyInfo;
|
||||||
|
|
||||||
|
|||||||
@@ -132,4 +132,7 @@ public class LineDetailDataVO {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "对象类型大类")
|
@ApiModelProperty(name = "对象类型大类")
|
||||||
private String bigObjType;
|
private String bigObjType;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "监测点数据类型 一次值:Primary 二次值:Secondary")
|
||||||
|
private String dataLevel;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
@@ -50,9 +51,9 @@ public class RStatIntegrityDController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("获取数据")
|
@ApiOperation("获取数据")
|
||||||
public HttpResult<List<RStatIntegrityD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){
|
public HttpResult<List<RStatIntegrityD>> list(@RequestBody @Validated IcdBzParam param){
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
List<RStatIntegrityD> result = irStatIntegrityDService.getData(list,startTime,endTime);
|
List<RStatIntegrityD> result = irStatIntegrityDService.getData(param.getLineList(),param.getStartTime(),param.getEndTime());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -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.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
@@ -16,7 +17,10 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -50,9 +54,9 @@ public class RStatOnlineRateDController extends BaseController {
|
|||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/list")
|
@PostMapping("/list")
|
||||||
@ApiOperation("获取数据")
|
@ApiOperation("获取数据")
|
||||||
public HttpResult<List<RStatOnlineRateD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){
|
public HttpResult<List<RStatOnlineRateD>> list(@RequestBody @Validated IcdBzParam param){
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
List<RStatOnlineRateD> result = rStatOnlineRateDService.getData(list,startTime,endTime);
|
List<RStatOnlineRateD> result = rStatOnlineRateDService.getData(param.getLineList(),param.getStartTime(),param.getEndTime());
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -395,13 +395,14 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping("/flipCldDevStatus")
|
@PostMapping("/flipCldDevStatus")
|
||||||
@ApiOperation("云前置设备状态翻转")
|
@ApiOperation("云前置设备状态翻转")
|
||||||
@ApiImplicitParams({
|
@ApiImplicitParams({
|
||||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
@ApiImplicitParam(name = "date", value = "时间", required = true),
|
||||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||||
|
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||||
})
|
})
|
||||||
@ApiIgnore
|
@ApiIgnore
|
||||||
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
||||||
String methodDescribe = getMethodDescribe("flipCldDevStatus");
|
String methodDescribe = getMethodDescribe("flipCldDevStatus");
|
||||||
csEquipmentDeliveryService.flipCldDevStatus(devId,status);
|
csEquipmentDeliveryService.flipCldDevStatus(date,devId,status);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -56,4 +56,6 @@ public interface AppTopologyDiagramService extends IService<AppTopologyDiagramPO
|
|||||||
IPage<AppTopologyDiagramVO> queryTopologyDiagramPage(AppTopologyDiagramQueryPageParm appTopologyDiagramQueryPageParm);
|
IPage<AppTopologyDiagramVO> queryTopologyDiagramPage(AppTopologyDiagramQueryPageParm appTopologyDiagramQueryPageParm);
|
||||||
|
|
||||||
Boolean checkCanDelete(String id);
|
Boolean checkCanDelete(String id);
|
||||||
|
|
||||||
|
AppTopologyDiagramPO getByProjectId(String projectId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,10 +179,11 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据设备id和状态来修改设备运行状态;同时修改设备下的监测点的状态
|
* 根据设备id和状态来修改设备运行状态;同时修改设备下的监测点的状态
|
||||||
|
* @param date
|
||||||
* @param devId
|
* @param devId
|
||||||
* @param status
|
* @param status
|
||||||
*/
|
*/
|
||||||
void flipCldDevStatus(String devId, Integer status);
|
void flipCldDevStatus(String date, String devId, Integer status);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据项目id获取设备列表
|
* 根据项目id获取设备列表
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.Query;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
@@ -10,15 +10,18 @@ import com.google.common.base.Objects;
|
|||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.*;
|
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
||||||
|
import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||||
|
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
|
||||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramAddParm;
|
import com.njcn.csdevice.pojo.param.AppTopologyDiagramAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramAuditParm;
|
import com.njcn.csdevice.pojo.param.AppTopologyDiagramAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryPageParm;
|
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryPageParm;
|
||||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
||||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
|
||||||
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||||
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
@@ -178,4 +181,11 @@ public class AppTopologyDiagramServiceImpl extends ServiceImpl<AppTopologyDiagra
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AppTopologyDiagramPO getByProjectId(String projectId) {
|
||||||
|
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(AppTopologyDiagramPO::getProjectId,projectId).eq(AppTopologyDiagramPO::getStatus,"1");
|
||||||
|
return this.getOne(queryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ import cn.afterturn.easypoi.excel.entity.ImportParams;
|
|||||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
@@ -29,6 +30,7 @@ import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
|||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
||||||
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
@@ -67,6 +69,7 @@ import java.io.ByteArrayOutputStream;
|
|||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
/**
|
/**
|
||||||
@@ -103,7 +106,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final CsDevModelService csDevModelService;
|
private final CsDevModelService csDevModelService;
|
||||||
private final CsLedgerMapper csLedgerMapper;
|
private final CsLedgerMapper csLedgerMapper;
|
||||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||||
|
private final ICsCommunicateService csCommunicateService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -437,6 +440,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||||
}
|
}
|
||||||
|
addDataSet(dataSetList, item, "运行趋势", "devRunTrend");
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
@@ -939,17 +943,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
||||||
if (CollectionUtil.isNotEmpty(devList)) {
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
//修改设备运行状态
|
//修改设备运行状态
|
||||||
devList.forEach(item->{item.setRunStatus(1);});
|
devList.forEach(item->{
|
||||||
|
item.setRunStatus(1);
|
||||||
|
insertPqsCommunicateRecord(LocalDateTime.now().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)), item.getNdid(), 0);
|
||||||
|
});
|
||||||
this.updateBatchById(devList);
|
this.updateBatchById(devList);
|
||||||
//修改监测点运行状态
|
|
||||||
//List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
|
||||||
//List<CsLinePO> lineList = csLinePOService.getLinesByDevList(devIdList);
|
|
||||||
//csLinePOService.updateCldLineStatus(lineList,2);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void flipCldDevStatus(String devId, Integer status) {
|
@Transactional(rollbackFor = Exception.class)
|
||||||
|
public void flipCldDevStatus(String time, String devId, Integer status) {
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId)
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId)
|
||||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
||||||
@@ -958,13 +962,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if (ObjectUtil.isNotNull(po)) {
|
if (ObjectUtil.isNotNull(po)) {
|
||||||
po.setRunStatus(status);
|
po.setRunStatus(status);
|
||||||
this.updateById(po);
|
this.updateById(po);
|
||||||
//这边是监测点的运行状态 不是通讯状态,所以不要修改,通讯状态跟着设备的通讯状态来
|
//修改设备的运行状态,则录入influxdb表数据
|
||||||
//修改监测点运行状态
|
int communicateType = status == 2 ? 1 : 0;
|
||||||
//List<CsLinePO> lineList = csLinePOService.getLinesByDevList(Collections.singletonList(po.getId()));
|
insertPqsCommunicateRecord(time, po.getNdid(), communicateType);
|
||||||
//csLinePOService.updateCldLineStatus(lineList,status==1?2:0);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 时序数据库写入数据
|
||||||
|
private void insertPqsCommunicateRecord(String time, String devId, Integer status) {
|
||||||
|
PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto();
|
||||||
|
pqsCommunicateDto.setTime(time);
|
||||||
|
pqsCommunicateDto.setDevId(devId);
|
||||||
|
pqsCommunicateDto.setType(status);
|
||||||
|
pqsCommunicateDto.setDescription(status == 0 ? "通讯中断" : "通讯正常");
|
||||||
|
csCommunicateService.insertion(pqsCommunicateDto);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsEquipmentDeliveryPO> getDevListByProjectId(String projectId) {
|
public List<CsEquipmentDeliveryPO> getDevListByProjectId(String projectId) {
|
||||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
||||||
|
|||||||
@@ -65,6 +65,11 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.ZonedDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
@@ -102,6 +107,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
private final InfluxDbParamUtil influxDbParamUtil;
|
private final InfluxDbParamUtil influxDbParamUtil;
|
||||||
private final DictTreeFeignClient dictTreeFeignClient;
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
private static final ZoneId DEFAULT_ZONE = ZoneId.systemDefault();
|
||||||
|
|
||||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||||
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
||||||
@@ -302,9 +309,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
//传1 则是趋势数据tab页面
|
//传1 则是趋势数据tab页面
|
||||||
if("1".equals(type)){
|
if("1".equals(type)){
|
||||||
formatQueryParamList(commonStatisticalQueryParam);
|
formatQueryParamList(commonStatisticalQueryParam);
|
||||||
List<ThdDataVO> result = new ArrayList();
|
List<ThdDataVO> result = new ArrayList<>();
|
||||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
|
||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Collections.singletonList(commonStatisticalQueryParam.getLineId())).getData();
|
||||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||||
@@ -444,6 +451,21 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//长时闪变
|
||||||
|
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
||||||
|
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
||||||
|
collect1 = collect1.stream()
|
||||||
|
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
//短时闪变 || 电压波动
|
||||||
|
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
||||||
|
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
||||||
|
collect1 = collect1.stream()
|
||||||
|
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
result.addAll(collect1);
|
result.addAll(collect1);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -561,6 +583,20 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<Instant> getTimeInstants(String startDateStr, String endDateStr, long interval, ChronoUnit unit, ZoneId zone) {
|
||||||
|
List<Instant> instants = new ArrayList<>();
|
||||||
|
LocalDate startDate = LocalDate.parse(startDateStr, DATE_FORMATTER);
|
||||||
|
LocalDate endDate = LocalDate.parse(endDateStr, DATE_FORMATTER);
|
||||||
|
// 转换为指定时区的 ZonedDateTime
|
||||||
|
ZonedDateTime current = startDate.atStartOfDay(zone);
|
||||||
|
ZonedDateTime endDateTime = endDate.atTime(23, 59, 59).atZone(zone);
|
||||||
|
while (!current.isAfter(endDateTime)) {
|
||||||
|
instants.add(current.toInstant());
|
||||||
|
current = current.plus(interval, unit);
|
||||||
|
}
|
||||||
|
return instants;
|
||||||
|
}
|
||||||
|
|
||||||
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
||||||
List<CommonStatisticalQueryParam> list = new ArrayList<>();
|
List<CommonStatisticalQueryParam> list = new ArrayList<>();
|
||||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||||
@@ -934,6 +970,21 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
return vo;
|
return vo;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
|
|
||||||
|
//长时闪变
|
||||||
|
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
||||||
|
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
||||||
|
collect1 = collect1.stream()
|
||||||
|
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
//短时闪变 || 电压波动
|
||||||
|
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
||||||
|
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
||||||
|
collect1 = collect1.stream()
|
||||||
|
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
result.addAll(collect1);
|
result.addAll(collect1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -586,14 +587,17 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
device.setEquipmentName(dev.getName());
|
device.setEquipmentName(dev.getName());
|
||||||
device.setEquipmentId(devId);
|
device.setEquipmentId(devId);
|
||||||
CsLedger project = this.findDataById(dev.getPid());
|
CsLedger project = this.findDataById(dev.getPid());
|
||||||
device.setProjectId(project.getId());
|
if (ObjectUtil.isNotNull(project)) {
|
||||||
device.setProjectName(project.getName());
|
device.setProjectId(project.getId());
|
||||||
CsLedger engineer = this.findDataById(project.getPid());
|
device.setProjectName(project.getName());
|
||||||
device.setEngineeringid(engineer.getId());
|
|
||||||
device.setEngineeringName(engineer.getName());
|
CsLedger engineer = this.findDataById(project.getPid());
|
||||||
|
if (ObjectUtil.isNotNull(engineer)) {
|
||||||
|
device.setEngineeringid(engineer.getId());
|
||||||
|
device.setEngineeringName(engineer.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return device;
|
return device;
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -11,7 +11,6 @@ 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.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;
|
||||||
@@ -44,7 +43,6 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -208,7 +206,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||||
.set(CsLinePO::getGovern,param.getGovern())
|
.set(CsLinePO::getGovern,param.getGovern())
|
||||||
.set(CsLinePO::getPosition,param.getPosition())
|
.set(CsLinePO::getPosition,param.getPosition())
|
||||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser());
|
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
||||||
|
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||||
|
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
|
|
||||||
//修改台账树中监测点的名称
|
//修改台账树中监测点的名称
|
||||||
@@ -274,7 +274,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
public List<CsLinePO> getSimpleLine() {
|
public List<CsLinePO> getSimpleLine() {
|
||||||
List<String> devIds = commGetDevIds(RequestUtil.getUserIndex());
|
List<String> devIds = commGetDevIds(RequestUtil.getUserIndex());
|
||||||
if(CollUtil.isNotEmpty(devIds)){
|
if(CollUtil.isNotEmpty(devIds)){
|
||||||
List<CsLinePO> poList = this.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getName,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
List<CsLinePO> poList = this.lambdaQuery().in(CsLinePO::getDeviceId,devIds)
|
||||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||||
return poList;
|
return poList;
|
||||||
}else {
|
}else {
|
||||||
@@ -325,6 +325,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
lambdaQueryWrapper.in(CsLinePO::getLineId, lineList);
|
lambdaQueryWrapper.in(CsLinePO::getLineId, lineList);
|
||||||
}
|
}
|
||||||
|
if (ObjectUtil.isNotNull(param.getSearchValue())) {
|
||||||
|
lambdaQueryWrapper.and(par -> par.like(CsLinePO::getName, param.getSearchValue()));
|
||||||
|
}
|
||||||
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), lambdaQueryWrapper);
|
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), lambdaQueryWrapper);
|
||||||
BeanUtil.copyProperties(linePage, result);
|
BeanUtil.copyProperties(linePage, result);
|
||||||
List<CsLinePO> records = linePage.getRecords();
|
List<CsLinePO> records = linePage.getRecords();
|
||||||
@@ -451,7 +454,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
lineDetailDataVO.setShortCapacity(Objects.isNull(csLinePO.getShortCircuitCapacity())?0.0f:csLinePO.getShortCircuitCapacity().floatValue());
|
lineDetailDataVO.setShortCapacity(Objects.isNull(csLinePO.getShortCircuitCapacity())?0.0f:csLinePO.getShortCircuitCapacity().floatValue());
|
||||||
lineDetailDataVO.setStandardCapacity(Objects.isNull(csLinePO.getBasicCapacity())?0.0f:csLinePO.getBasicCapacity().floatValue());
|
lineDetailDataVO.setStandardCapacity(Objects.isNull(csLinePO.getBasicCapacity())?0.0f:csLinePO.getBasicCapacity().floatValue());
|
||||||
lineDetailDataVO.setTimeInterval(csLinePO.getLineInterval());
|
lineDetailDataVO.setTimeInterval(csLinePO.getLineInterval());
|
||||||
|
//获取监测点数据类型
|
||||||
|
CsDataSet dataSet = csDataSetService.getById(csLinePO.getDataSetId());
|
||||||
|
if (ObjectUtil.isNotNull(dataSet)) {
|
||||||
|
lineDetailDataVO.setDataLevel(dataSet.getDataLevel());
|
||||||
|
}
|
||||||
return lineDetailDataVO;
|
return lineDetailDataVO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,22 +5,19 @@ import cn.hutool.core.util.ObjectUtil;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
|
import com.njcn.csdevice.mapper.CsTopologyDiagramTemplateMapper;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.EngineeringProjectRelationVo;
|
import com.njcn.csdevice.pojo.vo.EngineeringProjectRelationVo;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
|
import com.njcn.system.pojo.po.Area;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Objects;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -40,6 +37,8 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
|||||||
private final ICsLedgerService csLedgerService;
|
private final ICsLedgerService csLedgerService;
|
||||||
private final CsLedgerMapper csLedgerMapper;
|
private final CsLedgerMapper csLedgerMapper;
|
||||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||||
|
private final AreaFeignClient areaFeignClient;
|
||||||
|
private final CsTopologyDiagramTemplateMapper csTopologyDiagramTemplateMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
@@ -94,6 +93,7 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean addProject(AppProjectAddParm param) {
|
public boolean addProject(AppProjectAddParm param) {
|
||||||
boolean result = false;
|
boolean result = false;
|
||||||
//新增项目信息
|
//新增项目信息
|
||||||
@@ -109,29 +109,61 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
|||||||
if (ObjectUtil.isNotNull(po1) && ObjectUtil.isNotNull(po2)) {
|
if (ObjectUtil.isNotNull(po1) && ObjectUtil.isNotNull(po2)) {
|
||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
|
//新增项目拓扑图
|
||||||
|
if (CollectionUtil.isNotEmpty(param.getTopoIds())) {
|
||||||
|
CsTopologyDiagramTemplate csTopologyDiagramTemplate = csTopologyDiagramTemplateMapper.selectById(param.getTopoIds().get(0));
|
||||||
|
AppTopologyDiagramPO po3 = new AppTopologyDiagramPO();
|
||||||
|
po3.setFilePath (csTopologyDiagramTemplate.getFilePath());
|
||||||
|
po3.setProjectId (po1.getId());
|
||||||
|
po3.setName (csTopologyDiagramTemplate.getName());
|
||||||
|
po3.setStatus ("1");
|
||||||
|
po3.setTopoId(param.getTopoIds().get(0));
|
||||||
|
appTopologyDiagramService.save(po3);
|
||||||
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean updateProject(AppProjectAuditParm param) {
|
public boolean updateProject(AppProjectAuditParm param) {
|
||||||
//修改工程信息
|
//修改工程信息
|
||||||
AppProjectPO po1 = appProjectService.updateData(param);
|
AppProjectPO po1 = appProjectService.updateData(param);
|
||||||
//修改cs_ledger数据
|
//修改cs_ledger数据
|
||||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||||
csLedgerParam.setId(po1.getId());
|
csLedgerParam.setId(po1.getId());
|
||||||
|
csLedgerParam.setPid(param.getEngineeringId());
|
||||||
|
csLedgerParam.setPids("0," + param.getEngineeringId());
|
||||||
csLedgerParam.setName(param.getName());
|
csLedgerParam.setName(param.getName());
|
||||||
csLedgerParam.setSort(param.getSort());
|
|
||||||
csLedgerParam.setRemark(param.getDescription());
|
csLedgerParam.setRemark(param.getDescription());
|
||||||
|
csLedgerParam.setSort(param.getSort());
|
||||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||||
|
//修改项目拓扑图
|
||||||
|
AppTopologyDiagramPO po2 = appTopologyDiagramService.getByProjectId(param.getId());
|
||||||
|
if (ObjectUtil.isNotNull(po2)) {
|
||||||
|
CsTopologyDiagramTemplate csTopologyDiagramTemplate = csTopologyDiagramTemplateMapper.selectById(param.getTopoIds().get(0));
|
||||||
|
po2.setId(po2.getId());
|
||||||
|
po2.setFilePath (csTopologyDiagramTemplate.getFilePath());
|
||||||
|
po2.setName (csTopologyDiagramTemplate.getName());
|
||||||
|
po2.setStatus ("1");
|
||||||
|
po2.setTopoId(param.getTopoIds().get(0));
|
||||||
|
appTopologyDiagramService.updateById(po2);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public boolean deleteProject(String id) {
|
public boolean deleteProject(String id) {
|
||||||
//删除项目信息
|
//删除项目信息
|
||||||
appProjectService.delete(id);
|
appProjectService.delete(id);
|
||||||
//删除台账信息
|
//删除台账信息
|
||||||
csLedgerService.deleteLedgerTree(id);
|
csLedgerService.deleteLedgerTree(id);
|
||||||
|
//删除项目拓扑图
|
||||||
|
AppTopologyDiagramPO po2 = appTopologyDiagramService.getByProjectId(id);
|
||||||
|
if (ObjectUtil.isNotNull(po2)) {
|
||||||
|
po2.setStatus("0");
|
||||||
|
appTopologyDiagramService.updateById(po2);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -163,11 +195,15 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
|||||||
EngineeringProjectRelationVo temp = new EngineeringProjectRelationVo();
|
EngineeringProjectRelationVo temp = new EngineeringProjectRelationVo();
|
||||||
temp.setEngineeringId(item.getId());
|
temp.setEngineeringId(item.getId());
|
||||||
temp.setEngineeringName(item.getName());
|
temp.setEngineeringName(item.getName());
|
||||||
temp.setEngineeringArea(item.getProvince()+item.getCity());
|
temp.setProvinceId(item.getProvince());
|
||||||
|
temp.setCityId(item.getCity());
|
||||||
|
Area area1 = areaFeignClient.selectIdArea(item.getProvince()).getData();
|
||||||
|
Area area2 = areaFeignClient.selectIdArea(item.getCity()).getData();
|
||||||
|
temp.setEngineeringAreaName((ObjectUtil.isNotNull(area1)?area1.getName():"") + (ObjectUtil.isNotNull(area2)?area2.getName():""));
|
||||||
temp.setEngineeringRemark(item.getDescription());
|
temp.setEngineeringRemark(item.getDescription());
|
||||||
temp.setEngineeringSort(item.getSort());
|
temp.setEngineeringSort(item.getSort());
|
||||||
|
|
||||||
List<CsLedgerVO> projectList = allList.stream().filter(item2->item2.getPid().equals(item.getId())).collect(Collectors.toList());
|
List<CsLedgerVO> projectList = allList.stream().filter(item2->item2.getPid().equals(item.getId())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
if (CollectionUtil.isNotEmpty(projectList)) {
|
if (CollectionUtil.isNotEmpty(projectList)) {
|
||||||
List<EngineeringProjectRelationVo.ProjectInfo> projectInfoList = new ArrayList<>();
|
List<EngineeringProjectRelationVo.ProjectInfo> projectInfoList = new ArrayList<>();
|
||||||
projectList.forEach(item2->{
|
projectList.forEach(item2->{
|
||||||
@@ -178,6 +214,7 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
|||||||
projectInfo.setProjectArea(po.getArea());
|
projectInfo.setProjectArea(po.getArea());
|
||||||
projectInfo.setProjectRemark(po.getDescription());
|
projectInfo.setProjectRemark(po.getDescription());
|
||||||
projectInfo.setProjectSort(po.getSort());
|
projectInfo.setProjectSort(po.getSort());
|
||||||
|
projectInfo.setTopologyInfoId(Objects.isNull(map3.get(po.getId()))?null:map3.get(po.getId()).getTopoId());
|
||||||
projectInfo.setTopologyInfo(Objects.isNull(map3.get(po.getId()))?null:map3.get(po.getId()).getFilePath());
|
projectInfo.setTopologyInfo(Objects.isNull(map3.get(po.getId()))?null:map3.get(po.getId()).getFilePath());
|
||||||
projectInfoList.add(projectInfo);
|
projectInfoList.add(projectInfo);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -98,6 +98,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
detail.setDevType(Objects.isNull(finalSysDicTreeMap.get(dev.getDevModel())) ? "/":finalSysDicTreeMap.get(dev.getDevModel()).getCode());
|
detail.setDevType(Objects.isNull(finalSysDicTreeMap.get(dev.getDevModel())) ? "/":finalSysDicTreeMap.get(dev.getDevModel()).getCode());
|
||||||
detail.setNode(dev.getNodeProcess());
|
detail.setNode(dev.getNodeProcess());
|
||||||
detail.setMaxProcessNum(node.getMaxProcessNum());
|
detail.setMaxProcessNum(node.getMaxProcessNum());
|
||||||
|
detail.setDevLogLevel(dev.getDevLogLevel());
|
||||||
|
|
||||||
// 只获取当前设备的监测点数据
|
// 只获取当前设备的监测点数据
|
||||||
List<CsLinePO> lines = lineMap.get(dev.getId());
|
List<CsLinePO> lines = lineMap.get(dev.getId());
|
||||||
@@ -116,6 +117,7 @@ class IcdServiceImpl implements IcdService {
|
|||||||
monitorInfo.setPt2(line.getPt2Ratio());
|
monitorInfo.setPt2(line.getPt2Ratio());
|
||||||
monitorInfo.setCt1(line.getCtRatio());
|
monitorInfo.setCt1(line.getCtRatio());
|
||||||
monitorInfo.setCt2(line.getCt2Ratio());
|
monitorInfo.setCt2(line.getCt2Ratio());
|
||||||
|
monitorInfo.setLineLogLevel(line.getLineLogLevel());
|
||||||
monitorInfos.add(monitorInfo);
|
monitorInfos.add(monitorInfo);
|
||||||
});
|
});
|
||||||
detail.setMonitorData(monitorInfos);
|
detail.setMonitorData(monitorInfos);
|
||||||
|
|||||||
@@ -1,13 +1,14 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||||
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
|
||||||
import com.njcn.csdevice.service.ICsCommunicateService;
|
import com.njcn.csdevice.service.ICsCommunicateService;
|
||||||
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
|
||||||
import com.njcn.influx.pojo.po.PqsCommunicate;
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||||
import com.njcn.influx.utils.InfluxDbUtils;
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
@@ -26,6 +27,7 @@ import java.time.ZoneId;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
|
import java.util.concurrent.atomic.AtomicInteger;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,7 +41,7 @@ import java.util.concurrent.TimeUnit;
|
|||||||
public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||||
|
|
||||||
private final InfluxDbUtils influxDbUtils;
|
private final InfluxDbUtils influxDbUtils;
|
||||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
@Resource
|
@Resource
|
||||||
private PqsCommunicateMapper pqsCommunicateMapper;
|
private PqsCommunicateMapper pqsCommunicateMapper;
|
||||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
@@ -76,14 +78,154 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
public List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam) {
|
public List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
List<PqsCommunicateDto> result = new ArrayList<>();
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
List<PqsCommunicate> list = getPqsCommunicateData(lineParam);
|
List<PqsCommunicate> list = getPqsCommunicateData(lineParam);
|
||||||
list.forEach(item -> {
|
|
||||||
PqsCommunicateDto dto = new PqsCommunicateDto();
|
|
||||||
BeanUtils.copyProperties(item, dto);
|
|
||||||
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
|
||||||
result.add(dto);
|
|
||||||
});
|
|
||||||
return result;
|
|
||||||
|
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
result = processWithData(list, lineParam);
|
||||||
|
} else {
|
||||||
|
result = processWithoutData(lineParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理有数据的情况
|
||||||
|
*/
|
||||||
|
private List<PqsCommunicateDto> processWithData(List<PqsCommunicate> list, LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
int lastIndex = list.size() - 1;
|
||||||
|
|
||||||
|
for (int i = 0; i < list.size(); i++) {
|
||||||
|
PqsCommunicate item = list.get(i);
|
||||||
|
PqsCommunicateDto dto = convertToDto(item);
|
||||||
|
result.add(dto);
|
||||||
|
|
||||||
|
// 如果是最后一组数据,补充结束数据点
|
||||||
|
if (i == lastIndex) {
|
||||||
|
PqsCommunicateDto endData = createEndDataDto(item, lineParam);
|
||||||
|
result.add(endData);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理无数据的情况
|
||||||
|
*/
|
||||||
|
private List<PqsCommunicateDto> processWithoutData(LineCountEvaluateParam lineParam) {
|
||||||
|
LocalDateTime endTime = getEndDateTime(lineParam.getEndTime());
|
||||||
|
LocalDateTime currentTime = LocalDateTime.now();
|
||||||
|
|
||||||
|
// 判断 endTime 是否早于最早入库时间
|
||||||
|
List<PqsCommunicateDto> firstData = getRawDataFirst(lineParam);
|
||||||
|
if (CollectionUtil.isNotEmpty(firstData)) {
|
||||||
|
LocalDateTime firstTime = parseDateTime(firstData.get(0).getTime());
|
||||||
|
if (endTime.isBefore(firstTime)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断 startTime 是否晚于当前时间
|
||||||
|
LocalDateTime startTime = getStartDateTime(lineParam.getStartTime());
|
||||||
|
if (startTime.isAfter(currentTime)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 获取最新数据并创建起始和结束点
|
||||||
|
List<PqsCommunicateDto> latestData = getRawDataLatest(lineParam);
|
||||||
|
if (CollectionUtil.isEmpty(latestData)) {
|
||||||
|
return Collections.emptyList();
|
||||||
|
}
|
||||||
|
|
||||||
|
return createStartAndEndDtos(latestData.get(0), lineParam);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建起始和结束数据点
|
||||||
|
*/
|
||||||
|
private List<PqsCommunicateDto> createStartAndEndDtos(PqsCommunicateDto templateDto, LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
|
||||||
|
// 创建起始点
|
||||||
|
PqsCommunicateDto startDto = new PqsCommunicateDto();
|
||||||
|
copyDtoProperties(templateDto, startDto);
|
||||||
|
startDto.setTime(lineParam.getStartTime() + " 00:00:00");
|
||||||
|
result.add(startDto);
|
||||||
|
|
||||||
|
// 创建结束点
|
||||||
|
PqsCommunicateDto endDto = new PqsCommunicateDto();
|
||||||
|
copyDtoProperties(templateDto, endDto);
|
||||||
|
endDto.setTime(getEndTimeString(lineParam));
|
||||||
|
result.add(endDto);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建结束数据点
|
||||||
|
*/
|
||||||
|
private PqsCommunicateDto createEndDataDto(PqsCommunicate item, LineCountEvaluateParam lineParam) {
|
||||||
|
PqsCommunicateDto endData = new PqsCommunicateDto();
|
||||||
|
endData.setTime(getEndTimeString(lineParam));
|
||||||
|
endData.setDevId(lineParam.getLineId().get(0));
|
||||||
|
endData.setType(item.getType());
|
||||||
|
endData.setDescription(item.getDescription());
|
||||||
|
return endData;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 转换实体为DTO
|
||||||
|
*/
|
||||||
|
private PqsCommunicateDto convertToDto(PqsCommunicate item) {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
return dto;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 复制DTO属性
|
||||||
|
*/
|
||||||
|
private void copyDtoProperties(PqsCommunicateDto source, PqsCommunicateDto target) {
|
||||||
|
target.setDevId(source.getDevId());
|
||||||
|
target.setType(source.getType());
|
||||||
|
target.setDescription(source.getDescription());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取结束时间字符串
|
||||||
|
*/
|
||||||
|
private String getEndTimeString(LineCountEvaluateParam lineParam) {
|
||||||
|
LocalDateTime currentTime = LocalDateTime.now();
|
||||||
|
LocalDateTime endTime = getEndDateTime(lineParam.getEndTime());
|
||||||
|
|
||||||
|
if (endTime.isBefore(currentTime)) {
|
||||||
|
return lineParam.getEndTime() + " 23:59:59";
|
||||||
|
} else {
|
||||||
|
return currentTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析日期时间字符串
|
||||||
|
*/
|
||||||
|
private LocalDateTime parseDateTime(String dateTimeStr) {
|
||||||
|
return LocalDateTime.parse(dateTimeStr, DATE_TIME_FORMATTER);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取开始时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime getStartDateTime(String startDate) {
|
||||||
|
return parseDateTime(startDate + " 00:00:00");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取结束时间
|
||||||
|
*/
|
||||||
|
private LocalDateTime getEndDateTime(String endDate) {
|
||||||
|
return parseDateTime(endDate + " 23:59:59");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -111,7 +253,10 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
@Override
|
@Override
|
||||||
public void insertion(PqsCommunicateDto pqsCommunicateDto) {
|
public void insertion(PqsCommunicateDto pqsCommunicateDto) {
|
||||||
//根据NDID获取装置信息
|
//根据NDID获取装置信息
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(pqsCommunicateDto.getDevId());
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,pqsCommunicateDto.getDevId()).ne(CsEquipmentDeliveryPO::getRunStatus,0);
|
||||||
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectOne(lambdaQueryWrapper);
|
||||||
|
|
||||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
influxQueryWrapper.eq(PqsCommunicate::getDevId,po.getId()).timeDesc().limit(1);
|
influxQueryWrapper.eq(PqsCommunicate::getDevId,po.getId()).timeDesc().limit(1);
|
||||||
List<PqsCommunicate> pqsCommunicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
List<PqsCommunicate> pqsCommunicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
@@ -138,8 +283,28 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
|||||||
.select(PqsCommunicate::getDevId)
|
.select(PqsCommunicate::getDevId)
|
||||||
.select(PqsCommunicate::getDescription)
|
.select(PqsCommunicate::getDescription)
|
||||||
.select(PqsCommunicate::getType)
|
.select(PqsCommunicate::getType)
|
||||||
.between(PqsCommunicate::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
.between(PqsCommunicate::getTime, lineParam.getStartTime() + " 00:00:00", lineParam.getEndTime() + " 23:59:59")
|
||||||
.timeAsc();
|
.timeAsc();
|
||||||
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<PqsCommunicateDto> getRawDataFirst(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.regular(PqsCommunicate::getDevId, lineParam.getLineId())
|
||||||
|
.select(PqsCommunicate::getTime)
|
||||||
|
.select(PqsCommunicate::getDevId)
|
||||||
|
.select(PqsCommunicate::getDescription)
|
||||||
|
.select(PqsCommunicate::getType)
|
||||||
|
.timeAsc()
|
||||||
|
.limit(1);
|
||||||
|
List<PqsCommunicate> list = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
list.forEach(item -> {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,6 +20,12 @@ public class EventStatisticParam extends BaseParam {
|
|||||||
@ApiModelProperty("监测点id")
|
@ApiModelProperty("监测点id")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 暂态事件类型
|
||||||
|
*/
|
||||||
|
@ApiModelProperty("暂态事件类型 0:全部 1:暂降 2:中断 3:暂升")
|
||||||
|
private Integer eventType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 安装位置
|
* 安装位置
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -59,6 +59,17 @@ public class PqSensitiveUserController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getListByUser")
|
||||||
|
@ApiOperation("根据当前用户获取敏感负荷用户列表")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||||
|
public HttpResult<List<PqSensitiveUserVo>> getListByUser(@RequestBody BaseParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getListByUser");
|
||||||
|
List<PqSensitiveUserVo> result = pqSensitiveUserService.getListByUser(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getListByIds")
|
@PostMapping("/getListByIds")
|
||||||
@ApiOperation("根据id集合获取敏感负荷用户列表")
|
@ApiOperation("根据id集合获取敏感负荷用户列表")
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ public class WordExportModelController extends BaseController {
|
|||||||
deviceUnitCommDTO = BeanUtil.copyProperties(pqsDeviceUnit, DeviceUnitCommDTO.class);
|
deviceUnitCommDTO = BeanUtil.copyProperties(pqsDeviceUnit, DeviceUnitCommDTO.class);
|
||||||
|
|
||||||
|
|
||||||
monitorHarmonicReportService.exportWorld(response, startTime, endTime, type, lineIndex, name, reportNumber, crmName, isUrl, file, harmLineDetailDataCommDTO, overLimitInfoCommDTO,deviceUnitCommDTO);
|
monitorHarmonicReportService.exportWorld(response, startTime, endTime, type, lineIndex, name, reportNumber, crmName, isUrl, file, harmLineDetailDataCommDTO, overLimitInfoCommDTO,deviceUnitCommDTO,lineDto.getDataLevel());
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -125,15 +125,10 @@
|
|||||||
select DISTINCT b.id id,
|
select DISTINCT b.id id,
|
||||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
b.device_id deviceId,b.line_id lineId,b.code code,
|
||||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
|
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,b.cl_did clDid
|
||||||
<if test="csEventUserQueryPage!=null and (csEventUserQueryPage.type == 0 or csEventUserQueryPage.type == 1 )">
|
|
||||||
,d.name lineName
|
,d.name lineName
|
||||||
</if>
|
|
||||||
from cs_event b
|
from cs_event b
|
||||||
<if test="csEventUserQueryPage!=null and (csEventUserQueryPage.type == 0 or csEventUserQueryPage.type == 1 )">
|
left join cs_line d on d.line_id=b.line_id
|
||||||
inner join cs_line d on d.line_id=b.line_id
|
|
||||||
</if>
|
|
||||||
where 1=1
|
where 1=1
|
||||||
|
|
||||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@@ -7,6 +7,8 @@ import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
|||||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||||
import com.njcn.web.pojo.param.BaseParam;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
* 服务类
|
* 服务类
|
||||||
@@ -19,6 +21,8 @@ public interface IPqSensitiveUserService extends IService<PqSensitiveUser> {
|
|||||||
|
|
||||||
Page<PqSensitiveUserVo> getList(BaseParam param);
|
Page<PqSensitiveUserVo> getList(BaseParam param);
|
||||||
|
|
||||||
|
List<PqSensitiveUserVo> getListByUser(BaseParam param);
|
||||||
|
|
||||||
boolean save(PqSensitiveUserParam pqSensitiveUserParam);
|
boolean save(PqSensitiveUserParam pqSensitiveUserParam);
|
||||||
|
|
||||||
boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam);
|
boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam);
|
||||||
|
|||||||
@@ -192,24 +192,50 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
Page<DataGroupEventVO> result = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
|
Page<DataGroupEventVO> result = new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam));
|
||||||
DateTime begin = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN));
|
DateTime begin = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN));
|
||||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN));
|
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN));
|
||||||
|
//暂态类型
|
||||||
|
final List<String> EVENT_TAGS;
|
||||||
|
if (Objects.isNull(baseParam.getEventType())) {
|
||||||
|
EVENT_TAGS = Arrays.asList(
|
||||||
|
EVT_SYS_DIPSTR.getCode(),
|
||||||
|
EVT_SYS_INTRSTR.getCode(),
|
||||||
|
EVT_SYS_SWLSTR.getCode()
|
||||||
|
);
|
||||||
|
} else {
|
||||||
|
switch (baseParam.getEventType()) {
|
||||||
|
case 1:
|
||||||
|
EVENT_TAGS = Collections.singletonList(EVT_SYS_DIPSTR.getCode());
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
EVENT_TAGS = Collections.singletonList(EVT_SYS_INTRSTR.getCode());
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
EVENT_TAGS = Collections.singletonList(EVT_SYS_SWLSTR.getCode());
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
EVENT_TAGS = Arrays.asList(
|
||||||
|
EVT_SYS_DIPSTR.getCode(),
|
||||||
|
EVT_SYS_INTRSTR.getCode(),
|
||||||
|
EVT_SYS_SWLSTR.getCode()
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
List<String> EVENT_TAGS = Arrays.asList(
|
//监测点
|
||||||
EVT_SYS_DIPSTR.getCode(),
|
List<CsLinePO> csLinePOList = csLineFeignClient.getSimpleLine().getData();
|
||||||
EVT_SYS_INTRSTR.getCode(),
|
if (CollUtil.isEmpty(csLinePOList)) {
|
||||||
EVT_SYS_SWLSTR.getCode()
|
return result;
|
||||||
);
|
}
|
||||||
|
List<String> lineIds = csLinePOList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(StrUtil.isNotBlank(baseParam.getLineId()),CsEventPO::getLineId,baseParam.getLineId())
|
lambdaQueryWrapper.eq(StrUtil.isNotBlank(baseParam.getLineId()),CsEventPO::getLineId,baseParam.getLineId())
|
||||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||||
|
.in(CsEventPO::getLineId,lineIds)
|
||||||
.between(CsEventPO::getStartTime,begin,end)
|
.between(CsEventPO::getStartTime,begin,end)
|
||||||
.orderByDesc(CsEventPO::getStartTime);
|
.orderByDesc(CsEventPO::getStartTime);
|
||||||
Page<CsEventPO> page = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
Page<CsEventPO> page = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
||||||
if(CollUtil.isNotEmpty(page.getRecords())){
|
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||||
|
|
||||||
List<String> ids = page.getRecords().stream().map(CsEventPO::getLineId).distinct().collect(Collectors.toList());
|
|
||||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(ids).getData();
|
|
||||||
Map<String,String> linePOMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, CsLinePO::getName));
|
Map<String,String> linePOMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, CsLinePO::getName));
|
||||||
|
|
||||||
List<DataGroupEventVO> dataGroupEventVOList = BeanUtil.copyToList(page.getRecords(),DataGroupEventVO.class);
|
List<DataGroupEventVO> dataGroupEventVOList = BeanUtil.copyToList(page.getRecords(),DataGroupEventVO.class);
|
||||||
@@ -402,7 +428,7 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
|||||||
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
rmpEventDetailPO.setMeasurementPointId(param.getMonitorId());
|
||||||
rmpEventDetailPO.setStartTime(time);
|
rmpEventDetailPO.setStartTime(time);
|
||||||
rmpEventDetailPO.setEventType(getEventType(param.getEventType()));
|
rmpEventDetailPO.setEventType(getEventType(param.getEventType()));
|
||||||
rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude() * 100);
|
rmpEventDetailPO.setFeatureAmplitude(param.getAmplitude());
|
||||||
rmpEventDetailPO.setDuration(param.getDuration());
|
rmpEventDetailPO.setDuration(param.getDuration());
|
||||||
rmpEventDetailPO.setEventDescribe(getTag(param.getEventType()));
|
rmpEventDetailPO.setEventDescribe(getTag(param.getEventType()));
|
||||||
rmpEventDetailPO.setPhase(param.getPhase());
|
rmpEventDetailPO.setPhase(param.getPhase());
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import cn.hutool.json.*;
|
|||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
|
||||||
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
import com.baomidou.mybatisplus.extension.toolkit.SqlRunner;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
@@ -428,14 +429,17 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
if (!nowDate.isAfter(startDate)) {
|
if (!nowDate.isAfter(startDate)) {
|
||||||
startDate = LocalDate.now();
|
startDate = LocalDate.now();
|
||||||
}
|
}
|
||||||
String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN) + InfluxDbSqlConstant.START_TIME;
|
// String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN) + InfluxDbSqlConstant.START_TIME;
|
||||||
|
String startTime = LocalDateTimeUtil.format(startDate, DatePattern.NORM_DATE_PATTERN);
|
||||||
//如时间是大于当前时间则用当前时间
|
//如时间是大于当前时间则用当前时间
|
||||||
String localTime = InfluxDbSqlConstant.END_TIME;
|
String localTime = InfluxDbSqlConstant.END_TIME;
|
||||||
LocalDate endDate = LocalDateTimeUtil.parseDate(queryParam.getEndTime(), DatePattern.NORM_DATE_PATTERN);
|
LocalDate endDate = LocalDateTimeUtil.parseDate(queryParam.getEndTime(), DatePattern.NORM_DATE_PATTERN);
|
||||||
if (nowDate.isAfter(endDate)) {
|
if (nowDate.isAfter(endDate)) {
|
||||||
localTime = " " + LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
localTime = " " + LocalTime.now().format(DatePattern.NORM_TIME_FORMATTER);
|
||||||
}
|
}
|
||||||
String endTime = queryParam.getEndTime() + localTime;
|
// String endTime = queryParam.getEndTime() + localTime;
|
||||||
|
//报表结束时间是当前日的前一天
|
||||||
|
String endTime = LocalDate.parse(queryParam.getEndTime(), DatePattern.NORM_DATE_FORMATTER).minusDays(1).format(DatePattern.NORM_DATE_FORMATTER);
|
||||||
String val = v.replace(STR_THREE, "").replace("start_time", startTime).replace("end_time", endTime);
|
String val = v.replace(STR_THREE, "").replace("start_time", startTime).replace("end_time", endTime);
|
||||||
son.putOpt(V, val);
|
son.putOpt(V, val);
|
||||||
|
|
||||||
@@ -2141,7 +2145,13 @@ public class CustomReportServiceImpl implements CustomReportService {
|
|||||||
} else {
|
} else {
|
||||||
phase = PHASE_MAPPING.get(item.getPhase());
|
phase = PHASE_MAPPING.get(item.getPhase());
|
||||||
}
|
}
|
||||||
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
if (ObjectUtils.isNotNull(item.getHarmStart()) && ObjectUtils.isNotNull(item.getHarmEnd())) {
|
||||||
|
for (int i = item.getHarmStart(); i <= item.getHarmEnd() + 1; i++) {
|
||||||
|
tMap.put((item.getOtherName() + "_" + i + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
tMap.put((item.getOtherName() + phase + item.getResourcesId()).toUpperCase(), item.getPrimaryFormula());
|
||||||
|
}
|
||||||
});
|
});
|
||||||
//pt
|
//pt
|
||||||
double pt = safeDivide(linePO.getPtRatio(), linePO.getPt2Ratio());
|
double pt = safeDivide(linePO.getPtRatio(), linePO.getPt2Ratio());
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.csharmonic.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -86,6 +87,48 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqSensitiveUserVo> getListByUser(BaseParam param) {
|
||||||
|
List<PqSensitiveUserVo> result = new ArrayList<>();
|
||||||
|
//现根据用户获取监测点
|
||||||
|
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||||
|
//获取敏感用户集合
|
||||||
|
List<String> monitorUsers = poList.stream()
|
||||||
|
.map(CsLinePO::getMonitorUser)
|
||||||
|
.filter(Objects::nonNull)
|
||||||
|
.distinct()
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isEmpty(monitorUsers)) {
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
//根据敏感用户进行监测点分组
|
||||||
|
Map<String,List<CsLinePO>> map = poList.stream()
|
||||||
|
.filter(po -> po.getMonitorUser() != null)
|
||||||
|
.collect(Collectors.groupingBy(CsLinePO::getMonitorUser));
|
||||||
|
//查询敏感用户信息集合
|
||||||
|
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper.in(PqSensitiveUser::getId,monitorUsers).orderByAsc(PqSensitiveUser::getSort);
|
||||||
|
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||||
|
lambdaQueryWrapper.like(PqSensitiveUser::getName, param.getSearchValue());
|
||||||
|
}
|
||||||
|
List<PqSensitiveUser> sensitiveUserList = this.list(lambdaQueryWrapper);
|
||||||
|
sensitiveUserList.forEach(item->{
|
||||||
|
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
||||||
|
BeanUtil.copyProperties(item,vo);
|
||||||
|
if (map.containsKey(item.getId())) {
|
||||||
|
vo.setIsMonitor("是");
|
||||||
|
List<CsLinePO> list = map.get(item.getId());
|
||||||
|
boolean hasGoverned = list.stream().anyMatch(item2 -> item2.getGovern() == 1);
|
||||||
|
vo.setIsGovern(hasGoverned ? "是" : "否");
|
||||||
|
} else {
|
||||||
|
vo.setIsMonitor("否");
|
||||||
|
vo.setIsGovern("否");
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean save(PqSensitiveUserParam pqSensitiveUserParam) {
|
public boolean save(PqSensitiveUserParam pqSensitiveUserParam) {
|
||||||
checkParam(pqSensitiveUserParam,false);
|
checkParam(pqSensitiveUserParam,false);
|
||||||
|
|||||||
@@ -159,11 +159,11 @@ public class RStatLimitRateDServiceImpl extends ServiceImpl<RStatLimitRateDMappe
|
|||||||
if (CollUtil.isEmpty(lineList)) {
|
if (CollUtil.isEmpty(lineList)) {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
keywordsLineIds = lineList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
keywordsLineIds = lineList.stream().filter(po -> po.getIsImportant() != null && po.getIsImportant() == 1).map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
} else {
|
} else {
|
||||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||||
if (CollUtil.isNotEmpty(poList)) {
|
if (CollUtil.isNotEmpty(poList)) {
|
||||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
keywordsLineIds = poList.stream().filter(po -> po.getIsImportant() != null && po.getIsImportant() == 1).map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.njcn.csharmonic.service.impl;
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.lang.Pair;
|
import cn.hutool.core.lang.Pair;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
@@ -34,6 +35,7 @@ import java.math.RoundingMode;
|
|||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@DS("sjzx")
|
@DS("sjzx")
|
||||||
@@ -51,7 +53,7 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
static List<List<Integer>> extentPeriodList = new ArrayList<>();
|
static List<List<Integer>> extentPeriodList = new ArrayList<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
indexMap.put("flicker", "闪变");
|
indexMap.put("flicker", "长时闪变");
|
||||||
indexMap.put("uharm", "谐波电压");
|
indexMap.put("uharm", "谐波电压");
|
||||||
indexMap.put("iharm", "谐波电流");
|
indexMap.put("iharm", "谐波电流");
|
||||||
indexMap.put("ubalance", "三相电压不平衡度");
|
indexMap.put("ubalance", "三相电压不平衡度");
|
||||||
@@ -278,10 +280,69 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
);
|
);
|
||||||
CsLinePO linePO = csLineFeignClient.getById(param.getLineId()).getData();
|
CsLinePO linePO = csLineFeignClient.getById(param.getLineId()).getData();
|
||||||
List<Overlimit> overlimitList = overLimitClient.getOverLimitByLineIds(Collections.singletonList(linePO.getLineId())).getData();
|
List<Overlimit> overlimitList = overLimitClient.getOverLimitByLineIds(Collections.singletonList(linePO.getLineId())).getData();
|
||||||
JSONObject overlimitJSON = null;
|
JSONObject overlimitJSON;
|
||||||
if (CollUtil.isNotEmpty(overlimitList)) {
|
if (CollUtil.isNotEmpty(overlimitList)) {
|
||||||
overlimitJSON = JSONUtil.parseObj(overlimitList.get(0));
|
overlimitJSON = JSONUtil.parseObj(overlimitList.get(0));
|
||||||
|
} else {
|
||||||
|
overlimitJSON = null;
|
||||||
}
|
}
|
||||||
|
//按日期获取各个指标最大值
|
||||||
|
Map<LocalDate, List<RStatLimitRateDetailDPO>> detailMap = detailList.stream().sorted(Comparator.comparing(RStatLimitRateDetailDPO::getTime)).collect(Collectors.groupingBy(RStatLimitRateDetailDPO::getTime));
|
||||||
|
Map<LocalDate, Map<String,Float>> maxValueMapByDay = new HashMap<>();
|
||||||
|
detailMap.forEach((k,v)->{
|
||||||
|
Map<String, Pair<Float, RStatLimitRateDetailDPO>> maxValueMap = findMaxValueHandle(v);
|
||||||
|
Map<String,Float> m1 = new HashMap<>();
|
||||||
|
maxValueMap.forEach((k1,v1)->{
|
||||||
|
m1.put(k1,v1.getKey());
|
||||||
|
});
|
||||||
|
|
||||||
|
Map<String,Float> m2 = new HashMap<>();
|
||||||
|
m1.forEach((k1,v1)->{
|
||||||
|
double extentValue = 0;
|
||||||
|
if (k1.startsWith("uharm") && k1.endsWith("Overtime")) {
|
||||||
|
String d1 = k1.replaceAll("([a-zA-Z]+)(\\d+)(.*)", "$1$2");
|
||||||
|
String d2 = k1.replaceAll("([a-zA-Z]+)(\\d+)(.*)", "$1");
|
||||||
|
assert overlimitJSON != null;
|
||||||
|
double limitValue = overlimitJSON.getDouble(d1);
|
||||||
|
extentValue = calculatePercentage(v1.doubleValue() - limitValue, limitValue);
|
||||||
|
m2.put(d2,(float) extentValue);
|
||||||
|
} else if (k1.startsWith("iharm") && k1.endsWith("Overtime")) {
|
||||||
|
String d1 = k1.replaceAll("([a-zA-Z]+)(\\d+)(.*)", "$1$2");
|
||||||
|
String d2 = k1.replaceAll("([a-zA-Z]+)(\\d+)(.*)", "$1");
|
||||||
|
assert overlimitJSON != null;
|
||||||
|
double limitValue = overlimitJSON.getDouble(d1);
|
||||||
|
extentValue = calculatePercentage(v1.doubleValue() - limitValue, limitValue);
|
||||||
|
m2.put(d2,(float) extentValue);
|
||||||
|
} else {
|
||||||
|
if (v1.doubleValue() != 0.0) {
|
||||||
|
assert overlimitJSON != null;
|
||||||
|
double limitValue = overlimitJSON.getDouble(k1);
|
||||||
|
extentValue = calculatePercentage(v1.doubleValue() - limitValue, limitValue);
|
||||||
|
}
|
||||||
|
m2.put(k1,(float) extentValue);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
Float f1 = m2.get("uharm");
|
||||||
|
Float f2 = m2.get("uaberrance");
|
||||||
|
m2.remove("uharm");
|
||||||
|
m2.remove("uaberrance");
|
||||||
|
m2.put("uharm",Math.max(f1,f2));
|
||||||
|
maxValueMapByDay.put(k,m2);
|
||||||
|
});
|
||||||
|
|
||||||
|
// 确保 extentMap 初始化为线程安全的 ConcurrentHashMap
|
||||||
|
Map<String, List<Float>> extentMap = new ConcurrentHashMap<>();
|
||||||
|
maxValueMapByDay.forEach((dayKey, dayValues) -> {
|
||||||
|
dayValues.forEach((key, value) -> {
|
||||||
|
// 获取当前 key 对应的列表,若不存在则初始化为空列表
|
||||||
|
List<Float> list = extentMap.computeIfAbsent(key, k -> new ArrayList<>());
|
||||||
|
// 直接添加值到列表中
|
||||||
|
if (value > 0.0) {
|
||||||
|
list.add(value);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
LimitProbabilityVO probabilityVO;
|
LimitProbabilityVO probabilityVO;
|
||||||
for (Map.Entry<String, String> indexEntry : indexMap.entrySet()) {
|
for (Map.Entry<String, String> indexEntry : indexMap.entrySet()) {
|
||||||
String indexCode = indexEntry.getKey();
|
String indexCode = indexEntry.getKey();
|
||||||
@@ -290,53 +351,114 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
probabilityVO.setIndexCode(indexCode);
|
probabilityVO.setIndexCode(indexCode);
|
||||||
probabilityVO.setLineId(linePO.getLineId());
|
probabilityVO.setLineId(linePO.getLineId());
|
||||||
probabilityVO.setLineName(linePO.getName());
|
probabilityVO.setLineName(linePO.getName());
|
||||||
// 计算越限程度
|
|
||||||
List<Double> extentValuesList = new ArrayList<>();
|
|
||||||
for (RStatLimitRateDetailDPO detail : detailList) {
|
|
||||||
JSONObject entries = JSONUtil.parseObj(detail);
|
|
||||||
for (Map.Entry<String, Object> dayEntry : entries.entrySet()) {
|
|
||||||
String key = dayEntry.getKey();
|
|
||||||
if (key.endsWith("Overtime") && key.startsWith(indexCode)) {
|
|
||||||
double extentValue = 0;
|
|
||||||
Object data = dayEntry.getValue();
|
|
||||||
// 有数据有越限
|
|
||||||
if (ObjectUtil.isNotEmpty(data)) {
|
|
||||||
float maxValue = parseMaxValueFromJsonArray(data);
|
|
||||||
if (overlimitJSON != null) {
|
|
||||||
String itemKey = StrUtil.sub(key, 0, key.length() - 8);
|
|
||||||
double limitValue = overlimitJSON.getDouble(itemKey);
|
|
||||||
if (limitValue != 0) {
|
|
||||||
extentValue = calculatePercentage(maxValue - limitValue, limitValue);
|
|
||||||
|
|
||||||
}
|
List<Map<Integer, Integer>> extentGrades = getFenBu(extentMap.get(indexCode));
|
||||||
}
|
probabilityVO.setExtentGrades(extentGrades);
|
||||||
}
|
result.add(probabilityVO);
|
||||||
extentValuesList.add(extentValue);
|
}
|
||||||
}
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
public List<Map<Integer, Integer>> getFenBu(List<Float> data) {
|
||||||
List<Map<Integer, Integer>> extentGrades = new ArrayList<>();
|
List<Map<Integer, Integer>> result = new ArrayList<>();
|
||||||
for (int i = 0; i < extentPeriodList.size(); i++) {
|
for (int i = 0; i < extentPeriodList.size(); i++) {
|
||||||
Map<Integer, Integer> grade = new HashMap<>();
|
Map<Integer, Integer> grade = new HashMap<>();
|
||||||
int times = 0;
|
int times = 0;
|
||||||
for (Double extentValue : extentValuesList) {
|
if (CollectionUtil.isNotEmpty(data)) {
|
||||||
|
for (Float extentValue : data) {
|
||||||
List<Integer> period = extentPeriodList.get(i);
|
List<Integer> period = extentPeriodList.get(i);
|
||||||
Integer start = period.get(0);
|
Integer start = period.get(0);
|
||||||
Integer end = period.get(1);
|
Integer end = period.get(1);
|
||||||
if (extentValue > start && extentValue <= end) {
|
if (extentValue > start && extentValue <= end) {
|
||||||
times++;
|
times++;
|
||||||
}
|
}
|
||||||
|
if ((i == extentPeriodList.size() - 1) && extentValue > 100.0) {
|
||||||
|
times++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
grade.put(i, times);
|
|
||||||
extentGrades.add(grade);
|
|
||||||
}
|
}
|
||||||
probabilityVO.setExtentGrades(extentGrades);
|
grade.put(i, times);
|
||||||
result.add(probabilityVO);
|
result.add(grade);
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public List<LimitProbabilityVO> limitProbabilityData(LimitProbabilityQueryParam param) {
|
||||||
|
// List<LimitProbabilityVO> result = new ArrayList<>();
|
||||||
|
// List<RStatLimitRateDetailDPO> detailList = this.list(new LambdaQueryWrapper<RStatLimitRateDetailDPO>()
|
||||||
|
// .eq(RStatLimitRateDetailDPO::getLineId, param.getLineId())
|
||||||
|
// .ge(StrUtil.isNotBlank(param.getSearchBeginTime()), RStatLimitRateDetailDPO::getTime, param.getSearchBeginTime())
|
||||||
|
// .le(StrUtil.isNotBlank(param.getSearchEndTime()), RStatLimitRateDetailDPO::getTime, param.getSearchEndTime())
|
||||||
|
// .orderByAsc(RStatLimitRateDetailDPO::getTime)
|
||||||
|
// );
|
||||||
|
// CsLinePO linePO = csLineFeignClient.getById(param.getLineId()).getData();
|
||||||
|
// List<Overlimit> overlimitList = overLimitClient.getOverLimitByLineIds(Collections.singletonList(linePO.getLineId())).getData();
|
||||||
|
// JSONObject overlimitJSON = null;
|
||||||
|
// if (CollUtil.isNotEmpty(overlimitList)) {
|
||||||
|
// overlimitJSON = JSONUtil.parseObj(overlimitList.get(0));
|
||||||
|
// }
|
||||||
|
// LimitProbabilityVO probabilityVO;
|
||||||
|
// for (Map.Entry<String, String> indexEntry : indexMap.entrySet()) {
|
||||||
|
// String indexCode = indexEntry.getKey();
|
||||||
|
// probabilityVO = new LimitProbabilityVO();
|
||||||
|
// probabilityVO.setIndexName(indexEntry.getValue());
|
||||||
|
// probabilityVO.setIndexCode(indexCode);
|
||||||
|
// probabilityVO.setLineId(linePO.getLineId());
|
||||||
|
// probabilityVO.setLineName(linePO.getName());
|
||||||
|
// // 计算越限程度
|
||||||
|
// List<Double> extentValuesList = new ArrayList<>();
|
||||||
|
// for (RStatLimitRateDetailDPO detail : detailList) {
|
||||||
|
// JSONObject entries = JSONUtil.parseObj(detail);
|
||||||
|
// for (Map.Entry<String, Object> dayEntry : entries.entrySet()) {
|
||||||
|
// String key = dayEntry.getKey();
|
||||||
|
// if (shouldProcess(key, indexCode)) {
|
||||||
|
// double extentValue = 0;
|
||||||
|
// Object data = dayEntry.getValue();
|
||||||
|
// if (ObjectUtil.isNotEmpty(data) && overlimitJSON != null) {
|
||||||
|
// float maxValue = parseMaxValueFromJsonArray(data);
|
||||||
|
// String itemKey = StrUtil.sub(key, 0, key.length() - 8);
|
||||||
|
// double limitValue = overlimitJSON.getDouble(itemKey);
|
||||||
|
// if (limitValue != 0) {
|
||||||
|
// extentValue = calculatePercentage(maxValue - limitValue, limitValue);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// extentValuesList.add(extentValue);
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// List<Map<Integer, Integer>> extentGrades = new ArrayList<>();
|
||||||
|
// for (int i = 0; i < extentPeriodList.size(); i++) {
|
||||||
|
// Map<Integer, Integer> grade = new HashMap<>();
|
||||||
|
// int times = 0;
|
||||||
|
// for (Double extentValue : extentValuesList) {
|
||||||
|
// List<Integer> period = extentPeriodList.get(i);
|
||||||
|
// Integer start = period.get(0);
|
||||||
|
// Integer end = period.get(1);
|
||||||
|
// if (extentValue > start && extentValue <= end) {
|
||||||
|
// times++;
|
||||||
|
// }
|
||||||
|
// if ((i == extentPeriodList.size() - 1) && extentValue > 100.0) {
|
||||||
|
// times++;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// grade.put(i, times);
|
||||||
|
// extentGrades.add(grade);
|
||||||
|
// }
|
||||||
|
// probabilityVO.setExtentGrades(extentGrades);
|
||||||
|
// result.add(probabilityVO);
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
// }
|
||||||
|
|
||||||
|
private boolean shouldProcess(String key, String indexCode) {
|
||||||
|
return (key.endsWith("Overtime") && key.startsWith(indexCode)) ||
|
||||||
|
(Objects.equals(indexCode, "uharm") && key.startsWith("uaberrance"));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LimitTimeProbabilityVO> limitTimeProbabilityData(LimitProbabilityQueryParam param) {
|
public List<LimitTimeProbabilityVO> limitTimeProbabilityData(LimitProbabilityQueryParam param) {
|
||||||
|
|
||||||
@@ -431,20 +553,34 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
|
|
||||||
RStatLimitRateDetailDPO voltageDevMaxDetail = null;
|
RStatLimitRateDetailDPO voltageDevMaxDetail = null;
|
||||||
float voltageDevMaxValue = 0.0000F;
|
float voltageDevMaxValue = 0.0000F;
|
||||||
|
|
||||||
RStatLimitRateDetailDPO ubalanceMaxDetail = null;
|
RStatLimitRateDetailDPO ubalanceMaxDetail = null;
|
||||||
float ubalanceMaxValue = 0.0000F;
|
float ubalanceMaxValue = 0.0000F;
|
||||||
|
|
||||||
|
|
||||||
|
RStatLimitRateDetailDPO uaberranceMaxDetail = null;
|
||||||
|
float uaberranceMaxValue = 0.0000F;
|
||||||
|
|
||||||
|
RStatLimitRateDetailDPO freqDevMaxDetail = null;
|
||||||
|
float freqDevMaxValue = 0.0000F;
|
||||||
|
|
||||||
RStatLimitRateDetailDPO uharmMaxDetail = null;
|
RStatLimitRateDetailDPO uharmMaxDetail = null;
|
||||||
float uharmMaxValue = 0.0000F;
|
float uharmMaxValue = 0.0000F;
|
||||||
String uharmMaxKey = ""; // 记录uharm最大值对应的key
|
// 记录uharm最大值对应的key
|
||||||
|
String uharmMaxKey = "";
|
||||||
|
|
||||||
RStatLimitRateDetailDPO iharmMaxDetail = null;
|
RStatLimitRateDetailDPO iharmMaxDetail = null;
|
||||||
float iharmMaxValue = 0.0000F;
|
float iharmMaxValue = 0.0000F;
|
||||||
String iharmMaxKey = ""; // 记录iharm最大值对应的key
|
// 记录iharm最大值对应的key
|
||||||
|
String iharmMaxKey = "";
|
||||||
|
|
||||||
for (RStatLimitRateDetailDPO po : detailList) {
|
for (RStatLimitRateDetailDPO po : detailList) {
|
||||||
String flickerOvertime = po.getFlickerOvertime();
|
String flickerOvertime = po.getFlickerOvertime();
|
||||||
String voltageDevOvertime = po.getVoltageDevOvertime();
|
String voltageDevOvertime = po.getVoltageDevOvertime();
|
||||||
String ubalanceOvertime = po.getUbalanceOvertime();
|
String ubalanceOvertime = po.getUbalanceOvertime();
|
||||||
|
String uaberranceOvertime = po.getUaberranceOvertime();
|
||||||
|
String freqDevOvertime = po.getFreqDevOvertime();
|
||||||
|
|
||||||
if (StrUtil.isNotBlank(flickerOvertime)) {
|
if (StrUtil.isNotBlank(flickerOvertime)) {
|
||||||
float dayFlickerMaxValue = parseMaxValueFromJsonArray(flickerOvertime);
|
float dayFlickerMaxValue = parseMaxValueFromJsonArray(flickerOvertime);
|
||||||
if (dayFlickerMaxValue > flickerMaxValue) {
|
if (dayFlickerMaxValue > flickerMaxValue) {
|
||||||
@@ -466,11 +602,30 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
ubalanceMaxDetail = po;
|
ubalanceMaxDetail = po;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (StrUtil.isNotBlank(uaberranceOvertime)) {
|
||||||
|
float dayuaberranceMaxValue = parseMaxValueFromJsonArray(uaberranceOvertime);
|
||||||
|
if (dayuaberranceMaxValue > uaberranceMaxValue) {
|
||||||
|
uaberranceMaxValue = dayuaberranceMaxValue;
|
||||||
|
uaberranceMaxDetail = po;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (StrUtil.isNotBlank(freqDevOvertime)) {
|
||||||
|
float dayFreqDevMaxValue = parseMaxValueFromJsonArray(freqDevOvertime);
|
||||||
|
if (dayFreqDevMaxValue > freqDevMaxValue) {
|
||||||
|
freqDevMaxValue = dayFreqDevMaxValue;
|
||||||
|
freqDevMaxDetail = po;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
JSONObject entries = JSONUtil.parseObj(po);
|
JSONObject entries = JSONUtil.parseObj(po);
|
||||||
float dayUharmMaxValue = 0.0000F;
|
float dayUharmMaxValue = 0.0000F;
|
||||||
String dayUharmMaxKey = ""; // 当前记录中uharm的最大值key
|
// 当前记录中uharm的最大值key
|
||||||
|
String dayUharmMaxKey = "";
|
||||||
float dayIharmMaxValue = 0.0000F;
|
float dayIharmMaxValue = 0.0000F;
|
||||||
String dayIharmMaxKey = ""; // 当前记录中iharm的最大值key
|
// 当前记录中iharm的最大值key
|
||||||
|
String dayIharmMaxKey = "";
|
||||||
|
|
||||||
for (Map.Entry<String, Object> entry : entries.entrySet()) {
|
for (Map.Entry<String, Object> entry : entries.entrySet()) {
|
||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
@@ -498,17 +653,21 @@ public class RStatLimitRateDetailDServiceImpl extends ServiceImpl<RStatLimitRate
|
|||||||
if (dayUharmMaxValue > uharmMaxValue) {
|
if (dayUharmMaxValue > uharmMaxValue) {
|
||||||
uharmMaxValue = dayUharmMaxValue;
|
uharmMaxValue = dayUharmMaxValue;
|
||||||
uharmMaxDetail = po;
|
uharmMaxDetail = po;
|
||||||
uharmMaxKey = dayUharmMaxKey; // 记录产生最大值的key
|
// 记录产生最大值的key
|
||||||
|
uharmMaxKey = dayUharmMaxKey;
|
||||||
}
|
}
|
||||||
if (dayIharmMaxValue > iharmMaxValue) {
|
if (dayIharmMaxValue > iharmMaxValue) {
|
||||||
iharmMaxValue = dayIharmMaxValue;
|
iharmMaxValue = dayIharmMaxValue;
|
||||||
iharmMaxDetail = po;
|
iharmMaxDetail = po;
|
||||||
iharmMaxKey = dayIharmMaxKey; // 记录产生最大值的key
|
// 记录产生最大值的key
|
||||||
|
iharmMaxKey = dayIharmMaxKey;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
result.put("flicker", Pair.of(flickerMaxValue, flickerMaxDetail));
|
result.put("flicker", Pair.of(flickerMaxValue, flickerMaxDetail));
|
||||||
result.put("voltageDev", Pair.of(voltageDevMaxValue, voltageDevMaxDetail));
|
result.put("voltageDev", Pair.of(voltageDevMaxValue, voltageDevMaxDetail));
|
||||||
result.put("ubalance", Pair.of(ubalanceMaxValue, ubalanceMaxDetail));
|
result.put("ubalance", Pair.of(ubalanceMaxValue, ubalanceMaxDetail));
|
||||||
|
result.put("uaberrance", Pair.of(uaberranceMaxValue, uaberranceMaxDetail));
|
||||||
|
result.put("freqDev", Pair.of(freqDevMaxValue, freqDevMaxDetail));
|
||||||
result.put(uharmMaxKey.isEmpty() ? "uharm" : uharmMaxKey, Pair.of(uharmMaxValue, uharmMaxDetail));
|
result.put(uharmMaxKey.isEmpty() ? "uharm" : uharmMaxKey, Pair.of(uharmMaxValue, uharmMaxDetail));
|
||||||
result.put(iharmMaxKey.isEmpty() ? "iharm" : iharmMaxKey, Pair.of(iharmMaxValue, iharmMaxDetail));
|
result.put(iharmMaxKey.isEmpty() ? "iharm" : iharmMaxKey, Pair.of(iharmMaxValue, iharmMaxDetail));
|
||||||
|
|
||||||
|
|||||||
@@ -4,12 +4,12 @@ import cn.hutool.core.collection.CollectionUtil;
|
|||||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||||
import com.njcn.csdevice.api.*;
|
import com.njcn.csdevice.api.*;
|
||||||
|
import com.njcn.csdevice.param.IcdBzParam;
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
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.po.RStatIntegrityD;
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
|
||||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.DataVo;
|
import com.njcn.csharmonic.pojo.vo.DataVo;
|
||||||
import com.njcn.csharmonic.pojo.vo.HalfMonthReportVO;
|
import com.njcn.csharmonic.pojo.vo.HalfMonthReportVO;
|
||||||
@@ -110,9 +110,17 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
|
|||||||
List<String> lineList = csLineList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
List<String> lineList = csLineList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||||
List<String> deviceList = csLineList.stream().map(CsLinePO::getDeviceId).collect(Collectors.toList());
|
List<String> deviceList = csLineList.stream().map(CsLinePO::getDeviceId).collect(Collectors.toList());
|
||||||
//获取监测点数据完整性
|
//获取监测点数据完整性
|
||||||
List<RStatIntegrityD> list1 = integrityFeignClient.list(lineList,param.getStartTime(),param.getEndTime()).getData();
|
IcdBzParam param1 = new IcdBzParam();
|
||||||
|
param1.setLineList(lineList);
|
||||||
|
param1.setStartTime(param.getStartTime());
|
||||||
|
param1.setEndTime(param.getEndTime());
|
||||||
|
List<RStatIntegrityD> list1 = integrityFeignClient.list(param1).getData();
|
||||||
//获取终端在线率
|
//获取终端在线率
|
||||||
List<RStatOnlineRateD> list2 = onlineRateFeignClient.list(deviceList,param.getStartTime(),param.getEndTime()).getData();
|
IcdBzParam param2 = new IcdBzParam();
|
||||||
|
param2.setLineList(deviceList);
|
||||||
|
param2.setStartTime(param.getStartTime());
|
||||||
|
param2.setEndTime(param.getEndTime());
|
||||||
|
List<RStatOnlineRateD> list2 = onlineRateFeignClient.list(param2).getData();
|
||||||
//获取监测点最新数据时间
|
//获取监测点最新数据时间
|
||||||
List<CsLineLatestData> list3 = csLineLatestDataFeignClient.listData().getData();
|
List<CsLineLatestData> list3 = csLineLatestDataFeignClient.listData().getData();
|
||||||
equipmentDeliveryList.forEach(dev->{
|
equipmentDeliveryList.forEach(dev->{
|
||||||
@@ -129,7 +137,8 @@ public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService
|
|||||||
vo.setOperationalTime(dev.getCreateTime());
|
vo.setOperationalTime(dev.getCreateTime());
|
||||||
vo.setOperationalStatus(dev.getUsageStatus() == 0 ? "停运" : "在运");
|
vo.setOperationalStatus(dev.getUsageStatus() == 0 ? "停运" : "在运");
|
||||||
if (Objects.equals(line.getName(),"治理监测点")) {
|
if (Objects.equals(line.getName(),"治理监测点")) {
|
||||||
vo.setLineName(line.getName() + "(" + map.get(dev.getId()).getModuleNumber() + "模块)");
|
int moduleNumber = Objects.isNull(map.get(dev.getId()).getModuleNumber()) ? 0 : map.get(dev.getId()).getModuleNumber();
|
||||||
|
vo.setLineName(line.getName() + "(" + moduleNumber + "模块)");
|
||||||
} else {
|
} else {
|
||||||
vo.setLineName(line.getName());
|
vo.setLineName(line.getName());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user