Compare commits
11 Commits
9c6a74a2d6
...
2025-11
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
24187ca6d9 | ||
| f33986e934 | |||
|
|
cea2b9694a | ||
| 8e4c4383c0 | |||
| cdd1b5075c | |||
| ea54b2b907 | |||
|
|
61c8656fd9 | ||
| 02e5100426 | |||
| 85ae7e7ddb | |||
| 9ae17b14f5 | |||
|
|
f7477ea8ff |
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,4 +135,10 @@ public class CsLinePO extends BaseEntity {
|
||||
|
||||
@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;
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -13,6 +13,7 @@ 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;
|
||||
@@ -28,6 +29,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -168,5 +170,18 @@ public class CsGroupController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过监测点获取监测点数据单位
|
||||
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -10,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;
|
||||
@@ -230,6 +231,15 @@ public class CslineController extends BaseController {
|
||||
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")
|
||||
@@ -248,7 +258,8 @@ public class CslineController extends BaseController {
|
||||
public HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<CsLinePO> list = csLinePOService.list(new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(StrUtil.isNotBlank(param.getPosition()), CsLinePO::getPosition, param.getPosition())
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.eq(StrUtil.isNotBlank(param.getPosition()), CsLinePO::getPosition, param.getPosition())
|
||||
.orderByAsc(CsLinePO::getName));
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
@@ -262,4 +273,33 @@ public class CslineController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -73,5 +76,11 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -8,12 +8,14 @@ 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 java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -82,13 +84,22 @@ public interface ICsGroupService extends IService<CsGroup> {
|
||||
|
||||
/**
|
||||
* 查询趋势数据
|
||||
* @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);
|
||||
|
||||
}
|
||||
|
||||
@@ -34,10 +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.FittingDataQueryParam;
|
||||
import com.njcn.csharmonic.param.TrendDataQueryParam;
|
||||
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;
|
||||
@@ -46,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.DictTreeFeignClient;
|
||||
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;
|
||||
@@ -101,6 +96,10 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
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)
|
||||
@@ -1130,6 +1129,47 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
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());
|
||||
}
|
||||
|
||||
@@ -1,30 +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;
|
||||
|
||||
/**
|
||||
@@ -44,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) {
|
||||
@@ -214,7 +243,7 @@ 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
|
||||
@@ -227,6 +256,34 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.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()
|
||||
@@ -235,6 +292,111 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.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 "未知";
|
||||
}
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||
// *
|
||||
|
||||
@@ -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,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,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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -46,4 +46,19 @@ public class PqSensitiveUserVo implements Serializable{
|
||||
* 是否治理
|
||||
*/
|
||||
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,6 +11,7 @@ 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;
|
||||
@@ -65,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("暂态事件波形分析")
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,12 +1,17 @@
|
||||
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;
|
||||
@@ -16,10 +21,10 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -48,6 +53,57 @@ public class PqSensitiveUserController extends BaseController {
|
||||
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,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,11 +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;
|
||||
@@ -51,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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ 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;
|
||||
@@ -18,4 +19,8 @@ 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);
|
||||
}
|
||||
@@ -19,11 +19,14 @@ 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;
|
||||
@@ -48,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;
|
||||
@@ -64,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;
|
||||
@@ -73,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【需求编号】
|
||||
@@ -166,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) {
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -7,21 +7,23 @@ 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.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,6 +42,8 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
public Page<PqSensitiveUserVo> getList(BaseParam param) {
|
||||
Page<PqSensitiveUserVo> result = new Page<>(param.getPageNum(),param.getPageSize());
|
||||
@@ -82,5 +86,41 @@ public class PqSensitiveUserServiceImpl extends ServiceImpl<PqSensitiveUserMappe
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user