Compare commits
23 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24187ca6d9 | ||
| f33986e934 | |||
|
|
cea2b9694a | ||
| 8e4c4383c0 | |||
| cdd1b5075c | |||
| ea54b2b907 | |||
|
|
61c8656fd9 | ||
| 02e5100426 | |||
| 85ae7e7ddb | |||
| 9ae17b14f5 | |||
|
|
f7477ea8ff | ||
| 9c6a74a2d6 | |||
| d346e80a88 | |||
|
|
0227d0731c | ||
|
|
e34721c035 | ||
| 2451df7d8d | |||
| 6e5aab4791 | |||
| adb811e9df | |||
|
|
340ba18f99 | ||
|
|
e320685af1 | ||
|
|
400b9fd9c1 | ||
|
|
ce0b9892c2 | ||
| 2fb11ecaaf |
@@ -35,12 +35,6 @@
|
||||
<artifactId>common-microservice</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-warn-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
@@ -59,6 +53,12 @@
|
||||
<artifactId>common-device-biz</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>cn.afterturn</groupId>
|
||||
<artifactId>easypoi-base</artifactId>
|
||||
<version>4.4.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -22,4 +22,13 @@ public interface CsCommTerminalFeignClient {
|
||||
|
||||
@GetMapping("lineUnitDetail")
|
||||
HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId);
|
||||
|
||||
@GetMapping("getDevIdsByUser")
|
||||
HttpResult<List<String>> getDevIdsByUser(@RequestParam("userId") String userId);
|
||||
|
||||
@GetMapping("getLineIdsByUser")
|
||||
HttpResult<List<String>> getLineIdsByUser(@RequestParam("userId") String userId);
|
||||
|
||||
@GetMapping("getPqUserIdsByUser")
|
||||
HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.api;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -22,4 +23,10 @@ public interface CsDeviceUserFeignClient {
|
||||
|
||||
@PostMapping("/findUserById")
|
||||
HttpResult<List<String>> findUserById(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/findDevByUserId")
|
||||
HttpResult<List<String>> findDevByUserId(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/channelDevByUserId")
|
||||
HttpResult<List<String>> channelDevByUserId(@RequestBody UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -42,5 +42,15 @@ public interface CsLedgerFeignClient {
|
||||
@PostMapping("/getAllLedger")
|
||||
HttpResult<List<CsLedgerVO>> getAllLedger();
|
||||
|
||||
@PostMapping("/getInfoByIds")
|
||||
HttpResult<List<DevDetailDTO>> getInfoByIds(@RequestBody @Validated List<String> list);
|
||||
|
||||
@PostMapping("/getDevInfoByEngineerIds")
|
||||
@ApiOperation("根据工程获取设备信息")
|
||||
HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(@RequestBody @Validated List<String> list);
|
||||
|
||||
@PostMapping("/getEngineeringHaveDevs")
|
||||
@ApiOperation("根据工程信息获取有设备的工程")
|
||||
HttpResult<List<DevDetailDTO>> getEngineeringHaveDevs(@RequestBody @Validated List<String> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -48,4 +54,21 @@ public interface CsLineFeignClient {
|
||||
|
||||
@PostMapping("/updateLineDataByList")
|
||||
HttpResult<String> updateDataByList(@RequestParam("list") List<String> list, @RequestParam("id") String id, @RequestParam("setId") String setId);
|
||||
|
||||
@PostMapping("/getLineByName")
|
||||
HttpResult<List<CsLinePO>> getLineByName(@RequestParam("lineName") String lineName);
|
||||
|
||||
@PostMapping("/getAllLine")
|
||||
HttpResult<List<String>> getAllLine();
|
||||
|
||||
@PostMapping("/getOverLimitDataByIds")
|
||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list);
|
||||
|
||||
@PostMapping("/list")
|
||||
HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param);
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@@ -31,6 +33,24 @@ public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory
|
||||
log.error("{}异常,降级处理,异常为:{}","查询分组",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getDevIdsByUser(String userId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取用户所有设备id集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getLineIdsByUser(String userId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取用户所有监测点id集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getPqUserIdsByUser(String userId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据登录用户id获取电能质量用户id集合",cause.toString());
|
||||
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.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -38,6 +39,18 @@ public class CsDeviceUserClientFallbackFactory implements FallbackFactory<CsDevi
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> findDevByUserId(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据用户Id查询设备集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> channelDevByUserId(UserDevParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据用户Id解绑设备集合异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,6 +68,24 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
|
||||
log.error("{}异常,降级处理,异常为:{}","获取台账树所有数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getInfoByIds(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据设备集合查询工程,设备信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据工程获取设备信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<DevDetailDTO>> getEngineeringHaveDevs(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据工程获取设备信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -86,6 +87,35 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置集合修改监测点信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<String>> getAllLine() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有监测点id",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<Overlimit>> getOverLimitData(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取国标限值异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(List<String> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据敏感用户查询监测点异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getLineByName(String lineName) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据名称查询监测点异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> list(CsLinePO param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询监测点列表异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -105,4 +105,27 @@ public class CsLineParam extends BaseEntity {
|
||||
* 运行状态(0:运行;1:检修;2:停运;3:调试;4:退运)
|
||||
*/
|
||||
private Integer runStatus;
|
||||
|
||||
/**
|
||||
* 短路容量
|
||||
*/
|
||||
private Integer shortCircuitCapacity;
|
||||
|
||||
/**
|
||||
* 设备容量
|
||||
*/
|
||||
private Integer devCapacity;
|
||||
|
||||
/**
|
||||
* 基准容量
|
||||
*/
|
||||
private Integer basicCapacity;
|
||||
|
||||
/**
|
||||
* 协议容量
|
||||
*/
|
||||
private Integer protocolCapacity;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class UserDevParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(value="用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value="设备集合id")
|
||||
private List<String> list;
|
||||
|
||||
}
|
||||
@@ -122,4 +122,23 @@ public class CsLinePO extends BaseEntity {
|
||||
*/
|
||||
@TableField(value = "line_no")
|
||||
private Integer lineNo;
|
||||
/**
|
||||
* 监测对象类型
|
||||
*/
|
||||
@TableField(value = "monitor_obj")
|
||||
private String monitorObj;
|
||||
/**
|
||||
* 是否治理(0:未治理 1:已治理)
|
||||
*/
|
||||
@TableField(value = "is_govern")
|
||||
private Integer govern;
|
||||
|
||||
@TableField(value = "monitor_user")
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 治理报告文件路径
|
||||
*/
|
||||
@TableField(value = "report_file_path")
|
||||
private String reportFilePath;
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
@@ -60,6 +61,12 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("暂降幅值")
|
||||
private Float featureAmplitude;
|
||||
|
||||
@ApiModelProperty("映射数据库暂降幅值")
|
||||
private Double amplitude;
|
||||
|
||||
@ApiModelProperty("严重度")
|
||||
private String severity;
|
||||
|
||||
@ApiModelProperty("波形路径")
|
||||
private String wavePath;
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.cswarn.pojo.vo.CsEquipmentAlarmVO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
@Data
|
||||
public class PqSensitiveUserLineVO {
|
||||
@ApiModelProperty("治理对象")
|
||||
private String sensitiveUser;
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
@ApiModelProperty("测点名称")
|
||||
private String lineName;
|
||||
@ApiModelProperty("是否治理")
|
||||
private String govern;
|
||||
@ApiModelProperty("电压等级")
|
||||
private double volGrade;
|
||||
@ApiModelProperty("监测类型")
|
||||
private String position;
|
||||
@ApiModelProperty("运行状态")
|
||||
private String runStatus;
|
||||
@ApiModelProperty("报告文件")
|
||||
private String reportFilePath;
|
||||
@ApiModelProperty("最新数据时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||
private LocalDateTime latestTime;
|
||||
}
|
||||
@@ -88,11 +88,6 @@
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.5</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-warn-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- zxing生成二维码 -->
|
||||
<dependency>
|
||||
@@ -153,12 +148,21 @@
|
||||
<artifactId>access-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-mq</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-mq</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -12,7 +12,11 @@ import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import com.njcn.csdevice.service.ICsGroupService;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.param.FittingDataQueryParam;
|
||||
import com.njcn.csharmonic.param.SensitiveUserTrendDataQueryParam;
|
||||
import com.njcn.csharmonic.param.TrendDataQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -21,9 +25,11 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -143,5 +149,39 @@ public class CsGroupController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/trendData")
|
||||
@ApiOperation("查询指标趋势图数据")
|
||||
@ApiImplicitParam(name = "param",required = true)
|
||||
public HttpResult<List<ThdDataVO>> trendData(@RequestBody @Validated TrendDataQueryParam param){
|
||||
String methodDescribe = getMethodDescribe("trendData");
|
||||
List<ThdDataVO> list = csGroupService.trendData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/fittingData")
|
||||
@ApiOperation("查询指标拟合图数据")
|
||||
@ApiImplicitParam(name = "param",required = true)
|
||||
public HttpResult<List<ThdDataVO>> fittingData(@RequestBody @Validated FittingDataQueryParam param){
|
||||
String methodDescribe = getMethodDescribe("fittingData");
|
||||
List<ThdDataVO> list = csGroupService.fittingData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/sensitiveUserTrendData")
|
||||
@ApiOperation("查询监测对象电网侧和负载侧监测点指标趋势对比数据")
|
||||
@ApiImplicitParam(name = "param",required = true)
|
||||
public HttpResult<Map<String,List<ThdDataVO>>> sensitiveUserTrendData(@RequestBody @Validated SensitiveUserTrendDataQueryParam param){
|
||||
String methodDescribe = getMethodDescribe("sensitiveUserTrendData");
|
||||
Map<String,List<ThdDataVO>> result = csGroupService.sensitiveUserTrendData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.enums.DeviceOperate;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
@@ -140,4 +141,24 @@ public class DeviceUserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/findDevByUserId")
|
||||
@ApiOperation("根据用户Id查询设备集合")
|
||||
@ApiImplicitParam(name = "id", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> findDevByUserId(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("findDevByUserId");
|
||||
List<String> list = csDeviceUserPOService.findDevByUserId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/channelDevByUserId")
|
||||
@ApiOperation("根据用户Id解绑设备集合")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<String>> channelDevByUserId(@RequestBody UserDevParam param){
|
||||
String methodDescribe = getMethodDescribe("channelDevByUserId");
|
||||
csDeviceUserPOService.channelDevByUserId(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -405,4 +405,14 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getRunPortableDev")
|
||||
@ApiOperation("获取用户未绑定的在运的便携式设备")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getRunPortableDev(@RequestParam("userId") String userId){
|
||||
String methodDescribe = getMethodDescribe("getRunPortableDev");
|
||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getRunPortableDev(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,13 +1,24 @@
|
||||
package com.njcn.csdevice.controller.ledger;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -17,7 +28,11 @@ import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
@@ -34,7 +49,89 @@ public class CsCommTerminalController extends BaseController {
|
||||
|
||||
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
||||
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
/**
|
||||
* 根据用户获取设备信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDevIdsByUser")
|
||||
@ApiOperation("根据登录用户id获取用户所有设备id集合")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getDevIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getDevIdsByUser");
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devIds, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户获取设备信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getLineIdsByUser")
|
||||
@ApiOperation("根据登录用户id获取用户所有监测点id集合")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getLineIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}else {
|
||||
List<String> result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 根据用户获取设备信息
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getPqUserIdsByUser")
|
||||
@ApiOperation("根据登录用户id获取电能质量用户id集合")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<String>> getPqUserIdsByUser(@RequestParam("userId") String userId) {
|
||||
String methodDescribe = getMethodDescribe("getPqUserIdsByUser");
|
||||
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus,DataStateEnum.ENABLE.getCode()).list();
|
||||
if(CollUtil.isEmpty(poList)){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}else {
|
||||
List<String> result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, Collections.emptyList(), methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<String> commGetDevIds(String userId){
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if(userVO.getType().equals(UserType.SUPER_ADMINISTRATOR ) || userVO.getType().equals(UserType.ADMINISTRATOR )){
|
||||
devIds = csEquipmentDeliveryService.getAll().stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
List<CsDeviceUserPO> devList = csDeviceUserPOService.lambdaQuery().select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过监测点获取监测点数据单位
|
||||
|
||||
@@ -165,5 +165,35 @@ public class CsLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getInfoByIds")
|
||||
@ApiOperation("根据设备集合查询工程,设备信息")
|
||||
@ApiImplicitParam(name = "list", value = "查询条件", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getInfoByIds(@RequestBody @Validated List<String> list){
|
||||
String methodDescribe = getMethodDescribe("getInfoByIds");
|
||||
List<DevDetailDTO> details = csLedgerService.getInfoByIds(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDevInfoByEngineerIds")
|
||||
@ApiOperation("根据工程获取设备信息")
|
||||
@ApiImplicitParam(name = "list", value = "查询条件", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getDevInfoByEngineerIds(@RequestBody @Validated List<String> list){
|
||||
String methodDescribe = getMethodDescribe("getDevInfoByEngineerIds");
|
||||
List<DevDetailDTO> details = csLedgerService.getDevInfoByEngineerIds(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEngineeringHaveDevs")
|
||||
@ApiOperation("根据工程信息获取有设备的工程")
|
||||
@ApiImplicitParam(name = "list", value = "查询条件", required = true)
|
||||
public HttpResult<List<DevDetailDTO>> getEngineeringHaveDevs(@RequestBody @Validated List<String> list){
|
||||
String methodDescribe = getMethodDescribe("getEngineeringHaveDevs");
|
||||
List<DevDetailDTO> details = csLedgerService.getEngineeringHaveDevs(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.csdevice.controller.line;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -9,19 +11,19 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.*;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
@@ -136,12 +138,12 @@ public class CslineController extends BaseController {
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitData")
|
||||
@ApiOperation("根据监测点id获取国标限值")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitData");
|
||||
Overlimit result = overlimitMapper.selectById(id);
|
||||
@PostMapping("/getOverLimitDataByIds")
|
||||
@ApiOperation("根据监测点id集合获取国标限值")
|
||||
@ApiImplicitParam(name = "ids", value = "监测点id集合", required = true)
|
||||
public HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitDataByIds");
|
||||
List<Overlimit> result = overlimitMapper.selectBatchIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -220,4 +222,84 @@ public class CslineController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAllLine")
|
||||
@ApiOperation("获取系统中所有监测点id")
|
||||
public HttpResult<List<String>> getAllLine(){
|
||||
String methodDescribe = getMethodDescribe("getAllLine");
|
||||
List<String> list = csLinePOService.getAllLine();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getSimpleLine")
|
||||
@ApiOperation("查询登录用户拥有的监测点台账")
|
||||
public HttpResult<List<CsLinePO>> getSimpleLine(){
|
||||
String methodDescribe = getMethodDescribe("getSimpleLine");
|
||||
List<CsLinePO> list = csLinePOService.getSimpleLine();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineByName")
|
||||
@ApiOperation("根据名称获取监测点")
|
||||
@ApiImplicitParam(name = "lineName", value = "监测点名称", required = true)
|
||||
public HttpResult<List<CsLinePO>> getLineByName(@RequestParam("lineName") String lineName) {
|
||||
String methodDescribe = getMethodDescribe("getLineByName");
|
||||
List<CsLinePO> list = csLinePOService.getLineByName(lineName);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询监测点列表")
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<CsLinePO> list = csLinePOService.list(new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.eq(StrUtil.isNotBlank(param.getPosition()), CsLinePO::getPosition, param.getPosition())
|
||||
.orderByAsc(CsLinePO::getName));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineBySensitiveUser")
|
||||
@ApiOperation("根据敏感用户查询监测点")
|
||||
public HttpResult<List<CsLinePO>> getLineBySensitiveUser(@RequestBody List<String> list) {
|
||||
String methodDescribe = getMethodDescribe("getLineBySensitiveUser");
|
||||
List<CsLinePO> result = csLinePOService.getLineBySensitiveUser(list);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSensitiveUserLineList")
|
||||
@ApiOperation("获取敏感负荷用户监测点列表")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqSensitiveUserLineVO>> getSensitiveUserLineList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
Page<PqSensitiveUserLineVO> page = csLinePOService.getSensitiveUserLineList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/uploadReport")
|
||||
@ApiOperation("上传治理报告")
|
||||
public HttpResult<Boolean> uploadReport(@ApiParam(value = "文件",name="报告文件", required = true) @RequestPart("file") MultipartFile file,@ApiParam(value = "lineId", name="监测点ID", required = true) @RequestParam String lineId) {
|
||||
String methodDescribe = getMethodDescribe("uploadReport");
|
||||
boolean success = csLinePOService.uploadReport(file, lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, success, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getReportUrl")
|
||||
@ApiOperation("获取治理报告链接")
|
||||
public HttpResult<String> getReportUrl(@ApiParam(value = "lineId", name="监测点ID", required = true) @RequestParam String lineId) {
|
||||
String methodDescribe = getMethodDescribe("getReportUrl");
|
||||
String url = csLinePOService.getReportUrl(lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, url, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryPageParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import com.njcn.csdevice.service.CsEngineeringService;
|
||||
@@ -94,4 +95,14 @@ public class EngineeringController extends BaseController {
|
||||
CsEngineeringPO po = csEngineeringService.queryEngineeringById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getUnlinkedEngineering")
|
||||
@ApiOperation("获取用户未绑定的工程信息")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<List<CsEngineeringPO>> getUnlinkedEngineering(@RequestParam("userId") String userId){
|
||||
String methodDescribe = getMethodDescribe("getUnlinkedEngineering");
|
||||
List<CsEngineeringPO> result = csEngineeringService.getUnlinkedEngineering(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@
|
||||
from
|
||||
cs_equipment_delivery
|
||||
<where>
|
||||
1=1
|
||||
dev_access_method = 'MQTT'
|
||||
<if test="queryParam.process != null and queryParam.process !=''">
|
||||
and process = #{queryParam.process}
|
||||
</if>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
@@ -48,4 +49,8 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
* @return
|
||||
*/
|
||||
List<String> findUserById(String devId);
|
||||
|
||||
List<String> findDevByUserId(String userId);
|
||||
|
||||
void channelDevByUserId(UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -57,4 +57,6 @@ public interface CsEngineeringService extends IService<CsEngineeringPO>{
|
||||
List<CsEngineeringPO> getEngineerings(List<String> list);
|
||||
|
||||
CsEngineeringPO queryEngineeringById(String id);
|
||||
|
||||
List<CsEngineeringPO> getUnlinkedEngineering(String userId);
|
||||
}
|
||||
|
||||
@@ -193,4 +193,6 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
|
||||
List<CsEquipmentDeliveryPO> getListByIds(List<String> devList);
|
||||
|
||||
List<CsEquipmentDeliveryPO> getRunPortableDev(String userId);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,12 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -70,4 +73,14 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
* @return
|
||||
*/
|
||||
List<CsLinePO> getLineByName(String lineName);
|
||||
|
||||
List<String> getAllLine();
|
||||
|
||||
List<CsLinePO> getSimpleLine();
|
||||
|
||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
||||
|
||||
Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param);
|
||||
boolean uploadReport(MultipartFile file, String lineId);
|
||||
String getReportUrl(String lineId);
|
||||
}
|
||||
|
||||
@@ -7,12 +7,15 @@ import com.njcn.csdevice.pojo.po.CsGroup;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.param.FittingDataQueryParam;
|
||||
import com.njcn.csharmonic.param.SensitiveUserTrendDataQueryParam;
|
||||
import com.njcn.csharmonic.param.TrendDataQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -78,4 +81,25 @@ public interface ICsGroupService extends IService<CsGroup> {
|
||||
*/
|
||||
void deleteGroup(String groupId);
|
||||
|
||||
|
||||
/**
|
||||
* 查询趋势数据
|
||||
* @param trendDataQueryParam
|
||||
* @return
|
||||
*/
|
||||
List<ThdDataVO> trendData(TrendDataQueryParam trendDataQueryParam);
|
||||
/**
|
||||
* 查询指标拟合图数据
|
||||
* @param fittingDataQueryParam
|
||||
* @return
|
||||
*/
|
||||
List<ThdDataVO> fittingData(FittingDataQueryParam fittingDataQueryParam);
|
||||
|
||||
/**
|
||||
* 查询敏感用户趋势数据
|
||||
* @param sensitiveUserTrendDataQueryParam
|
||||
* @return
|
||||
*/
|
||||
Map<String,List<ThdDataVO>> sensitiveUserTrendData(SensitiveUserTrendDataQueryParam sensitiveUserTrendDataQueryParam);
|
||||
|
||||
}
|
||||
|
||||
@@ -85,4 +85,11 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getProAndEngineer(List<String> id);
|
||||
|
||||
CsLedgerVO cldTree();
|
||||
|
||||
List<DevDetailDTO> getInfoByIds(List<String> list);
|
||||
|
||||
List<DevDetailDTO> getDevInfoByEngineerIds(List<String> list);
|
||||
|
||||
List<DevDetailDTO> getEngineeringHaveDevs(List<String> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
@@ -12,6 +11,7 @@ import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDeviceUserPOMapper;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsMarketDataMapper;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
@@ -51,22 +51,17 @@ import static java.util.Objects.isNull;
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper, CsDeviceUserPO> implements CsDeviceUserPOService{
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
// private final CsEquipmentAlarmFeignClient csEquipmentAlarmFeignClient;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
|
||||
private final AppLineTopologyDiagramService appLineTopologyDiagramService;
|
||||
|
||||
private final CsTouristDataPOService csTouristDataPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final CsMarketDataMapper csMarketDataMapper;
|
||||
private final EventUserFeignClient eventUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
private final FeedBackFeignClient feedBackFeignClient;
|
||||
private final IMqttUserService mqttUserService;
|
||||
|
||||
@@ -407,4 +402,22 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> findDevByUserId(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getPrimaryUserId,userId).list();
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
result = list.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelDevByUserId(UserDevParam param) {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,param.getUserId())
|
||||
.in(CsDeviceUserPO::getDeviceId,param.getList());
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,17 +2,20 @@ package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
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.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
||||
import com.njcn.csdevice.mapper.CsEngineeringUserMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.mapper.CsMarketDataMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryPageParm;
|
||||
@@ -20,7 +23,6 @@ import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import com.njcn.csdevice.service.CsEngineeringService;
|
||||
import com.njcn.csdevice.service.CsMarketDataService;
|
||||
import com.njcn.csdevice.service.CsTouristDataPOService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
@@ -34,10 +36,8 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -58,12 +58,10 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final CsEngineeringUserMapper csEngineeringUserMapper;
|
||||
private final RoleEngineerDevServiceImpl roleEngineerDevService;
|
||||
|
||||
private final CsMarketDataMapper csMarketDataMapper;
|
||||
private final CsTouristDataPOService csTouristDataPOService;
|
||||
|
||||
|
||||
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
@@ -222,6 +220,45 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
return this.lambdaQuery().eq(CsEngineeringPO::getId,id).eq(CsEngineeringPO::getStatus,"1").one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsEngineeringPO> getUnlinkedEngineering(String userId) {
|
||||
List<CsEngineeringPO> result = new ArrayList<>();
|
||||
List<String> list1 = new ArrayList<>();
|
||||
//根据用户信息获取设备信息
|
||||
List<String> devList = csDeviceUserFeignClient.findDevByUserId(userId).getData();
|
||||
//根据设备查询工程信息
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
List<DevDetailDTO> ledger = csLedgerFeignClient.getInfoByIds(devList).getData();
|
||||
ledger.forEach(item->{
|
||||
if (!Objects.equals(item.getEngineeringid(),"/")) {
|
||||
list1.add(item.getEngineeringid());
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取有设备的工程信息
|
||||
LambdaQueryWrapper<CsEngineeringPO> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.eq(CsEngineeringPO::getStatus,"1");
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
queryWrapper2.notIn(CsEngineeringPO::getId,list1);
|
||||
}
|
||||
List<CsEngineeringPO> list = this.baseMapper.selectList(queryWrapper2);
|
||||
//剔除没有设备的工程
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Map<String, CsEngineeringPO> map = list.stream().collect(Collectors.toMap(CsEngineeringPO::getId, Function.identity()));
|
||||
List<String> list2 = list.stream().map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||
List<DevDetailDTO> ledger = csLedgerFeignClient.getEngineeringHaveDevs(list2).getData();
|
||||
if (CollectionUtil.isNotEmpty(ledger)) {
|
||||
ledger.forEach(item->{
|
||||
CsEngineeringPO po = new CsEngineeringPO();
|
||||
po.setId(item.getEngineeringid());
|
||||
po.setName(map.get(item.getEngineeringid()).getName());
|
||||
result.add(po);
|
||||
});
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
public String getAreaById(String id){
|
||||
|
||||
|
||||
@@ -48,6 +48,7 @@ import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -985,6 +986,25 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return this.lambdaQuery().in(CsEquipmentDeliveryPO::getId,devList).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
||||
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
||||
DictTreeVO vo = dictTreeFeignClient.queryByCode(DicDataEnum.PORTABLE.getCode()).getData();
|
||||
if (ObjectUtil.isNotNull(vo)) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
||||
//获取用户已经绑定的便携式设备
|
||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId,devList);
|
||||
}
|
||||
result = this.list(lambdaQueryWrapper);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
//根据前置机id获取装置数量
|
||||
public List<CsEquipmentDeliveryPO> getListByNodeId(String nodeId) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.json.JSONObject;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -31,8 +34,7 @@ import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.*;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
@@ -41,10 +43,8 @@ import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.api.*;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.system.pojo.vo.CsStatisticalSetVO;
|
||||
@@ -59,6 +59,7 @@ import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
@@ -85,7 +86,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
private final EvtDataService evtDataService;
|
||||
@@ -95,6 +95,11 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
private final EventFeignClient eventFeignClient;
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -784,6 +789,387 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThdDataVO> trendData(TrendDataQueryParam trendDataQueryParam) {
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
CsLinePO finalCsLinePO = csLineFeignClient.getById(trendDataQueryParam.getLineId()).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePO.getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
Double pt = finalCsLinePO.getPtRatio();
|
||||
if(CollectionUtil.isNotEmpty(trendDataQueryParam.getList())) {
|
||||
for (TrendDataQueryParam param : trendDataQueryParam.getList()) {
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
|
||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(trendDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(trendDataQueryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||
|
||||
commonQueryParam.setDataType(trendDataQueryParam.getValueType());
|
||||
|
||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
||||
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(Objects.equals("M", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||
String position = finalCsLinePO.getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
if (temp.getValue() != null) {
|
||||
double re = 0;
|
||||
if (Objects.equals("Primary", trendDataQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue() / 1000));
|
||||
vo.setStatisticalData(re);
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = temp.getValue() * pt / 1000;
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
case "*CT":
|
||||
re = temp.getValue() * ct;
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
case "*PT*CT":
|
||||
re = temp.getValue() * pt * ct / 1000;
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
default:
|
||||
re = temp.getValue();
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
}
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
} else {
|
||||
re = temp.getValue();
|
||||
unit = epdPqd.getUnit();
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = temp.getValue() / pt;
|
||||
break;
|
||||
case "*CT":
|
||||
re = temp.getValue() / ct;
|
||||
break;
|
||||
case "*PT*CT":
|
||||
re = temp.getValue() / pt / ct;
|
||||
break;
|
||||
default:
|
||||
re = temp.getValue();
|
||||
break;
|
||||
}
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
} else {
|
||||
re = temp.getValue();
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
}
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(null);
|
||||
if (Objects.equals("Primary", trendDataQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
case "*CT":
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
case "*PT*CT":
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
default:
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
vo.setUnit(unit);
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
result.addAll(collect1);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThdDataVO> fittingData(FittingDataQueryParam fittingDataQueryParam) {
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
CsLinePO finalCsLinePO = csLineFeignClient.getById(fittingDataQueryParam.getLineId()).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePO.getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
Double pt = finalCsLinePO.getPtRatio();
|
||||
// String position = finalCsLinePO.getPosition();
|
||||
Overlimit overlimit = overlimitMapper.selectById(finalCsLinePO.getLineId());
|
||||
JSONObject entries = JSONUtil.parseObj(overlimit);
|
||||
if(CollectionUtil.isNotEmpty(fittingDataQueryParam.getList())) {
|
||||
for (FittingDataQueryParam param : fittingDataQueryParam.getList()) {
|
||||
String dictCode = dictTreeFeignClient.queryById(param.getStatisticalId()).getData().getCode();
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||
List<ThdDataVO> dataList = new ArrayList<>();
|
||||
for (EleEpdPqd epdPqd : eleEpdPqds) {
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(finalCsLinePO.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName() + (StringUtils.isEmpty(param.getFrequency()) ? "" : "_" + param.getFrequency()));
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
|
||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(fittingDataQueryParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(fittingDataQueryParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||
// 兼容用户功率需要该参数过滤
|
||||
String dataType = param.getValueType();
|
||||
if (StrUtil.isEmpty(dataType)) {
|
||||
// 电能质量指标,取限值计算类型,判断是否越限
|
||||
dataType = epdPqd.getFormula();
|
||||
}
|
||||
commonQueryParam.setDataType(dataType);
|
||||
|
||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(finalCsLinePO.getLineId()));
|
||||
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getNewDeviceRtDataByTime(Collections.singletonList(commonQueryParam));
|
||||
dataList = deviceRtData.stream().map(temp -> {
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
// vo.setLineName(finalCsLinePO.getName());
|
||||
vo.setPhase(Objects.equals("M", temp.getPhaseType()) ? null : temp.getPhaseType());
|
||||
// vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
vo.setStatMethod(commonQueryParam.getDataType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
if (temp.getValue() != null) {
|
||||
double re;
|
||||
if (Objects.equals("Primary", fittingDataQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue() / 1000));
|
||||
vo.setStatisticalData(re);
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = temp.getValue() * pt / 1000;
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
case "*CT":
|
||||
re = temp.getValue() * ct;
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
case "*PT*CT":
|
||||
re = temp.getValue() * pt * ct / 1000;
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
default:
|
||||
re = temp.getValue();
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
}
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
} else {
|
||||
re = temp.getValue();
|
||||
unit = epdPqd.getUnit();
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
}
|
||||
|
||||
}
|
||||
} else {
|
||||
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = temp.getValue() / pt;
|
||||
break;
|
||||
case "*CT":
|
||||
re = temp.getValue() / ct;
|
||||
break;
|
||||
case "*PT*CT":
|
||||
re = temp.getValue() / pt / ct;
|
||||
break;
|
||||
default:
|
||||
re = temp.getValue();
|
||||
break;
|
||||
}
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
} else {
|
||||
re = temp.getValue();
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
}
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(null);
|
||||
if (Objects.equals("Primary", fittingDataQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary", csDataSet.getDataLevel())) {
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (Objects.nonNull(epdPqd.getPrimaryFormula())) {
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
case "*CT":
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
case "*PT*CT":
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
default:
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
vo.setUnit(unit);
|
||||
// vo.setStatisticalIndex(epdPqd.getId());
|
||||
// vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setStatisticalIndex(param.getStatisticalId());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
// 电能质量指标(越限为1,不越限为0)
|
||||
List<String> hasKeys = entries.keySet().stream().filter(key -> key.startsWith(dictCode)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(hasKeys)) {
|
||||
List<ThdDataVO> limitDataList = new ArrayList<>();
|
||||
Map<Instant, List<ThdDataVO>> timeMap = dataList.stream().collect(Collectors.groupingBy(ThdDataVO::getTime));
|
||||
// 限值
|
||||
ThdDataVO data;
|
||||
for (Map.Entry<Instant, List<ThdDataVO>> entry: timeMap.entrySet()) {
|
||||
data = new ThdDataVO();
|
||||
List<ThdDataVO> list = entry.getValue();
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
ThdDataVO thdDataVO = list.get(0);
|
||||
// data.setPosition(thdDataVO.getPosition());
|
||||
data.setLineId(thdDataVO.getLineId());
|
||||
// data.setLineName(thdDataVO.getLineName());
|
||||
data.setFrequency(param.getFrequency());
|
||||
data.setStatMethod(thdDataVO.getStatMethod());
|
||||
data.setUnit(thdDataVO.getUnit());
|
||||
data.setAnotherName(thdDataVO.getAnotherName());
|
||||
data.setStatisticalIndex(param.getStatisticalId());
|
||||
}
|
||||
Instant time = entry.getKey();
|
||||
data.setTime(time);
|
||||
|
||||
double limitValue = entries.getDouble(dictCode + (StringUtils.isEmpty(param.getFrequency()) ? "" : param.getFrequency()));
|
||||
double maxValue = list.stream().filter(v -> ObjectUtil.isNotEmpty(v.getStatisticalData())).mapToDouble(ThdDataVO::getStatisticalData).max().orElse(0.0);
|
||||
// 越限为1,不越限为0
|
||||
data.setStatisticalData(maxValue > limitValue ? 1.0 : 0.0);
|
||||
limitDataList.add(data);
|
||||
}
|
||||
limitDataList.sort(Comparator.comparing(ThdDataVO::getTime));
|
||||
result.addAll(limitDataList);
|
||||
} else {
|
||||
result.addAll(dataList);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, List<ThdDataVO>> sensitiveUserTrendData(SensitiveUserTrendDataQueryParam param) {
|
||||
Map<String, List<ThdDataVO>> result = new HashMap<>();
|
||||
result.put("before", new ArrayList<>());
|
||||
result.put("after", new ArrayList<>());
|
||||
String sensitiveUserId = param.getSensitiveUserId();
|
||||
List<CsLinePO> linePOList = csLineFeignClient.getLineBySensitiveUser(Collections.singletonList(sensitiveUserId)).getData();
|
||||
if (CollUtil.isEmpty(linePOList)) {
|
||||
return result;
|
||||
}
|
||||
DictData loadSideDictData = dicDataFeignClient.getDicDataByCode(LOAD_SIDE_DICT_CODE).getData();
|
||||
DictData gridSideDictData = dicDataFeignClient.getDicDataByCode(GRID_SIDE_DICT_CODE).getData();
|
||||
CsLinePO gridSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(gridSideDictData.getId())).findFirst().orElse(null);
|
||||
CsLinePO loadSideLine = linePOList.stream().filter(linePO -> linePO.getPosition().equals(loadSideDictData.getId())).findFirst().orElse(null);
|
||||
TrendDataQueryParam trendDataQueryParam = new TrendDataQueryParam();
|
||||
trendDataQueryParam.setSearchBeginTime(param.getSearchBeginTime());
|
||||
trendDataQueryParam.setSearchEndTime(param.getSearchEndTime());
|
||||
trendDataQueryParam.setValueType(param.getValueType());
|
||||
trendDataQueryParam.setDataLevel(param.getDataLevel());
|
||||
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
||||
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
||||
TrendDataQueryParam queryParam = new TrendDataQueryParam();
|
||||
queryParam.setFrequency(item.getFrequency());
|
||||
queryParam.setStatisticalId(item.getStatisticalId());
|
||||
return queryParam;
|
||||
}).collect(Collectors.toList());
|
||||
trendDataQueryParam.setList(indexList);
|
||||
if (loadSideLine != null) {
|
||||
trendDataQueryParam.setLineId(loadSideLine.getLineId());
|
||||
List<ThdDataVO> thdDataList = this.trendData(trendDataQueryParam);
|
||||
result.put("before", thdDataList);
|
||||
}
|
||||
if (gridSideLine != null) {
|
||||
trendDataQueryParam.setLineId(gridSideLine.getLineId());
|
||||
List<ThdDataVO> thdDataList = this.trendData(trendDataQueryParam);
|
||||
result.put("after", thdDataList);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
private List<EnergyTemplateVO> getChildren(String tabId, List<EnergyTemplateVO> all) {
|
||||
return all.stream().filter(item -> item.getPid().equals(tabId)).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@@ -4,10 +4,12 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.controller.project.EngineeringController;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
@@ -22,6 +24,8 @@ import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -53,6 +57,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final EngineeringController engineeringController;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLedgerTree() {
|
||||
@@ -190,10 +196,29 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
//针对未启用的装置判断
|
||||
List<CsLedgerVO> ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//根据当前用户获取便携式设备
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
@@ -376,10 +401,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
|
||||
//针对未启用的装置判断
|
||||
List<CsLedgerVO> ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
@@ -743,6 +786,78 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return government;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getInfoByIds(List<String> list) {
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
List<CsLedger> ledgers = this.listByIds(list);
|
||||
Set<String> enginingeringIds = new HashSet<>();
|
||||
ledgers.forEach(item->{
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
if(Objects.equals(item.getPid(),"0")){
|
||||
device.setEquipmentName(item.getName());
|
||||
device.setEquipmentId(item.getId());
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
device.setEngineeringName("/");
|
||||
details.add(device);
|
||||
} else {
|
||||
enginingeringIds.add(item.getPids().split(",")[1]);
|
||||
}
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(enginingeringIds)) {
|
||||
List<CsLedger> engineer = this.listByIds(enginingeringIds);
|
||||
engineer.forEach(item->{
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEngineeringid(item.getId());
|
||||
detail.setEngineeringName(item.getName());
|
||||
details.add(detail);
|
||||
});
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getDevInfoByEngineerIds(List<String> list) {
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(CsLedger::getPid, list);
|
||||
List<CsLedger> project = this.list(queryWrapper);
|
||||
//工程id
|
||||
List<String> projectIds = project.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
dev.forEach(item->{
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEquipmentName(item.getName());
|
||||
detail.setEquipmentId(item.getId());
|
||||
details.add(detail);
|
||||
});
|
||||
return details;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getEngineeringHaveDevs(List<String> list) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLedger::getPid, item);
|
||||
List<CsLedger> project = this.list(queryWrapper);
|
||||
//工程id
|
||||
List<String> projectIds = project.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
if (CollectionUtil.isNotEmpty(dev)) {
|
||||
DevDetailDTO dto = new DevDetailDTO();
|
||||
dto.setEngineeringid(item);
|
||||
result.add(dto);
|
||||
}
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -1,29 +1,50 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -43,6 +64,15 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||
private final CsLineLatestDataFeignClient csLineLatestDataFeignClient;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineByDev(List<String> list) {
|
||||
@@ -213,7 +243,158 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineByName(String lineName) {
|
||||
return this.lambdaQuery().like(CsLinePO::getName,lineName).list();
|
||||
return this.lambdaQuery().eq(CsLinePO::getStatus, 1).like(CsLinePO::getName,lineName).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getAllLine() {
|
||||
return this.lambdaQuery()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.list()
|
||||
.stream()
|
||||
.map(CsLinePO::getLineId)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getSimpleLine() {
|
||||
List<String> devIds = commGetDevIds(RequestUtil.getUserIndex());
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = this.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getName).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
return poList;
|
||||
}else {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
private List<String> commGetDevIds(String userId){
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if(userVO.getType().equals(UserType.SUPER_ADMINISTRATOR ) || userVO.getType().equals(UserType.ADMINISTRATOR )){
|
||||
devIds = csEquipmentDeliveryMapper.selectList(new LambdaQueryWrapper<CsEquipmentDeliveryPO>().eq(CsEquipmentDeliveryPO::getStatus,DataStateEnum.ENABLE)).stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
}else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsDeviceUserPO::getDeviceId)
|
||||
.and(w->w.eq(CsDeviceUserPO::getPrimaryUserId,userId).or().eq(CsDeviceUserPO::getSubUserId,userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsDeviceUserPO> devList = this.csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineBySensitiveUser(List<String> list) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsLinePO::getMonitorUser,list)
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PqSensitiveUserLineVO> getSensitiveUserLineList(BaseParam param) {
|
||||
Page<PqSensitiveUserLineVO> result = new Page<>();
|
||||
result.setCurrent(param.getPageNum());
|
||||
result.setSize(param.getPageSize());
|
||||
|
||||
|
||||
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()),
|
||||
new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser)
|
||||
);
|
||||
BeanUtil.copyProperties(linePage, result);
|
||||
List<CsLinePO> records = linePage.getRecords();
|
||||
if (CollUtil.isEmpty(records)) {
|
||||
return result;
|
||||
}
|
||||
List<PqSensitiveUserLineVO> list = new ArrayList<>();
|
||||
List<String> sensitiveUserIds = list.stream().map(PqSensitiveUserLineVO::getSensitiveUser).distinct().collect(Collectors.toList());
|
||||
|
||||
Map<String, String> sensitiveUserNameMap = pqSensitiveUserFeignClient.getListByIds(sensitiveUserIds).getData()
|
||||
.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
PqSensitiveUserLineVO sensitiveUserLineVO;
|
||||
for (CsLinePO record : records) {
|
||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
||||
// 治理对象
|
||||
sensitiveUserLineVO.setSensitiveUser(sensitiveUserNameMap.getOrDefault(record.getMonitorUser(), null));
|
||||
// 测点名称
|
||||
sensitiveUserLineVO.setLineId(record.getLineId());
|
||||
sensitiveUserLineVO.setLineName(record.getName());
|
||||
// 是否治理
|
||||
if (ObjectUtil.isNotEmpty(record.getGovern())) {
|
||||
if (record.getGovern().equals(0)) {
|
||||
sensitiveUserLineVO.setGovern("未治理");
|
||||
}
|
||||
if (record.getGovern().equals(1)) {
|
||||
sensitiveUserLineVO.setGovern("已治理");
|
||||
}
|
||||
}
|
||||
// 监测类型
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
DictData positionDictData = dicDataFeignClient.getDicDataById(record.getPosition()).getData();
|
||||
if (positionDictData != null) {
|
||||
sensitiveUserLineVO.setPosition(positionDictData.getName());
|
||||
}
|
||||
// 电压等级
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
// 运行状态
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(record.getRunStatus()));
|
||||
// 报告文件
|
||||
sensitiveUserLineVO.setReportFilePath(record.getReportFilePath());
|
||||
// 最新数据时间
|
||||
List<CsLineLatestData> lineLatestDataList = csLineLatestDataFeignClient.listData().getData();
|
||||
if (CollUtil.isNotEmpty(lineLatestDataList)) {
|
||||
sensitiveUserLineVO.setLatestTime(lineLatestDataList.stream()
|
||||
.filter(item -> item.getLineId().equals(record.getLineId()))
|
||||
.map(CsLineLatestData::getTimeId)
|
||||
.max(LocalDateTime::compareTo)
|
||||
.orElse(null));
|
||||
}
|
||||
list.add(sensitiveUserLineVO);
|
||||
}
|
||||
result.setRecords(list);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean uploadReport(MultipartFile file, String lineId) {
|
||||
String filePath = fileStorageUtil.uploadMultipart(file, OssPath.GOVERN_HARMONIC_FILE);
|
||||
return this.update(new LambdaUpdateWrapper<CsLinePO>().eq(CsLinePO::getLineId, lineId).set(CsLinePO::getReportFilePath, filePath));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getReportUrl(String lineId) {
|
||||
CsLinePO linePO = this.getById(lineId);
|
||||
if (linePO != null) {
|
||||
String reportFilePath = linePO.getReportFilePath();
|
||||
if (StrUtil.isNotBlank(reportFilePath)) {
|
||||
return fileStorageUtil.getFileUrl(reportFilePath);
|
||||
}
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
private String getRunStatusDescription(Integer runStatus) {
|
||||
// 0:运行;1:检修;2:停运;3:调试;4:退运
|
||||
switch (runStatus) {
|
||||
case 0:
|
||||
return "运行";
|
||||
case 1:
|
||||
return "检修";
|
||||
case 2:
|
||||
return "停运";
|
||||
case 3:
|
||||
return "调试";
|
||||
case 4:
|
||||
return "退运";
|
||||
default:
|
||||
return "未知";
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
|
||||
@@ -88,11 +88,13 @@ public class CsTerminalReplyServiceImpl extends ServiceImpl<CsTerminalReplyMappe
|
||||
devNameListString = "[" + item.getDeviceName() + "]";
|
||||
}
|
||||
if (item.getIsReceived() == 0) {
|
||||
key = nodeName + item.getProcessNo() + "号进程下," + devNameListString + "设备" + code + "数据失败";
|
||||
key = nodeName + item.getProcessNo() + "号进程下," + devNameListString + "设备未收到应答";
|
||||
//将cs_terminal_logs数据置为未发送
|
||||
csTerminalLogsService.updateLaterData(item.getDeviceId(),item.getCode());
|
||||
} else {
|
||||
} else if (item.getIsReceived() == 1){
|
||||
key = nodeName + item.getProcessNo() + "号进程下," + devNameListString + "设备" + code + "数据成功";
|
||||
} else {
|
||||
key = nodeName + item.getProcessNo() + "号进程下," + devNameListString + "设备" + code + "数据失败";
|
||||
}
|
||||
result.add(key);
|
||||
});
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.access.utils.ChannelObjectUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.csdevice.param.IcdLedgerParam;
|
||||
import com.njcn.csdevice.param.IcdParam;
|
||||
@@ -23,6 +24,8 @@ import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.mq.message.BZEventMessage;
|
||||
import com.njcn.mq.template.BZEventMessageTemplate;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
@@ -58,6 +61,7 @@ class IcdServiceImpl implements IcdService {
|
||||
private final EventFeignClient eventFeignClient;
|
||||
private final ICsTerminalLogsService csTerminalLogsService;
|
||||
private final ICsTerminalReplyService csTerminalReplyService;
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final DateTimeFormatter microsecondFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||
|
||||
@Override
|
||||
@@ -123,7 +127,6 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addLedgerInfo(IcdLedgerParam param) {
|
||||
// 第一种:全流程创建
|
||||
if (isAllIndicesNull(param)) {
|
||||
@@ -579,7 +582,8 @@ class IcdServiceImpl implements IcdService {
|
||||
&& ObjectUtil.isNull(param.getDevIndex());
|
||||
}
|
||||
|
||||
private void handleFullProcessCreation(@NotNull IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFullProcessCreation(@NotNull IcdLedgerParam param) {
|
||||
if (ObjectUtil.isNotNull(param.getEngineering())) {
|
||||
CsEngineeringPO po1 = csEngineeringService.addEngineering(param.getEngineering());
|
||||
param.setEngineeringIndex(po1.getId());
|
||||
@@ -587,15 +591,18 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
}
|
||||
|
||||
private void handleFromEngineeringCreation(IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromEngineeringCreation(IcdLedgerParam param) {
|
||||
createProjectAndDevices(param);
|
||||
}
|
||||
|
||||
private void handleFromProjectCreation(IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromProjectCreation(IcdLedgerParam param) {
|
||||
saveDevicesAndLines(param);
|
||||
}
|
||||
|
||||
private void handleFromDeviceCreation(IcdLedgerParam param) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromDeviceCreation(IcdLedgerParam param) {
|
||||
saveLines(param);
|
||||
}
|
||||
|
||||
@@ -628,8 +635,8 @@ class IcdServiceImpl implements IcdService {
|
||||
saveLines(param);
|
||||
}
|
||||
|
||||
private void saveLines(IcdLedgerParam param) {
|
||||
List<CsLinePO> list = new ArrayList<>();
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveLines(IcdLedgerParam param) {
|
||||
List<CsLineParam> lineList = param.getLine();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
boolean result = checkAndAlertDuplicates(lineList);
|
||||
@@ -651,7 +658,10 @@ class IcdServiceImpl implements IcdService {
|
||||
line.setDevId(param.getDevIndex());
|
||||
}
|
||||
CsLinePO po = csLinePOService.addCldLine(line);
|
||||
list.add(po);
|
||||
//新增监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(line.getVolGrade().floatValue(), line.getProtocolCapacity().floatValue(),line.getDevCapacity().floatValue(),line.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(po.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
}
|
||||
|
||||
//新增台账日志
|
||||
|
||||
@@ -61,26 +61,24 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
});
|
||||
List<CsDeviceUserPO> csDeviceUserPOS = csDeviceUserPOMapper.selectList(csDeviceUserPOQueryWrapper);
|
||||
List<String> collect1 = csDeviceUserPOS.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(collect1)){
|
||||
return collect;
|
||||
}else{
|
||||
csLedgerQueryWrapper.in("id",collect1).eq("level",2);
|
||||
if (!CollectionUtils.isEmpty(collect1)) {
|
||||
csLedgerQueryWrapper.in("id", collect1).eq("level", 2);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect2 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
csLedgerQueryWrapper.clear();
|
||||
if(CollectionUtils.isEmpty(collect2)){
|
||||
if (CollectionUtils.isEmpty(collect2)) {
|
||||
return collect;
|
||||
}
|
||||
csLedgerQueryWrapper.in("id",collect2).eq("level",1);
|
||||
csLedgerQueryWrapper.in("id", collect2).eq("level", 1);
|
||||
csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
List<String> collect3 = csLedgers.stream().map(CsLedger::getPid).distinct().collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(collect3)){
|
||||
return collect;
|
||||
if (CollectionUtils.isEmpty(collect3)) {
|
||||
return collect;
|
||||
}
|
||||
collect.addAll(collect3);
|
||||
collect = collect.stream().distinct().collect(Collectors.toList());
|
||||
return collect;
|
||||
}
|
||||
return collect;
|
||||
|
||||
} else if ( Objects.equals(role,AppRoleEnum.MARKET_USER.getCode())||
|
||||
Objects.equals(role, AppRoleEnum.ENGINEERING_USER.getCode())) {
|
||||
@@ -94,7 +92,9 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getEnginerId).distinct().collect(Collectors.toList());
|
||||
|
||||
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())||Objects.equals(role,"bxs_user")){
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -196,7 +196,9 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
List<CsTouristDataPO> csTouristDataPOS = csTouristDataPOMapper.selectList(null);
|
||||
collect = csTouristDataPOS.stream().map(CsTouristDataPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
|
||||
}else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())||Objects.equals(role,"bxs_user")){
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
|
||||
@@ -53,7 +53,7 @@ public class InfluxDbParamUtil {
|
||||
//如果是云前置设备,直接返回clDid
|
||||
boolean isCLdDevice = DicDataEnum.DEV_CLD.getCode().equals(dictTreeFeignClient.queryById(csEquipmentDeliveryDTOList.get(0).getDevType()).getData().getCode());
|
||||
if(isCLdDevice){
|
||||
// return String.valueOf(finalCsLinePOList.get(0).getLineNo());
|
||||
return String.valueOf(finalCsLinePOList.get(0).getLineNo());
|
||||
}
|
||||
//之后的逻辑还是按照原来的不变
|
||||
String position = csLineFeignClient.getPositionById(lineId).getData();
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/pqSensitiveUser", fallbackFactory = EventUserFeignClientFallbackFactory.class,contextId = "pqSensitiveUser")
|
||||
public interface PqSensitiveUserFeignClient {
|
||||
|
||||
@PostMapping("/getListByIds")
|
||||
HttpResult<List<PqSensitiveUser>> getListByIds(@RequestParam(name = "ids", required = false) List<String> ids);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.csharmonic.api.fallback;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PqSensitiveUserFeignClientFallbackFactory implements FallbackFactory<PqSensitiveUserFeignClient> {
|
||||
|
||||
@Override
|
||||
public PqSensitiveUserFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PqSensitiveUserFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<PqSensitiveUser>> getListByIds(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据id集合获取敏感负荷用户列表",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.csharmonic.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum CsEventEnum {
|
||||
|
||||
EVENT_TYPE(0,"暂态事件"),
|
||||
HARMONIC_TYPE(1,"稳态事件"),
|
||||
DEVICE_TYPE(2,"设备事件"),
|
||||
ALARM_TYPE(3,"告警事件")
|
||||
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final Integer code;
|
||||
|
||||
private final String name;
|
||||
|
||||
CsEventEnum(Integer code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -20,7 +20,18 @@ public enum CsHarmonicResponseEnum {
|
||||
RECORD_MISSING("A00602","record.bin文件缺失,补召失败"),
|
||||
|
||||
EVENT_FILE_NOT_SAME("A00603","cfg、dat文件名称不一致"),
|
||||
CUSTOM_REPORT_REPEAT("A00552","自定义报表模板名称已存在"),
|
||||
|
||||
CUSTOM_REPORT_JSON("A00553","模板非严格json数据"),
|
||||
|
||||
CUSTOM_REPORT_DEPT("A00554","该部门已存在绑定报表模板"),
|
||||
CUSTOM_TYPE("A00555","字典中未查询到报表模板类型"),
|
||||
CUSTOM_REPORT_ACTIVE("A00556","不存在激活的自定义报告模板"),
|
||||
CUSTOM_REPORT_EMPTY("A00557","自定义报表模板异常,模板数据为空"),
|
||||
CUSTOM_REPORT_FILE("A00558","上传文件服务器错误,请检查数据"),
|
||||
|
||||
REPORT_DOWNLOAD_ERROR("A00559","报表文件下载异常"),
|
||||
REPORT_TEMPLATE_DOWNLOAD_ERROR("A00560","报表模板下载异常")
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.njcn.csharmonic.enums;
|
||||
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
public enum CsTransientEnum {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
EVT_SYS_DIPSTR("Evt_Sys_DipStr","电压暂降"),
|
||||
EVT_SYS_INTRSTR("Evt_Sys_IntrStr","电压中断"),
|
||||
EVT_SYS_SWLSTR("Evt_Sys_SwlStr","电压暂升"),
|
||||
TRANSIENT("Transient","录波"),
|
||||
UN_KNOW("Un_Know","未知")
|
||||
|
||||
|
||||
;
|
||||
|
||||
private final String code;
|
||||
|
||||
private final String name;
|
||||
|
||||
CsTransientEnum(String code, String name) {
|
||||
this.code = code;
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 根据code获取对应的name
|
||||
* @param code 枚举编码
|
||||
* @return 匹配的名称,未匹配时返回"未知",code为null时返回"未知"
|
||||
*/
|
||||
public static String getNameByCode(String code) {
|
||||
// 处理code为null的情况
|
||||
if (code == null) {
|
||||
return UN_KNOW.getName();
|
||||
}
|
||||
// 遍历所有枚举常量,匹配code
|
||||
for (CsTransientEnum transientEnum : CsTransientEnum.values()) {
|
||||
if (transientEnum.getCode().equals(code)) {
|
||||
return transientEnum.getName();
|
||||
}
|
||||
}
|
||||
// 未找到匹配的code时,返回未知名称
|
||||
return UN_KNOW.getName();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class FittingDataQueryParam {
|
||||
|
||||
@ApiModelProperty(value = "监测点")
|
||||
@NotBlank(message = "监测点ID不可为空")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty(value = "用于选择多个指标及谐波次数")
|
||||
List<FittingDataQueryParam> list;
|
||||
@ApiModelProperty(value = "指标组id")
|
||||
private String statisticalId;
|
||||
@ApiModelProperty(value = "一次值:Primary;二次值:Secondary")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty(value = "取值类型:Max,Min,cp95,avg(用户功率专用)")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty(value = "频次2-50(谐波电压、谐波电流专用)")
|
||||
private String frequency;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
|
||||
|
||||
@Data
|
||||
public class SensitiveUserReportQueryParam {
|
||||
@NotBlank(message = "监测对象id不可为空")
|
||||
@ApiModelProperty(name = "lineId",value = "监测对象id")
|
||||
private String sensitiveUserId;
|
||||
@NotBlank(message = "模板ID不可为空")
|
||||
@ApiModelProperty(name = "tempId",value = "模板ID")
|
||||
private String tempId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class SensitiveUserTrendDataQueryParam {
|
||||
|
||||
@ApiModelProperty(value = "检测对象ID")
|
||||
@NotBlank(message = "检测对象ID不可为空")
|
||||
private String sensitiveUserId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty(value = "用于选择多个指标及谐波次数")
|
||||
List<SensitiveUserTrendDataQueryParam> list;
|
||||
@ApiModelProperty(value = "指标组id")
|
||||
private String statisticalId;
|
||||
@ApiModelProperty(value = "取值类型(Max,Min,cp95,avg)")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty(value = "一次值:Primary;二次值:Secondary")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty(value = "频次2-50")
|
||||
private String frequency;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
|
||||
import com.njcn.web.pojo.annotation.DateTimeStrValid;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TrendDataQueryParam {
|
||||
|
||||
@ApiModelProperty(value = "监测点")
|
||||
@NotBlank(message = "监测点ID不可为空")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty(value = "用于选择多个指标及谐波次数")
|
||||
List<TrendDataQueryParam> list;
|
||||
@ApiModelProperty(value = "指标组id")
|
||||
private String statisticalId;
|
||||
@ApiModelProperty(value = "取值类型(Max,Min,cp95,avg)")
|
||||
private String valueType;
|
||||
|
||||
@ApiModelProperty(value = "一次值:Primary;二次值:Secondary")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty(value = "频次2-50")
|
||||
private String frequency;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.csharmonic.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/8/22
|
||||
*/
|
||||
@Data
|
||||
public class ReportTemplateDTO {
|
||||
/**
|
||||
* $HA[_25]#B#max#classId#resourceId$
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
|
||||
/**
|
||||
* 对应influxdb数据库中字段
|
||||
*/
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 对应限值字段
|
||||
*/
|
||||
private String limitName;
|
||||
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* max min avg cp95
|
||||
*/
|
||||
private String statMethod;
|
||||
|
||||
/**
|
||||
* 对应influxdb数据库的表名
|
||||
*/
|
||||
private String classId;
|
||||
|
||||
/**
|
||||
* 对应mysql数据库的表名
|
||||
*/
|
||||
private String resourceId;
|
||||
|
||||
/**
|
||||
* 标识指标是否越限 0.否 1.是
|
||||
*/
|
||||
private Integer overLimitFlag;
|
||||
|
||||
/**
|
||||
* 填入的value值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.csharmonic.pojo.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-21
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class EventStatisticParam extends BaseParam {
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 安装位置
|
||||
*/
|
||||
@ApiModelProperty("字典表:安装位置(负载侧,电网侧, 输出侧)")
|
||||
private String position;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,76 @@
|
||||
package com.njcn.csharmonic.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-12-02
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class PqSensitiveUserParam {
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 敏感用户名称
|
||||
*/
|
||||
@NotBlank(message = "用户名称不可为空")
|
||||
@ApiModelProperty(name = "name",value = "用户名称不可为空")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 敏感负荷类型
|
||||
*/
|
||||
@NotBlank(message = "敏感负荷类型不可为空")
|
||||
@ApiModelProperty(name = "loadType",value = "敏感负荷类型")
|
||||
private String loadType;
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
@Range(min = 0,max = 10000000 )
|
||||
@ApiModelProperty(name = "userAgreementCapacity",value = "用户协议容量")
|
||||
private Double userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 装机容量
|
||||
*/
|
||||
@Range(min = 0,max = 10000000 )
|
||||
@ApiModelProperty(name = "installedCapacity",value = "装机容量")
|
||||
private Double installedCapacity;
|
||||
|
||||
/**
|
||||
* 所属厂站名称
|
||||
*/
|
||||
@NotBlank(message = "所属厂站名称不可为空")
|
||||
@ApiModelProperty(name = "substationName",value = "所属厂站名称")
|
||||
private String substationName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@NotNull(message = "排序不可为空")
|
||||
@ApiModelProperty(name = "sort",value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdatePqSensitiveUserParam extends PqSensitiveUserParam{
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@NotBlank(message = "id不可为空")
|
||||
@ApiModelProperty(name = "id",value = "id")
|
||||
private String id;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.csharmonic.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 模板动态更新数据
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/11
|
||||
*/
|
||||
@Data
|
||||
public class ReportSearchParam {
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "tempId",value = "模板ID")
|
||||
private String tempId;
|
||||
|
||||
@ApiModelProperty(name = "activation",value = "激活状态")
|
||||
private Integer activation;
|
||||
|
||||
@ApiModelProperty(name = "type",value = "报表类型")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty(name = "startTime",value = "开始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(name = "endTime",value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(name = "deptId",value = "部门ID")
|
||||
private String deptId;
|
||||
|
||||
//目前用于区分不同系统资源,null默认 1.无线系统,配合cs-device
|
||||
private Integer resourceType;
|
||||
|
||||
//浙江无线报表特殊标识 null为通用报表 1.浙江无线报表
|
||||
private Integer customType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
package com.njcn.csharmonic.pojo.param;
|
||||
|
||||
import com.njcn.common.pojo.constant.PatternRegex;
|
||||
import com.njcn.web.constant.ValidMessage;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@Data
|
||||
public class ReportTemplateParam {
|
||||
|
||||
@ApiModelProperty(name = "name",value = "模板名称",required = true)
|
||||
@NotBlank(message = "模板名称不可为空")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "fileContent",value = "json文件",required = true)
|
||||
@NotNull(message = "模板文件不可为空")
|
||||
private MultipartFile fileContent;
|
||||
|
||||
@ApiModelProperty(name = "content",value = "json文件内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(name = "deptId",value = "部门id")
|
||||
private List<String> deptId;
|
||||
|
||||
@ApiModelProperty(name = "valueTitle",value = "存取库中")
|
||||
private String valueTitle;
|
||||
|
||||
@ApiModelProperty(name = "reportType",value = "模板类型",required = true)
|
||||
@NotBlank(message = "模板类型不可为空")
|
||||
private String reportType;
|
||||
|
||||
@ApiModelProperty(name = "reportForm",value = "报表类型",required = true)
|
||||
private String reportForm;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class UpdateReportTemplateParam extends ReportTemplateParam {
|
||||
|
||||
@ApiModelProperty(name = "id",required = true)
|
||||
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,7 +17,7 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "cs_configuration")
|
||||
@TableName(value = "cs_configuration")
|
||||
public class CsConfigurationPO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
|
||||
@@ -54,6 +54,7 @@ public class CsPagePO extends BaseEntity {
|
||||
@TableField(value = "`status`")
|
||||
private String status;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
@@ -74,4 +75,7 @@ public class CsPagePO extends BaseEntity {
|
||||
public static final String COL_UPDATE_BY = "update_by";
|
||||
|
||||
public static final String COL_UPDATE_TIME = "update_time";
|
||||
|
||||
public static final String SORT = "sort";
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 自定义报表
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@TableName(value = "sys_excel_rpt_temp")
|
||||
public class ExcelRptTemp extends BaseEntity {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String content;
|
||||
|
||||
private Integer activation;
|
||||
|
||||
private Integer state;
|
||||
|
||||
private String valueTitle;
|
||||
|
||||
private String reportType;
|
||||
|
||||
private String reportForm;
|
||||
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("pq_sensitive_user")
|
||||
public class PqSensitiveUser extends BaseEntity implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 敏感用户名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 敏感负荷类型
|
||||
*/
|
||||
private String loadType;
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
private Double userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 装机容量
|
||||
*/
|
||||
private Double installedCapacity;
|
||||
|
||||
/**
|
||||
* 所属厂站名称
|
||||
*/
|
||||
private String substationName;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class EventStatisticsVo implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "监测点名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty(value = "电压中断次数")
|
||||
private Integer times1;
|
||||
|
||||
@ApiModelProperty(value = "电压暂降次数")
|
||||
private Integer times2;
|
||||
|
||||
@ApiModelProperty(value = "电压暂升次数")
|
||||
private Integer times3;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@Data
|
||||
public class PqSensitiveUserVo implements Serializable{
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 敏感用户名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 敏感负荷类型
|
||||
*/
|
||||
private String loadType;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
private Integer sort;
|
||||
|
||||
/**
|
||||
* 是否监测
|
||||
*/
|
||||
private String isMonitor;
|
||||
|
||||
/**
|
||||
* 是否治理
|
||||
*/
|
||||
private String isGovern;
|
||||
|
||||
/**
|
||||
* 用户协议容量
|
||||
*/
|
||||
private Double userAgreementCapacity;
|
||||
|
||||
/**
|
||||
* 装机容量
|
||||
*/
|
||||
private Double installedCapacity;
|
||||
|
||||
/**
|
||||
* 所属厂站名称
|
||||
*/
|
||||
private String substationName;
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
|
||||
@Data
|
||||
public class ReportTemplateDataVO {
|
||||
/**
|
||||
* $HA[_25]#B#max#classId#resourceId$
|
||||
*/
|
||||
private String itemName;
|
||||
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 对应influxdb数据库中字段
|
||||
*/
|
||||
private String templateName;
|
||||
|
||||
/**
|
||||
* 相别
|
||||
*/
|
||||
private String phase;
|
||||
|
||||
/**
|
||||
* max min avg cp95
|
||||
*/
|
||||
private String statMethod;
|
||||
|
||||
/**
|
||||
* 对应influxdb数据库的表名
|
||||
*/
|
||||
private String classId;
|
||||
|
||||
/**
|
||||
* 对应mysql数据库的表名
|
||||
*/
|
||||
private String resourceId;
|
||||
|
||||
/**
|
||||
* 填入的value值
|
||||
*/
|
||||
private String value;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 自定义报表
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public class ReportTemplateVO extends BaseEntity {
|
||||
private String id;
|
||||
|
||||
private String name;
|
||||
|
||||
private String content;
|
||||
|
||||
private String deptId;
|
||||
|
||||
private Integer activation;
|
||||
|
||||
private Integer state;
|
||||
|
||||
private String deptName;
|
||||
|
||||
private String reportType;
|
||||
|
||||
private String reportForm;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/8/18
|
||||
*/
|
||||
@Data
|
||||
public class ReportTreeVO {
|
||||
|
||||
@ApiModelProperty(name = "id",value = "模板索引")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(name = "name",value = "模板字段名")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(name = "showName",value = "模板中文展示名")
|
||||
private String showName;
|
||||
|
||||
@ApiModelProperty(name = "flag",value = "用于标识最底层对象 1.表示已经没有子级")
|
||||
private Integer flag;
|
||||
|
||||
private List<ReportTreeVO> children;
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author qijian
|
||||
* @since 2022-10-19 09:31:39
|
||||
*/
|
||||
@Data
|
||||
public class SysDeptTempVO implements Serializable {
|
||||
private static final long serialVersionUID = -35391150359300949L;
|
||||
/**
|
||||
* 主键
|
||||
*/
|
||||
private String id;
|
||||
/**
|
||||
* 部门主键
|
||||
*/
|
||||
private String deptId;
|
||||
|
||||
/**
|
||||
* 模板主键
|
||||
*/
|
||||
private String tempId;
|
||||
|
||||
/**
|
||||
* 激活状态
|
||||
*/
|
||||
private Integer activation;
|
||||
|
||||
//部门名称
|
||||
private String deptName;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.csharmonic.pojo.vo.event;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-24
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class EventCoordsVO {
|
||||
|
||||
@ApiModelProperty(name = "xList",value = "下面的图x轴")
|
||||
private List<String> xList;
|
||||
|
||||
@ApiModelProperty(name = "trendList",value = "下面的图y轴")
|
||||
private List<TagObj> trendList;
|
||||
|
||||
@ApiModelProperty(name = "innerList",value = "xyz图")
|
||||
private List<inner> innerList;
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class inner {
|
||||
@ApiModelProperty(name = "x",value = "x轴")
|
||||
private Integer x;
|
||||
|
||||
@ApiModelProperty(name = "y",value = "y轴")
|
||||
private Integer y;
|
||||
|
||||
@ApiModelProperty(name = "z",value = "z轴")
|
||||
private Integer z;
|
||||
}
|
||||
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public static class TagObj {
|
||||
@ApiModelProperty(name = "name",value = "名称")
|
||||
private String name;
|
||||
@ApiModelProperty(name = "trendList",value = "y轴数据")
|
||||
private List<Integer> trendList;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.csharmonic.pojo.vo.event;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import org.apache.ibatis.javassist.runtime.Inner;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-20
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class EventStatisticVO {
|
||||
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "暂降")
|
||||
private Integer eventDown = 0;
|
||||
|
||||
@ApiModelProperty(value = "中断")
|
||||
private Integer eventOff = 0;
|
||||
|
||||
@ApiModelProperty(value = "暂升")
|
||||
private Integer eventUp = 0;
|
||||
|
||||
@ApiModelProperty(value = "总数")
|
||||
private Integer allNum = 0;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.csharmonic.pojo.vo.event;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-21
|
||||
* @Description:
|
||||
*/
|
||||
@Data
|
||||
public class F47Curve {
|
||||
|
||||
@ApiModelProperty(name = "eventId", value = "暂降id")
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty(name = "lineName", value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "time", value = "事件发生时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS",timezone = "GMT+8")
|
||||
private LocalDateTime time;
|
||||
|
||||
@ApiModelProperty(name = "tag", value = "事件类型")
|
||||
private String tag;
|
||||
|
||||
@ApiModelProperty(name = "persistTime", value = "持续时间(ms)")
|
||||
private BigDecimal persistTime;
|
||||
|
||||
@ApiModelProperty(name = "eventValue", value = "特征幅值")
|
||||
private BigDecimal eventValue;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.csharmonic.utils;
|
||||
|
||||
public class DataChangeUtil {
|
||||
|
||||
/**
|
||||
* 用来将二次值转成一次值
|
||||
*/
|
||||
public static double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
|
||||
switch (formula) {
|
||||
|
||||
case "*PT":
|
||||
data = data * pt;
|
||||
break;
|
||||
case "*CT":
|
||||
data = data * ct;
|
||||
break;
|
||||
case "*PT*CT":
|
||||
data = data * pt * ct;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来将一次值转成二次值
|
||||
*/
|
||||
public static double primaryToSecondary(String formula, Double data,Double pt, Double ct) {
|
||||
switch (formula) {
|
||||
case "*PT":
|
||||
data = data / pt;
|
||||
break;
|
||||
case "*CT":
|
||||
data = data / ct;
|
||||
break;
|
||||
case "*PT*CT":
|
||||
data = data / pt / ct;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -119,6 +119,27 @@
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>3.5.1</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-mq</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.rocketmq</groupId>
|
||||
<artifactId>rocketmq-spring-boot-starter</artifactId>
|
||||
<version>2.2.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.platform</groupId>
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>harmonic-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -11,9 +11,11 @@ import com.njcn.csharmonic.param.CldEventParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
@@ -64,6 +66,15 @@ public class CsEventController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/pageEvent")
|
||||
@ApiOperation("分页查询暂降事件")
|
||||
public HttpResult<Page<DataGroupEventVO>> pageEvent(@RequestBody EventStatisticParam baseParam) {
|
||||
String methodDescribe = getMethodDescribe("pageEvent");
|
||||
Page<DataGroupEventVO> page = csEventPOService.pageEvent(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/analyseWave")
|
||||
@ApiOperation("暂态事件波形分析")
|
||||
@@ -155,4 +166,15 @@ public class CsEventController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/eventStatistics")
|
||||
@ApiOperation("暂态事件统计")
|
||||
@ApiImplicitParam(name = "param", value = "事件信息", required = true)
|
||||
public HttpResult<List<EventStatisticsVo>> getEventStatistics(@RequestBody CsEventUserQueryParam param) {
|
||||
String methodDescribe = getMethodDescribe("getEventByTime");
|
||||
List<EventStatisticsVo> list = csEventPOService.getEventStatistics(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,282 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.param.SensitiveUserReportQueryParam;
|
||||
import com.njcn.csharmonic.pojo.param.ReportSearchParam;
|
||||
import com.njcn.csharmonic.pojo.param.ReportTemplateParam;
|
||||
import com.njcn.csharmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.csharmonic.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ReportTreeVO;
|
||||
import com.njcn.csharmonic.pojo.vo.SysDeptTempVO;
|
||||
import com.njcn.csharmonic.service.CustomReportService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 用户自定义报表
|
||||
* @author cdf
|
||||
* @date 2022/8/15
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/customReport")
|
||||
@Api(tags = "用户自定义报表")
|
||||
@AllArgsConstructor
|
||||
public class CustomReportController extends BaseController {
|
||||
|
||||
private final CustomReportService customReportService;
|
||||
|
||||
|
||||
/**
|
||||
* 替换报表数据并返回
|
||||
* @author qijian
|
||||
* @date 2022/10/19
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getCustomReport")
|
||||
@ApiOperation("获取报表")
|
||||
@ApiImplicitParam(name = "reportSearchParam", value = "查询体", required = false)
|
||||
public void getCustomReport(@RequestBody ReportSearchParam reportSearchParam, HttpServletResponse response) {
|
||||
customReportService.getCustomReport(reportSearchParam,response);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 新增自定义报表模板
|
||||
* @author cdf
|
||||
* @date 2022/10/19
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.ADD)
|
||||
@PostMapping("/addTemplate")
|
||||
@ApiOperation("新增自定义报表模板")
|
||||
public HttpResult<Boolean> addCustomReportTemplate(@Validated ReportTemplateParam reportTemplateParam){
|
||||
String methodDescribe = getMethodDescribe("addCustomReportTemplate");
|
||||
boolean res = customReportService.addCustomReportTemplate(reportTemplateParam);
|
||||
if(res){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询所有模板
|
||||
* @author qijian
|
||||
* @date 2022/10/14
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTemplateList")
|
||||
@ApiOperation("查询报表模板")
|
||||
@ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
||||
public HttpResult<List<ReportTemplateVO>> getTemplateList(@RequestBody ReportSearchParam reportSearchParam){
|
||||
String methodDescribe = getMethodDescribe("getTemplateList");
|
||||
List<ReportTemplateVO> list = customReportService.getTemplateList(reportSearchParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门查询模板
|
||||
* @author qijian
|
||||
* @date 2022/10/19
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getTemplateByDept")
|
||||
@ApiOperation("根据部门查询模板")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("getTemplateList");
|
||||
List<ReportTemplateVO> list = customReportService.getTemplateByDept(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.DELETE)
|
||||
@PostMapping("/delTemplate")
|
||||
@ApiOperation("删除报表模板")
|
||||
@ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
||||
public HttpResult<Boolean> delTemplate(@RequestBody ReportSearchParam reportSearchParam){
|
||||
String methodDescribe = getMethodDescribe("delTemplate");
|
||||
boolean res = customReportService.delTemplate(reportSearchParam);
|
||||
if(res){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id查询模板详情
|
||||
* @author qijian
|
||||
* @date 2022/10/14
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getCustomReportTemplateById")
|
||||
@ApiOperation("根据id查询模板详情")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<ExcelRptTemp> getCustomReportTemplateById(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("getCustomReportTemplateById");
|
||||
ExcelRptTemp excelRptTemp = customReportService.getCustomReportTemplateById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, excelRptTemp, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id回显模板
|
||||
* @author qijian
|
||||
* @date 2022/10/14
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/viewCustomReportTemplateById")
|
||||
@ApiOperation("根据id查询模板详情")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public void viewCustomReportTemplateById(@RequestParam("id") String id,HttpServletResponse response){
|
||||
customReportService.viewCustomReportTemplateById(id,response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改自定义报表模板
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
||||
@PostMapping("/updateTemplate")
|
||||
@ApiOperation("修改自定义报表模板")
|
||||
public HttpResult<Boolean> updateCustomReportTemplate(@Validated ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam){
|
||||
String methodDescribe = getMethodDescribe("updateCustomReportTemplate");
|
||||
boolean res = customReportService.updateCustomReportTemplate(reportTemplateParam);
|
||||
if(res){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定/解绑模板数据
|
||||
* @author qijian
|
||||
* @date 2022/10/19
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
||||
@PostMapping("/updateBindTemplate")
|
||||
@ApiOperation("绑定/解绑模板数据")
|
||||
@ApiImplicitParam(name = "reportSearchParams", value = "实体参数", required = false)
|
||||
public HttpResult<Boolean> updateBindTemplate(@RequestBody List<ReportSearchParam> reportSearchParams){
|
||||
String methodDescribe = getMethodDescribe("updateBindTemplate");
|
||||
boolean res = customReportService.updateBindTemplate(reportSearchParams);
|
||||
if(res){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板ID查询数据
|
||||
* @author qijian
|
||||
* @date 2022/10/19
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDataByTempId")
|
||||
@ApiOperation("根据模板ID查询数据")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<List<SysDeptTempVO>> getDataByTempId(@RequestParam("id")String id){
|
||||
String methodDescribe = getMethodDescribe("getDataByTempId");
|
||||
List<SysDeptTempVO> list = customReportService.getDataByTempId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改激活状态
|
||||
* @author qijian
|
||||
* @date 2022/10/17
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType=OperateType.UPDATE)
|
||||
@PostMapping("/updateTemplateActive")
|
||||
@ApiOperation("修改激活状态")
|
||||
@ApiImplicitParam(name = "reportSearchParam", value = "实体参数", required = false)
|
||||
public HttpResult<Page<ExcelRptTemp>> updateTemplateActive(@RequestBody ReportSearchParam reportSearchParam){
|
||||
String methodDescribe = getMethodDescribe("updateTemplateActive");
|
||||
boolean res = customReportService.updateStatus(reportSearchParam);
|
||||
if(res){
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取报表模板树
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/reportChooseTree")
|
||||
@ApiOperation("获取报表模板树")
|
||||
public HttpResult<List<ReportTreeVO>> reportChooseTree(){
|
||||
String methodDescribe = getMethodDescribe("reportChooseTree");
|
||||
List<ReportTreeVO> res = customReportService.reportChooseTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取报表指标是否合格模板树
|
||||
* @author cdf
|
||||
* @date 2023/10/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/targetLimitChooseTree")
|
||||
@ApiOperation("获取报表指标是否合格模板树")
|
||||
public HttpResult<List<ReportTreeVO>> targetLimitChooseTree(){
|
||||
String methodDescribe = getMethodDescribe("targetLimitChooseTree");
|
||||
List<ReportTreeVO> res = customReportService.targetLimitChooseTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取报表台账模板树
|
||||
* @author cdf
|
||||
* @date 2023/10/11
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/terminalChooseTree")
|
||||
@ApiOperation("获取报表台账模板树")
|
||||
public HttpResult<List<ReportTreeVO>> terminalChooseTree(){
|
||||
String methodDescribe = getMethodDescribe("terminalChooseTree");
|
||||
List<ReportTreeVO> res = customReportService.terminalChooseTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, res, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getSensitiveUserReport")
|
||||
@ApiOperation("获取监测对象治理报表")
|
||||
@ApiImplicitParam(name = "queryParam", value = "查询体", required = true)
|
||||
public void getSensitiveUserReport(@RequestBody SensitiveUserReportQueryParam queryParam, HttpServletResponse response) {
|
||||
customReportService.getSensitiveUserReport(queryParam,response);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventCoordsVO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.F47Curve;
|
||||
import com.njcn.csharmonic.service.event.EventOverviewService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-20
|
||||
* @Description: 暂降概览
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csevent")
|
||||
@Api(tags = "暂降概览")
|
||||
@RequiredArgsConstructor
|
||||
public class EventOverviewController extends BaseController {
|
||||
|
||||
private final EventOverviewService eventOverviewService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("暂降类型分类统计Echart")
|
||||
@PostMapping("netEventEcharts")
|
||||
public HttpResult<EventStatisticVO> netEventEcharts(@RequestBody EventStatisticParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("netEventEcharts");
|
||||
EventStatisticVO eventStatisticVO = eventOverviewService.netEventEcharts(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, eventStatisticVO, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("暂降类型分类统计表格")
|
||||
@PostMapping("netEventTable")
|
||||
public HttpResult<List<EventStatisticVO>> netEventTable(@RequestBody EventStatisticParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("netEventTable");
|
||||
List<EventStatisticVO> list = eventOverviewService.netEventTable(baseParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("F47曲线")
|
||||
@PostMapping("f47Curve")
|
||||
public HttpResult<List<F47Curve>> getF47Curve(@RequestBody EventStatisticParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("getF47Curve");
|
||||
List<F47Curve> list = eventOverviewService.getF47Curve(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("日历暂降事件详情")
|
||||
@PostMapping("getEventDate")
|
||||
public HttpResult<List<EventStatisticVO>> getEventDate(@RequestBody EventStatisticParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("getEventDate");
|
||||
List<EventStatisticVO> list = eventOverviewService.getEventDate(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEventCoords")
|
||||
@ApiOperation("获取电压暂态表及密度坐标图")
|
||||
public HttpResult<EventCoordsVO> getEventCoords(@RequestBody EventStatisticParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("getEventCoords");
|
||||
EventCoordsVO vo = eventOverviewService.getEventCoords(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,vo,methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/pqSensitiveUser")
|
||||
@Api(tags = "敏感负荷用户管理")
|
||||
@AllArgsConstructor
|
||||
public class PqSensitiveUserController extends BaseController {
|
||||
|
||||
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getList")
|
||||
@ApiOperation("获取敏感负荷用户列表")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqSensitiveUserVo>> getList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
Page<PqSensitiveUserVo> page = pqSensitiveUserService.getList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getListByIds")
|
||||
@ApiOperation("根据id集合获取敏感负荷用户列表")
|
||||
@ApiImplicitParam(name = "ids", value = "id集合")
|
||||
public HttpResult<List<PqSensitiveUser>> getListByIds(@RequestParam(name = "ids", required = false) List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getListByIds");
|
||||
List<PqSensitiveUser> list = pqSensitiveUserService.list(
|
||||
new LambdaQueryWrapper<PqSensitiveUser>()
|
||||
.in(CollUtil.isNotEmpty(ids),PqSensitiveUser::getId, ids)
|
||||
);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户对象
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||
@PostMapping("/save")
|
||||
@ApiOperation("新增用户对象")
|
||||
public HttpResult<Boolean> save(@RequestBody @Validated PqSensitiveUserParam pqSensitiveUserParam) {
|
||||
String methodDescribe = getMethodDescribe("save");
|
||||
pqSensitiveUserService.save(pqSensitiveUserParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改用户对象
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.UPDATE)
|
||||
@PostMapping("/update")
|
||||
@ApiOperation("修改用户对象")
|
||||
public HttpResult<Boolean> update(@RequestBody @Validated PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam) {
|
||||
String methodDescribe = getMethodDescribe("update");
|
||||
pqSensitiveUserService.update(pqSensitiveUserParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 删除用户对象
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
|
||||
@PostMapping("/delete")
|
||||
@ApiOperation("删除用户对象")
|
||||
@ApiImplicitParam(name = "ids", value = "id集合")
|
||||
public HttpResult<Boolean> delete(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("delete");
|
||||
pqSensitiveUserService.removeByIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csharmonic.pojo.param.ReportSearchParam;
|
||||
import com.njcn.csharmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.csharmonic.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
public interface ExcelRptTempMapper extends BaseMapper<ExcelRptTemp> {
|
||||
|
||||
Page<ReportTemplateVO> getReportTemplateListPage(Page<BaseParam> page, @Param("baseParam")BaseParam baseParam);
|
||||
|
||||
List<ReportTemplateVO> getReportTemplateList(@Param("reportSearchParam")ReportSearchParam reportSearchParam);
|
||||
|
||||
List<ReportTemplateVO> getReportTemplateByDept(@Param("ids") List<String> ids);
|
||||
|
||||
|
||||
@Select("${sqlStr}")
|
||||
StatisticalDataDTO dynamicSql(@Param("sqlStr")String sql);
|
||||
|
||||
@Select("${sqlStr}")
|
||||
Map<String, Float> dynamicSqlMap(@Param("sqlStr")String sql);
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
public interface PqSensitiveUserMapper extends BaseMapper<PqSensitiveUser> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.csharmonic.mapper.ExcelRptTempMapper">
|
||||
|
||||
<select id="getReportTemplateListPage" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||
select
|
||||
a.id,
|
||||
a.name,
|
||||
a.dept_id,
|
||||
b.name deptName,
|
||||
a.activation,
|
||||
a.update_time,
|
||||
c.name updateBy
|
||||
from sys_excel_rpt_temp a
|
||||
left join sys_dept b on a.dept_id = b.id
|
||||
left join sys_user c on a.update_by = c.id
|
||||
where a.state = 1
|
||||
<if test="baseParam.searchValue!=null and baseParam.searchValue!=''">
|
||||
and (
|
||||
a.name like CONCAT('%', #{baseParam.searchValue},'%') or
|
||||
b.name like CONCAT('%', #{baseParam.searchValue},'%')
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getReportTemplateList" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||
SELECT
|
||||
a.id,
|
||||
a.NAME,
|
||||
a.update_time,
|
||||
a.create_time,
|
||||
a.update_by,
|
||||
a.Activation,
|
||||
a.Report_Type,
|
||||
a.Report_Form
|
||||
FROM
|
||||
sys_excel_rpt_temp a
|
||||
WHERE
|
||||
a.state = 1
|
||||
</select>
|
||||
|
||||
<select id="getReportTemplateByDept" resultType="com.njcn.csharmonic.pojo.vo.ReportTemplateVO">
|
||||
SELECT
|
||||
DISTINCT
|
||||
a.id,
|
||||
a.NAME,
|
||||
a.activation,
|
||||
a.report_form,
|
||||
a.sort
|
||||
FROM
|
||||
sys_excel_rpt_temp a
|
||||
LEFT JOIN sys_dept_temp b ON a.Id = b.temp_id
|
||||
WHERE
|
||||
a.activation = 1
|
||||
order by a.sort asc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -7,10 +7,13 @@ import com.njcn.csharmonic.param.CldEventParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||
import com.njcn.event.file.pojo.dto.WaveDataDTO;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -50,6 +53,8 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
||||
|
||||
Page<DataGroupEventVO> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage);
|
||||
|
||||
Page<DataGroupEventVO> pageEvent(EventStatisticParam baseParam);
|
||||
|
||||
void saveBatchEventList(List<CsEventPO> csEventPOS);
|
||||
|
||||
void getFileZip(String eventId,HttpServletResponse response);
|
||||
@@ -62,4 +67,6 @@ public interface CsEventPOService extends IService<CsEventPO>{
|
||||
|
||||
List<CsEventPO> getEventByTime(List<String> lineList, String startTime, String endTime);
|
||||
|
||||
List<EventStatisticsVo> getEventStatistics(CsEventUserQueryParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,134 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.csharmonic.param.SensitiveUserReportQueryParam;
|
||||
import com.njcn.csharmonic.pojo.param.ReportSearchParam;
|
||||
import com.njcn.csharmonic.pojo.param.ReportTemplateParam;
|
||||
import com.njcn.csharmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.csharmonic.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ReportTreeVO;
|
||||
import com.njcn.csharmonic.pojo.vo.SysDeptTempVO;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 自定义报表
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/8/16
|
||||
*/
|
||||
public interface CustomReportService {
|
||||
|
||||
|
||||
/**
|
||||
* 新增自定义报表模板
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
boolean addCustomReportTemplate(ReportTemplateParam reportTemplateParam);
|
||||
|
||||
|
||||
/**
|
||||
* 修改自定义报表模板
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
boolean updateCustomReportTemplate(ReportTemplateParam.UpdateReportTemplateParam reportTemplateParam);
|
||||
|
||||
/**
|
||||
* 根据id获取模板
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
ExcelRptTemp getCustomReportTemplateById(String id);
|
||||
|
||||
|
||||
/**
|
||||
* 模板列表
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
List<ReportTemplateVO> getTemplateList(ReportSearchParam reportSearchParam);
|
||||
|
||||
/**
|
||||
* 删除模板
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
boolean delTemplate(ReportSearchParam reportSearchParam);
|
||||
|
||||
|
||||
/**
|
||||
* 切换模板激活状态
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
boolean updateStatus(ReportSearchParam reportSearchParam);
|
||||
|
||||
|
||||
/**
|
||||
* 替换报表数据并返回
|
||||
*
|
||||
* @param reportSearchParam 请求参数
|
||||
* @param response
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
void getCustomReport(ReportSearchParam reportSearchParam, HttpServletResponse response);
|
||||
|
||||
|
||||
/**
|
||||
* 查询报告模板树节点
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2022/8/26
|
||||
*/
|
||||
List<ReportTreeVO> reportChooseTree();
|
||||
|
||||
List<ReportTreeVO> targetLimitChooseTree();
|
||||
|
||||
/**
|
||||
* 台账类型树
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/10/23
|
||||
*/
|
||||
List<ReportTreeVO> terminalChooseTree();
|
||||
|
||||
/**
|
||||
* 绑定/解绑模板数据
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
boolean updateBindTemplate(List<ReportSearchParam> reportSearchParams);
|
||||
|
||||
/**
|
||||
* 根据模板ID查询数据
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
List<SysDeptTempVO> getDataByTempId(String id);
|
||||
|
||||
/**
|
||||
* 根据部门查询模板
|
||||
*
|
||||
* @author qijian
|
||||
* @date 2022/10/18
|
||||
*/
|
||||
List<ReportTemplateVO> getTemplateByDept(String id);
|
||||
|
||||
void viewCustomReportTemplateById(String id, HttpServletResponse response);
|
||||
|
||||
|
||||
void getSensitiveUserReport(SensitiveUserReportQueryParam queryParam, HttpServletResponse response);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
public interface IPqSensitiveUserService extends IService<PqSensitiveUser> {
|
||||
|
||||
Page<PqSensitiveUserVo> getList(BaseParam param);
|
||||
|
||||
boolean save(PqSensitiveUserParam pqSensitiveUserParam);
|
||||
|
||||
boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
package com.njcn.csharmonic.service.event;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventCoordsVO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.F47Curve;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-20
|
||||
* @Description: 暂降相关
|
||||
*/
|
||||
public interface EventOverviewService {
|
||||
|
||||
EventStatisticVO netEventEcharts(EventStatisticParam baseParam);
|
||||
|
||||
|
||||
List<EventStatisticVO> netEventTable(EventStatisticParam baseParam);
|
||||
|
||||
List<F47Curve> getF47Curve(EventStatisticParam baseParam);
|
||||
|
||||
List<EventStatisticVO> getEventDate(EventStatisticParam baseParam);
|
||||
|
||||
EventCoordsVO getEventCoords(EventStatisticParam baseParam);
|
||||
}
|
||||
@@ -72,7 +72,7 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
String name = csConfigurationPO.getName();
|
||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, name).eq(CsConfigurationPO::getStatus, "1").count();
|
||||
if(count>1){
|
||||
throw new BusinessException("存在相同的组态项目名称");
|
||||
throw new BusinessException("存在相同的组态项目名称在其他工程项目中,无法新建");
|
||||
}
|
||||
return save;
|
||||
}
|
||||
@@ -86,7 +86,12 @@ public class CsConfigurationServiceImpl extends ServiceImpl<CsConfigurationMappe
|
||||
boolean b = this.updateById(csConfigurationPO);
|
||||
return b;
|
||||
}
|
||||
Integer count = this.lambdaQuery().eq(CsConfigurationPO::getName, auditParm.getName()).ne(CsConfigurationPO::getId,auditParm.getId()).eq(CsConfigurationPO::getStatus, "1").count();
|
||||
if(count>0){
|
||||
throw new BusinessException("修改名称失败,存在相同的组态项目");
|
||||
}
|
||||
BeanUtils.copyProperties(auditParm,csConfigurationPO);
|
||||
|
||||
List<String> projectIds = auditParm.getProjectIds();
|
||||
if(!CollectionUtils.isEmpty(projectIds)){
|
||||
String projects = String.join(",", projectIds);
|
||||
|
||||
@@ -19,14 +19,18 @@ import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csharmonic.enums.CsEventEnum;
|
||||
import com.njcn.csharmonic.enums.CsTransientEnum;
|
||||
import com.njcn.csharmonic.mapper.CsEventPOMapper;
|
||||
import com.njcn.csharmonic.param.CldEventParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventStatisticsVo;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.event.file.component.WaveFileComponent;
|
||||
@@ -47,6 +51,7 @@ import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -63,7 +68,10 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.net.URLEncoder;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
@@ -72,6 +80,8 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.csharmonic.enums.CsTransientEnum.*;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/9/4 15:15【需求编号】
|
||||
@@ -165,6 +175,72 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<DataGroupEventVO> pageEvent(EventStatisticParam 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 end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime(), DatePattern.NORM_DATE_PATTERN));
|
||||
|
||||
List<String> EVENT_TAGS = Arrays.asList(
|
||||
EVT_SYS_DIPSTR.getCode(),
|
||||
EVT_SYS_INTRSTR.getCode(),
|
||||
EVT_SYS_SWLSTR.getCode()
|
||||
);
|
||||
|
||||
LambdaQueryWrapper<CsEventPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(StrUtil.isNotBlank(baseParam.getLineId()),CsEventPO::getLineId,baseParam.getLineId())
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.between(CsEventPO::getStartTime,begin,end)
|
||||
.orderByDesc(CsEventPO::getStartTime);
|
||||
Page<CsEventPO> page = this.page(new Page<>(PageFactory.getPageNum(baseParam),PageFactory.getPageSize(baseParam)),lambdaQueryWrapper);
|
||||
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));
|
||||
|
||||
List<DataGroupEventVO> dataGroupEventVOList = BeanUtil.copyToList(page.getRecords(),DataGroupEventVO.class);
|
||||
dataGroupEventVOList.forEach(item->{
|
||||
item.setLineName(linePOMap.getOrDefault(item.getLineId(),"/"));
|
||||
if(CsTransientEnum.EVT_SYS_SWLSTR.getCode().equals(item.getTag())){
|
||||
item.setSeverity("/");
|
||||
}else {
|
||||
item.setSeverity(getYzd(item.getPersistTime()*1000,item.getAmplitude()/100.0));
|
||||
}
|
||||
item.setTag(CsTransientEnum.getNameByCode(item.getTag()));
|
||||
item.setPersistTime(BigDecimal.valueOf(item.getPersistTime()).setScale(3, RoundingMode.HALF_UP).doubleValue());
|
||||
});
|
||||
result.setRecords(dataGroupEventVOList);
|
||||
result.setTotal(page.getTotal());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该事件的严重度
|
||||
*
|
||||
* @param persistTime 持续时间 ms单位
|
||||
* @param eventValue 暂降、暂升幅值
|
||||
*/
|
||||
public String getYzd(Double persistTime, Double eventValue) {
|
||||
Double yzd;
|
||||
// 格式化小数
|
||||
DecimalFormat df = new DecimalFormat("0.000");
|
||||
if (persistTime <= 20) {
|
||||
yzd = 1.0 - eventValue;
|
||||
} else if (persistTime > 20 && persistTime <= 200) {
|
||||
yzd = 2.0 * (1 - eventValue);
|
||||
} else if (persistTime > 200 && persistTime <= 500) {
|
||||
yzd = 3.3 * (1 - eventValue);
|
||||
} else if (persistTime > 500 && persistTime <= 10000) {
|
||||
yzd = 5.0 * (1 - eventValue);
|
||||
} else {
|
||||
yzd = 10.0 * (1 - eventValue);
|
||||
}
|
||||
return df.format(yzd);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public void saveBatchEventList(List<CsEventPO> csEventPOS) {
|
||||
@@ -316,6 +392,15 @@ public class CsEventPOServiceImpl extends ServiceImpl<CsEventPOMapper, CsEventPO
|
||||
return this.list(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventStatisticsVo> getEventStatistics(CsEventUserQueryParam param) {
|
||||
|
||||
|
||||
|
||||
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
public String getTag(Integer type) {
|
||||
String tag;
|
||||
switch (type) {
|
||||
|
||||
@@ -107,7 +107,7 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
||||
queryWrapper.eq(StringUtils.isNotBlank (csPageParam.getPid()),CsPagePO.COL_PID,csPageParam.getPid()).
|
||||
like(StringUtils.isNotBlank (csPageParam.getSearchValue()),CsPagePO.COL_NAME,csPageParam.getSearchValue()).
|
||||
eq ("status",1).
|
||||
orderByAsc(CsPagePO.COL_KID);
|
||||
orderByAsc(CsPagePO.SORT);
|
||||
|
||||
IPage<CsPagePO> pageData = this.page(new Page<>(csPageParam.getPageNum(), csPageParam.getPageSize()), queryWrapper);
|
||||
List<String> collect1 = pageData.getRecords().stream().map(CsPagePO::getCreateBy).collect(Collectors.toList());
|
||||
@@ -123,7 +123,7 @@ public class CsPagePOServiceImpl extends ServiceImpl<CsPagePOMapper, CsPagePO> i
|
||||
CsPageVO csPageVO = new CsPageVO();
|
||||
CsConfigurationPO csConfigurationPO = csConfigurationMapper.selectById(temp.getPid());
|
||||
BeanUtils.copyProperties(temp, csPageVO);
|
||||
csPageVO.setKId(temp.getKId());
|
||||
// csPageVO.setKId(temp.getKId());
|
||||
csPageVO.setConfigurationName(csConfigurationPO.getName());
|
||||
InputStream fileStream = fileStorageUtil.getFileStream(temp.getPath());
|
||||
String text = new BufferedReader(
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,126 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.mapper.PqSensitiveUserMapper;
|
||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
import com.njcn.csharmonic.service.IPqSensitiveUserService;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-17
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMapper, PqSensitiveUser> implements IPqSensitiveUserService {
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public Page<PqSensitiveUserVo> getList(BaseParam param) {
|
||||
Page<PqSensitiveUserVo> result = new Page<>(param.getPageNum(),param.getPageSize());
|
||||
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.orderByDesc(PqSensitiveUser::getSort);
|
||||
if (StrUtil.isNotBlank(param.getSearchValue())) {
|
||||
lambdaQueryWrapper.like(PqSensitiveUser::getName, param.getSearchValue());
|
||||
}
|
||||
Page<PqSensitiveUser> page = this.page(new Page<>(param.getPageNum(),param.getPageSize()),lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(page.getRecords())){
|
||||
List<PqSensitiveUserVo> dataGroupEventVOList = new ArrayList<>();
|
||||
Map<String,List<CsLinePO>> map = new HashMap<>();
|
||||
//获取绑定敏感用户的监测点信息
|
||||
List<String> sensitiveUserIds = page.getRecords().stream().map(PqSensitiveUser::getId).collect(Collectors.toList());
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.getLineBySensitiveUser(sensitiveUserIds).getData();
|
||||
if (CollUtil.isNotEmpty(csLinePOList)) {
|
||||
map = csLinePOList.stream().collect(Collectors.groupingBy(CsLinePO::getMonitorUser));
|
||||
}
|
||||
Map<String, List<CsLinePO>> finalMap = map;
|
||||
page.getRecords().forEach(item->{
|
||||
PqSensitiveUserVo vo = new PqSensitiveUserVo();
|
||||
BeanUtil.copyProperties(item,vo);
|
||||
if (finalMap.containsKey(item.getId())) {
|
||||
vo.setIsMonitor("是");
|
||||
List<CsLinePO> list = finalMap.get(item.getId());
|
||||
boolean hasGoverned = list.stream().anyMatch(item2 -> item2.getGovern() == 1);
|
||||
vo.setIsGovern(hasGoverned ? "是" : "否");
|
||||
} else {
|
||||
vo.setIsMonitor("否");
|
||||
vo.setIsGovern("否");
|
||||
}
|
||||
dataGroupEventVOList.add(vo);
|
||||
});
|
||||
result.setRecords(dataGroupEventVOList);
|
||||
result.setTotal(page.getTotal());
|
||||
result.setSize(page.getSize());
|
||||
result.setCurrent(page.getCurrent());
|
||||
result.setPages(page.getPages());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean save(PqSensitiveUserParam pqSensitiveUserParam) {
|
||||
checkParam(pqSensitiveUserParam,false);
|
||||
|
||||
PqSensitiveUser pqSensitiveUser = new PqSensitiveUser();
|
||||
BeanUtil.copyProperties(pqSensitiveUserParam,pqSensitiveUser);
|
||||
return this.save(pqSensitiveUser);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean update(PqSensitiveUserParam.UpdatePqSensitiveUserParam pqSensitiveUserParam) {
|
||||
checkParam(pqSensitiveUserParam,true);
|
||||
PqSensitiveUser pqSensitiveUser = new PqSensitiveUser();
|
||||
BeanUtil.copyProperties(pqSensitiveUserParam,pqSensitiveUser);
|
||||
return this.updateById(pqSensitiveUser);
|
||||
}
|
||||
|
||||
|
||||
private void checkParam(PqSensitiveUserParam param,boolean update){
|
||||
DictData data = dicDataFeignClient.getDicDataById(param.getLoadType()).getData();
|
||||
if(Objects.isNull(data)){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"字典负荷类型缺失!");
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<PqSensitiveUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(PqSensitiveUser::getName,param.getName());
|
||||
if(update){
|
||||
if(param instanceof PqSensitiveUserParam.UpdatePqSensitiveUserParam){
|
||||
lambdaQueryWrapper.ne(PqSensitiveUser::getId,((PqSensitiveUserParam.UpdatePqSensitiveUserParam) param).getId());
|
||||
}
|
||||
}
|
||||
int count = this.count(lambdaQueryWrapper);
|
||||
if(count>0){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"用户名称重复!");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,362 @@
|
||||
package com.njcn.csharmonic.service.impl.event;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.*;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.nacos.shaded.org.checkerframework.checker.units.qual.C;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.ImmutableMap;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.enums.CsEventEnum;
|
||||
import com.njcn.csharmonic.enums.CsTransientEnum;
|
||||
import com.njcn.csharmonic.pojo.param.EventStatisticParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventCoordsVO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.EventStatisticVO;
|
||||
import com.njcn.csharmonic.pojo.vo.event.F47Curve;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.csharmonic.service.event.EventOverviewService;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import static com.njcn.csharmonic.enums.CsTransientEnum.*;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-11-20
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EventOverviewServiceImpl implements EventOverviewService {
|
||||
private static final List<String> EVENT_TAGS = Arrays.asList(
|
||||
EVT_SYS_DIPSTR.getCode(),
|
||||
EVT_SYS_INTRSTR.getCode(),
|
||||
EVT_SYS_SWLSTR.getCode()
|
||||
);
|
||||
|
||||
private final CsEventPOService csEventPOService;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||
|
||||
@Override
|
||||
public EventStatisticVO netEventEcharts(EventStatisticParam baseParam) {
|
||||
EventStatisticVO result = new EventStatisticVO();
|
||||
DateTime start = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime()));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime()));
|
||||
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return result;
|
||||
}
|
||||
List<CsEventPO> csEventPOList = csEventPOService.lambdaQuery()
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
|
||||
if (CollUtil.isEmpty(csEventPOList)) {
|
||||
return result;
|
||||
}
|
||||
Map<String, Long> eventCountByTag = csEventPOList.stream().collect(Collectors.groupingBy(CsEventPO::getTag, Collectors.counting()));
|
||||
result.setEventDown(eventCountByTag.getOrDefault(EVT_SYS_DIPSTR.getCode(), 0L).intValue());
|
||||
result.setEventOff(eventCountByTag.getOrDefault(EVT_SYS_INTRSTR.getCode(), 0L).intValue());
|
||||
result.setEventUp(eventCountByTag.getOrDefault(EVT_SYS_SWLSTR.getCode(), 0L).intValue());
|
||||
result.setAllNum(csEventPOList.size());
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventStatisticVO> netEventTable(EventStatisticParam baseParam) {
|
||||
DateTime start = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime()));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime()));
|
||||
|
||||
List<String> lineIds = StrUtil.isBlank(baseParam.getSearchValue())
|
||||
? csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData()
|
||||
: Collections.singletonList(baseParam.getSearchValue());
|
||||
|
||||
if(CollUtil.isEmpty(lineIds)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(lineIds).getData();
|
||||
if (CollUtil.isEmpty(csLinePOList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<String> validLineIds = csLinePOList.stream()
|
||||
.map(CsLinePO::getLineId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsEventPO> csEventPOList = csEventPOService.lambdaQuery()
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.in(CsEventPO::getLineId, validLineIds)
|
||||
.list();
|
||||
|
||||
if (CollUtil.isEmpty(csEventPOList)) {
|
||||
return csLinePOList.stream()
|
||||
.map(line -> {
|
||||
EventStatisticVO vo = new EventStatisticVO();
|
||||
vo.setName(line.getName());
|
||||
vo.setId(line.getLineId());
|
||||
return vo;
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
// 按线路ID和事件类型分组统计
|
||||
Map<String, Map<String, Long>> eventCountByLineAndTag = csEventPOList.stream()
|
||||
.collect(Collectors.groupingBy(
|
||||
CsEventPO::getLineId,
|
||||
Collectors.groupingBy(
|
||||
CsEventPO::getTag,
|
||||
Collectors.counting()
|
||||
)
|
||||
));
|
||||
|
||||
return csLinePOList.stream()
|
||||
.map(line -> {
|
||||
EventStatisticVO vo = new EventStatisticVO();
|
||||
vo.setName(line.getName());
|
||||
vo.setId(line.getLineId());
|
||||
Map<String, Long> lineEvents = eventCountByLineAndTag.getOrDefault(line.getLineId(), Collections.emptyMap());
|
||||
vo.setEventDown(lineEvents.getOrDefault(EVT_SYS_DIPSTR.getCode(), 0L).intValue());
|
||||
vo.setEventOff(lineEvents.getOrDefault(EVT_SYS_INTRSTR.getCode(), 0L).intValue());
|
||||
vo.setEventUp(lineEvents.getOrDefault(EVT_SYS_SWLSTR.getCode(), 0L).intValue());
|
||||
|
||||
return vo;
|
||||
}).sorted(Comparator.comparing(EventStatisticVO::getEventDown, Comparator.reverseOrder())
|
||||
.thenComparing(EventStatisticVO::getEventOff, Comparator.reverseOrder()).thenComparing(EventStatisticVO::getEventUp, Comparator.reverseOrder()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<F47Curve> getF47Curve(EventStatisticParam baseParam) {
|
||||
DateTime start = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime()));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime()));
|
||||
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
List<CsEventPO> csEventPOList = csEventPOService.lambdaQuery().select(CsEventPO::getId,CsEventPO::getLineId,CsEventPO::getStartTime,CsEventPO::getTag,CsEventPO::getPersistTime,CsEventPO::getAmplitude)
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
if(CollUtil.isEmpty(csEventPOList)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<String> monitorIds = csEventPOList.stream().map(CsEventPO::getLineId).distinct().collect(Collectors.toList());
|
||||
List<CsLinePO> csLinePOList = csLineFeignClient.queryLineById(monitorIds).getData();
|
||||
Map<String,String> nameMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, CsLinePO::getName));
|
||||
|
||||
|
||||
List<F47Curve> f47CurveList = csEventPOList.stream().map(item->{
|
||||
F47Curve f47Curve = new F47Curve();
|
||||
f47Curve.setEventId(item.getId());
|
||||
f47Curve.setTime(item.getStartTime());
|
||||
f47Curve.setTag(item.getTag());
|
||||
f47Curve.setPersistTime(BigDecimal.valueOf(item.getPersistTime()).setScale(3, RoundingMode.HALF_UP));
|
||||
f47Curve.setEventValue(BigDecimal.valueOf(item.getAmplitude()));
|
||||
f47Curve.setLineName(nameMap.getOrDefault(item.getLineId(),"异常测点"));
|
||||
return f47Curve;
|
||||
}).collect(Collectors.toList());
|
||||
return f47CurveList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EventStatisticVO> getEventDate(EventStatisticParam baseParam) {
|
||||
if(StrUtil.isBlank(baseParam.getSearchBeginTime())){
|
||||
throw new BusinessException(CommonResponseEnum.FAIL,"月份不可为空");
|
||||
}
|
||||
DateTime dateTime = DateUtil.parse(baseParam.getSearchBeginTime(), DatePattern.NORM_DATE_PATTERN);
|
||||
DateTime start = DateUtil.beginOfMonth(dateTime);
|
||||
DateTime end = DateUtil.endOfMonth(dateTime);
|
||||
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<DateTime> rangList = DateUtil.rangeToList(start,end, DateField.DAY_OF_MONTH);
|
||||
List<CsEventPO> csEventPOList = csEventPOService.lambdaQuery().select(CsEventPO::getId,CsEventPO::getTag,CsEventPO::getStartTime,CsEventPO::getPersistTime,CsEventPO::getAmplitude)
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
if(CollUtil.isEmpty(csEventPOList)){
|
||||
return rangList.stream().map(item->{
|
||||
EventStatisticVO eventStatisticVO = new EventStatisticVO();
|
||||
eventStatisticVO.setName(DateUtil.format(item,DatePattern.NORM_DATE_PATTERN));
|
||||
return eventStatisticVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, Map<String, Long>> map = csEventPOList.stream().collect(Collectors.groupingBy(item-> DateUtil.format(item.getStartTime(),DatePattern.NORM_DATE_PATTERN),Collectors.groupingBy(
|
||||
CsEventPO::getTag,
|
||||
Collectors.counting()
|
||||
)));
|
||||
|
||||
return rangList.stream().map(item->{
|
||||
EventStatisticVO eventStatisticVO = new EventStatisticVO();
|
||||
String day = DateUtil.format(item,DatePattern.NORM_DATE_PATTERN);
|
||||
eventStatisticVO.setName(day);
|
||||
|
||||
Map<String,Long> itemMap = map.getOrDefault(day,Collections.emptyMap());
|
||||
eventStatisticVO.setEventDown(itemMap.getOrDefault(EVT_SYS_DIPSTR.getCode(), 0L).intValue());
|
||||
eventStatisticVO.setEventOff(itemMap.getOrDefault(EVT_SYS_INTRSTR.getCode(), 0L).intValue());
|
||||
eventStatisticVO.setEventUp(itemMap.getOrDefault(EVT_SYS_SWLSTR.getCode(), 0L).intValue());
|
||||
return eventStatisticVO;
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public EventCoordsVO getEventCoords(EventStatisticParam baseParam) {
|
||||
EventCoordsVO eventCoordsVO = new EventCoordsVO();
|
||||
// 初始化结果列表
|
||||
List<EventCoordsVO.inner> result = new ArrayList<>(50);
|
||||
for (int i = 0; i < 10; i++) {
|
||||
for (int j = 0; j < 5; j++) {
|
||||
result.add(new EventCoordsVO.inner(i, j, 0));
|
||||
}
|
||||
}
|
||||
List<String> ids = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
if(CollUtil.isEmpty(ids)){
|
||||
return eventCoordsVO;
|
||||
}
|
||||
|
||||
//查询监测点未处理暂态事件
|
||||
DateTime start = DateUtil.beginOfDay(DateUtil.parse(baseParam.getSearchBeginTime()));
|
||||
DateTime end = DateUtil.endOfDay(DateUtil.parse(baseParam.getSearchEndTime()));
|
||||
List<CsEventPO> events = csEventPOService.lambdaQuery().select(CsEventPO::getId,CsEventPO::getTag,CsEventPO::getStartTime,CsEventPO::getPersistTime,CsEventPO::getAmplitude)
|
||||
.between(CsEventPO::getStartTime, start, end)
|
||||
.eq(CsEventPO::getType, CsEventEnum.EVENT_TYPE.getCode())
|
||||
.in(CsEventPO::getTag, EVENT_TAGS)
|
||||
.in(CsEventPO::getLineId,ids)
|
||||
.list();
|
||||
|
||||
// 定义幅值和持续时间的分类规则
|
||||
Map<Double, Integer> amplitudeRanges = ImmutableMap.<Double, Integer>builder()
|
||||
.put(0.0, 0)
|
||||
.put(10.0, 1)
|
||||
.put(20.0, 2)
|
||||
.put(30.0, 3)
|
||||
.put(40.0, 4)
|
||||
.put(50.0, 5)
|
||||
.put(60.0, 6)
|
||||
.put(70.0, 7)
|
||||
.put(80.0, 8)
|
||||
.put(90.0, 9)
|
||||
// 默认分类
|
||||
.put(Double.MAX_VALUE, 10)
|
||||
.build();
|
||||
|
||||
// 持续时间分类规则
|
||||
Map<Double, Integer> persistTimeRanges = ImmutableMap.<Double, Integer>builder()
|
||||
.put(0.01, 0)
|
||||
.put(0.1, 1)
|
||||
.put(1.0, 2)
|
||||
.put(10.0, 3)
|
||||
.put(1000.0, 4)
|
||||
.build();
|
||||
|
||||
// 时间段分类规则
|
||||
Map<Double, Integer> startTimeRanges = ImmutableMap.<Double, Integer>builder()
|
||||
.put(8.0, 0)
|
||||
.put(12.0, 1)
|
||||
.put(14.0, 2)
|
||||
.put(18.0, 3)
|
||||
.put(24.0, 4)
|
||||
.build();
|
||||
|
||||
// 分类事件
|
||||
// 0:down, 1:off, 2:up
|
||||
List<Integer>[] timeSegmentStats = new List[3];
|
||||
for (int i = 0; i < timeSegmentStats.length; i++) {
|
||||
timeSegmentStats[i] = IntStream.range(0, 5).boxed().collect(Collectors.toList());
|
||||
}
|
||||
for (CsEventPO event : events) {
|
||||
double amplitude = event.getAmplitude();
|
||||
double persistTimeSec = event.getPersistTime();
|
||||
|
||||
// 确定幅值分类
|
||||
int amplitudeGroup = getRangeGroup(amplitudeRanges, amplitude);
|
||||
// 确定持续时间分类(幅值分类作为行,持续时间分类作为列)
|
||||
int persistTimeGroup = getRangeGroup(persistTimeRanges, persistTimeSec);
|
||||
|
||||
// 计算索引:行 = 幅值分组,列 = 持续时间分组
|
||||
int row = amplitudeGroup;
|
||||
int col = persistTimeGroup;
|
||||
// 10行 x 5列的网格
|
||||
int index = row * 5 + col;
|
||||
|
||||
if (index >= 0 && index < result.size()) {
|
||||
EventCoordsVO.inner inner = result.get(index);
|
||||
inner.setZ(inner.getZ() + 1);
|
||||
}
|
||||
|
||||
int hour = event.getStartTime().getHour();
|
||||
int startTimeGroup = getRangeGroup(startTimeRanges, hour);
|
||||
|
||||
String tag = event.getTag();
|
||||
if (EVT_SYS_DIPSTR.getCode().equals(tag)) {
|
||||
timeSegmentStats[0].set(startTimeGroup, timeSegmentStats[0].get(startTimeGroup) + 1);
|
||||
} else if (EVT_SYS_INTRSTR.getCode().equals(tag)) {
|
||||
timeSegmentStats[1].set(startTimeGroup, timeSegmentStats[1].get(startTimeGroup) + 1);
|
||||
} else if (EVT_SYS_SWLSTR.getCode().equals(tag)) {
|
||||
timeSegmentStats[2].set(startTimeGroup, timeSegmentStats[2].get(startTimeGroup) + 1);
|
||||
}
|
||||
}
|
||||
eventCoordsVO.setInnerList(result);
|
||||
List<String> xList = Stream.of("0时-8时","8时-12时","12时-14时","14时-18时","18时-24时").collect(Collectors.toList());
|
||||
|
||||
List<EventCoordsVO.TagObj> trendList = Arrays.asList(
|
||||
new EventCoordsVO.TagObj(EVT_SYS_DIPSTR.getCode(),
|
||||
timeSegmentStats[0]),
|
||||
new EventCoordsVO.TagObj(EVT_SYS_INTRSTR.getCode(),
|
||||
timeSegmentStats[1]),
|
||||
new EventCoordsVO.TagObj(EVT_SYS_SWLSTR.getCode(),
|
||||
timeSegmentStats[2])
|
||||
);
|
||||
eventCoordsVO.setXList(xList);
|
||||
eventCoordsVO.setTrendList(trendList);
|
||||
return eventCoordsVO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据范围映射表获取分组
|
||||
*/
|
||||
private int getRangeGroup(Map<Double, Integer> ranges, double value) {
|
||||
for (Map.Entry<Double, Integer> entry : ranges.entrySet()) {
|
||||
if (value <= entry.getKey()) {
|
||||
return entry.getValue();
|
||||
}
|
||||
}
|
||||
// 默认返回最大分组
|
||||
return ranges.size() - 1;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.cssystem.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class WlUserParam implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty(value = "工程id集合")
|
||||
private List<String> engineeringList;
|
||||
|
||||
@ApiModelProperty(value = "便携式设备id")
|
||||
private List<String> portableDevList;
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.cssystem.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class WlUserVo implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
@ApiModelProperty(value = "工程集合")
|
||||
private List<EngineeringVo> engineeringList;
|
||||
|
||||
@ApiModelProperty(value = "便携式设备集合")
|
||||
private List<portableDevVo> portableDevList;
|
||||
|
||||
|
||||
@Data
|
||||
public static class EngineeringVo implements Serializable{
|
||||
|
||||
@ApiModelProperty(value = "工程id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "工程名称")
|
||||
private String name;
|
||||
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class portableDevVo implements Serializable{
|
||||
|
||||
@ApiModelProperty(value = "设备id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String name;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.njcn.cssystem.controller;
|
||||
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.OperateType;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.cssystem.pojo.param.WlUserParam;
|
||||
import com.njcn.cssystem.pojo.vo.WlUserVo;
|
||||
import com.njcn.cssystem.service.IWlUserService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2025-11-12
|
||||
*/
|
||||
@Validated
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/wlUser")
|
||||
@Api(tags = "用户设备分配")
|
||||
@AllArgsConstructor
|
||||
public class WlUserController extends BaseController {
|
||||
|
||||
private final IWlUserService wlUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@PostMapping("/selectDevByUserId")
|
||||
@ApiOperation("根据用户id查询工程和便携式设备")
|
||||
@ApiImplicitParam(name = "userId", value = "用户id", required = true)
|
||||
public HttpResult<WlUserVo> selectDevByUserId(@RequestParam @Validated String userId ) {
|
||||
String methodDescribe = getMethodDescribe("selectDevByUserId");
|
||||
LogUtil.njcnDebug(log, "{},用户数据为:{}", methodDescribe, userId);
|
||||
WlUserVo vo = wlUserService.selectDevByUserId(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/addUserDev")
|
||||
@ApiOperation("用户绑定工程和便携式设备")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<WlUserVo> addUserDev(@RequestBody @Validated WlUserParam param) {
|
||||
String methodDescribe = getMethodDescribe("addUserDev");
|
||||
LogUtil.njcnDebug(log, "{},参数:{}", methodDescribe, param);
|
||||
wlUserService.addUserDev(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.DELETE)
|
||||
@PostMapping("/deleteUserDev")
|
||||
@ApiOperation("用户取消绑定工程和便携式设备")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<WlUserVo> deleteUserDev(@RequestBody @Validated WlUserParam param) {
|
||||
String methodDescribe = getMethodDescribe("deleteUserDev");
|
||||
LogUtil.njcnDebug(log, "{},参数:{}", methodDescribe, param);
|
||||
wlUserService.deleteUserDev(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.njcn.cssystem.pojo.param.WlUserParam;
|
||||
import com.njcn.cssystem.pojo.vo.WlUserVo;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
public interface IWlUserService {
|
||||
|
||||
WlUserVo selectDevByUserId(String userId);
|
||||
|
||||
void addUserDev(WlUserParam param);
|
||||
|
||||
void deleteUserDev(WlUserParam param);
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
package com.njcn.cssystem.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.cssystem.pojo.param.WlUserParam;
|
||||
import com.njcn.cssystem.pojo.vo.WlUserVo;
|
||||
import com.njcn.cssystem.service.IWlUserService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class WlUserServiceImpl implements IWlUserService {
|
||||
|
||||
private final CsDeviceUserFeignClient csDeviceUserFeignClient;
|
||||
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||
|
||||
@Override
|
||||
public WlUserVo selectDevByUserId(String userId) {
|
||||
WlUserVo wlUserVo = new WlUserVo();
|
||||
List<WlUserVo.EngineeringVo> list1 = new ArrayList<>();
|
||||
List<WlUserVo.portableDevVo> list2 = new ArrayList<>();
|
||||
//根据用户信息获取设备信息
|
||||
List<String> devList = csDeviceUserFeignClient.findDevByUserId(userId).getData();
|
||||
//根据设备查询工程信息
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
List<DevDetailDTO> ledger = csLedgerFeignClient.getInfoByIds(devList).getData();
|
||||
ledger.forEach(item->{
|
||||
if (Objects.equals(item.getEngineeringid(),"/")) {
|
||||
WlUserVo.portableDevVo portableDevVo = new WlUserVo.portableDevVo();
|
||||
portableDevVo.setId(item.getEquipmentId());
|
||||
portableDevVo.setName(item.getEquipmentName());
|
||||
list2.add(portableDevVo);
|
||||
} else {
|
||||
WlUserVo.EngineeringVo engineeringVo = new WlUserVo.EngineeringVo();
|
||||
engineeringVo.setId(item.getEngineeringid());
|
||||
engineeringVo.setName(item.getEngineeringName());
|
||||
list1.add(engineeringVo);
|
||||
}
|
||||
});
|
||||
}
|
||||
wlUserVo.setEngineeringList(list1);
|
||||
wlUserVo.setPortableDevList(list2);
|
||||
return wlUserVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addUserDev(WlUserParam param) {
|
||||
List<String> devList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(param.getEngineeringList())) {
|
||||
//根据工程id获取设备id
|
||||
List<DevDetailDTO> dto = csLedgerFeignClient.getDevInfoByEngineerIds(param.getEngineeringList()).getData();
|
||||
if (CollectionUtil.isNotEmpty(dto)) {
|
||||
devList.addAll(dto.stream().map(DevDetailDTO::getEquipmentId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(param.getPortableDevList())) {
|
||||
devList.addAll(param.getPortableDevList());
|
||||
}
|
||||
//存储用户和设备的关系
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
List<CsDeviceUserPO> list = new ArrayList<>();
|
||||
devList.forEach(item->{
|
||||
CsDeviceUserPO po = new CsDeviceUserPO();
|
||||
po.setPrimaryUserId(param.getUserId());
|
||||
po.setSubUserId(param.getUserId());
|
||||
po.setDeviceId(item);
|
||||
po.setStatus("1");
|
||||
list.add(po);
|
||||
});
|
||||
csDeviceUserFeignClient.add(list);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteUserDev(WlUserParam param) {
|
||||
List<String> devList = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(param.getEngineeringList())) {
|
||||
//根据工程id获取设备id
|
||||
List<DevDetailDTO> dto = csLedgerFeignClient.getDevInfoByEngineerIds(param.getEngineeringList()).getData();
|
||||
if (CollectionUtil.isNotEmpty(dto)) {
|
||||
devList.addAll(dto.stream().map(DevDetailDTO::getEquipmentId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(param.getPortableDevList())) {
|
||||
devList.addAll(param.getPortableDevList());
|
||||
}
|
||||
//解绑用户和设备的关系
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
UserDevParam par = new UserDevParam();
|
||||
par.setUserId(param.getUserId());
|
||||
par.setList(devList);
|
||||
csDeviceUserFeignClient.channelDevByUserId(par);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
8
pom.xml
8
pom.xml
@@ -32,6 +32,12 @@
|
||||
<nacos.url>${middle.server.url}:18848</nacos.url>
|
||||
<nacos.namespace>72972c43-3c20-4452-a261-66624e17da97</nacos.namespace>
|
||||
|
||||
<!-- <middle.server.url>192.168.1.103</middle.server.url>-->
|
||||
<!-- <service.server.url>192.168.1.103</service.server.url>-->
|
||||
<!-- <docker.server.url>192.168.1.103</docker.server.url>-->
|
||||
<!-- <nacos.url>${middle.server.url}:18848</nacos.url>-->
|
||||
<!-- <nacos.namespace>3b1afe3f-2841-413b-a5dd-3b182de49a43</nacos.namespace>-->
|
||||
|
||||
<!-- <middle.server.url>192.168.1.103</middle.server.url>-->
|
||||
<!-- <service.server.url>192.168.1.103</service.server.url>-->
|
||||
<!-- <docker.server.url>192.168.1.103</docker.server.url>-->
|
||||
@@ -40,7 +46,7 @@
|
||||
|
||||
<!--102-->
|
||||
<!-- <middle.server.url>192.168.1.102</middle.server.url>-->
|
||||
<!-- <service.server.url>127.0.0.1</service.server.url>-->
|
||||
<!-- <service.server.url>192.168.1.126</service.server.url>-->
|
||||
<!-- <docker.server.url>192.168.1.102</docker.server.url>-->
|
||||
<!-- <nacos.url>${middle.server.url}:18848</nacos.url>-->
|
||||
<!-- <nacos.namespace>d99572a5-415e-480b-bb92-30f05c2f6d93</nacos.namespace>-->
|
||||
|
||||
Reference in New Issue
Block a user