Compare commits
37 Commits
5539c8fed5
...
2026-01
| Author | SHA1 | Date | |
|---|---|---|---|
| 3727b5777e | |||
| c3cb9a5f85 | |||
| 05ef7028c4 | |||
| 736b0a6e60 | |||
| cc63cead04 | |||
| 30bc3c7448 | |||
| 51a16c5701 | |||
| 4497699178 | |||
| 0ac51648f4 | |||
| fb515cca9b | |||
| 14d77725aa | |||
| ee87ffb0d4 | |||
| 5ff8c946aa | |||
| cccc73f211 | |||
| 4882151ccd | |||
| b774b7ce91 | |||
| 6b0feb1320 | |||
| e92326c55d | |||
| 7abbfd500b | |||
| 77360ef468 | |||
| b38d3bad1b | |||
| 27aebf2ca4 | |||
| 9981b04ed6 | |||
| f8c9828369 | |||
| 0d652b9f4d | |||
| 3ea67da152 | |||
| c7dce89d36 | |||
| e7dbee2df5 | |||
| 29168bbd9f | |||
| 56d88939c4 | |||
| bc6f3dca80 | |||
| 2957188466 | |||
| 2894a4780b | |||
| 240ec304b0 | |||
| ae09cc1996 | |||
| efdb1781da | |||
|
|
46aef0d97f |
@@ -4,18 +4,14 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.njcn.cloud.enums.app.UserCodeEnum;
|
||||
import com.njcn.cloud.pojo.vo.AdminStatistic.Integrity;
|
||||
import com.njcn.cloud.pojo.vo.AdminStatistic.StaticInfo;
|
||||
import com.njcn.cloud.service.AdminStatistic.DataIntegrityService;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.LineDeviceStateVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@@ -10,12 +10,14 @@ import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||
import com.njcn.device.pq.pojo.param.OnlineRateParam;
|
||||
import com.njcn.device.pq.pojo.vo.DevDetail;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlinerateVO;
|
||||
import com.njcn.device.pq.pojo.vo.RStatOnlineRateVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -54,7 +56,7 @@ public class StaticServiceImpl implements StaticService {
|
||||
//获取终端信息
|
||||
List<DevDetail> devDetails = generalDeviceInfoClient.getDevInfoByIds(new ArrayList<>()).getData();
|
||||
//获取终端在线率
|
||||
List<RStatOnlinerateVO> onlineRates = generalDeviceInfoClient.getOnlineRateByDevIds(param).getData();
|
||||
List<RStatOnlineRateVO> onlineRates = generalDeviceInfoClient.getOnlineRateByDevIds(param).getData();
|
||||
//异常终端数据
|
||||
long count = devDetails.stream().filter(x -> 0==x.getComFlag()).count();
|
||||
StaticInfo info=new StaticInfo();
|
||||
@@ -63,14 +65,14 @@ public class StaticServiceImpl implements StaticService {
|
||||
info.setOnlineRatez(data);
|
||||
info.setComError(count);
|
||||
List<StaticInfo.DevStatic> list=new ArrayList<>();
|
||||
Map<String, Float> onlineRateMap = onlineRates.stream().collect(Collectors.toMap(RStatOnlinerateVO::getDevIndex, RStatOnlinerateVO::getOnlineRate));
|
||||
Map<String, BigDecimal> onlineRateMap = onlineRates.stream().collect(Collectors.toMap(RStatOnlineRateVO::getDevIndex, RStatOnlineRateVO::getOnlineRate));
|
||||
StaticInfo.DevStatic devStatic;
|
||||
for (DevDetail devDetail : devDetails) {
|
||||
devStatic=new StaticInfo.DevStatic();
|
||||
devStatic.setDevIndex(devDetail.getDevIndex());
|
||||
devStatic.setDevName(devDetail.getDevName());
|
||||
devStatic.setIp(devDetail.getIp());
|
||||
devStatic.setOnlineRate(onlineRateMap.get(devDetail.getDevIndex()));
|
||||
devStatic.setOnlineRate(onlineRateMap.get(devDetail.getDevIndex()).setScale(3, RoundingMode.HALF_UP).floatValue());
|
||||
devStatic.setGdName(devDetail.getGdName());
|
||||
devStatic.setSubName(devDetail.getBdzName());
|
||||
devStatic.setTimeId(devDetail.getTimeID());
|
||||
@@ -80,4 +82,4 @@ public class StaticServiceImpl implements StaticService {
|
||||
return info;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,11 +14,13 @@ import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
@@ -38,6 +40,10 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/findByNdid")
|
||||
HttpResult<List<CsLinePO>> findByNdid(@RequestParam("id") String id);
|
||||
|
||||
|
||||
@GetMapping("/getCustomDetailByLineId")
|
||||
HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/getPositionById")
|
||||
HttpResult<String> getPositionById(@RequestParam("id") String id);
|
||||
|
||||
@@ -75,4 +81,7 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/getLineDetailData")
|
||||
HttpResult<LineDetailDataVO> getLineDetailData(@RequestParam("id") String id);
|
||||
|
||||
@GetMapping("/getSimpleLine")
|
||||
HttpResult<List<CsLinePO>> getSimpleLine();
|
||||
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.njcn.csdevice.api;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsOverLimitFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
@@ -14,6 +14,7 @@ import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
@@ -54,6 +55,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam("id") String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据id查询监测点",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> getPositionById(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","通过id查询监测点位置",cause.toString());
|
||||
@@ -124,6 +131,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getSimpleLine() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询登录用户拥有的监测点台账",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsOverLimitClient;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@@ -58,7 +58,7 @@ public interface DataParam {
|
||||
|
||||
String GOVERNANCE_SYSTEM = "治理系统";
|
||||
|
||||
String cldDev = "在线设备";
|
||||
String cldDev = "监测设备";
|
||||
|
||||
String EvtParamPhase = "Evt_Param_Phase";
|
||||
|
||||
|
||||
@@ -55,4 +55,7 @@ public class AppProjectAddParm {
|
||||
@ApiModelProperty(value="拓扑图模版id集合")
|
||||
private List<String> topoIds;
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
|
||||
@@ -44,4 +44,7 @@ public class AppProjectAuditParm {
|
||||
private List<String> topoIds;
|
||||
|
||||
private List<String> newTopoIds;
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
}
|
||||
|
||||
@@ -53,6 +53,10 @@ public class CsEngineeringAddParm {
|
||||
@ApiModelProperty(value = "描述")
|
||||
private String description;
|
||||
|
||||
|
||||
/**
|
||||
* 描述
|
||||
*/
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -54,6 +54,7 @@ public class CsEngineeringAuditParm {
|
||||
@ApiModelProperty(value="0:删除 1:正常")
|
||||
private String status;
|
||||
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -140,6 +140,11 @@ public class CsLineParam extends BaseEntity {
|
||||
*/
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 监测位置
|
||||
*/
|
||||
private String position;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -23,31 +23,31 @@ public class DeviceExcelTemplete implements Serializable {
|
||||
/**
|
||||
* 装置名称
|
||||
*/
|
||||
@Excel(name = "装置名称", width = 15)
|
||||
@Excel(name = "设备名称", width = 15)
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 网关识别码
|
||||
*/
|
||||
@Excel(name = "网关识别码", width = 15)
|
||||
@Excel(name = "网络设备ID", width = 15)
|
||||
private String ndid;
|
||||
|
||||
/**
|
||||
* 装置类型(直连设备、网关设备、装置)
|
||||
*/
|
||||
@Excel(name = "装置类型(直连设备,网关设备)", width = 30)
|
||||
@Excel(name = "设备类型(直连设备,网关设备、便携式设备)", width = 30)
|
||||
private String devType;
|
||||
|
||||
/**
|
||||
* 装置型号(pqs588、pqs680...)
|
||||
*/
|
||||
@Excel(name = "装置型号", width = 15)
|
||||
@Excel(name = "设备型号", width = 15)
|
||||
private String devModel;
|
||||
|
||||
/**
|
||||
* 装置接入方式(mqtt、cloud)
|
||||
*/
|
||||
@Excel(name = "装置接入方式(mqtt、cloud)", width = 25)
|
||||
@Excel(name = "通讯协议(MQTT、CLD)", width = 25)
|
||||
private String devAccessMethod;
|
||||
|
||||
/**
|
||||
|
||||
@@ -57,5 +57,8 @@ public class AppProjectPO extends BaseEntity {
|
||||
@TableField(value = "description")
|
||||
private String description;
|
||||
|
||||
@TableField(value = "sort")
|
||||
private Integer sort;
|
||||
|
||||
|
||||
}
|
||||
@@ -64,5 +64,10 @@ public class CsEngineeringPO extends BaseEntity {
|
||||
@TableField(value = "status")
|
||||
private String status;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField(value = "sort")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,59 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* 日志信息
|
||||
*/
|
||||
@Data
|
||||
public class EngineeringProjectRelationVo implements Serializable {
|
||||
|
||||
//工程信息
|
||||
@ApiModelProperty("工程id")
|
||||
private String engineeringId;
|
||||
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty("区域")
|
||||
private String engineeringArea;
|
||||
|
||||
@ApiModelProperty("工程备注")
|
||||
private String engineeringRemark;
|
||||
|
||||
@ApiModelProperty("工程排序")
|
||||
private Integer engineeringSort;
|
||||
|
||||
@ApiModelProperty("项目信息")
|
||||
private List<ProjectInfo> projectInfoList;
|
||||
|
||||
//项目信息
|
||||
@Data
|
||||
public static class ProjectInfo implements Serializable {
|
||||
|
||||
@ApiModelProperty("项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty("项目名称")
|
||||
private String projectName;
|
||||
|
||||
@ApiModelProperty("项目地址")
|
||||
private String projectArea;
|
||||
|
||||
@ApiModelProperty("项目备注")
|
||||
private String projectRemark;
|
||||
|
||||
@ApiModelProperty("项目排序")
|
||||
private Integer projectSort;
|
||||
|
||||
@ApiModelProperty("拓扑图信息")
|
||||
private String topologyInfo;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,383 +1,383 @@
|
||||
package com.njcn.csdevice.utils;
|
||||
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.enums.RunFlagEnum;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* pqs
|
||||
* 限值计算工具类
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2023/5/15
|
||||
*/
|
||||
public class COverlimitUtil {
|
||||
|
||||
|
||||
/**
|
||||
* 谐波电流系数
|
||||
*/
|
||||
private static final double[][] ARR = {
|
||||
{78, 62, 39, 62, 26, 44, 19, 21, 16, 28, 13, 24, 11, 12, 9.7, 18, 8.6, 16, 7.8, 8.9, 7.1, 14, 6.5, 12, 6.0, 6.9, 5.6, 11, 5.2, 10, 4.9, 5.6, 4.6, 8.9, 4.3, 8.4, 4.1, 4.8, 3.9, 7.6, 3.7, 7.2, 3.5, 4.1, 3.4, 6.6, 3.3, 6.3, 3.1},
|
||||
{43, 34, 21, 34, 14, 24, 11, 11, 8.5, 16, 7.1, 13, 6.1, 6.8, 5.3, 10, 4.7, 9, 4.3, 4.9, 3.9, 7.4, 3.6, 6.8, 3.3, 3.8, 3.1, 5.9, 2.9, 5.5, 2.7, 3.1, 2.5, 4.9, 2.4, 4.6, 2.3, 2.6, 2.2, 4.1, 2.0, 4.0, 2.0, 2.3, 1.9, 3.6, 1.8, 3.5, 1.7},
|
||||
{26, 20, 13, 20, 8.5, 15, 6.4, 6.8, 5.1, 9.3, 4.3, 7.9, 3.7, 4.1, 3.2, 6, 2.8, 5.4, 2.6, 2.9, 2.3, 4.5, 2.1, 4.1, 2.0, 2.2, 1.9, 3.4, 1.7, 3.2, 1.6, 1.8, 1.5, 2.9, 1.4, 2.7, 1.4, 1.5, 1.3, 2.4, 1.2, 2.3, 1.2, 1.3, 1.1, 2.1, 1.1, 2.0, 1.0},
|
||||
{15, 12, 7.7, 12, 5.1, 8.8, 3.8, 4.1, 3.1, 5.6, 2.6, 4.7, 2.2, 2.5, 1.9, 3.6, 1.7, 3.2, 1.5, 1.8, 1.4, 2.7, 1.3, 2.5, 1.2, 1.3, 1.1, 2.1, 1.0, 1.9, 0.9, 1.1, 0.9, 1.7, 0.8, 1.6, 0.8, 0.9, 0.8, 1.5, 0.7, 1.4, 0.7, 0.8, 0.7, 1.3, 0.6, 1.2, 0.6},
|
||||
{16, 13, 8.1, 13, 5.4, 9.3, 4.1, 4.3, 3.3, 5.9, 2.7, 5, 2.3, 2.6, 2, 3.8, 1.8, 3.4, 1.6, 1.9, 1.5, 2.8, 1.4, 2.6, 1.2, 1.4, 1.1, 2.2, 1.1, 2.1, 1.0, 1.2, 0.9, 1.9, 0.9, 1.8, 0.8, 1.0, 0.8, 1.6, 0.8, 1.5, 0.7, 0.9, 0.7, 1.4, 0.7, 1.3, 0.6},
|
||||
{12, 9.6, 6, 9.6, 4, 6.8, 3, 3.2, 2.4, 4.3, 2, 3.7, 1.7, 1.9, 1.5, 2.8, 1.3, 2.5, 1.2, 1.4, 1.1, 2.1, 1, 1.9, 0.9, 1.1, 0.9, 1.7, 0.8, 1.5, 0.8, 0.9, 0.7, 1.4, 0.7, 1.3, 0.6, 0.7, 0.6, 1.2, 0.6, 1.1, 0.5, 0.6, 0.5, 1.0, 0.5, 1.0, 0.5}
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* 计算监测点限值
|
||||
* @param voltageLevel 电压等级(10kV = 10 220kV = 220 )
|
||||
* @param protocolCapacity 协议容量
|
||||
* @param devCapacity 设备容量
|
||||
* @param shortCapacity 短路容量
|
||||
* @param powerFlag 0.用户侧 1.电网侧
|
||||
* @param lineType 0.主网 1.配网 需要注意配网目前没有四种容量,谐波电流幅值限值,负序电流限值无法计算默认-3.14159
|
||||
*/
|
||||
public static Overlimit globalAssemble(Float voltageLevel, Float protocolCapacity, Float devCapacity,
|
||||
Float shortCapacity, Integer powerFlag, Integer lineType) {
|
||||
Overlimit overlimit = new Overlimit();
|
||||
voltageDeviation(overlimit,voltageLevel);
|
||||
frequency(overlimit);
|
||||
voltageFluctuation(overlimit,voltageLevel);
|
||||
voltageFlicker(overlimit,voltageLevel);
|
||||
totalHarmonicDistortion(overlimit,voltageLevel);
|
||||
uHarm(overlimit,voltageLevel);
|
||||
threeVoltageUnbalance(overlimit);
|
||||
interharmonicCurrent(overlimit,voltageLevel);
|
||||
|
||||
if(Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
|
||||
//配网
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
|
||||
iHarmTem[i] = -3.14159f;
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
overlimit.setINeg(-3.14159f);
|
||||
}else {
|
||||
//主网
|
||||
iHarm(overlimit, voltageLevel, protocolCapacity, devCapacity, shortCapacity);
|
||||
negativeSequenceCurrent(overlimit, voltageLevel, shortCapacity);
|
||||
}
|
||||
return overlimit;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电压偏差限值
|
||||
*
|
||||
*/
|
||||
public static void voltageDeviation(Overlimit overlimit,Float voltageLevel) {
|
||||
float voltageDev = 3.14159f,uvoltageDev = 3.14159f;
|
||||
if(voltageLevel <= Float.parseFloat(DicDataEnum.V220.getCode())){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-10.0f;
|
||||
}else if(voltageLevel>Float.parseFloat(DicDataEnum.V220.getCode())&&voltageLevel<Float.parseFloat(DicDataEnum.KV20.getCode())){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-7.0f;
|
||||
}else if(voltageLevel>=Float.parseFloat(DicDataEnum.KV20.getCode())&&voltageLevel<Float.parseFloat(DicDataEnum.KV35.getCode())){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-7.0f;
|
||||
}else if(voltageLevel>=Float.parseFloat(DicDataEnum.KV35.getCode())&&voltageLevel<Float.parseFloat(DicDataEnum.KV66.getCode())){
|
||||
voltageDev = 10.0f;
|
||||
uvoltageDev=-10.0f;
|
||||
}else if(voltageLevel>=Float.parseFloat(DicDataEnum.KV66.getCode())&&voltageLevel<=Float.parseFloat(DicDataEnum.KV110.getCode())){
|
||||
voltageDev = 7.0f;
|
||||
uvoltageDev=-3.0f;
|
||||
}else if(voltageLevel>Float.parseFloat(DicDataEnum.KV110.getCode())){
|
||||
voltageDev = 10.0f;
|
||||
uvoltageDev=-10.0f;
|
||||
}
|
||||
overlimit.setVoltageDev(voltageDev);
|
||||
overlimit.setUvoltageDev(uvoltageDev);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 频率偏差
|
||||
* 默认限值:±0.2Hz(即:-0.2 Hz≤限值≤0.2 Hz)
|
||||
*/
|
||||
public static void frequency(Overlimit overlimit) {
|
||||
overlimit.setFreqDev(0.2f);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电压波动
|
||||
* 对LV、MV:0≤限值≤3%;对HV:0≤限值≤2.5%。
|
||||
* LV、MV、HV的定义:
|
||||
* 低压(LV) UN≤1kV
|
||||
* 中压(MV) 1kV<UN≤35kV
|
||||
* 高压(HV) 35kV<UN≤220kV
|
||||
* 超高压(EHV),220kV<UN,参照HV执行
|
||||
*/
|
||||
public static void voltageFluctuation(Overlimit overlimit, Float voltageLevel) {
|
||||
if (voltageLevel < Float.parseFloat(DicDataEnum.KV35.getCode())) {
|
||||
overlimit.setVoltageFluctuation(3.0f);
|
||||
} else {
|
||||
overlimit.setVoltageFluctuation(2.5f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 电压闪变
|
||||
* ≤110kV 1
|
||||
* >110kV 0.8
|
||||
*/
|
||||
public static void voltageFlicker(Overlimit overlimit, Float voltageLevel) {
|
||||
if (voltageLevel <= Float.parseFloat(DicDataEnum.KV110.getCode())) {
|
||||
overlimit.setFlicker(1.0f);
|
||||
} else {
|
||||
overlimit.setFlicker(0.8f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 总谐波电压畸变率
|
||||
*
|
||||
*
|
||||
*/
|
||||
public static void totalHarmonicDistortion(Overlimit overlimit, Float voltageLevel) {
|
||||
float result = 3.14159f;
|
||||
if (voltageLevel < Float.parseFloat(DicDataEnum.KV6.getCode())) {
|
||||
result = 5.0f;
|
||||
} else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV6.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV20.getCode())){
|
||||
result = 4.0f;
|
||||
} else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV35.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV66.getCode())){
|
||||
result = 3.0f;
|
||||
} else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV110.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV1000.getCode())){
|
||||
result = 2.0f;
|
||||
}
|
||||
overlimit.setUaberrance(result);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 谐波电压含有率
|
||||
*/
|
||||
public static void uHarm(Overlimit overlimit, Float voltageLevel) {
|
||||
float resultOdd = 3.14159f,resultEven = 3.14159f;
|
||||
if (voltageLevel < Float.parseFloat(DicDataEnum.KV6.getCode())) {
|
||||
resultOdd = 4.0f;
|
||||
resultEven = 2.0f;
|
||||
} else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV6.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV20.getCode())){
|
||||
resultOdd = 3.2f;
|
||||
resultEven = 1.6f;
|
||||
} else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV35.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV66.getCode())){
|
||||
resultOdd = 2.4f;
|
||||
resultEven = 1.2f;
|
||||
} else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV110.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV1000.getCode())){
|
||||
resultOdd = 1.6f;
|
||||
resultEven = 0.8f;
|
||||
}
|
||||
overlimit.buildUharm(resultEven,resultOdd);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 负序电压不平衡(三相电压不平衡度)
|
||||
*
|
||||
*/
|
||||
public static void threeVoltageUnbalance(Overlimit overlimit) {
|
||||
overlimit.setUbalance(2.0f);
|
||||
overlimit.setShortUbalance(4.0f);
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------谐波电流限值start-----------------------------------*/
|
||||
|
||||
/**
|
||||
* 谐波电流限值
|
||||
*/
|
||||
public static void iHarm(Overlimit overlimit, Float voltageLevel,Float protocolCapacity,Float devCapacity,Float shortCapacity) {
|
||||
float calCap = shortCapacity/getDlCapByVoltageLevel(voltageLevel);
|
||||
//24谐波电流幅值
|
||||
Float[] iHarmTem = new Float[49];
|
||||
for (int i = 0; i <= 48; i++) {
|
||||
float inHarm = iHarmCalculate(i+2,voltageLevel,protocolCapacity,devCapacity,calCap);
|
||||
iHarmTem[i] = inHarm;
|
||||
}
|
||||
overlimit.buildIHarm(iHarmTem);
|
||||
}
|
||||
/**
|
||||
* @Description: iHarmCalculate
|
||||
* @Param: protocolCapacity 协议容量 devCapacity设备容量 calCap 短路容量
|
||||
* @return: float
|
||||
* @Author: clam
|
||||
* @Date: 2024/2/4
|
||||
*/
|
||||
private static float iHarmCalculate(int nHarm, Float voltageLevel,float protocolCapacity, float devCapacity,float calCap) {
|
||||
double tag = calCap*getHarmTag(nHarm,voltageLevel);
|
||||
Double limit = getHarmonicLimit(nHarm,tag,new BigDecimal(String.valueOf(devCapacity)).doubleValue(),new BigDecimal(String.valueOf(protocolCapacity)).doubleValue());
|
||||
BigDecimal bigDecimal = BigDecimal.valueOf(limit).setScale(4,RoundingMode.HALF_UP);
|
||||
return bigDecimal.floatValue();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 电流谐波限值
|
||||
*/
|
||||
private static Double getHarmTag(Integer iCount, Float voltageLevel) {
|
||||
int x, y;
|
||||
if (voltageLevel < DicDataEnum.KV6.getValue()) {
|
||||
x = 0;
|
||||
} else if (voltageLevel<DicDataEnum.KV10.getValue()) {
|
||||
x = 1;
|
||||
} else if (voltageLevel<DicDataEnum.KV35.getValue()) {
|
||||
x = 2;
|
||||
} else if (voltageLevel<DicDataEnum.KV66.getValue()) {
|
||||
x = 3;
|
||||
} else if (voltageLevel<DicDataEnum.KV110.getValue()) {
|
||||
x = 4;
|
||||
} else {
|
||||
x = 5;
|
||||
}
|
||||
y = iCount - 2;
|
||||
return ARR[x][y];
|
||||
}
|
||||
|
||||
/**
|
||||
* 相位叠加系数的取值
|
||||
*/
|
||||
public static Double getHarmonicLimit(Integer times, double iTag, double supply, double user) {
|
||||
if (supply == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
double coefficient = 2.0;
|
||||
if (times == 3) {
|
||||
coefficient = 1.1;
|
||||
} else if (times == 5) {
|
||||
coefficient = 1.2;
|
||||
} else if (times == 7) {
|
||||
coefficient = 1.4;
|
||||
} else if (times == 11) {
|
||||
coefficient = 1.8;
|
||||
} else if (times == 13) {
|
||||
coefficient = 1.9;
|
||||
}
|
||||
BigDecimal bd = new BigDecimal(iTag * Math.pow((user / supply), (1 / coefficient)));
|
||||
bd = bd.setScale(6, RoundingMode.HALF_UP);
|
||||
return Double.parseDouble(bd.toString());
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据电压等级获取基准短路容量
|
||||
*/
|
||||
public static float getDlCapByVoltageLevel(Float voltageLevel){
|
||||
float capValue;
|
||||
if(voltageLevel< DicDataEnum.KV06.getValue()){
|
||||
capValue = 10;
|
||||
}else if(voltageLevel<DicDataEnum.KV20.getValue()){
|
||||
capValue = 100;
|
||||
}else if(voltageLevel<DicDataEnum.KV35.getValue()){
|
||||
capValue = 200;
|
||||
}else if(voltageLevel<DicDataEnum.KV66.getValue()){
|
||||
capValue = 250;
|
||||
}else if(voltageLevel<DicDataEnum.KV110.getValue()){
|
||||
capValue = 500;
|
||||
}else if(voltageLevel<DicDataEnum.KV220.getValue()){
|
||||
capValue = 750;
|
||||
}else if(voltageLevel<DicDataEnum.KV330.getValue()){
|
||||
capValue = 2000;
|
||||
}else if(voltageLevel<DicDataEnum.KV500.getValue()){
|
||||
capValue = 3000;
|
||||
}else if(voltageLevel<DicDataEnum.KV750.getValue()){
|
||||
capValue = 4500;
|
||||
}else if(voltageLevel<DicDataEnum.KV1000.getValue()){
|
||||
capValue = 7000;
|
||||
}else {
|
||||
capValue = 9000;
|
||||
}
|
||||
return capValue;
|
||||
}
|
||||
|
||||
|
||||
/*---------------------------------谐波电流限值end-----------------------------------*/
|
||||
|
||||
|
||||
/**
|
||||
* 间谐波电压含有率
|
||||
*/
|
||||
|
||||
public static void interharmonicCurrent(Overlimit overlimit,Float voltageLevel){
|
||||
float aValue,bValue;
|
||||
if(voltageLevel <= DicDataEnum.KV1.getValue()){
|
||||
aValue = 0.2f;bValue = 0.5f;
|
||||
}else {
|
||||
aValue = 0.16f;bValue = 0.4f;
|
||||
}
|
||||
overlimit.setInuharm1(aValue);
|
||||
overlimit.setInuharm2(aValue);
|
||||
|
||||
overlimit.setInuharm3(bValue);
|
||||
overlimit.setInuharm4(bValue);
|
||||
overlimit.setInuharm5(bValue);
|
||||
overlimit.setInuharm6(bValue);
|
||||
overlimit.setInuharm7(bValue);
|
||||
overlimit.setInuharm8(bValue);
|
||||
overlimit.setInuharm9(bValue);
|
||||
overlimit.setInuharm10(bValue);
|
||||
overlimit.setInuharm11(bValue);
|
||||
overlimit.setInuharm12(bValue);
|
||||
overlimit.setInuharm13(bValue);
|
||||
overlimit.setInuharm14(bValue);
|
||||
overlimit.setInuharm15(bValue);
|
||||
overlimit.setInuharm16(bValue);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 负序电流限值
|
||||
*/
|
||||
public static void negativeSequenceCurrent(Overlimit overlimit,Float voltageLevel,Float shortCapacity){
|
||||
double v = (0.013*shortCapacity*1000)/(getUl(voltageLevel)*Math.sqrt(3));
|
||||
overlimit.setINeg((float) v);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取额定线电压
|
||||
*/
|
||||
private static float getUl(Float voltageLevel){
|
||||
float value;
|
||||
if(voltageLevel<DicDataEnum.KV6.getValue()){
|
||||
value = 0.4f;
|
||||
}else if(voltageLevel<DicDataEnum.KV10.getValue()){
|
||||
value = 6.3f;
|
||||
}else if(voltageLevel<DicDataEnum.KV20.getValue()){
|
||||
value = 10.5f;
|
||||
}else if(voltageLevel<DicDataEnum.KV35.getValue()){
|
||||
value = 21.0f;
|
||||
}else if(voltageLevel<DicDataEnum.KV66.getValue()){
|
||||
value = 36.5f;
|
||||
}else if(voltageLevel<DicDataEnum.KV110.getValue()){
|
||||
value = 69.0f;
|
||||
}else if(voltageLevel<DicDataEnum.KV220.getValue()){
|
||||
value = 115.5f;
|
||||
}else if(voltageLevel<DicDataEnum.KV330.getValue()){
|
||||
value = 230.0f;
|
||||
}else {
|
||||
value = 345.0f;
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
System.out.println("sss");
|
||||
float aa = iHarmCalculate(9,500f,10,10,0.002222222222f);
|
||||
|
||||
System.out.println(aa);
|
||||
}
|
||||
}
|
||||
//package com.njcn.csdevice.utils;
|
||||
//
|
||||
//import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
//import com.njcn.device.biz.enums.RunFlagEnum;
|
||||
//import com.njcn.system.enums.DicDataEnum;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//import java.math.RoundingMode;
|
||||
//import java.util.Objects;
|
||||
//
|
||||
//
|
||||
///**
|
||||
// * pqs
|
||||
// * 限值计算工具类
|
||||
// *
|
||||
// * @author cdf
|
||||
// * @date 2023/5/15
|
||||
// */
|
||||
//public class COverlimitUtil {
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 谐波电流系数
|
||||
// */
|
||||
// private static final double[][] ARR = {
|
||||
// {78, 62, 39, 62, 26, 44, 19, 21, 16, 28, 13, 24, 11, 12, 9.7, 18, 8.6, 16, 7.8, 8.9, 7.1, 14, 6.5, 12, 6.0, 6.9, 5.6, 11, 5.2, 10, 4.9, 5.6, 4.6, 8.9, 4.3, 8.4, 4.1, 4.8, 3.9, 7.6, 3.7, 7.2, 3.5, 4.1, 3.4, 6.6, 3.3, 6.3, 3.1},
|
||||
// {43, 34, 21, 34, 14, 24, 11, 11, 8.5, 16, 7.1, 13, 6.1, 6.8, 5.3, 10, 4.7, 9, 4.3, 4.9, 3.9, 7.4, 3.6, 6.8, 3.3, 3.8, 3.1, 5.9, 2.9, 5.5, 2.7, 3.1, 2.5, 4.9, 2.4, 4.6, 2.3, 2.6, 2.2, 4.1, 2.0, 4.0, 2.0, 2.3, 1.9, 3.6, 1.8, 3.5, 1.7},
|
||||
// {26, 20, 13, 20, 8.5, 15, 6.4, 6.8, 5.1, 9.3, 4.3, 7.9, 3.7, 4.1, 3.2, 6, 2.8, 5.4, 2.6, 2.9, 2.3, 4.5, 2.1, 4.1, 2.0, 2.2, 1.9, 3.4, 1.7, 3.2, 1.6, 1.8, 1.5, 2.9, 1.4, 2.7, 1.4, 1.5, 1.3, 2.4, 1.2, 2.3, 1.2, 1.3, 1.1, 2.1, 1.1, 2.0, 1.0},
|
||||
// {15, 12, 7.7, 12, 5.1, 8.8, 3.8, 4.1, 3.1, 5.6, 2.6, 4.7, 2.2, 2.5, 1.9, 3.6, 1.7, 3.2, 1.5, 1.8, 1.4, 2.7, 1.3, 2.5, 1.2, 1.3, 1.1, 2.1, 1.0, 1.9, 0.9, 1.1, 0.9, 1.7, 0.8, 1.6, 0.8, 0.9, 0.8, 1.5, 0.7, 1.4, 0.7, 0.8, 0.7, 1.3, 0.6, 1.2, 0.6},
|
||||
// {16, 13, 8.1, 13, 5.4, 9.3, 4.1, 4.3, 3.3, 5.9, 2.7, 5, 2.3, 2.6, 2, 3.8, 1.8, 3.4, 1.6, 1.9, 1.5, 2.8, 1.4, 2.6, 1.2, 1.4, 1.1, 2.2, 1.1, 2.1, 1.0, 1.2, 0.9, 1.9, 0.9, 1.8, 0.8, 1.0, 0.8, 1.6, 0.8, 1.5, 0.7, 0.9, 0.7, 1.4, 0.7, 1.3, 0.6},
|
||||
// {12, 9.6, 6, 9.6, 4, 6.8, 3, 3.2, 2.4, 4.3, 2, 3.7, 1.7, 1.9, 1.5, 2.8, 1.3, 2.5, 1.2, 1.4, 1.1, 2.1, 1, 1.9, 0.9, 1.1, 0.9, 1.7, 0.8, 1.5, 0.8, 0.9, 0.7, 1.4, 0.7, 1.3, 0.6, 0.7, 0.6, 1.2, 0.6, 1.1, 0.5, 0.6, 0.5, 1.0, 0.5, 1.0, 0.5}
|
||||
// };
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 计算监测点限值
|
||||
// * @param voltageLevel 电压等级(10kV = 10 220kV = 220 )
|
||||
// * @param protocolCapacity 协议容量
|
||||
// * @param devCapacity 设备容量
|
||||
// * @param shortCapacity 短路容量
|
||||
// * @param powerFlag 0.用户侧 1.电网侧
|
||||
// * @param lineType 0.主网 1.配网 需要注意配网目前没有四种容量,谐波电流幅值限值,负序电流限值无法计算默认-3.14159
|
||||
// */
|
||||
// public static Overlimit globalAssemble(Float voltageLevel, Float protocolCapacity, Float devCapacity,
|
||||
// Float shortCapacity, Integer powerFlag, Integer lineType) {
|
||||
// Overlimit overlimit = new Overlimit();
|
||||
// voltageDeviation(overlimit,voltageLevel);
|
||||
// frequency(overlimit);
|
||||
// voltageFluctuation(overlimit,voltageLevel);
|
||||
// voltageFlicker(overlimit,voltageLevel);
|
||||
// totalHarmonicDistortion(overlimit,voltageLevel);
|
||||
// uHarm(overlimit,voltageLevel);
|
||||
// threeVoltageUnbalance(overlimit);
|
||||
// interharmonicCurrent(overlimit,voltageLevel);
|
||||
//
|
||||
// if(Objects.equals(lineType, RunFlagEnum.PW_FLAG.getStatus())) {
|
||||
// //配网
|
||||
// Float[] iHarmTem = new Float[49];
|
||||
// for (int i = 0; i <= 48; i++) {
|
||||
//
|
||||
// iHarmTem[i] = -3.14159f;
|
||||
// }
|
||||
// overlimit.buildIHarm(iHarmTem);
|
||||
// overlimit.setINeg(-3.14159f);
|
||||
// }else {
|
||||
// //主网
|
||||
// iHarm(overlimit, voltageLevel, protocolCapacity, devCapacity, shortCapacity);
|
||||
// negativeSequenceCurrent(overlimit, voltageLevel, shortCapacity);
|
||||
// }
|
||||
// return overlimit;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 电压偏差限值
|
||||
// *
|
||||
// */
|
||||
// public static void voltageDeviation(Overlimit overlimit,Float voltageLevel) {
|
||||
// float voltageDev = 3.14159f,uvoltageDev = 3.14159f;
|
||||
// if(voltageLevel <= Float.parseFloat(DicDataEnum.V220.getCode())){
|
||||
// voltageDev = 7.0f;
|
||||
// uvoltageDev=-10.0f;
|
||||
// }else if(voltageLevel>Float.parseFloat(DicDataEnum.V220.getCode())&&voltageLevel<Float.parseFloat(DicDataEnum.KV20.getCode())){
|
||||
// voltageDev = 7.0f;
|
||||
// uvoltageDev=-7.0f;
|
||||
// }else if(voltageLevel>=Float.parseFloat(DicDataEnum.KV20.getCode())&&voltageLevel<Float.parseFloat(DicDataEnum.KV35.getCode())){
|
||||
// voltageDev = 7.0f;
|
||||
// uvoltageDev=-7.0f;
|
||||
// }else if(voltageLevel>=Float.parseFloat(DicDataEnum.KV35.getCode())&&voltageLevel<Float.parseFloat(DicDataEnum.KV66.getCode())){
|
||||
// voltageDev = 10.0f;
|
||||
// uvoltageDev=-10.0f;
|
||||
// }else if(voltageLevel>=Float.parseFloat(DicDataEnum.KV66.getCode())&&voltageLevel<=Float.parseFloat(DicDataEnum.KV110.getCode())){
|
||||
// voltageDev = 7.0f;
|
||||
// uvoltageDev=-3.0f;
|
||||
// }else if(voltageLevel>Float.parseFloat(DicDataEnum.KV110.getCode())){
|
||||
// voltageDev = 10.0f;
|
||||
// uvoltageDev=-10.0f;
|
||||
// }
|
||||
// overlimit.setVoltageDev(voltageDev);
|
||||
// overlimit.setUvoltageDev(uvoltageDev);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 频率偏差
|
||||
// * 默认限值:±0.2Hz(即:-0.2 Hz≤限值≤0.2 Hz)
|
||||
// */
|
||||
// public static void frequency(Overlimit overlimit) {
|
||||
// overlimit.setFreqDev(0.2f);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 电压波动
|
||||
// * 对LV、MV:0≤限值≤3%;对HV:0≤限值≤2.5%。
|
||||
// * LV、MV、HV的定义:
|
||||
// * 低压(LV) UN≤1kV
|
||||
// * 中压(MV) 1kV<UN≤35kV
|
||||
// * 高压(HV) 35kV<UN≤220kV
|
||||
// * 超高压(EHV),220kV<UN,参照HV执行
|
||||
// */
|
||||
// public static void voltageFluctuation(Overlimit overlimit, Float voltageLevel) {
|
||||
// if (voltageLevel < Float.parseFloat(DicDataEnum.KV35.getCode())) {
|
||||
// overlimit.setVoltageFluctuation(3.0f);
|
||||
// } else {
|
||||
// overlimit.setVoltageFluctuation(2.5f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 电压闪变
|
||||
// * ≤110kV 1
|
||||
// * >110kV 0.8
|
||||
// */
|
||||
// public static void voltageFlicker(Overlimit overlimit, Float voltageLevel) {
|
||||
// if (voltageLevel <= Float.parseFloat(DicDataEnum.KV110.getCode())) {
|
||||
// overlimit.setFlicker(1.0f);
|
||||
// } else {
|
||||
// overlimit.setFlicker(0.8f);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 总谐波电压畸变率
|
||||
// *
|
||||
// *
|
||||
// */
|
||||
// public static void totalHarmonicDistortion(Overlimit overlimit, Float voltageLevel) {
|
||||
// float result = 3.14159f;
|
||||
// if (voltageLevel < Float.parseFloat(DicDataEnum.KV6.getCode())) {
|
||||
// result = 5.0f;
|
||||
// } else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV6.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV20.getCode())){
|
||||
// result = 4.0f;
|
||||
// } else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV35.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV66.getCode())){
|
||||
// result = 3.0f;
|
||||
// } else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV110.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV1000.getCode())){
|
||||
// result = 2.0f;
|
||||
// }
|
||||
// overlimit.setUaberrance(result);
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 谐波电压含有率
|
||||
// */
|
||||
// public static void uHarm(Overlimit overlimit, Float voltageLevel) {
|
||||
// float resultOdd = 3.14159f,resultEven = 3.14159f;
|
||||
// if (voltageLevel < Float.parseFloat(DicDataEnum.KV6.getCode())) {
|
||||
// resultOdd = 4.0f;
|
||||
// resultEven = 2.0f;
|
||||
// } else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV6.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV20.getCode())){
|
||||
// resultOdd = 3.2f;
|
||||
// resultEven = 1.6f;
|
||||
// } else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV35.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV66.getCode())){
|
||||
// resultOdd = 2.4f;
|
||||
// resultEven = 1.2f;
|
||||
// } else if(voltageLevel >= Float.parseFloat(DicDataEnum.KV110.getCode()) && voltageLevel <= Float.parseFloat(DicDataEnum.KV1000.getCode())){
|
||||
// resultOdd = 1.6f;
|
||||
// resultEven = 0.8f;
|
||||
// }
|
||||
// overlimit.buildUharm(resultEven,resultOdd);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 负序电压不平衡(三相电压不平衡度)
|
||||
// *
|
||||
// */
|
||||
// public static void threeVoltageUnbalance(Overlimit overlimit) {
|
||||
// overlimit.setUbalance(2.0f);
|
||||
// overlimit.setShortUbalance(4.0f);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*---------------------------------谐波电流限值start-----------------------------------*/
|
||||
//
|
||||
// /**
|
||||
// * 谐波电流限值
|
||||
// */
|
||||
// public static void iHarm(Overlimit overlimit, Float voltageLevel,Float protocolCapacity,Float devCapacity,Float shortCapacity) {
|
||||
// float calCap = shortCapacity/getDlCapByVoltageLevel(voltageLevel);
|
||||
// //24谐波电流幅值
|
||||
// Float[] iHarmTem = new Float[49];
|
||||
// for (int i = 0; i <= 48; i++) {
|
||||
// float inHarm = iHarmCalculate(i+2,voltageLevel,protocolCapacity,devCapacity,calCap);
|
||||
// iHarmTem[i] = inHarm;
|
||||
// }
|
||||
// overlimit.buildIHarm(iHarmTem);
|
||||
// }
|
||||
// /**
|
||||
// * @Description: iHarmCalculate
|
||||
// * @Param: protocolCapacity 协议容量 devCapacity设备容量 calCap 短路容量
|
||||
// * @return: float
|
||||
// * @Author: clam
|
||||
// * @Date: 2024/2/4
|
||||
// */
|
||||
// private static float iHarmCalculate(int nHarm, Float voltageLevel,float protocolCapacity, float devCapacity,float calCap) {
|
||||
// double tag = calCap*getHarmTag(nHarm,voltageLevel);
|
||||
// Double limit = getHarmonicLimit(nHarm,tag,new BigDecimal(String.valueOf(devCapacity)).doubleValue(),new BigDecimal(String.valueOf(protocolCapacity)).doubleValue());
|
||||
// BigDecimal bigDecimal = BigDecimal.valueOf(limit).setScale(4,RoundingMode.HALF_UP);
|
||||
// return bigDecimal.floatValue();
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 电流谐波限值
|
||||
// */
|
||||
// private static Double getHarmTag(Integer iCount, Float voltageLevel) {
|
||||
// int x, y;
|
||||
// if (voltageLevel < DicDataEnum.KV6.getValue()) {
|
||||
// x = 0;
|
||||
// } else if (voltageLevel<DicDataEnum.KV10.getValue()) {
|
||||
// x = 1;
|
||||
// } else if (voltageLevel<DicDataEnum.KV35.getValue()) {
|
||||
// x = 2;
|
||||
// } else if (voltageLevel<DicDataEnum.KV66.getValue()) {
|
||||
// x = 3;
|
||||
// } else if (voltageLevel<DicDataEnum.KV110.getValue()) {
|
||||
// x = 4;
|
||||
// } else {
|
||||
// x = 5;
|
||||
// }
|
||||
// y = iCount - 2;
|
||||
// return ARR[x][y];
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 相位叠加系数的取值
|
||||
// */
|
||||
// public static Double getHarmonicLimit(Integer times, double iTag, double supply, double user) {
|
||||
// if (supply == 0) {
|
||||
// return 0.0;
|
||||
// }
|
||||
// double coefficient = 2.0;
|
||||
// if (times == 3) {
|
||||
// coefficient = 1.1;
|
||||
// } else if (times == 5) {
|
||||
// coefficient = 1.2;
|
||||
// } else if (times == 7) {
|
||||
// coefficient = 1.4;
|
||||
// } else if (times == 11) {
|
||||
// coefficient = 1.8;
|
||||
// } else if (times == 13) {
|
||||
// coefficient = 1.9;
|
||||
// }
|
||||
// BigDecimal bd = new BigDecimal(iTag * Math.pow((user / supply), (1 / coefficient)));
|
||||
// bd = bd.setScale(6, RoundingMode.HALF_UP);
|
||||
// return Double.parseDouble(bd.toString());
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据电压等级获取基准短路容量
|
||||
// */
|
||||
// public static float getDlCapByVoltageLevel(Float voltageLevel){
|
||||
// float capValue;
|
||||
// if(voltageLevel< DicDataEnum.KV06.getValue()){
|
||||
// capValue = 10;
|
||||
// }else if(voltageLevel<DicDataEnum.KV20.getValue()){
|
||||
// capValue = 100;
|
||||
// }else if(voltageLevel<DicDataEnum.KV35.getValue()){
|
||||
// capValue = 200;
|
||||
// }else if(voltageLevel<DicDataEnum.KV66.getValue()){
|
||||
// capValue = 250;
|
||||
// }else if(voltageLevel<DicDataEnum.KV110.getValue()){
|
||||
// capValue = 500;
|
||||
// }else if(voltageLevel<DicDataEnum.KV220.getValue()){
|
||||
// capValue = 750;
|
||||
// }else if(voltageLevel<DicDataEnum.KV330.getValue()){
|
||||
// capValue = 2000;
|
||||
// }else if(voltageLevel<DicDataEnum.KV500.getValue()){
|
||||
// capValue = 3000;
|
||||
// }else if(voltageLevel<DicDataEnum.KV750.getValue()){
|
||||
// capValue = 4500;
|
||||
// }else if(voltageLevel<DicDataEnum.KV1000.getValue()){
|
||||
// capValue = 7000;
|
||||
// }else {
|
||||
// capValue = 9000;
|
||||
// }
|
||||
// return capValue;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /*---------------------------------谐波电流限值end-----------------------------------*/
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 间谐波电压含有率
|
||||
// */
|
||||
//
|
||||
// public static void interharmonicCurrent(Overlimit overlimit,Float voltageLevel){
|
||||
// float aValue,bValue;
|
||||
// if(voltageLevel <= DicDataEnum.KV1.getValue()){
|
||||
// aValue = 0.2f;bValue = 0.5f;
|
||||
// }else {
|
||||
// aValue = 0.16f;bValue = 0.4f;
|
||||
// }
|
||||
// overlimit.setInuharm1(aValue);
|
||||
// overlimit.setInuharm2(aValue);
|
||||
//
|
||||
// overlimit.setInuharm3(bValue);
|
||||
// overlimit.setInuharm4(bValue);
|
||||
// overlimit.setInuharm5(bValue);
|
||||
// overlimit.setInuharm6(bValue);
|
||||
// overlimit.setInuharm7(bValue);
|
||||
// overlimit.setInuharm8(bValue);
|
||||
// overlimit.setInuharm9(bValue);
|
||||
// overlimit.setInuharm10(bValue);
|
||||
// overlimit.setInuharm11(bValue);
|
||||
// overlimit.setInuharm12(bValue);
|
||||
// overlimit.setInuharm13(bValue);
|
||||
// overlimit.setInuharm14(bValue);
|
||||
// overlimit.setInuharm15(bValue);
|
||||
// overlimit.setInuharm16(bValue);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 负序电流限值
|
||||
// */
|
||||
// public static void negativeSequenceCurrent(Overlimit overlimit,Float voltageLevel,Float shortCapacity){
|
||||
// double v = (0.013*shortCapacity*1000)/(getUl(voltageLevel)*Math.sqrt(3));
|
||||
// overlimit.setINeg((float) v);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 获取额定线电压
|
||||
// */
|
||||
// private static float getUl(Float voltageLevel){
|
||||
// float value;
|
||||
// if(voltageLevel<DicDataEnum.KV6.getValue()){
|
||||
// value = 0.4f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV10.getValue()){
|
||||
// value = 6.3f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV20.getValue()){
|
||||
// value = 10.5f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV35.getValue()){
|
||||
// value = 21.0f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV66.getValue()){
|
||||
// value = 36.5f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV110.getValue()){
|
||||
// value = 69.0f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV220.getValue()){
|
||||
// value = 115.5f;
|
||||
// }else if(voltageLevel<DicDataEnum.KV330.getValue()){
|
||||
// value = 230.0f;
|
||||
// }else {
|
||||
// value = 345.0f;
|
||||
// }
|
||||
// return value;
|
||||
// }
|
||||
//
|
||||
//
|
||||
// public static void main(String[] args) {
|
||||
// System.out.println("sss");
|
||||
// float aa = iHarmCalculate(9,500f,10,10,0.002222222222f);
|
||||
//
|
||||
// System.out.println(aa);
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -6,9 +6,9 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.csdevice.pojo.vo.LineOverLimitVO;
|
||||
import com.njcn.csdevice.service.IOverLimitService;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
|
||||
@@ -67,7 +67,7 @@ public class IcdController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/bzFileByEventId")
|
||||
@ApiOperation("指定事件补召波形")
|
||||
@ApiOperation("指定事件补召波形指令下发")
|
||||
@ApiImplicitParam(name = "eventId", value = "事件id", required = true)
|
||||
public HttpResult<String> bzFileByEventId(@RequestParam String eventId){
|
||||
String methodDescribe = getMethodDescribe("bzFileByEventId");
|
||||
@@ -77,7 +77,7 @@ public class IcdController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/bzEvent")
|
||||
@ApiOperation("补召事件")
|
||||
@ApiOperation("补召事件指令下发")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<String> bzEvent(@RequestBody @Validated IcdBzParam param){
|
||||
String methodDescribe = getMethodDescribe("bzEvent");
|
||||
@@ -87,7 +87,7 @@ public class IcdController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/bzFile")
|
||||
@ApiOperation("补召波形")
|
||||
@ApiOperation("补召波形指令下发")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<String> bzFile(@RequestBody @Validated IcdBzParam param){
|
||||
String methodDescribe = getMethodDescribe("bzFile");
|
||||
|
||||
@@ -12,6 +12,7 @@ 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.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
@@ -47,13 +48,8 @@ import java.util.stream.Collectors;
|
||||
@Api(tags = "通用台账查询")
|
||||
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;
|
||||
private final CsCommTerminalService commTerminalService;
|
||||
|
||||
/**
|
||||
* 根据用户获取设备信息
|
||||
@@ -64,7 +60,7 @@ public class CsCommTerminalController extends BaseController {
|
||||
@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);
|
||||
List<String> devIds = commTerminalService.commGetDevIds(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, devIds, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -77,19 +73,8 @@ public class CsCommTerminalController extends BaseController {
|
||||
@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);
|
||||
}
|
||||
List<String> lineIds = commTerminalService.getLineIdsByUser(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineIds, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -101,37 +86,12 @@ public class CsCommTerminalController extends BaseController {
|
||||
@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);
|
||||
}
|
||||
String methodDescribe = getMethodDescribe("getLineIdsByUser");
|
||||
List<String> lineIds = commTerminalService.getPqUserIdsByUser(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineIds, 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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过监测点获取监测点数据单位
|
||||
@@ -144,11 +104,7 @@ public class CsCommTerminalController extends BaseController {
|
||||
@ApiImplicitParam(name = "lineId", value = "实体", required = true)
|
||||
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("lineUnitDetail");
|
||||
|
||||
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
||||
if(Objects.isNull(pqsDeviceUnit)){
|
||||
pqsDeviceUnit = new PqsDeviceUnit();
|
||||
}
|
||||
PqsDeviceUnit pqsDeviceUnit = commTerminalService.lineUnitDetail(lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,16 @@ public class CsLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/objTree")
|
||||
@ApiOperation("三层对象用户树")
|
||||
public HttpResult<List<CsLedgerVO>> objTree(){
|
||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
List<CsLedgerVO> list = csLedgerService.objTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增台账信息")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
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;
|
||||
@@ -8,14 +7,14 @@ 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.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.csdevice.pojo.vo.PqSensitiveUserLineVO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.utils.COverlimitUtil;
|
||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.*;
|
||||
@@ -28,6 +27,7 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
@@ -44,7 +44,7 @@ import java.util.List;
|
||||
public class CslineController extends BaseController {
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final OverLimitWlMapper overLimitWlMapper;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryLineById")
|
||||
@@ -87,8 +87,8 @@ public class CslineController extends BaseController {
|
||||
for(CsLinePO csLinePO: list){
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(csLinePO.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||
overlimit.setId(csLinePO.getLineId());
|
||||
overlimitMapper.deleteById(csLinePO.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
overLimitWlMapper.deleteById(csLinePO.getLineId());
|
||||
overLimitWlMapper.insert(overlimit);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
@@ -104,6 +104,17 @@ public class CslineController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, lineList, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getCustomDetailByLineId")
|
||||
@ApiOperation("根据id查询监测点")
|
||||
public HttpResult<Map<String,String>> getCustomDetailByLineId(@RequestParam String id){
|
||||
String methodDescribe = getMethodDescribe("getCustomDetailByLineId");
|
||||
Map<String,String> map = csLinePOService.getCustomDetailByLineId(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, map, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateLine")
|
||||
@ApiOperation("修改监测点信息")
|
||||
@@ -144,7 +155,17 @@ public class CslineController extends BaseController {
|
||||
@ApiImplicitParam(name = "ids", value = "监测点id集合", required = true)
|
||||
public HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitDataByIds");
|
||||
List<Overlimit> result = overlimitMapper.selectBatchIds(ids);
|
||||
List<Overlimit> result = overLimitWlMapper.selectBatchIds(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitData")
|
||||
@ApiOperation("根据监测点id获取国标限值")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitData");
|
||||
Overlimit result = overLimitWlMapper.selectById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -176,10 +197,10 @@ public class CslineController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("addCldLine");
|
||||
csLinePOService.addCldLine(param);
|
||||
//新增监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),param.getProtocolCapacity().floatValue(),param.getDevCapacity().floatValue(),param.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(param.getLineId());
|
||||
overlimitMapper.deleteById(param.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
overLimitWlMapper.deleteById(param.getLineId());
|
||||
overLimitWlMapper.insert(overlimit);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -191,10 +212,10 @@ public class CslineController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("updateCldLine");
|
||||
csLinePOService.updateCldLine(param);
|
||||
//修改监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(param.getVolGrade().floatValue(),param.getProtocolCapacity().floatValue(),param.getDevCapacity().floatValue(),param.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(param.getLineId());
|
||||
overlimitMapper.deleteById(param.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
overLimitWlMapper.deleteById(param.getLineId());
|
||||
overLimitWlMapper.insert(overlimit);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -205,6 +226,7 @@ public class CslineController extends BaseController {
|
||||
public HttpResult<List<CsLinePO>> delCldLine(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("delCldLine");
|
||||
csLinePOService.deleteCldLine(id);
|
||||
overLimitWlMapper.deleteById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -258,10 +280,7 @@ public class CslineController extends BaseController {
|
||||
@ApiImplicitParam(name = "param", value = "param", required = true)
|
||||
public HttpResult<List<CsLinePO>> list(@RequestBody CsLinePO param) {
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<CsLinePO> list = csLinePOService.list(new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.eq(StrUtil.isNotBlank(param.getPosition()), CsLinePO::getPosition, param.getPosition())
|
||||
.orderByAsc(CsLinePO::getName));
|
||||
List<CsLinePO> list = csLinePOService.getLineList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -280,7 +299,7 @@ public class CslineController extends BaseController {
|
||||
@ApiOperation("获取敏感负荷用户监测点列表")
|
||||
@ApiImplicitParam(name = "param", value = "查询参数", required = true)
|
||||
public HttpResult<Page<PqSensitiveUserLineVO>> getSensitiveUserLineList(@RequestBody BaseParam param) {
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
String methodDescribe = getMethodDescribe("getSensitiveUserLineList");
|
||||
Page<PqSensitiveUserLineVO> page = csLinePOService.getSensitiveUserLineList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -11,8 +11,6 @@ import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryPageParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import com.njcn.csdevice.service.CsEngineeringService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.njcn.csdevice.controller.project;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
||||
import com.njcn.csdevice.pojo.vo.EngineeringProjectRelationVo;
|
||||
import com.njcn.csdevice.service.IEngineeringProjectService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
* @date 2026/1/29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/engineeringProjectRelation")
|
||||
@Api(tags = " 工程信息管理(不分权限)")
|
||||
@AllArgsConstructor
|
||||
public class EngineeringProjectController extends BaseController {
|
||||
|
||||
private final IEngineeringProjectService csEngineeringService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addEngineering")
|
||||
@ApiOperation("新增工程信息")
|
||||
public HttpResult<Boolean> addEngineering(@Validated @RequestBody CsEngineeringAddParm csEngineeringAddParm){
|
||||
String methodDescribe = getMethodDescribe("addEngineering");
|
||||
boolean result = csEngineeringService.addEngineering(csEngineeringAddParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateEngineering")
|
||||
@ApiOperation("修改工程信息")
|
||||
public HttpResult<Boolean> updateEngineering(@Validated @RequestBody CsEngineeringAuditParm csEngineeringAuditParm){
|
||||
String methodDescribe = getMethodDescribe("updateEngineering");
|
||||
boolean result = csEngineeringService.updateEngineering(csEngineeringAuditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deleteEngineering")
|
||||
@ApiOperation("删除工程信息")
|
||||
public HttpResult<Boolean> deleteEngineering(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("deleteEngineering");
|
||||
boolean result = csEngineeringService.deleteEngineering(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addProject")
|
||||
@ApiOperation("新增项目信息")
|
||||
public HttpResult<Boolean> addProject(@Validated @RequestBody AppProjectAddParm param){
|
||||
String methodDescribe = getMethodDescribe("addProject");
|
||||
boolean result = csEngineeringService.addProject(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateProject")
|
||||
@ApiOperation("修改项目信息")
|
||||
public HttpResult<Boolean> updateProject(@Validated @RequestBody AppProjectAuditParm param){
|
||||
String methodDescribe = getMethodDescribe("updateProject");
|
||||
boolean result = csEngineeringService.updateProject(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deleteProject")
|
||||
@ApiOperation("删除项目信息")
|
||||
public HttpResult<Boolean> deleteProject(@RequestParam("id") String id){
|
||||
String methodDescribe = getMethodDescribe("deleteProject");
|
||||
boolean result = csEngineeringService.deleteProject(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/list")
|
||||
@ApiOperation("查询工程信息列表")
|
||||
public HttpResult<List<EngineeringProjectRelationVo>> getList(){
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
List<EngineeringProjectRelationVo> result = csEngineeringService.getList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -5,6 +5,7 @@ import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -17,4 +18,7 @@ import java.util.List;
|
||||
public interface CsLinePOMapper extends BaseMapper<CsLinePO> {
|
||||
|
||||
List<CsLinePO> findByNdid(@Param("id") String id);
|
||||
|
||||
|
||||
Map<String,String> getCustomDetailByLineId(@Param("lineId")String lineId);
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Mapper
|
||||
public interface OverlimitMapper extends BaseMapper<Overlimit> {
|
||||
|
||||
}
|
||||
@@ -19,7 +19,7 @@
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
line_id, dev_id, `name`, `position`, vol_grade, pt_ratio, ct_ratio, `status`, create_by,
|
||||
line_id, dev_id, `name`, `position`, vol_grade, pt_ratio, ct_ratio, `status`, create_by,
|
||||
create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
@@ -33,4 +33,24 @@
|
||||
where
|
||||
t0.ndid = #{id}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
|
||||
<select id="getCustomDetailByLineId" resultType="map">
|
||||
SELECT
|
||||
line.line_id as lineId,
|
||||
line.name as lineName,
|
||||
concat(round(line.pt_ratio,0), ':', round(IFNULL(line.pt2_ratio, 1), 0)) as pt,
|
||||
concat(round(line.ct_ratio,0), ':', round(IFNULL(line.ct2_ratio, 1), 0)) as ct,
|
||||
line.dev_capacity as Dev_Capacity,
|
||||
line.short_circuit_capacity as Short_Capacity,
|
||||
line.basic_capacity as Standard_Capacity,
|
||||
line.protocol_capacity as Deal_Capacity,
|
||||
line.vol_grade AS voltageLevel,
|
||||
dataSet.data_level AS level
|
||||
FROM
|
||||
cs_line line
|
||||
left JOIN cs_data_set dataSet on line.data_set_id = dataSet.id
|
||||
WHERE
|
||||
line.line_id = #{lineId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -55,4 +55,11 @@ public interface AppProjectService extends IService<AppProjectPO> {
|
||||
* @return
|
||||
*/
|
||||
List<AppProjectPO> getProjectByEngineering(List<String> list);
|
||||
|
||||
|
||||
AppProjectPO add(AppProjectAddParm param);
|
||||
|
||||
AppProjectPO updateData(AppProjectAuditParm param);
|
||||
|
||||
boolean delete(String id);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CsCommTerminalService {
|
||||
|
||||
|
||||
List<String> getLineIdsByUser(String userId);
|
||||
|
||||
|
||||
|
||||
List<String> getPqUserIdsByUser(String userId);
|
||||
|
||||
|
||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||
|
||||
|
||||
List<String> commGetDevIds(String userId);
|
||||
}
|
||||
@@ -59,4 +59,11 @@ public interface CsEngineeringService extends IService<CsEngineeringPO>{
|
||||
CsEngineeringPO queryEngineeringById(String id);
|
||||
|
||||
List<CsEngineeringPO> getUnlinkedEngineering(String userId);
|
||||
|
||||
CsEngineeringPO add(CsEngineeringAddParm csEngineeringAddParm);
|
||||
|
||||
CsEngineeringPO updateData(CsEngineeringAuditParm csEngineeringAuditParm);
|
||||
|
||||
boolean deleteData(String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.njcn.web.pojo.param.BaseParam;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -39,6 +40,9 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
*/
|
||||
List<CsLinePO> findByNdid(String id);
|
||||
|
||||
|
||||
Map<String,String> getCustomDetailByLineId(String lineId);
|
||||
|
||||
/**
|
||||
* 更新监测点信息
|
||||
* @param csLineParam
|
||||
@@ -91,4 +95,6 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
* @return 结果
|
||||
*/
|
||||
LineDetailDataVO getLineDetailData(String id);
|
||||
|
||||
List<CsLinePO> getLineList(CsLinePO param);
|
||||
}
|
||||
|
||||
@@ -32,7 +32,7 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedgerVO> getLineTree();
|
||||
|
||||
/**
|
||||
* 终端三层树
|
||||
* 终端三层树
|
||||
* @return
|
||||
*/
|
||||
List<CsLedgerVO> getDeviceTree();
|
||||
@@ -77,6 +77,9 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
|
||||
|
||||
List<CsLedgerVO> objTree();
|
||||
|
||||
/**
|
||||
* 根据设备集合获取项目和工程
|
||||
* @param id
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAuditParm;
|
||||
import com.njcn.csdevice.pojo.vo.EngineeringProjectRelationVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 组和指标关系表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-06-19
|
||||
*/
|
||||
public interface IEngineeringProjectService {
|
||||
|
||||
boolean addEngineering(CsEngineeringAddParm csEngineeringAddParm);
|
||||
|
||||
boolean updateEngineering(CsEngineeringAuditParm csEngineeringAuditParm);
|
||||
|
||||
boolean deleteEngineering(String id);
|
||||
|
||||
boolean addProject(AppProjectAddParm param);
|
||||
|
||||
boolean updateProject(AppProjectAuditParm param);
|
||||
|
||||
boolean deleteProject(String id);
|
||||
|
||||
List<EngineeringProjectRelationVo> getList();
|
||||
|
||||
}
|
||||
@@ -2,8 +2,8 @@ package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.csdevice.pojo.vo.LineOverLimitVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.stream.CollectorUtil;
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@@ -17,7 +17,6 @@ import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.AppProjectVO;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
||||
import com.njcn.csdevice.service.AppProjectService;
|
||||
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
||||
@@ -367,4 +366,42 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppProjectPO add(AppProjectAddParm param) {
|
||||
AppProjectPO po = new AppProjectPO ( );
|
||||
List<AppProjectPO> list = this.lambdaQuery().eq(AppProjectPO::getName, param.getName()).eq(AppProjectPO::getStatus, "1").list();
|
||||
if(!list.isEmpty()){
|
||||
throw new BusinessException("新增失败,项目名重复");
|
||||
}
|
||||
BeanUtils.copyProperties (param, po);
|
||||
po.setStatus ("1");
|
||||
this.save(po);
|
||||
return po;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppProjectPO updateData(AppProjectAuditParm param) {
|
||||
List<AppProjectPO> list = this.lambdaQuery()
|
||||
.eq(AppProjectPO::getName, param.getName())
|
||||
.eq(AppProjectPO::getStatus, "1")
|
||||
.ne(AppProjectPO::getId, param.getId())
|
||||
.list();
|
||||
if(!list.isEmpty()){
|
||||
throw new BusinessException("修改失败,项目名重复");
|
||||
}
|
||||
AppProjectPO po = new AppProjectPO ();
|
||||
BeanUtils.copyProperties (param, po);
|
||||
this.updateById(po);
|
||||
return po;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delete(String id) {
|
||||
LambdaUpdateWrapper<AppProjectPO> queryWrapper = new LambdaUpdateWrapper<>();
|
||||
queryWrapper.eq(AppProjectPO::getId,id).set(AppProjectPO::getStatus,"0");
|
||||
return this.update(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,102 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
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.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
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 lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Author: cdf
|
||||
* @CreateTime: 2025-12-23
|
||||
* @Description:
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
|
||||
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> getLineIdsByUser(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsLinePO::getLineId).in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsLinePO> poList = csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
result = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getPqUserIdsByUser(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<String> devIds = commGetDevIds(userId);
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(CsLinePO::getLineId, CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode());
|
||||
List<CsLinePO> poList =csLinePOMapper.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
result = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PqsDeviceUnit lineUnitDetail(String lineId) {
|
||||
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
||||
if(Objects.isNull(pqsDeviceUnit)){
|
||||
pqsDeviceUnit = new PqsDeviceUnit();
|
||||
}
|
||||
return pqsDeviceUnit;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public 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;
|
||||
}
|
||||
}
|
||||
@@ -22,7 +22,7 @@ import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* Description:
|
||||
* Date: 2023/9/27 10:29【需求编号】
|
||||
*
|
||||
@@ -50,12 +50,12 @@ public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMappe
|
||||
public Double getDevCapacity(String id) {
|
||||
List<CsLinePO> csLinePOS = csLinePOService.queryByDevId(id);
|
||||
|
||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
//String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
|
||||
Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||
List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||
//Optional.ofNullable(csLinePOS).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.LINE_DATA_ERROR));
|
||||
//List<CsLinePO> collect1 = csLinePOS.stream().filter(temp -> Objects.equals(areaId, temp.getPosition())).collect(Collectors.toList());
|
||||
/*治理侧监测点*/
|
||||
CsLinePO csLinePO = collect1.get(0);
|
||||
CsLinePO csLinePO = csLinePOS.get(0);
|
||||
CsDevCapacityPO one = this.lambdaQuery().eq(CsDevCapacityPO::getLineId, csLinePO.getLineId()).eq(CsDevCapacityPO::getCldid, 0).one();
|
||||
// Optional.ofNullable(one).orElseThrow(()-> new BusinessException(AlgorithmResponseEnum.DATA_MISSING));
|
||||
if(Objects.isNull(one)){
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -259,6 +260,43 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEngineeringPO add(CsEngineeringAddParm csEngineeringAddParm) {
|
||||
List<CsEngineeringPO> list = this.lambdaQuery().eq(CsEngineeringPO::getName, csEngineeringAddParm.getName()).eq(CsEngineeringPO::getStatus, "1").list();
|
||||
if(!list.isEmpty()){
|
||||
throw new BusinessException("新增失败,工程名重复");
|
||||
}
|
||||
//新增工程
|
||||
CsEngineeringPO po = new CsEngineeringPO ();
|
||||
BeanUtils.copyProperties (csEngineeringAddParm, po);
|
||||
po.setStatus ("1");
|
||||
this.save(po);
|
||||
return po;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEngineeringPO updateData(CsEngineeringAuditParm csEngineeringAuditParm) {
|
||||
List<CsEngineeringPO> list = this.lambdaQuery()
|
||||
.eq(CsEngineeringPO::getName, csEngineeringAuditParm.getName())
|
||||
.eq(CsEngineeringPO::getStatus, "1")
|
||||
.ne(CsEngineeringPO::getId, csEngineeringAuditParm.getId())
|
||||
.list();
|
||||
if(!list.isEmpty()){
|
||||
throw new BusinessException("修改失败,工程名重复");
|
||||
}
|
||||
CsEngineeringPO po = new CsEngineeringPO();
|
||||
BeanUtils.copyProperties(csEngineeringAuditParm, po);
|
||||
this.updateById(po);
|
||||
return po;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteData(String id) {
|
||||
LambdaUpdateWrapper<CsEngineeringPO> queryWrapper = new LambdaUpdateWrapper<>();
|
||||
queryWrapper.eq(CsEngineeringPO::getId,id).set(CsEngineeringPO::getStatus,"0");
|
||||
return this.update(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
public String getAreaById(String id){
|
||||
|
||||
|
||||
@@ -117,8 +117,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
if(Objects.nonNull (one)){
|
||||
List<CsEquipmentDeliveryPO> one = this.lambdaQuery()
|
||||
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus, 0)
|
||||
.eq(CsEquipmentDeliveryPO::getDevAccessMethod, "MQTT")
|
||||
.list();
|
||||
if(CollUtil.isNotEmpty(one)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
}
|
||||
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAddParm.getNdid());
|
||||
@@ -259,12 +263,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
//修改台账树中的设备名称
|
||||
//如果是已经接入的设备需要修改台账树中的设备名称
|
||||
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
if (ObjectUtil.isNotNull(csLedger)) {
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
}
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||
@@ -435,8 +441,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||
if(!csLinePOS.isEmpty() && csLinePOS.get(0)!=null){
|
||||
deviceManagerVo.setTime(csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid()).get(0).getCreateTime());
|
||||
if(!csLinePOS.isEmpty()){
|
||||
Optional<CsLinePO> earliest = csLinePOS.stream().min(Comparator.comparing(CsLinePO::getCreateTime));
|
||||
deviceManagerVo.setTime(earliest.map(CsLinePO::getCreateTime).orElse(null));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -935,9 +942,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
devList.forEach(item->{item.setRunStatus(1);});
|
||||
this.updateBatchById(devList);
|
||||
//修改监测点运行状态
|
||||
List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
List<CsLinePO> lineList = csLinePOService.getLinesByDevList(devIdList);
|
||||
csLinePOService.updateCldLineStatus(lineList,2);
|
||||
//List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
//List<CsLinePO> lineList = csLinePOService.getLinesByDevList(devIdList);
|
||||
//csLinePOService.updateCldLineStatus(lineList,2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -951,9 +958,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
if (ObjectUtil.isNotNull(po)) {
|
||||
po.setRunStatus(status);
|
||||
this.updateById(po);
|
||||
//这边是监测点的运行状态 不是通讯状态,所以不要修改,通讯状态跟着设备的通讯状态来
|
||||
//修改监测点运行状态
|
||||
List<CsLinePO> lineList = csLinePOService.getLinesByDevList(Collections.singletonList(po.getId()));
|
||||
csLinePOService.updateCldLineStatus(lineList,status==1?2:0);
|
||||
//List<CsLinePO> lineList = csLinePOService.getLinesByDevList(Collections.singletonList(po.getId()));
|
||||
//csLinePOService.updateCldLineStatus(lineList,status==1?2:0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -990,17 +998,33 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
public List<CsEquipmentDeliveryPO> getRunPortableDev(String userId) {
|
||||
List<CsEquipmentDeliveryPO> result = new ArrayList<>();
|
||||
DictTreeVO vo = dictTreeFeignClient.queryByCode(DicDataEnum.PORTABLE.getCode()).getData();
|
||||
if (ObjectUtil.isNotNull(vo)) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
||||
//获取用户已经绑定的便携式设备
|
||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId,devList);
|
||||
if (ObjectUtil.isNull(vo)) {
|
||||
throw new BusinessException("便携式设备类型字典缺失");
|
||||
}
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getDevType,vo.getId())
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1);
|
||||
//获取用户已经绑定的便携式设备
|
||||
List<String> devList = csDeviceUserPOService.findDevByUserId(userId);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
lambdaQueryWrapper.notIn(CsEquipmentDeliveryPO::getId,devList);
|
||||
}
|
||||
result = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
//获取已经接入过系统的设备,未接入的不给分配
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
List<String> ids = result.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
queryWrapper.in(CsLedger::getId,ids);
|
||||
List<CsLedger> list = csLedgerService.list(queryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
Set<String> idSet = list.stream()
|
||||
.map(CsLedger::getId)
|
||||
.collect(Collectors.toSet());
|
||||
return result.stream()
|
||||
.filter(data -> idSet.contains(data.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
result = this.list(lambdaQueryWrapper);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,10 @@ import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroupMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
@@ -38,6 +41,8 @@ import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.param.*;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
@@ -91,7 +96,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
private final EvtDataService evtDataService;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final OverLimitWlMapper overLimitWlMapper;
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
private final EventFeignClient eventFeignClient;
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
@@ -580,7 +585,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
@Override
|
||||
public List<ThdDataTdVO> getDeviceTrendData(String devId, String lineId,String groupId) {
|
||||
List<ThdDataTdVO> data = new ArrayList();
|
||||
List<Overlimit> overlimits = overlimitMapper.selectBatchIds(Arrays.asList(lineId));
|
||||
List<Overlimit> overlimits = overLimitWlMapper.selectBatchIds(Arrays.asList(lineId));
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(lineId)).getData();
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(devId).collect(Collectors.toList())).getData();
|
||||
//便携式设备-稳态指标-实时数据-指标
|
||||
@@ -794,7 +799,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
CsLinePO finalCsLinePO = csLineFeignClient.getById(trendDataQueryParam.getLineId()).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePO.getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())) {
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
@@ -947,7 +952,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
Double ct = finalCsLinePO.getCtRatio();
|
||||
Double pt = finalCsLinePO.getPtRatio();
|
||||
// String position = finalCsLinePO.getPosition();
|
||||
Overlimit overlimit = overlimitMapper.selectById(finalCsLinePO.getLineId());
|
||||
Overlimit overlimit = overLimitWlMapper.selectById(finalCsLinePO.getLineId());
|
||||
if (Objects.isNull(overlimit)) {
|
||||
throw new BusinessException("当前测点限值信息缺失,请联系管理员排查");
|
||||
}
|
||||
@@ -1126,7 +1131,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
} else {
|
||||
result.addAll(dataList);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return result;
|
||||
@@ -1135,6 +1140,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
@Override
|
||||
public Map<String, List<ThdDataVO>> sensitiveUserTrendData(SensitiveUserTrendDataQueryParam param) {
|
||||
Map<String, List<ThdDataVO>> result = new HashMap<>();
|
||||
if (Objects.isNull(param.getSensitiveUserId())) {
|
||||
return result;
|
||||
}
|
||||
result.put("before", new ArrayList<>());
|
||||
result.put("after", new ArrayList<>());
|
||||
String sensitiveUserId = param.getSensitiveUserId();
|
||||
@@ -1154,7 +1162,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<SensitiveUserTrendDataQueryParam> paramList = param.getList();
|
||||
List<TrendDataQueryParam> indexList = paramList.stream().map(item -> {
|
||||
TrendDataQueryParam queryParam = new TrendDataQueryParam();
|
||||
queryParam.setFrequency(item.getFrequency());
|
||||
if (ObjectUtil.isNotNull(param.getHarmonicCount())) {
|
||||
queryParam.setFrequency(String.valueOf(param.getHarmonicCount()));
|
||||
}
|
||||
queryParam.setStatisticalId(item.getStatisticalId());
|
||||
return queryParam;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
@@ -4,12 +4,13 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.controller.project.EngineeringController;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
@@ -18,13 +19,18 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -57,8 +63,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final EngineeringController engineeringController;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLedgerTree() {
|
||||
@@ -104,7 +112,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
}
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||
@@ -148,14 +156,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.peek(
|
||||
item -> {
|
||||
item.setType("line");
|
||||
String index = item.getId().substring(item.getId().length()-1);
|
||||
if (Objects.equals(index,"0")) {
|
||||
String index = item.getId().substring(item.getId().length() - 1);
|
||||
if (Objects.equals(index, "0")) {
|
||||
item.setLineType(0);
|
||||
} else {
|
||||
item.setLineType(1);
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1);
|
||||
queryWrapper.eq(CsLinePO::getLineId, item.getId()).eq(CsLinePO::getStatus, 1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
item.setConType(po.getConType());
|
||||
}
|
||||
@@ -201,16 +209,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
@@ -269,6 +277,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
||||
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||
@@ -328,7 +337,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
);
|
||||
}
|
||||
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||
@@ -404,16 +413,16 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,RequestUtil.getUserIndex());
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)){
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
@@ -475,11 +484,11 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public CsLedger addLedgerTree(CsLedgerParam csLedgerParam) {
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId,csLedgerParam.getPid()).one();
|
||||
CsLedger fatherCsLedger = this.lambdaQuery().eq(CsLedger::getId, csLedgerParam.getPid()).one();
|
||||
CsLedger csLedger = new CsLedger();
|
||||
BeanUtils.copyProperties(csLedgerParam,csLedger);
|
||||
BeanUtils.copyProperties(csLedgerParam, csLedger);
|
||||
csLedger.setState(1);
|
||||
if (Objects.equals(csLedgerParam.getPid(),"9999999")){
|
||||
if (Objects.equals(csLedgerParam.getPid(), "9999999")) {
|
||||
csLedger.setPid("0");
|
||||
csLedger.setPids("0");
|
||||
} else {
|
||||
@@ -491,7 +500,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public void deleteLedgerTree(String id) {
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId,id).one();
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId, id).one();
|
||||
csLedger.setState(0);
|
||||
this.updateById(csLedger);
|
||||
}
|
||||
@@ -506,8 +515,8 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
@Override
|
||||
public String findDevByLineId(String lineId) {
|
||||
String deviceId = null;
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId,lineId).eq(CsLedger::getState,1).one();
|
||||
if (!Objects.isNull(csLedger)){
|
||||
CsLedger csLedger = this.lambdaQuery().eq(CsLedger::getId, lineId).eq(CsLedger::getState, 1).one();
|
||||
if (!Objects.isNull(csLedger)) {
|
||||
deviceId = csLedger.getPid();
|
||||
}
|
||||
return deviceId;
|
||||
@@ -515,7 +524,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public CsLedger findDataById(String id) {
|
||||
return this.lambdaQuery().eq(CsLedger::getId,id).eq(CsLedger::getState,1).one();
|
||||
return this.lambdaQuery().eq(CsLedger::getId, id).eq(CsLedger::getState, 1).one();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -523,12 +532,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
QueryWrapper<AppTopologyDiagramPO> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("status","1");
|
||||
queryWrapper.eq("status", "1");
|
||||
List<AppTopologyDiagramPO> appTopologyDiagramPOS = appTopologyDiagramMapper.selectList(queryWrapper);
|
||||
projectList.forEach(temp->{
|
||||
projectList.forEach(temp -> {
|
||||
AppProjectPO appProjectPO = appProjectMapper.selectById(temp.getId());
|
||||
temp.setArea(appProjectPO.getArea());
|
||||
temp.setRemark(appProjectPO.getDescription());
|
||||
@@ -544,13 +553,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
temp.setChildren(collect);
|
||||
});
|
||||
engineeringList.forEach(eng -> {
|
||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
||||
eng.setProvinceId(csEngineeringPO.getProvince());
|
||||
eng.setCityId(csEngineeringPO.getCity());
|
||||
eng.setRemark(csEngineeringPO.getDescription());
|
||||
eng.setChildren(getChildren(eng, projectList));
|
||||
}
|
||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince()) + this.getAreaById(csEngineeringPO.getCity()));
|
||||
eng.setProvinceId(csEngineeringPO.getProvince());
|
||||
eng.setCityId(csEngineeringPO.getCity());
|
||||
eng.setRemark(csEngineeringPO.getDescription());
|
||||
eng.setChildren(getChildren(eng, projectList));
|
||||
}
|
||||
);
|
||||
|
||||
return engineeringList;
|
||||
@@ -566,14 +575,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
CsLedger dev = this.findDataById(devId);
|
||||
//如果是便携式设备,pid为0,项目,工程都设置为/
|
||||
if(Objects.equals(dev.getPid(),"0")){
|
||||
if (Objects.equals(dev.getPid(), "0")) {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
device.setEngineeringName("/");
|
||||
}else {
|
||||
} else {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
@@ -587,7 +596,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getztProjectTree() {
|
||||
List<CsLedgerVO> engineeringList;
|
||||
@@ -595,93 +603,361 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
|
||||
List<String> zhiLianDevice = new ArrayList<>();
|
||||
List<String> cldDevice = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(device)) {
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
|
||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
Optional.ofNullable(vo1)
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(cldDevice::add)
|
||||
);
|
||||
DictTreeVO vo2 = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
||||
Optional.ofNullable(vo2)
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
}
|
||||
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
peek(
|
||||
temp->{
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(po.getRunStatus());
|
||||
temp.setNDId(po.getNdid());
|
||||
temp.setType("device");
|
||||
}
|
||||
).
|
||||
sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(deviceList);
|
||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||
.map(CsLedgerVO::getId)
|
||||
.distinct()
|
||||
.collect(Collectors.toMap(
|
||||
Function.identity(),
|
||||
csEquipmentDeliveryMapper::selectById
|
||||
));
|
||||
|
||||
//获取便携式项目数
|
||||
//获取治理设备
|
||||
List<CsLedgerVO> deviceList = allList.stream()
|
||||
.filter(item -> zhiLianDevice.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||
.peek(item -> {
|
||||
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||
item.setComFlag(po.getRunStatus());
|
||||
item.setNDId(po.getNdid());
|
||||
item.setType("device");
|
||||
item.setProcess(po.getProcess());
|
||||
})
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> engineeringList1 = new ArrayList<>();
|
||||
List<CsLedgerVO> projectList1 = new ArrayList<>();
|
||||
checkDevSetData(deviceList);
|
||||
List<String> dev = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsLedgerVO> ledger1 = getProAndEngineer(dev);
|
||||
if (CollectionUtil.isNotEmpty(ledger1)) {
|
||||
engineeringList1 = ledger1.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
projectList1 = ledger1.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
projectList1.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
List<CsLedgerVO> finalProjectList = projectList1;
|
||||
engineeringList1.forEach(eng -> eng.setChildren(getChildren(eng, finalProjectList)));
|
||||
}
|
||||
|
||||
//获取云前置设备
|
||||
List<CsLedgerVO> cldDevList = allList.stream()
|
||||
.filter(item -> cldDevice.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||
.peek(item -> {
|
||||
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||
item.setComFlag(po.getRunStatus());
|
||||
item.setNDId(po.getNdid());
|
||||
item.setType("device");
|
||||
item.setProcess(po.getProcess());
|
||||
})
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(cldDevList);
|
||||
List<CsLedgerVO> engineeringList2 = new ArrayList<>();
|
||||
List<CsLedgerVO> projectList2 = new ArrayList<>();
|
||||
|
||||
List<String> dev2 = cldDevList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsLedgerVO> ledger2 = getProAndEngineer(dev2);
|
||||
if (CollectionUtil.isNotEmpty(ledger2)) {
|
||||
engineeringList2 = ledger2.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
projectList2 = ledger2.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
projectList2.forEach(pro -> pro.setChildren(getChildren(pro, cldDevList)));
|
||||
List<CsLedgerVO> finalProjectList = projectList2;
|
||||
engineeringList2.forEach(eng -> eng.setChildren(getChildren(eng, finalProjectList)));
|
||||
}
|
||||
|
||||
//获取便携式设备树
|
||||
CsLedgerVO portable = new CsLedgerVO();
|
||||
portable.setLevel(0);
|
||||
portable.setName(DataParam.PORTABLE_SYSTEM);
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
|
||||
CsLedgerVO project = new CsLedgerVO();
|
||||
project.setLevel(1);
|
||||
project.setName(DataParam.WIRELESS_PROJECT);
|
||||
project.setPid("0");
|
||||
project.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||
|
||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
||||
checkDevSetData(portables);
|
||||
for(CsLedgerVO c : portables){
|
||||
c.setPid(project.getId());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
project.setChildren(portables);
|
||||
|
||||
List<CsLedgerVO> wxProjectList = new ArrayList<>();
|
||||
wxProjectList.add(project);
|
||||
|
||||
portable.setChildren(wxProjectList);
|
||||
|
||||
|
||||
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
csEquipmentDeliveryMapper::selectById,
|
||||
(existing, replacement) -> existing
|
||||
));
|
||||
List<CsLedgerVO> portables = ledger.stream()
|
||||
.peek(c -> {
|
||||
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||
c.setPid(portable.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
c.setName(po.getName());
|
||||
c.setSort(po.getSort());
|
||||
})
|
||||
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
portable.setChildren(portables);
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(0);
|
||||
government.setName(DataParam.GOVERNANCE_SYSTEM);
|
||||
government.setName(DataParam.governmentDev);
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
government.setChildren(engineeringList1);
|
||||
|
||||
//获取云前置设备树
|
||||
CsLedgerVO cld = new CsLedgerVO();
|
||||
cld.setLevel(0);
|
||||
cld.setName(DataParam.cldDev);
|
||||
cld.setPid("0");
|
||||
cld.setId(IdUtil.simpleUUID());
|
||||
cld.setChildren(engineeringList2);
|
||||
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
CsLedgerVO vo1 = new CsLedgerVO();
|
||||
vo1.setLevel(0);
|
||||
vo1.setName(DataParam.PORTABLE_SYSTEM);
|
||||
vo1.setPid("0");
|
||||
vo1.setId(IdUtil.simpleUUID());
|
||||
|
||||
CsLedgerVO vo2 = new CsLedgerVO();
|
||||
vo2.setLevel(1);
|
||||
vo2.setName(DataParam.WIRELESS_PROJECT);
|
||||
vo2.setPid("0");
|
||||
vo2.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||
vo2.setChildren(portables);
|
||||
vo1.setChildren(Collections.singletonList(vo2));
|
||||
tree.add(vo1);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
|
||||
}
|
||||
if (CollUtil.isNotEmpty(cldDevList)) {
|
||||
tree.add(cld);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<CsLedgerVO> getztProjectTree() {
|
||||
// List<CsLedgerVO> engineeringList;
|
||||
// List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
// /*获取用户工程,设备信息过滤*/
|
||||
// List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
// List<String> device = roleEngineerDevService.getDevice();
|
||||
// engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
// List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
//
|
||||
// List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0")).
|
||||
// peek(
|
||||
// temp -> {
|
||||
// CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
// temp.setComFlag(po.getRunStatus());
|
||||
// temp.setNDId(po.getNdid());
|
||||
// temp.setType("device");
|
||||
// }
|
||||
// ).
|
||||
// sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
// .collect(Collectors.toList());
|
||||
// checkDevSetData(deviceList);
|
||||
// projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
// engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
//
|
||||
// //获取便携式项目数
|
||||
// CsLedgerVO portable = new CsLedgerVO();
|
||||
// portable.setLevel(0);
|
||||
// portable.setName(DataParam.PORTABLE_SYSTEM);
|
||||
// portable.setPid("0");
|
||||
// portable.setId(IdUtil.simpleUUID());
|
||||
//
|
||||
// CsLedgerVO project = new CsLedgerVO();
|
||||
// project.setLevel(1);
|
||||
// project.setName(DataParam.WIRELESS_PROJECT);
|
||||
// project.setPid("0");
|
||||
// project.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||
//
|
||||
// List<CsLedgerVO> portables = allList.stream().filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0")).collect(Collectors.toList());
|
||||
// checkDevSetData(portables);
|
||||
// for (CsLedgerVO c : portables) {
|
||||
// c.setPid(project.getId());
|
||||
// CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
// c.setComFlag(po.getRunStatus());
|
||||
// c.setNDId(po.getNdid());
|
||||
// c.setType("device");
|
||||
// }
|
||||
// project.setChildren(portables);
|
||||
//
|
||||
// List<CsLedgerVO> wxProjectList = new ArrayList<>();
|
||||
// wxProjectList.add(project);
|
||||
//
|
||||
// portable.setChildren(wxProjectList);
|
||||
//
|
||||
//
|
||||
// CsLedgerVO government = new CsLedgerVO();
|
||||
// government.setLevel(0);
|
||||
// government.setName(DataParam.GOVERNANCE_SYSTEM);
|
||||
// government.setPid("0");
|
||||
// government.setId(IdUtil.simpleUUID());
|
||||
// government.setChildren(engineeringList);
|
||||
// List<CsLedgerVO> tree = new ArrayList<>();
|
||||
//
|
||||
// if (CollUtil.isNotEmpty(portables)) {
|
||||
// tree.add(portable);
|
||||
// }
|
||||
// if (CollUtil.isNotEmpty(deviceList)) {
|
||||
// tree.add(government);
|
||||
// }
|
||||
//
|
||||
// return tree;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> objTree() {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
String userId = RequestUtil.getUserIndex();
|
||||
UserVO userVO = userFeignClient.getUserById(userId).getData();
|
||||
List<String> devIds;
|
||||
if (userVO.getType().equals(UserType.SUPER_ADMINISTRATOR) || userVO.getType().equals(UserType.ADMINISTRATOR)) {
|
||||
devIds = csEquipmentDeliveryMapper.selectList(null).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 = csDeviceUserPOMapper.selectList(lambdaQueryWrapper);
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(devIds)) {
|
||||
return result;
|
||||
}
|
||||
List<CsLinePO> poList = csLinePOService.lambdaQuery().in(CsLinePO::getDeviceId, devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).ne(CsLinePO::getMonitorUser,"").isNotNull(CsLinePO::getMonitorUser).list();
|
||||
if (CollUtil.isEmpty(poList)) {
|
||||
return result;
|
||||
}
|
||||
List<String> objIds = poList.stream().map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
List<String> lineIds = poList.stream().map(CsLinePO::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(objIds).getData();
|
||||
if (CollUtil.isEmpty(pqSensitiveUserList)) {
|
||||
return result;
|
||||
}
|
||||
Map<String,String> objMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
|
||||
List<CsLedger> csLineList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, lineIds));
|
||||
Map<String,List<String>> lineMap = csLineList.stream().collect(Collectors.groupingBy(it->it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1],Collectors.mapping(CsLedger::getId,Collectors.toList())));
|
||||
|
||||
List<String> projectIds = csLineList.stream().map(it -> it.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).distinct().collect(Collectors.toList());
|
||||
List<CsLedger> projectList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, projectIds));
|
||||
|
||||
List<CsLedgerVO> realProjectList = new ArrayList<>();
|
||||
projectList.forEach(pro->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(pro.getId());
|
||||
csLedgerVO.setPid(pro.getPid());
|
||||
csLedgerVO.setLevel(pro.getLevel());
|
||||
csLedgerVO.setName(pro.getName());
|
||||
|
||||
List<CsLedgerVO> temObjList = new ArrayList<>();
|
||||
if(lineMap.containsKey(pro.getId())){
|
||||
List<String> ids = lineMap.get(pro.getId());
|
||||
List<String> objTemIds = poList.stream().filter(it->ids.contains(it.getLineId())).map(CsLinePO::getMonitorUser).distinct().collect(Collectors.toList());
|
||||
if(CollUtil.isNotEmpty(objTemIds)){
|
||||
objTemIds.forEach(it->{
|
||||
CsLedgerVO inner = new CsLedgerVO();
|
||||
inner.setName(objMap.getOrDefault(it,"未知异常用户"));
|
||||
inner.setId(it);
|
||||
inner.setLevel(2);
|
||||
temObjList.add(inner);
|
||||
});
|
||||
}
|
||||
}
|
||||
csLedgerVO.setChildren(temObjList);
|
||||
realProjectList.add(csLedgerVO);
|
||||
});
|
||||
|
||||
List<String> gcIds = projectList.stream().map(CsLedger::getPid).collect(Collectors.toList());
|
||||
List<CsLedger> gcList = this.baseMapper.selectList(new LambdaQueryWrapper<CsLedger>().in(CsLedger::getId, gcIds));
|
||||
|
||||
List<CsLedgerVO> realGcList = new ArrayList<>();
|
||||
gcList.forEach(gc->{
|
||||
CsLedgerVO csLedgerVO = new CsLedgerVO();
|
||||
csLedgerVO.setId(gc.getId());
|
||||
csLedgerVO.setPid(gc.getPid());
|
||||
csLedgerVO.setLevel(gc.getLevel());
|
||||
csLedgerVO.setName(gc.getName());
|
||||
|
||||
List<CsLedgerVO> proList = realProjectList.stream().filter(it->gc.getId().equals(it.getPid())).collect(Collectors.toList());
|
||||
csLedgerVO.setChildren(proList);
|
||||
realGcList.add(csLedgerVO);
|
||||
});
|
||||
return realGcList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getProAndEngineer(List<String> id) {
|
||||
List<CsLedgerVO> result = new ArrayList<>();
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
Set<String> idSet = new HashSet<>(id);
|
||||
if (CollectionUtil.isNotEmpty(id)) {
|
||||
id.forEach(item->{
|
||||
allList.forEach(item2->{
|
||||
if (Objects.equals(item2.getId(),item)) {
|
||||
idSet.addAll(Arrays.asList(item2.getPids().split( ",")));
|
||||
id.forEach(item -> {
|
||||
allList.forEach(item2 -> {
|
||||
if (Objects.equals(item2.getId(), item)) {
|
||||
idSet.addAll(Arrays.asList(item2.getPids().split(",")));
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(idSet)) {
|
||||
idSet.forEach(item->{
|
||||
allList.forEach(item2->{
|
||||
if (Objects.equals(item2.getId(),item)) {
|
||||
idSet.forEach(item -> {
|
||||
allList.forEach(item2 -> {
|
||||
if (Objects.equals(item2.getId(), item)) {
|
||||
result.add(item2);
|
||||
}
|
||||
});
|
||||
@@ -718,7 +994,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
|
||||
//list1是 cld设备
|
||||
devs.forEach(item->{
|
||||
devs.forEach(item -> {
|
||||
if (item.getDevType().equals(vo1.getId())) {
|
||||
list1.add(item.getId());
|
||||
}
|
||||
@@ -759,19 +1035,19 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
if (CollectionUtil.isNotEmpty(deviceTree)) {
|
||||
List<CsLedgerVO> finalLineTree = lineTree;
|
||||
deviceTree.forEach(item->{
|
||||
deviceTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalLineTree));
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(projectTree)) {
|
||||
List<CsLedgerVO> finalDeviceTree = deviceTree;
|
||||
projectTree.forEach(item->{
|
||||
projectTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalDeviceTree));
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(engineerTree)) {
|
||||
List<CsLedgerVO> finalProjectTree = projectTree;
|
||||
engineerTree.forEach(item->{
|
||||
engineerTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalProjectTree));
|
||||
});
|
||||
}
|
||||
@@ -791,9 +1067,9 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
List<CsLedger> ledgers = this.listByIds(list);
|
||||
Set<String> enginingeringIds = new HashSet<>();
|
||||
ledgers.forEach(item->{
|
||||
ledgers.forEach(item -> {
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
if(Objects.equals(item.getPid(),"0")){
|
||||
if (Objects.equals(item.getPid(), "0")) {
|
||||
device.setEquipmentName(item.getName());
|
||||
device.setEquipmentId(item.getId());
|
||||
device.setProjectId("/");
|
||||
@@ -807,7 +1083,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
});
|
||||
if (CollectionUtil.isNotEmpty(enginingeringIds)) {
|
||||
List<CsLedger> engineer = this.listByIds(enginingeringIds);
|
||||
engineer.forEach(item->{
|
||||
engineer.forEach(item -> {
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEngineeringid(item.getId());
|
||||
detail.setEngineeringName(item.getName());
|
||||
@@ -828,7 +1104,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
dev.forEach(item->{
|
||||
dev.forEach(item -> {
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEquipmentName(item.getName());
|
||||
detail.setEquipmentId(item.getId());
|
||||
@@ -840,7 +1116,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
@Override
|
||||
public List<DevDetailDTO> getEngineeringHaveDevs(List<String> list) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
list.forEach(item -> {
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLedger::getPid, item);
|
||||
List<CsLedger> project = this.list(queryWrapper);
|
||||
@@ -873,12 +1149,12 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return children;
|
||||
}
|
||||
|
||||
public String getAreaById(String id){
|
||||
String areaName =redisUtil.getStringByKey (id);
|
||||
areaName = Optional.ofNullable (areaName).orElseGet (() ->{
|
||||
Area data = areaFeignClient.selectIdArea (id).getData ( );
|
||||
redisUtil.saveByKey (id,data.getName ());
|
||||
return data.getName ();
|
||||
public String getAreaById(String id) {
|
||||
String areaName = redisUtil.getStringByKey(id);
|
||||
areaName = Optional.ofNullable(areaName).orElseGet(() -> {
|
||||
Area data = areaFeignClient.selectIdArea(id).getData();
|
||||
redisUtil.saveByKey(id, data.getName());
|
||||
return data.getName();
|
||||
});
|
||||
return areaName;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
@@ -28,6 +29,7 @@ import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
@@ -43,10 +45,7 @@ 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.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -73,7 +72,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -105,6 +104,10 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
return this.baseMapper.findByNdid(id);
|
||||
}
|
||||
|
||||
public Map<String,String> getCustomDetailByLineId(String lineId){
|
||||
return this.baseMapper.getCustomDetailByLineId(lineId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLine(CsLineParam csLineParam) {
|
||||
LambdaUpdateWrapper<CsLinePO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
@@ -141,7 +144,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
//1.新增监测点信息
|
||||
BeanUtils.copyProperties(param,po);
|
||||
po.setStatus(1);
|
||||
po.setRunStatus(2);
|
||||
po.setRunStatus(param.getRunStatus());
|
||||
po.setLineId(param.getDevMac().replace(":","") + param.getLineNo());
|
||||
//模板id
|
||||
CsDevModelPO po1 = csDevModelService.getCldModel();
|
||||
@@ -155,8 +158,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
po.setClDid(list.get(0).getClDev());
|
||||
}
|
||||
//监测位置
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||
po.setPosition(data.getId());
|
||||
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||
po.setPosition(param.getPosition());
|
||||
this.save(po);
|
||||
|
||||
//2.新增台账树信息
|
||||
@@ -204,6 +207,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getGovern,param.getGovern())
|
||||
.set(CsLinePO::getPosition,param.getPosition())
|
||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
|
||||
@@ -270,7 +274,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
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)
|
||||
List<CsLinePO> poList = this.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getName,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
return poList;
|
||||
}else {
|
||||
@@ -282,8 +286,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
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 {
|
||||
devIds = csEquipmentDeliveryMapper.selectList(new LambdaQueryWrapper<CsEquipmentDeliveryPO>().ne(CsEquipmentDeliveryPO::getRunStatus,DataStateEnum.DELETED.getCode())).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))
|
||||
@@ -308,24 +312,34 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
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)
|
||||
);
|
||||
// 查询登录用户拥有的监测点台账
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
// 构建基础查询条件
|
||||
LambdaQueryWrapper<CsLinePO> lambdaQueryWrapper = new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
// 关联敏感用户
|
||||
//.isNotNull(CsLinePO::getMonitorUser)
|
||||
.orderByAsc(CsLinePO::getMonitorUser);
|
||||
// 只有当lineList不为空时才添加in条件
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(CsLinePO::getLineId, lineList);
|
||||
}
|
||||
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), lambdaQueryWrapper);
|
||||
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));
|
||||
Map<String, String> sensitiveUserNameMap = new HashMap<>();
|
||||
List<PqSensitiveUser> pqSensitiveUserList = pqSensitiveUserFeignClient.getListByIds(sensitiveUserIds).getData();
|
||||
if (CollUtil.isNotEmpty(pqSensitiveUserList)) {
|
||||
sensitiveUserNameMap = pqSensitiveUserList.stream().collect(Collectors.toMap(PqSensitiveUser::getId, PqSensitiveUser::getName));
|
||||
}
|
||||
PqSensitiveUserLineVO sensitiveUserLineVO;
|
||||
for (CsLinePO record : records) {
|
||||
sensitiveUserLineVO = new PqSensitiveUserLineVO();
|
||||
@@ -344,26 +358,34 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
}
|
||||
}
|
||||
// 监测类型
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
DictData positionDictData = dicDataFeignClient.getDicDataById(record.getPosition()).getData();
|
||||
if (positionDictData != null) {
|
||||
sensitiveUserLineVO.setPosition(positionDictData.getName());
|
||||
if (ObjectUtil.isNotNull(record.getPosition())) {
|
||||
sensitiveUserLineVO.setPosition(record.getPosition());
|
||||
DictData positionDictData = dicDataFeignClient.getDicDataById(record.getPosition()).getData();
|
||||
if (positionDictData != null) {
|
||||
sensitiveUserLineVO.setPosition(positionDictData.getName());
|
||||
}
|
||||
}
|
||||
// 电压等级
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
if (ObjectUtil.isNotNull(record.getVolGrade())) {
|
||||
sensitiveUserLineVO.setVolGrade(record.getVolGrade());
|
||||
}
|
||||
// 运行状态
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(record.getRunStatus()));
|
||||
if (ObjectUtil.isNotNull(record.getRunStatus())) {
|
||||
//获取设备状态
|
||||
int devRunStatus = csEquipmentDeliveryMapper.selectById(record.getDeviceId()).getRunStatus();
|
||||
sensitiveUserLineVO.setRunStatus(getRunStatusDescription(devRunStatus));
|
||||
}
|
||||
// 报告文件
|
||||
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<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);
|
||||
@@ -372,7 +394,7 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
|
||||
@Override
|
||||
public boolean uploadReport(MultipartFile file, String lineId) {
|
||||
String filePath = fileStorageUtil.uploadMultipart(file, OssPath.GOVERN_HARMONIC_FILE);
|
||||
String filePath = fileStorageUtil.uploadMultipart(file, OssPath.GOVERN_HARMONIC_FILE, true);
|
||||
return this.update(new LambdaUpdateWrapper<CsLinePO>().eq(CsLinePO::getLineId, lineId).set(CsLinePO::getReportFilePath, filePath));
|
||||
}
|
||||
|
||||
@@ -395,9 +417,22 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
return new LineDetailDataVO();
|
||||
} else {
|
||||
CsLinePO csLinePO = this.baseMapper.selectOne(new LambdaQueryWrapper<CsLinePO>().eq(CsLinePO::getLineId,id));
|
||||
//获取设备信息
|
||||
CsEquipmentDeliveryPO csEquipmentDelivery = csEquipmentDeliveryMapper.selectById(csLinePO.getDeviceId());
|
||||
String code = dictTreeFeignClient.queryById(csEquipmentDelivery.getDevType()).getData().getCode();
|
||||
|
||||
CsLedger csLedger = csLedgerMapper.selectById(csLinePO.getLineId());
|
||||
LineDetailDataVO lineDetailDataVO = new LineDetailDataVO();
|
||||
|
||||
//lineDetailDataVO.setScale(dicDataFeignClient.getDicDataById(voltageMapper.selectById(voId).getScale()).getData().getName());
|
||||
lineDetailDataVO.setScale(csLinePO.getVolGrade()+"kV");
|
||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
lineDetailDataVO.setAreaName("便携式工程");
|
||||
lineDetailDataVO.setBdName("便携式项目");
|
||||
} else {
|
||||
lineDetailDataVO.setAreaName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.ENGINEERING_LEVEL.getCode()+1]).getName());
|
||||
lineDetailDataVO.setBdName(csLedgerMapper.selectById(csLedger.getPids().split(StrUtil.COMMA)[LineBaseEnum.PROJECT_LEVEL.getCode()+1]).getName());
|
||||
}
|
||||
lineDetailDataVO.setLineName(csLinePO.getName());
|
||||
//Device device = deviceMapper.selectById(devId);
|
||||
//lineDetailDataVO.setComFlag(PubUtils.comFlag(device.getComFlag()));
|
||||
//lineDetailDataVO.setRunFlag(PubUtils.lineRunFlag(lineDetail.getRunFlag()));
|
||||
@@ -409,33 +444,50 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
lineDetailDataVO.setObjName(csLinePO.getMonitorUser());
|
||||
lineDetailDataVO.setLineId(csLinePO.getLineId());
|
||||
lineDetailDataVO.setPtType(PubUtils.ptType(csLinePO.getConType()));
|
||||
//lineDetailDataVO.setPt(lineDetail.getPt1() + "/" + lineDetail.getPt2());
|
||||
//lineDetailDataVO.setCt(lineDetail.getCt1() + "/" + lineDetail.getCt2());
|
||||
lineDetailDataVO.setDealCapacity(csLinePO.getProtocolCapacity().floatValue());
|
||||
lineDetailDataVO.setDevCapacity(csLinePO.getDevCapacity().floatValue());
|
||||
lineDetailDataVO.setShortCapacity(csLinePO.getShortCircuitCapacity().floatValue());
|
||||
lineDetailDataVO.setStandardCapacity(csLinePO.getBasicCapacity().floatValue());
|
||||
lineDetailDataVO.setPt(csLinePO.getPtRatio() + "/" + (Objects.isNull(csLinePO.getPt2Ratio())?1.0:csLinePO.getPt2Ratio()));
|
||||
lineDetailDataVO.setCt(csLinePO.getCtRatio() + "/" + (Objects.isNull(csLinePO.getCt2Ratio())?1.0:csLinePO.getCt2Ratio()));
|
||||
lineDetailDataVO.setDealCapacity(Objects.isNull(csLinePO.getProtocolCapacity())?0.0f:csLinePO.getProtocolCapacity().floatValue());
|
||||
lineDetailDataVO.setDevCapacity(Objects.isNull(csLinePO.getDevCapacity())?0.0f:csLinePO.getDevCapacity().floatValue());
|
||||
lineDetailDataVO.setShortCapacity(Objects.isNull(csLinePO.getShortCircuitCapacity())?0.0f:csLinePO.getShortCircuitCapacity().floatValue());
|
||||
lineDetailDataVO.setStandardCapacity(Objects.isNull(csLinePO.getBasicCapacity())?0.0f:csLinePO.getBasicCapacity().floatValue());
|
||||
lineDetailDataVO.setTimeInterval(csLinePO.getLineInterval());
|
||||
|
||||
return lineDetailDataVO;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLineList(CsLinePO param) {
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = getSimpleLine();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
}
|
||||
List<CsLinePO> result = this.list(new LambdaQueryWrapper<CsLinePO>()
|
||||
.eq(CsLinePO::getStatus, 1)
|
||||
.eq(StrUtil.isNotBlank(param.getPosition()), CsLinePO::getPosition, param.getPosition())
|
||||
.in(CsLinePO::getLineId, keywordsLineIds)
|
||||
.orderByAsc(CsLinePO::getName));
|
||||
//根据监测点id查询设备信息
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
//获取设备信息集合
|
||||
List<String> devList = result.stream().map(CsLinePO::getDeviceId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> equipmentDeliveryList = csEquipmentDeliveryMapper.selectBatchIds(devList);
|
||||
Map<String,Integer> runStatusMap = equipmentDeliveryList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId,CsEquipmentDeliveryPO::getRunStatus));
|
||||
result.forEach(item->{
|
||||
item.setRunStatus(runStatusMap.get(item.getDeviceId()));
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
private String getRunStatusDescription(Integer runStatus) {
|
||||
// 0:运行;1:检修;2:停运;3:调试;4:退运
|
||||
switch (runStatus) {
|
||||
case 0:
|
||||
return "运行";
|
||||
case 1:
|
||||
return "检修";
|
||||
return "离线";
|
||||
case 2:
|
||||
return "停运";
|
||||
case 3:
|
||||
return "调试";
|
||||
case 4:
|
||||
return "退运";
|
||||
return "在线";
|
||||
default:
|
||||
return "未知";
|
||||
}
|
||||
|
||||
@@ -0,0 +1,191 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.EngineeringProjectRelationVo;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据集表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2026-01-29
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EngineeringProjectServiceImpl implements IEngineeringProjectService {
|
||||
|
||||
private final CsEngineeringService csEngineeringService;
|
||||
private final AppProjectService appProjectService;
|
||||
private final ICsLedgerService csLedgerService;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addEngineering(CsEngineeringAddParm csEngineeringAddParm) {
|
||||
boolean result = false;
|
||||
//新增工程信息
|
||||
CsEngineeringPO po1 = csEngineeringService.add(csEngineeringAddParm);
|
||||
//新增cs_ledger数据
|
||||
CsLedgerParam csLedgerParam = new CsLedgerParam();
|
||||
csLedgerParam.setId(po1.getId());
|
||||
csLedgerParam.setPid("9999999");
|
||||
csLedgerParam.setName(csEngineeringAddParm.getName());
|
||||
csLedgerParam.setLevel(0);
|
||||
csLedgerParam.setRemark(csEngineeringAddParm.getDescription());
|
||||
csLedgerParam.setSort(csEngineeringAddParm.getSort());
|
||||
CsLedger po2 = csLedgerService.addLedgerTree(csLedgerParam);
|
||||
if (ObjectUtil.isNotNull(po1) && ObjectUtil.isNotNull(po2)) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateEngineering(CsEngineeringAuditParm csEngineeringAuditParm) {
|
||||
//修改工程信息
|
||||
CsEngineeringPO po1 = csEngineeringService.updateData(csEngineeringAuditParm);
|
||||
//修改cs_ledger数据
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
csLedgerParam.setId(po1.getId());
|
||||
csLedgerParam.setName(csEngineeringAuditParm.getName());
|
||||
csLedgerParam.setSort(csEngineeringAuditParm.getSort());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteEngineering(String id) {
|
||||
//查询csledger数据
|
||||
List<CsLedgerVO> allList = csLedgerMapper.getAll();
|
||||
allList.forEach(item->{
|
||||
if (Objects.equals(item.getPid(),id)) {
|
||||
throw new BusinessException("请先删除该工程下的所有项目");
|
||||
}
|
||||
});
|
||||
//删除工程信息
|
||||
csEngineeringService.deleteData(id);
|
||||
//删除台账信息
|
||||
csLedgerService.deleteLedgerTree(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addProject(AppProjectAddParm param) {
|
||||
boolean result = false;
|
||||
//新增项目信息
|
||||
AppProjectPO po1 = appProjectService.add(param);
|
||||
//新增cs_ledger数据
|
||||
CsLedgerParam csLedgerParam = new CsLedgerParam();
|
||||
csLedgerParam.setId(po1.getId());
|
||||
csLedgerParam.setPid(param.getEngineeringId());
|
||||
csLedgerParam.setName(param.getName());
|
||||
csLedgerParam.setLevel(1);
|
||||
csLedgerParam.setSort(param.getSort());
|
||||
CsLedger po2 = csLedgerService.addLedgerTree(csLedgerParam);
|
||||
if (ObjectUtil.isNotNull(po1) && ObjectUtil.isNotNull(po2)) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateProject(AppProjectAuditParm param) {
|
||||
//修改工程信息
|
||||
AppProjectPO po1 = appProjectService.updateData(param);
|
||||
//修改cs_ledger数据
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
csLedgerParam.setId(po1.getId());
|
||||
csLedgerParam.setName(param.getName());
|
||||
csLedgerParam.setSort(param.getSort());
|
||||
csLedgerParam.setRemark(param.getDescription());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteProject(String id) {
|
||||
//删除项目信息
|
||||
appProjectService.delete(id);
|
||||
//删除台账信息
|
||||
csLedgerService.deleteLedgerTree(id);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EngineeringProjectRelationVo> getList() {
|
||||
List<EngineeringProjectRelationVo> result = new ArrayList<>();
|
||||
//查询所有工程
|
||||
LambdaQueryWrapper<CsEngineeringPO> queryWrapper1 = new LambdaQueryWrapper<>();
|
||||
queryWrapper1.eq(CsEngineeringPO::getStatus,"1").orderByAsc(CsEngineeringPO::getSort);
|
||||
List<CsEngineeringPO> list1 = csEngineeringService.list(queryWrapper1);
|
||||
|
||||
//查询所有项目
|
||||
LambdaQueryWrapper<AppProjectPO> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.eq(AppProjectPO::getStatus,"1").orderByAsc(AppProjectPO::getSort);
|
||||
List<AppProjectPO> list2 = appProjectService.list(queryWrapper2);
|
||||
Map<String,AppProjectPO> map = list2.stream().collect(Collectors.toMap(AppProjectPO::getId, item->item));
|
||||
|
||||
//查询所有拓扑图
|
||||
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper3 = new LambdaQueryWrapper<>();
|
||||
queryWrapper3.eq(AppTopologyDiagramPO::getStatus,"1");
|
||||
List<AppTopologyDiagramPO> list3 = appTopologyDiagramService.list(queryWrapper3);
|
||||
Map<String,AppTopologyDiagramPO> map3 = list3.stream().collect(Collectors.toMap(AppTopologyDiagramPO::getProjectId, item->item));
|
||||
|
||||
//查询台账信息
|
||||
List<CsLedgerVO> allList = csLedgerMapper.getAll();
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
list1.forEach(item->{
|
||||
EngineeringProjectRelationVo temp = new EngineeringProjectRelationVo();
|
||||
temp.setEngineeringId(item.getId());
|
||||
temp.setEngineeringName(item.getName());
|
||||
temp.setEngineeringArea(item.getProvince()+item.getCity());
|
||||
temp.setEngineeringRemark(item.getDescription());
|
||||
temp.setEngineeringSort(item.getSort());
|
||||
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item2->item2.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(projectList)) {
|
||||
List<EngineeringProjectRelationVo.ProjectInfo> projectInfoList = new ArrayList<>();
|
||||
projectList.forEach(item2->{
|
||||
AppProjectPO po = map.get(item2.getId());
|
||||
EngineeringProjectRelationVo.ProjectInfo projectInfo = new EngineeringProjectRelationVo.ProjectInfo();
|
||||
projectInfo.setProjectId(po.getId());
|
||||
projectInfo.setProjectName(po.getName());
|
||||
projectInfo.setProjectArea(po.getArea());
|
||||
projectInfo.setProjectRemark(po.getDescription());
|
||||
projectInfo.setProjectSort(po.getSort());
|
||||
projectInfo.setTopologyInfo(Objects.isNull(map3.get(po.getId()))?null:map3.get(po.getId()).getFilePath());
|
||||
projectInfoList.add(projectInfo);
|
||||
});
|
||||
temp.setProjectInfoList(projectInfoList);
|
||||
}
|
||||
result.add(temp);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -8,10 +8,10 @@ import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.csp.sentinel.util.StringUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DSTransactional;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.access.utils.ChannelObjectUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.csdevice.param.IcdLedgerParam;
|
||||
import com.njcn.csdevice.param.IcdParam;
|
||||
@@ -22,9 +22,11 @@ import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csdevice.utils.COverlimitUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.mq.message.BZEventMessage;
|
||||
import com.njcn.mq.template.BZEventMessageTemplate;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
@@ -60,7 +62,7 @@ class IcdServiceImpl implements IcdService {
|
||||
private final EventFeignClient eventFeignClient;
|
||||
private final ICsTerminalLogsService csTerminalLogsService;
|
||||
private final ICsTerminalReplyService csTerminalReplyService;
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final OverLimitWlMapper overLimitWlMapper;
|
||||
private final DateTimeFormatter microsecondFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||
|
||||
@Override
|
||||
@@ -126,6 +128,7 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void addLedgerInfo(IcdLedgerParam param) {
|
||||
// 第一种:全流程创建
|
||||
if (isAllIndicesNull(param)) {
|
||||
@@ -581,7 +584,6 @@ class IcdServiceImpl implements IcdService {
|
||||
&& ObjectUtil.isNull(param.getDevIndex());
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFullProcessCreation(@NotNull IcdLedgerParam param) {
|
||||
if (ObjectUtil.isNotNull(param.getEngineering())) {
|
||||
CsEngineeringPO po1 = csEngineeringService.addEngineering(param.getEngineering());
|
||||
@@ -590,17 +592,14 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromEngineeringCreation(IcdLedgerParam param) {
|
||||
createProjectAndDevices(param);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromProjectCreation(IcdLedgerParam param) {
|
||||
saveDevicesAndLines(param);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void handleFromDeviceCreation(IcdLedgerParam param) {
|
||||
saveLines(param);
|
||||
}
|
||||
@@ -634,7 +633,6 @@ class IcdServiceImpl implements IcdService {
|
||||
saveLines(param);
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void saveLines(IcdLedgerParam param) {
|
||||
List<CsLineParam> lineList = param.getLine();
|
||||
if (CollectionUtil.isNotEmpty(lineList)) {
|
||||
@@ -660,7 +658,7 @@ class IcdServiceImpl implements IcdService {
|
||||
//新增监测点限值
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(line.getVolGrade().floatValue(), line.getProtocolCapacity().floatValue(),line.getDevCapacity().floatValue(),line.getShortCircuitCapacity().floatValue(),0,0);
|
||||
overlimit.setId(po.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
overLimitWlMapper.insert(overlimit);
|
||||
}
|
||||
|
||||
//新增台账日志
|
||||
|
||||
@@ -1,11 +1,12 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.csdevice.pojo.vo.LineOverLimitVO;
|
||||
import com.njcn.csdevice.service.IOverLimitService;
|
||||
import com.njcn.device.biz.mapper.OverLimitWlMapper;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -15,9 +16,10 @@ import org.springframework.stereotype.Service;
|
||||
* @author cdf
|
||||
* @date 2023/6/7
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class OverLimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements IOverLimitService {
|
||||
public class OverLimitServiceImpl extends ServiceImpl<OverLimitWlMapper, Overlimit> implements IOverLimitService {
|
||||
|
||||
|
||||
@Override
|
||||
|
||||
@@ -47,7 +47,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper<>();
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
if(Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csEngineeringUserPOQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.clear();
|
||||
@@ -94,7 +94,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode()) || Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode()) ){
|
||||
List<CsEngineeringPO> csEngineeringPOS = csEngineeringMapper.selectList(null);
|
||||
collect =csEngineeringPOS.stream().filter(temp->Objects.equals(temp.getStatus(),"1")).map(CsEngineeringPO::getId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -116,7 +116,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
@@ -198,7 +198,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
}
|
||||
// ||Objects.equals(role,"bxs_user")
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode())){
|
||||
else if(Objects.equals(role,AppRoleEnum.ROOT.getCode())||Objects.equals(role,AppRoleEnum.OPERATION_MANAGER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER.getCode())){
|
||||
csLedgerQueryWrapper.clear();
|
||||
csLedgerQueryWrapper.eq("level",2).eq("state",1);
|
||||
List<CsLedger> csLedgers = csLedgerMapper.selectList(csLedgerQueryWrapper);
|
||||
|
||||
@@ -24,7 +24,6 @@ import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.po.Overlimit;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
@@ -32,10 +31,11 @@ import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IOverLimitService;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csdevice.utils.COverlimitUtil;
|
||||
import com.njcn.csdevice.utils.StringUtil;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.influx.imapper.CommonMapper;
|
||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class CldWarnParam extends BaseParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("告警等级")
|
||||
private String level;
|
||||
|
||||
}
|
||||
@@ -28,6 +28,11 @@ public class CsConfigurationParm {
|
||||
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 数据范围 0 私有 1全局
|
||||
*/
|
||||
private int scope;
|
||||
|
||||
private List<String> projectIds;
|
||||
|
||||
|
||||
@@ -55,6 +60,10 @@ public class CsConfigurationParm {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class CsConfigurationQueryParam extends BaseParam {
|
||||
private String id;
|
||||
@ApiModelProperty(value = "当前用户ID")
|
||||
private String currentUserId;
|
||||
@ApiModelProperty(value = "当前用户角色")
|
||||
private String roleCode;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,13 +16,13 @@ public class SensitiveUserReportQueryParam {
|
||||
@ApiModelProperty(name = "tempId",value = "模板ID")
|
||||
private String tempId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@ApiModelProperty(name = "startTime", value = "开始时间")
|
||||
@NotBlank(message = "起始时间不可为空")
|
||||
@DateTimeStrValid(message = "起始时间格式出错")
|
||||
private String searchBeginTime;
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime", value = "结束时间")
|
||||
@ApiModelProperty(name = "endTime", value = "结束时间")
|
||||
@NotBlank(message = "结束时间不可为空")
|
||||
private String searchEndTime;
|
||||
private String endTime;
|
||||
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.util.List;
|
||||
public class SensitiveUserTrendDataQueryParam {
|
||||
|
||||
@ApiModelProperty(value = "检测对象ID")
|
||||
@NotBlank(message = "检测对象ID不可为空")
|
||||
private String sensitiveUserId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime", value = "开始时间")
|
||||
@@ -37,4 +36,8 @@ public class SensitiveUserTrendDataQueryParam {
|
||||
@ApiModelProperty(value = "频次2-50")
|
||||
private String frequency;
|
||||
|
||||
//采用这个频次,上面那个频次用于多指标筛选
|
||||
@ApiModelProperty(value = "频次2-50")
|
||||
private Integer harmonicCount;
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csharmonic.pojo.dto;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2025/09/18 下午 2:00【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
public class RealTimeDataDTO {
|
||||
private Integer code;
|
||||
private String message;
|
||||
private Integer type =1;
|
||||
// private List<RealTimeDataVo> realTimeDataVoList;
|
||||
}
|
||||
@@ -56,4 +56,6 @@ public class ReportTemplateDTO {
|
||||
*/
|
||||
private String value;
|
||||
|
||||
private String lowValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -39,8 +39,11 @@ public class ZuTaiDTO {
|
||||
@SerializedName("lineId")
|
||||
private String lineId;
|
||||
|
||||
@SerializedName("UIDType")
|
||||
private Boolean uIdType;
|
||||
|
||||
@SerializedName("UID")
|
||||
private List<String> uId;
|
||||
private List<Object> uId;
|
||||
|
||||
@SerializedName("UIDName")
|
||||
private String target;
|
||||
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.njcn.csharmonic.pojo.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/6/14 20:07
|
||||
*/
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ZuTaiNewDTO {
|
||||
|
||||
private List<DiagramElement> json;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public static class DiagramElement{
|
||||
|
||||
private String id;
|
||||
private String title;
|
||||
private String keyId;
|
||||
private String type;
|
||||
private boolean resize;
|
||||
private boolean rotate;
|
||||
private boolean lock;
|
||||
private boolean active;
|
||||
private boolean hide;
|
||||
private String tag;
|
||||
private boolean use_proportional_scaling;
|
||||
private String lineId;
|
||||
private List<String> lineList;
|
||||
private String lineName;
|
||||
@JsonProperty("UID")
|
||||
private List<Object> uid;
|
||||
@JsonProperty("UIDNames")
|
||||
|
||||
private List<String> uidNames;
|
||||
private List<String> unit;
|
||||
|
||||
private Boolean uidType;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,42 +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;
|
||||
|
||||
}
|
||||
//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;
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -45,6 +45,12 @@ public class ReportTemplateParam {
|
||||
@ApiModelProperty(name = "reportForm",value = "报表类型",required = true)
|
||||
private String reportForm;
|
||||
|
||||
@ApiModelProperty(name = "wiringMethod",value = "接线方式",required = true)
|
||||
private String wiringMethod;
|
||||
|
||||
@ApiModelProperty(name = "sort",value = "排序",required = true)
|
||||
private Integer sort;
|
||||
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
|
||||
@@ -1,75 +1,75 @@
|
||||
package com.njcn.csharmonic.pojo.param.eventReport;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xxy
|
||||
* @version 1.0.0
|
||||
* @date 2022年08月16日 19:37
|
||||
*/
|
||||
@Data
|
||||
public class ExportParam implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "lineId",value = "监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(name = "searchBeginTime",value = "开始时间")
|
||||
private String searchBeginTime;
|
||||
|
||||
@ApiModelProperty(name = "searchEndTime",value = "结束时间")
|
||||
private String searchEndTime;
|
||||
|
||||
@ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
private String lineName;
|
||||
|
||||
@ApiModelProperty(name = "xq",value = "监测点详情",example = "true")
|
||||
private boolean xq;
|
||||
|
||||
@ApiModelProperty(name = "lb",value = "暂降事件列表",example = "true")
|
||||
private boolean lb;
|
||||
|
||||
@ApiModelProperty(name = "mdbg",value = "暂降密度表格",example = "false")
|
||||
private boolean mdbg;
|
||||
|
||||
@ApiModelProperty(name = "mdtx",value = "暂降密度图形",example = "false")
|
||||
private boolean mdtx;
|
||||
|
||||
@ApiModelProperty(name = "sjdITIC",value = "暂降时间点ITIC",example = "false")
|
||||
private boolean sjdITIC;
|
||||
|
||||
@ApiModelProperty(name = "sjdF47",value = "暂降时间点F47",example = "false")
|
||||
private boolean sjdF47;
|
||||
|
||||
@ApiModelProperty(name = "glfbfz",value = "概率分布暂降赋值",example = "false")
|
||||
private boolean glfbfz;
|
||||
|
||||
@ApiModelProperty(name = "glfbsj",value = "概率分布持续时间",example = "false")
|
||||
private boolean glfbsj;
|
||||
|
||||
@ApiModelProperty(name = "tjbg",value = "月份统计表格",example = "false")
|
||||
private boolean tjbg;
|
||||
|
||||
@ApiModelProperty(name = "tjtx",value = "月份统计图形",example = "false")
|
||||
private boolean tjtx;
|
||||
|
||||
@ApiModelProperty(name = "yybg",value = "暂降原因表格",example = "false")
|
||||
private boolean yybg;
|
||||
|
||||
@ApiModelProperty(name = "yytx",value = "暂降原因图形",example = "false")
|
||||
private boolean yytx;
|
||||
|
||||
@ApiModelProperty(name = "lxbg",value = "暂降类型表格",example = "false")
|
||||
private boolean lxbg;
|
||||
|
||||
@ApiModelProperty(name = "lxtx",value = "暂降类型图形",example = "false")
|
||||
private boolean lxtx;
|
||||
|
||||
@ApiModelProperty(name = "flag",value = "标识")
|
||||
private Integer flag;
|
||||
|
||||
@ApiModelProperty(name = "type",value = "系统区分(0:pq 1:pms)")
|
||||
private Integer type;
|
||||
}
|
||||
//package com.njcn.csharmonic.pojo.param.eventReport;
|
||||
//
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
//import lombok.Data;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//
|
||||
///**
|
||||
// * @author xxy
|
||||
// * @version 1.0.0
|
||||
// * @date 2022年08月16日 19:37
|
||||
// */
|
||||
//@Data
|
||||
//public class ExportParam implements Serializable {
|
||||
//
|
||||
// @ApiModelProperty(name = "lineId",value = "监测点ID")
|
||||
// private String lineId;
|
||||
//
|
||||
// @ApiModelProperty(name = "searchBeginTime",value = "开始时间")
|
||||
// private String searchBeginTime;
|
||||
//
|
||||
// @ApiModelProperty(name = "searchEndTime",value = "结束时间")
|
||||
// private String searchEndTime;
|
||||
//
|
||||
// @ApiModelProperty(name = "lineName",value = "监测点名称")
|
||||
// private String lineName;
|
||||
//
|
||||
// @ApiModelProperty(name = "xq",value = "监测点详情",example = "true")
|
||||
// private boolean xq;
|
||||
//
|
||||
// @ApiModelProperty(name = "lb",value = "暂降事件列表",example = "true")
|
||||
// private boolean lb;
|
||||
//
|
||||
// @ApiModelProperty(name = "mdbg",value = "暂降密度表格",example = "false")
|
||||
// private boolean mdbg;
|
||||
//
|
||||
// @ApiModelProperty(name = "mdtx",value = "暂降密度图形",example = "false")
|
||||
// private boolean mdtx;
|
||||
//
|
||||
// @ApiModelProperty(name = "sjdITIC",value = "暂降时间点ITIC",example = "false")
|
||||
// private boolean sjdITIC;
|
||||
//
|
||||
// @ApiModelProperty(name = "sjdF47",value = "暂降时间点F47",example = "false")
|
||||
// private boolean sjdF47;
|
||||
//
|
||||
// @ApiModelProperty(name = "glfbfz",value = "概率分布暂降赋值",example = "false")
|
||||
// private boolean glfbfz;
|
||||
//
|
||||
// @ApiModelProperty(name = "glfbsj",value = "概率分布持续时间",example = "false")
|
||||
// private boolean glfbsj;
|
||||
//
|
||||
// @ApiModelProperty(name = "tjbg",value = "月份统计表格",example = "false")
|
||||
// private boolean tjbg;
|
||||
//
|
||||
// @ApiModelProperty(name = "tjtx",value = "月份统计图形",example = "false")
|
||||
// private boolean tjtx;
|
||||
//
|
||||
// @ApiModelProperty(name = "yybg",value = "暂降原因表格",example = "false")
|
||||
// private boolean yybg;
|
||||
//
|
||||
// @ApiModelProperty(name = "yytx",value = "暂降原因图形",example = "false")
|
||||
// private boolean yytx;
|
||||
//
|
||||
// @ApiModelProperty(name = "lxbg",value = "暂降类型表格",example = "false")
|
||||
// private boolean lxbg;
|
||||
//
|
||||
// @ApiModelProperty(name = "lxtx",value = "暂降类型图形",example = "false")
|
||||
// private boolean lxtx;
|
||||
//
|
||||
// @ApiModelProperty(name = "flag",value = "标识")
|
||||
// private Integer flag;
|
||||
//
|
||||
// @ApiModelProperty(name = "type",value = "系统区分(0:pq 1:pms)")
|
||||
// private Integer type;
|
||||
//}
|
||||
|
||||
@@ -17,8 +17,8 @@ import lombok.NoArgsConstructor;
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "cs_configuration")
|
||||
public class CsConfigurationPO extends BaseEntity {
|
||||
@TableName(value = "cs_configuration")
|
||||
public class CsConfigurationPO extends BaseEntity {
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@@ -31,6 +31,12 @@ public class CsConfigurationPO extends BaseEntity {
|
||||
@TableField(value = "`name`")
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 数据范围 0 私有 1全局
|
||||
*/
|
||||
@TableField(value = "scope")
|
||||
private int scope;
|
||||
|
||||
@TableField(value = "image_path")
|
||||
private String imagePath;
|
||||
|
||||
@@ -50,7 +56,6 @@ public class CsConfigurationPO extends BaseEntity {
|
||||
private String status;
|
||||
|
||||
|
||||
|
||||
public static final String COL_ID = "id";
|
||||
|
||||
public static final String COL_NAME = "name";
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CsPageUser implements Serializable {
|
||||
|
||||
/**
|
||||
* 组态界面ID
|
||||
*/
|
||||
private String pageId;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
}
|
||||
@@ -1,37 +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;
|
||||
|
||||
}
|
||||
//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;
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csharmonic.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
@@ -7,6 +8,8 @@ import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import static com.baomidou.mybatisplus.annotation.IdType.ASSIGN_ID;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
@@ -25,6 +28,7 @@ public class PqSensitiveUser extends BaseEntity implements Serializable{
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
@TableId(value = "id",type = ASSIGN_ID)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,127 @@
|
||||
//package com.njcn.csharmonic.pojo.po;
|
||||
//
|
||||
//import com.baomidou.mybatisplus.annotation.IdType;
|
||||
//import com.baomidou.mybatisplus.annotation.TableField;
|
||||
//import com.baomidou.mybatisplus.annotation.TableId;
|
||||
//import com.baomidou.mybatisplus.annotation.TableName;
|
||||
//import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
//import io.swagger.annotations.ApiModel;
|
||||
//import io.swagger.annotations.ApiModelProperty;
|
||||
//import lombok.Data;
|
||||
//
|
||||
//import java.io.Serializable;
|
||||
//import java.time.LocalDateTime;
|
||||
//
|
||||
///**
|
||||
// * 暂降明细实体类
|
||||
// *
|
||||
// * @author yzh
|
||||
// * @since 2022-10-12 18:34:55
|
||||
// */
|
||||
//@Data
|
||||
//@TableName("r_mp_event_detail")
|
||||
//@ApiModel(value="RmpEventDetail对象")
|
||||
//public class RmpEventDetailPO implements Serializable {
|
||||
// private static final long serialVersionUID = 1L;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂时事件ID")
|
||||
// @TableId(value = "event_id", type = IdType.ASSIGN_ID)
|
||||
// private String eventId;
|
||||
//
|
||||
// @ApiModelProperty(value = "监测点ID")
|
||||
// private String measurementPointId;
|
||||
//
|
||||
// @ApiModelProperty(value = "监测点ID(复制)")
|
||||
// @TableField("measurement_point_id")
|
||||
// private String lineId;
|
||||
//
|
||||
// @ApiModelProperty(value = "统计类型")
|
||||
// private String eventType;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降原因(Event_Reason)")
|
||||
// @TableField("advance_reason")
|
||||
// private String advanceReason;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降类型(Event_Type)")
|
||||
// @TableField("advance_type")
|
||||
// private String advanceType;
|
||||
//
|
||||
// @ApiModelProperty(value = "事件关联分析表Guid")
|
||||
// private String eventassIndex;
|
||||
//
|
||||
// @ApiModelProperty(value = "dq计算持续时间 ")
|
||||
// private Double dqTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "特征值计算更新时间(外键PQS_Relevance的Time字段)")
|
||||
// private LocalDateTime dealTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "默认事件个数为0")
|
||||
// private Integer num;
|
||||
//
|
||||
// @ApiModelProperty(value = "波形文件是否从装置招到本地(0:未招,1:已招)默认值为0")
|
||||
// private Integer fileFlag;
|
||||
//
|
||||
// @ApiModelProperty(value = "特征值计算标志(0,未处理;1,已处理; 2,已处理,无结果;3,计算失败)默认值为0")
|
||||
// private Integer dealFlag;
|
||||
//
|
||||
// @ApiModelProperty(value = "处理结果第一条事件发生时间(读comtra文件获取)")
|
||||
// private LocalDateTime firstTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "处理结果第一条事件暂降类型(字典表PQS_Dicdata)")
|
||||
// private String firstType;
|
||||
//
|
||||
// @ApiModelProperty(value = "处理结果第一条事件发生时间毫秒(读comtra文件获取)")
|
||||
// private Double firstMs;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降能量")
|
||||
// private Double energy;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降严重度")
|
||||
// private Double severity;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降源与监测位置关系 Upper:上游;Lower :下游;Unknown :未知;为空则是未计算")
|
||||
// private String sagsource;
|
||||
//
|
||||
// @ApiModelProperty(value = "开始时间")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss.SSS")
|
||||
// private LocalDateTime startTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "格式化开始时间")
|
||||
// @TableField(exist = false)
|
||||
// private String formatTime;
|
||||
//
|
||||
//
|
||||
// @ApiModelProperty(value = "持续时间,单位秒")
|
||||
// private Double duration;
|
||||
//
|
||||
// @ApiModelProperty(value = "特征幅值")
|
||||
// private Double featureAmplitude;
|
||||
//
|
||||
// @ApiModelProperty(value = "相别")
|
||||
// private String phase;
|
||||
//
|
||||
// @ApiModelProperty(value = "事件描述")
|
||||
// private String eventDescribe;
|
||||
//
|
||||
// @ApiModelProperty(value = "波形路径")
|
||||
// private String wavePath;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降核实原因")
|
||||
// @TableField("verify_reason")
|
||||
// private String verifyReason;
|
||||
//
|
||||
// @ApiModelProperty(value = "暂降核实原因详情")
|
||||
// @TableField("verify_reason_detail")
|
||||
// private String verifyReasonDetail;
|
||||
//
|
||||
// private Double transientValue;
|
||||
//
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
// private LocalDateTime createTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "用于计算数量")
|
||||
// @TableField(exist = false)
|
||||
// private Integer count;
|
||||
//
|
||||
//}
|
||||
//
|
||||
@@ -31,6 +31,8 @@ public class CsConfigurationVO extends BaseEntity {
|
||||
|
||||
private Integer orderBy;
|
||||
|
||||
private Integer scope;
|
||||
|
||||
|
||||
private List<String> projectIds;
|
||||
|
||||
|
||||
@@ -42,6 +42,9 @@ public class CsRtDataVO {
|
||||
@ApiModelProperty("指标显示名称")
|
||||
private String statisticalName;
|
||||
|
||||
@ApiModelProperty("指标单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty("指标名称")
|
||||
private String target;
|
||||
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 组态下事件描述实体
|
||||
*/
|
||||
@Data
|
||||
public class CsWarnDescVO implements Serializable {
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
|
||||
/**
|
||||
* 名称,比如监测点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
|
||||
/**
|
||||
* 发生时间
|
||||
*/
|
||||
private String timeId;
|
||||
|
||||
|
||||
/**
|
||||
* 事件描述eventDesc
|
||||
*/
|
||||
private String eventDesc;
|
||||
|
||||
|
||||
/**
|
||||
* 持续时间
|
||||
*/
|
||||
private Double persistTime;
|
||||
|
||||
/**
|
||||
* 暂降幅值
|
||||
*/
|
||||
private Double amplitude;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,34 +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;
|
||||
|
||||
}
|
||||
//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;
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -22,8 +22,10 @@ public class TotalLimitStatisticsDetailsVO {
|
||||
private Integer allTime;
|
||||
|
||||
@ApiModelProperty(value = "闪变越限次数")
|
||||
private Integer flickerOvertime;
|
||||
private Integer flickerAllTime;
|
||||
|
||||
@ApiModelProperty(value = "闪变越限")
|
||||
private double flickerOvertime;
|
||||
|
||||
@ApiModelProperty(value = "频率偏差越限")
|
||||
private double freqDevOvertime;
|
||||
|
||||
@@ -1,142 +1,142 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
/**
|
||||
* @author hongawen
|
||||
* @date: 2020/8/20 13:36
|
||||
*/
|
||||
public class ClearPathUtil {
|
||||
|
||||
/**
|
||||
* 针对漏洞,新增的特殊字符替换的扫描方法
|
||||
*/
|
||||
public static String cleanString(String str) {
|
||||
if (str == null) {
|
||||
return null;
|
||||
}
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (int i = 0; i < str.length(); ++i) {
|
||||
sb.append(cleanChar(str.charAt(i)));
|
||||
}
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
private static char cleanChar(char ch) {
|
||||
|
||||
// 0 - 9
|
||||
for (int i = 48; i < 58; ++i) {
|
||||
if (ch == i) {
|
||||
return (char) i;
|
||||
}
|
||||
}
|
||||
|
||||
// 'A' - 'Z'
|
||||
for (int i = 65; i < 91; ++i) {
|
||||
if (ch == i) {
|
||||
return (char) i;
|
||||
}
|
||||
}
|
||||
|
||||
// 'a' - 'z'
|
||||
for (int i = 97; i < 123; ++i) {
|
||||
if (ch == i) {
|
||||
return (char) i;
|
||||
}
|
||||
}
|
||||
|
||||
// other valid characters
|
||||
switch (ch) {
|
||||
case '/':
|
||||
return '/';
|
||||
case '.':
|
||||
return '.';
|
||||
case '-':
|
||||
return '-';
|
||||
case '_':
|
||||
return '_';
|
||||
case ',':
|
||||
return ',';
|
||||
case ' ':
|
||||
return ' ';
|
||||
case '!':
|
||||
return '!';
|
||||
case '@':
|
||||
return '@';
|
||||
case '#':
|
||||
return '#';
|
||||
case '$':
|
||||
return '$';
|
||||
case '%':
|
||||
return '%';
|
||||
case '^':
|
||||
return '^';
|
||||
case '&':
|
||||
return '&';
|
||||
case '*':
|
||||
return '*';
|
||||
case '(':
|
||||
return '(';
|
||||
case ')':
|
||||
return ')';
|
||||
case '+':
|
||||
return '+';
|
||||
case '=':
|
||||
return '=';
|
||||
case ':':
|
||||
return ':';
|
||||
case ';':
|
||||
return ';';
|
||||
case '?':
|
||||
return '?';
|
||||
case '"':
|
||||
return '"';
|
||||
case '<':
|
||||
return '<';
|
||||
case '>':
|
||||
return '>';
|
||||
case '`':
|
||||
return '`';
|
||||
case '\\':
|
||||
return '/';
|
||||
case 'I':
|
||||
return 'I';
|
||||
case 'Ⅱ':
|
||||
return 'Ⅱ';
|
||||
case 'Ⅲ':
|
||||
return 'Ⅲ';
|
||||
case 'Ⅳ':
|
||||
return 'Ⅳ';
|
||||
case 'Ⅴ':
|
||||
return 'Ⅴ';
|
||||
case 'Ⅵ':
|
||||
return 'Ⅵ';
|
||||
case 'Ⅶ':
|
||||
return 'Ⅶ';
|
||||
case 'Ⅷ':
|
||||
return 'Ⅷ';
|
||||
case 'Ⅸ':
|
||||
return 'Ⅸ';
|
||||
|
||||
case 'V':
|
||||
return 'V';
|
||||
case 'X':
|
||||
return 'X';
|
||||
case 'Ⅹ':
|
||||
return 'Ⅹ';
|
||||
default:
|
||||
if (isChineseChar(ch)) {
|
||||
return ch;
|
||||
}
|
||||
return '%';
|
||||
}
|
||||
}
|
||||
|
||||
// 根据Unicode编码判断中文汉字和符号
|
||||
private static boolean isChineseChar(char c) {
|
||||
Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
|
||||
return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|
||||
|| ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
|
||||
|| ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
|
||||
|| ub == Character.UnicodeBlock.GENERAL_PUNCTUATION;
|
||||
}
|
||||
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
///**
|
||||
// * @author hongawen
|
||||
// * @date: 2020/8/20 13:36
|
||||
// */
|
||||
//public class ClearPathUtil {
|
||||
//
|
||||
// /**
|
||||
// * 针对漏洞,新增的特殊字符替换的扫描方法
|
||||
// */
|
||||
// public static String cleanString(String str) {
|
||||
// if (str == null) {
|
||||
// return null;
|
||||
// }
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (int i = 0; i < str.length(); ++i) {
|
||||
// sb.append(cleanChar(str.charAt(i)));
|
||||
// }
|
||||
// return sb.toString();
|
||||
// }
|
||||
//
|
||||
// private static char cleanChar(char ch) {
|
||||
//
|
||||
// // 0 - 9
|
||||
// for (int i = 48; i < 58; ++i) {
|
||||
// if (ch == i) {
|
||||
// return (char) i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 'A' - 'Z'
|
||||
// for (int i = 65; i < 91; ++i) {
|
||||
// if (ch == i) {
|
||||
// return (char) i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 'a' - 'z'
|
||||
// for (int i = 97; i < 123; ++i) {
|
||||
// if (ch == i) {
|
||||
// return (char) i;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // other valid characters
|
||||
// switch (ch) {
|
||||
// case '/':
|
||||
// return '/';
|
||||
// case '.':
|
||||
// return '.';
|
||||
// case '-':
|
||||
// return '-';
|
||||
// case '_':
|
||||
// return '_';
|
||||
// case ',':
|
||||
// return ',';
|
||||
// case ' ':
|
||||
// return ' ';
|
||||
// case '!':
|
||||
// return '!';
|
||||
// case '@':
|
||||
// return '@';
|
||||
// case '#':
|
||||
// return '#';
|
||||
// case '$':
|
||||
// return '$';
|
||||
// case '%':
|
||||
// return '%';
|
||||
// case '^':
|
||||
// return '^';
|
||||
// case '&':
|
||||
// return '&';
|
||||
// case '*':
|
||||
// return '*';
|
||||
// case '(':
|
||||
// return '(';
|
||||
// case ')':
|
||||
// return ')';
|
||||
// case '+':
|
||||
// return '+';
|
||||
// case '=':
|
||||
// return '=';
|
||||
// case ':':
|
||||
// return ':';
|
||||
// case ';':
|
||||
// return ';';
|
||||
// case '?':
|
||||
// return '?';
|
||||
// case '"':
|
||||
// return '"';
|
||||
// case '<':
|
||||
// return '<';
|
||||
// case '>':
|
||||
// return '>';
|
||||
// case '`':
|
||||
// return '`';
|
||||
// case '\\':
|
||||
// return '/';
|
||||
// case 'I':
|
||||
// return 'I';
|
||||
// case 'Ⅱ':
|
||||
// return 'Ⅱ';
|
||||
// case 'Ⅲ':
|
||||
// return 'Ⅲ';
|
||||
// case 'Ⅳ':
|
||||
// return 'Ⅳ';
|
||||
// case 'Ⅴ':
|
||||
// return 'Ⅴ';
|
||||
// case 'Ⅵ':
|
||||
// return 'Ⅵ';
|
||||
// case 'Ⅶ':
|
||||
// return 'Ⅶ';
|
||||
// case 'Ⅷ':
|
||||
// return 'Ⅷ';
|
||||
// case 'Ⅸ':
|
||||
// return 'Ⅸ';
|
||||
//
|
||||
// case 'V':
|
||||
// return 'V';
|
||||
// case 'X':
|
||||
// return 'X';
|
||||
// case 'Ⅹ':
|
||||
// return 'Ⅹ';
|
||||
// default:
|
||||
// if (isChineseChar(ch)) {
|
||||
// return ch;
|
||||
// }
|
||||
// return '%';
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// // 根据Unicode编码判断中文汉字和符号
|
||||
// private static boolean isChineseChar(char c) {
|
||||
// Character.UnicodeBlock ub = Character.UnicodeBlock.of(c);
|
||||
// return ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS || ub == Character.UnicodeBlock.CJK_COMPATIBILITY_IDEOGRAPHS
|
||||
// || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_A || ub == Character.UnicodeBlock.CJK_UNIFIED_IDEOGRAPHS_EXTENSION_B
|
||||
// || ub == Character.UnicodeBlock.CJK_SYMBOLS_AND_PUNCTUATION || ub == Character.UnicodeBlock.HALFWIDTH_AND_FULLWIDTH_FORMS
|
||||
// || ub == Character.UnicodeBlock.GENERAL_PUNCTUATION;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -1,83 +1,83 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
import org.apache.xmlbeans.XmlException;
|
||||
import org.apache.xmlbeans.XmlToken;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
|
||||
import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
||||
@Slf4j
|
||||
public class CustomXWPFDocument extends XWPFDocument {
|
||||
// 日志记录
|
||||
public CustomXWPFDocument(InputStream in) throws IOException {
|
||||
super(in);
|
||||
}
|
||||
|
||||
public CustomXWPFDocument() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CustomXWPFDocument(OPCPackage pkg) throws IOException {
|
||||
super(pkg);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param id
|
||||
* @param width
|
||||
* 宽
|
||||
* @param height
|
||||
* 高
|
||||
* @param paragraph
|
||||
* 段落
|
||||
*/
|
||||
public void createPicture(int id, int width, int height,String blipId, XWPFParagraph paragraph) {
|
||||
final int EMU = 9525;
|
||||
width *= EMU;
|
||||
height *= EMU;
|
||||
// String blipId = getAllPictures().get(id).getPackageRelationship().getId();
|
||||
CTInline inline = paragraph.createRun().getCTR().addNewDrawing().addNewInline();
|
||||
String picXml = "" + "<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">"
|
||||
+ " <a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">"
|
||||
+ " <pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">"
|
||||
+ " <pic:nvPicPr>" + " <pic:cNvPr id=\"" + id + "\" name=\"Generated\"/>"
|
||||
+ " <pic:cNvPicPr/>" + " </pic:nvPicPr>" + " <pic:blipFill>"
|
||||
+ " <a:blip r:embed=\"" + blipId
|
||||
+ "\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"/>"
|
||||
+ " <a:stretch>" + " <a:fillRect/>" + " </a:stretch>"
|
||||
+ " </pic:blipFill>" + " <pic:spPr>" + " <a:xfrm>"
|
||||
+ " <a:off x=\"0\" y=\"0\"/>" + " <a:ext cx=\"" + width + "\" cy=\""
|
||||
+ height + "\"/>" + " </a:xfrm>" + " <a:prstGeom prst=\"rect\">"
|
||||
+ " <a:avLst/>" + " </a:prstGeom>" + " </pic:spPr>"
|
||||
+ " </pic:pic>" + " </a:graphicData>" + "</a:graphic>";
|
||||
|
||||
inline.addNewGraphic().addNewGraphicData();
|
||||
XmlToken xmlToken = null;
|
||||
try {
|
||||
xmlToken = XmlToken.Factory.parse(picXml);
|
||||
} catch (XmlException xe) {
|
||||
log.error("生成报表发生异常,异常是"+xe.getMessage());
|
||||
}
|
||||
inline.set(xmlToken);
|
||||
|
||||
inline.setDistT(0);
|
||||
inline.setDistB(0);
|
||||
inline.setDistL(0);
|
||||
inline.setDistR(0);
|
||||
|
||||
CTPositiveSize2D extent = inline.addNewExtent();
|
||||
extent.setCx(width);
|
||||
extent.setCy(height);
|
||||
|
||||
CTNonVisualDrawingProps docPr = inline.addNewDocPr();
|
||||
docPr.setId(id);
|
||||
docPr.setName("图片" + id);
|
||||
docPr.setDescr("测试");
|
||||
}
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.poi.openxml4j.opc.OPCPackage;
|
||||
//import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
||||
//import org.apache.poi.xwpf.usermodel.XWPFParagraph;
|
||||
//import org.apache.xmlbeans.XmlException;
|
||||
//import org.apache.xmlbeans.XmlToken;
|
||||
//import org.openxmlformats.schemas.drawingml.x2006.main.CTNonVisualDrawingProps;
|
||||
//import org.openxmlformats.schemas.drawingml.x2006.main.CTPositiveSize2D;
|
||||
//import org.openxmlformats.schemas.drawingml.x2006.wordprocessingDrawing.CTInline;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.io.InputStream;
|
||||
//
|
||||
//@Slf4j
|
||||
//public class CustomXWPFDocument extends XWPFDocument {
|
||||
// // 日志记录
|
||||
// public CustomXWPFDocument(InputStream in) throws IOException {
|
||||
// super(in);
|
||||
// }
|
||||
//
|
||||
// public CustomXWPFDocument() {
|
||||
// super();
|
||||
// }
|
||||
//
|
||||
// public CustomXWPFDocument(OPCPackage pkg) throws IOException {
|
||||
// super(pkg);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param id
|
||||
// * @param width
|
||||
// * 宽
|
||||
// * @param height
|
||||
// * 高
|
||||
// * @param paragraph
|
||||
// * 段落
|
||||
// */
|
||||
// public void createPicture(int id, int width, int height,String blipId, XWPFParagraph paragraph) {
|
||||
// final int EMU = 9525;
|
||||
// width *= EMU;
|
||||
// height *= EMU;
|
||||
//// String blipId = getAllPictures().get(id).getPackageRelationship().getId();
|
||||
// CTInline inline = paragraph.createRun().getCTR().addNewDrawing().addNewInline();
|
||||
// String picXml = "" + "<a:graphic xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\">"
|
||||
// + " <a:graphicData uri=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">"
|
||||
// + " <pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">"
|
||||
// + " <pic:nvPicPr>" + " <pic:cNvPr id=\"" + id + "\" name=\"Generated\"/>"
|
||||
// + " <pic:cNvPicPr/>" + " </pic:nvPicPr>" + " <pic:blipFill>"
|
||||
// + " <a:blip r:embed=\"" + blipId
|
||||
// + "\" xmlns:r=\"http://schemas.openxmlformats.org/officeDocument/2006/relationships\"/>"
|
||||
// + " <a:stretch>" + " <a:fillRect/>" + " </a:stretch>"
|
||||
// + " </pic:blipFill>" + " <pic:spPr>" + " <a:xfrm>"
|
||||
// + " <a:off x=\"0\" y=\"0\"/>" + " <a:ext cx=\"" + width + "\" cy=\""
|
||||
// + height + "\"/>" + " </a:xfrm>" + " <a:prstGeom prst=\"rect\">"
|
||||
// + " <a:avLst/>" + " </a:prstGeom>" + " </pic:spPr>"
|
||||
// + " </pic:pic>" + " </a:graphicData>" + "</a:graphic>";
|
||||
//
|
||||
// inline.addNewGraphic().addNewGraphicData();
|
||||
// XmlToken xmlToken = null;
|
||||
// try {
|
||||
// xmlToken = XmlToken.Factory.parse(picXml);
|
||||
// } catch (XmlException xe) {
|
||||
// log.error("生成报表发生异常,异常是"+xe.getMessage());
|
||||
// }
|
||||
// inline.set(xmlToken);
|
||||
//
|
||||
// inline.setDistT(0);
|
||||
// inline.setDistB(0);
|
||||
// inline.setDistL(0);
|
||||
// inline.setDistR(0);
|
||||
//
|
||||
// CTPositiveSize2D extent = inline.addNewExtent();
|
||||
// extent.setCx(width);
|
||||
// extent.setCy(height);
|
||||
//
|
||||
// CTNonVisualDrawingProps docPr = inline.addNewDocPr();
|
||||
// docPr.setId(id);
|
||||
// docPr.setName("图片" + id);
|
||||
// docPr.setDescr("测试");
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author hongawen(创建) -----denghuajun(移植使用)
|
||||
* @Date: 2018/8/27 11:29
|
||||
*/
|
||||
public class FloatUtils {
|
||||
|
||||
|
||||
/**
|
||||
* 保留传入进来的float的两位小数,四舍五入的方式
|
||||
*
|
||||
* @param data Float参数
|
||||
*/
|
||||
public static float get2Float(Float data) {
|
||||
if (data == null || data.isNaN() || data.isInfinite()) {
|
||||
return 0f;
|
||||
}
|
||||
int scale = 2;//设置位数
|
||||
int roundingMode = 4;//表示四舍五入,可以选择其他舍值方式,例如去尾,等等.
|
||||
BigDecimal bd = new BigDecimal(data);
|
||||
bd = bd.setScale(scale, roundingMode);
|
||||
data = bd.floatValue();
|
||||
return data;
|
||||
}
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
//import java.math.BigDecimal;
|
||||
//
|
||||
///**
|
||||
// * @author hongawen(创建) -----denghuajun(移植使用)
|
||||
// * @Date: 2018/8/27 11:29
|
||||
// */
|
||||
//public class FloatUtils {
|
||||
//
|
||||
//
|
||||
// /**
|
||||
// * 保留传入进来的float的两位小数,四舍五入的方式
|
||||
// *
|
||||
// * @param data Float参数
|
||||
// */
|
||||
// public static float get2Float(Float data) {
|
||||
// if (data == null || data.isNaN() || data.isInfinite()) {
|
||||
// return 0f;
|
||||
// }
|
||||
// int scale = 2;//设置位数
|
||||
// int roundingMode = 4;//表示四舍五入,可以选择其他舍值方式,例如去尾,等等.
|
||||
// BigDecimal bd = new BigDecimal(data);
|
||||
// bd = bd.setScale(scale, roundingMode);
|
||||
// data = bd.floatValue();
|
||||
// return data;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,224 +1,224 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import lombok.SneakyThrows;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/4/10 17:39
|
||||
*/
|
||||
@Slf4j
|
||||
public class PubUtils {
|
||||
public static boolean createFile(String destFileName) {
|
||||
File file = new File(destFileName);
|
||||
if (file.exists()) {
|
||||
log.warn("创建单个文件" + destFileName + "失败,目标文件已存在!");
|
||||
return false;
|
||||
}
|
||||
if (destFileName.endsWith(File.separator)) {
|
||||
log.warn("创建单个文件" + destFileName + "失败,目标文件不能为目录!");
|
||||
return false;
|
||||
}
|
||||
//判断目标文件所在的目录是否存在
|
||||
if (!file.getParentFile().exists()) {
|
||||
//如果目标文件所在的目录不存在,则创建父目录
|
||||
log.warn("目标文件所在目录不存在,准备创建它!");
|
||||
if (!file.getParentFile().mkdirs()) {
|
||||
log.warn("创建目标文件所在目录失败!");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//创建目标文件
|
||||
try {
|
||||
if (file.createNewFile()) {
|
||||
log.warn("创建单个文件" + destFileName + "成功!");
|
||||
return true;
|
||||
} else {
|
||||
log.warn("创建单个文件" + destFileName + "失败!");
|
||||
return false;
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.warn("创建单个文件" + destFileName + "失败!" + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 读取配置文件
|
||||
*
|
||||
* @param cl 类名字
|
||||
* @param strPropertiesName 配置文件名称
|
||||
*/
|
||||
public static Properties readProperties(ClassLoader cl, String strPropertiesName) {
|
||||
Properties pros = new Properties();
|
||||
InputStream in = null;
|
||||
try {
|
||||
in = cl.getResourceAsStream(strPropertiesName);
|
||||
pros.load(in);
|
||||
} catch (Exception e) {
|
||||
log.error("读取配置文件失败失败:" + e.getMessage());
|
||||
} finally {
|
||||
if (in != null) {
|
||||
PubUtils.safeClose(in, "安全关闭读取配置文件失败,异常为:");
|
||||
}
|
||||
}
|
||||
return pros;
|
||||
}
|
||||
|
||||
/**
|
||||
* 安全关闭InputStream
|
||||
*
|
||||
* @param s
|
||||
*/
|
||||
public static void safeClose(InputStream s, String strError) {
|
||||
if (s != null) {
|
||||
try {
|
||||
s.close();
|
||||
} catch (IOException e) {
|
||||
log.error(strError + e.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static Double dataLimits(Double data) {
|
||||
if (ObjectUtil.isNotNull(data)) {
|
||||
return data > 100 ? 100 : data;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static List<String> getIntervalTime(String startTime, String endTime) {
|
||||
List<String> times = new ArrayList<>();
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
Date start = sdf.parse(startTime);
|
||||
Date end = sdf.parse(endTime);
|
||||
// 同月
|
||||
if (start.getTime() == end.getTime()) {
|
||||
String time = startTime.substring(0, 7);
|
||||
times.add(time);
|
||||
} else if (start.getYear() == end.getYear()) {
|
||||
// 同年
|
||||
int startM = start.getMonth() + 1;
|
||||
int endM = end.getMonth() + 1;
|
||||
int temp = endM - startM;
|
||||
for (int i = 0; i <= temp; i++) {
|
||||
String time = start.getYear() + 1900 + "";
|
||||
int month = startM + i;
|
||||
if (month < 10) {
|
||||
time = time + "-0" + month;
|
||||
} else {
|
||||
time = time + "-" + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不同年!!!!这里忽略了年份之间跨年的情况
|
||||
int startY = start.getYear() + 1900;
|
||||
int startM = start.getMonth() + 1;
|
||||
int endY = end.getYear() + 1900;
|
||||
int endM = end.getMonth() + 1;
|
||||
int tempS = 12 - startM;
|
||||
// 连续的年份
|
||||
if (endY - startY == 1) {
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
// 第二年的时间获取
|
||||
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
} else {
|
||||
// 不连续的年份
|
||||
// 第一年的时间获取
|
||||
for (int i = 0; i <= tempS; i++) {
|
||||
int month = startM + i;
|
||||
String time = startY + "-";
|
||||
if (month < 10) {
|
||||
time = time + "0" + month;
|
||||
} else {
|
||||
time = time + month;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
int tempY = endY - startY;
|
||||
// 中间年份的时间
|
||||
for (int i = 1; i < tempY; i++) {
|
||||
for (int j = 1; j <= 12; j++) {
|
||||
String time = startY + i + "-";
|
||||
if (j < 10) {
|
||||
time = time + "0" + j;
|
||||
} else {
|
||||
time = time + j;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
}
|
||||
// 最后一年的时间获取
|
||||
for (int i = 1; i <= endM; i++) {
|
||||
String time = endY + "-";
|
||||
if (i < 10) {
|
||||
time = time + "0" + i;
|
||||
} else {
|
||||
time = time + i;
|
||||
}
|
||||
times.add(time);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
return times;
|
||||
}
|
||||
|
||||
@SneakyThrows
|
||||
public static List<String> getIntervalDateTime(Integer startTime, int beginDay, Integer endTime, Integer dd) {
|
||||
List<String> list = new ArrayList<>();
|
||||
Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
||||
calendar.set(startTime, endTime - 1, 1);
|
||||
//年份
|
||||
int year = calendar.get(Calendar.YEAR);
|
||||
//月份
|
||||
int month = calendar.get(Calendar.MONTH) + 1;
|
||||
for (int i = beginDay; i <= dd; i++) {
|
||||
String date = null;
|
||||
if (month < 10 && i < 10) {
|
||||
date = year + "-0" + month + "-0" + i;
|
||||
}
|
||||
if (month < 10 && i >= 10) {
|
||||
date = year + "-0" + month + "-" + i;
|
||||
}
|
||||
if (month >= 10 && i < 10) {
|
||||
date = year + "-" + month + "-0" + i;
|
||||
}
|
||||
if (month >= 10 && i >= 10) {
|
||||
date = year + "-" + month + "-" + i;
|
||||
}
|
||||
|
||||
list.add(date);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
//import cn.hutool.core.util.ObjectUtil;
|
||||
//import lombok.SneakyThrows;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//
|
||||
//import java.io.File;
|
||||
//import java.io.IOException;
|
||||
//import java.io.InputStream;
|
||||
//import java.text.SimpleDateFormat;
|
||||
//import java.util.*;
|
||||
//
|
||||
///**
|
||||
// * @author wr
|
||||
// * @description
|
||||
// * @date 2023/4/10 17:39
|
||||
// */
|
||||
//@Slf4j
|
||||
//public class PubUtils {
|
||||
// public static boolean createFile(String destFileName) {
|
||||
// File file = new File(destFileName);
|
||||
// if (file.exists()) {
|
||||
// log.warn("创建单个文件" + destFileName + "失败,目标文件已存在!");
|
||||
// return false;
|
||||
// }
|
||||
// if (destFileName.endsWith(File.separator)) {
|
||||
// log.warn("创建单个文件" + destFileName + "失败,目标文件不能为目录!");
|
||||
// return false;
|
||||
// }
|
||||
// //判断目标文件所在的目录是否存在
|
||||
// if (!file.getParentFile().exists()) {
|
||||
// //如果目标文件所在的目录不存在,则创建父目录
|
||||
// log.warn("目标文件所在目录不存在,准备创建它!");
|
||||
// if (!file.getParentFile().mkdirs()) {
|
||||
// log.warn("创建目标文件所在目录失败!");
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
// //创建目标文件
|
||||
// try {
|
||||
// if (file.createNewFile()) {
|
||||
// log.warn("创建单个文件" + destFileName + "成功!");
|
||||
// return true;
|
||||
// } else {
|
||||
// log.warn("创建单个文件" + destFileName + "失败!");
|
||||
// return false;
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// log.warn("创建单个文件" + destFileName + "失败!" + e.getMessage());
|
||||
// return false;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 读取配置文件
|
||||
// *
|
||||
// * @param cl 类名字
|
||||
// * @param strPropertiesName 配置文件名称
|
||||
// */
|
||||
// public static Properties readProperties(ClassLoader cl, String strPropertiesName) {
|
||||
// Properties pros = new Properties();
|
||||
// InputStream in = null;
|
||||
// try {
|
||||
// in = cl.getResourceAsStream(strPropertiesName);
|
||||
// pros.load(in);
|
||||
// } catch (Exception e) {
|
||||
// log.error("读取配置文件失败失败:" + e.getMessage());
|
||||
// } finally {
|
||||
// if (in != null) {
|
||||
// PubUtils.safeClose(in, "安全关闭读取配置文件失败,异常为:");
|
||||
// }
|
||||
// }
|
||||
// return pros;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 安全关闭InputStream
|
||||
// *
|
||||
// * @param s
|
||||
// */
|
||||
// public static void safeClose(InputStream s, String strError) {
|
||||
// if (s != null) {
|
||||
// try {
|
||||
// s.close();
|
||||
// } catch (IOException e) {
|
||||
// log.error(strError + e.toString());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static Double dataLimits(Double data) {
|
||||
// if (ObjectUtil.isNotNull(data)) {
|
||||
// return data > 100 ? 100 : data;
|
||||
// }
|
||||
// return data;
|
||||
// }
|
||||
//
|
||||
// @SneakyThrows
|
||||
// public static List<String> getIntervalTime(String startTime, String endTime) {
|
||||
// List<String> times = new ArrayList<>();
|
||||
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
||||
// Date start = sdf.parse(startTime);
|
||||
// Date end = sdf.parse(endTime);
|
||||
// // 同月
|
||||
// if (start.getTime() == end.getTime()) {
|
||||
// String time = startTime.substring(0, 7);
|
||||
// times.add(time);
|
||||
// } else if (start.getYear() == end.getYear()) {
|
||||
// // 同年
|
||||
// int startM = start.getMonth() + 1;
|
||||
// int endM = end.getMonth() + 1;
|
||||
// int temp = endM - startM;
|
||||
// for (int i = 0; i <= temp; i++) {
|
||||
// String time = start.getYear() + 1900 + "";
|
||||
// int month = startM + i;
|
||||
// if (month < 10) {
|
||||
// time = time + "-0" + month;
|
||||
// } else {
|
||||
// time = time + "-" + month;
|
||||
// }
|
||||
// times.add(time);
|
||||
// }
|
||||
// } else {
|
||||
// // 不同年!!!!这里忽略了年份之间跨年的情况
|
||||
// int startY = start.getYear() + 1900;
|
||||
// int startM = start.getMonth() + 1;
|
||||
// int endY = end.getYear() + 1900;
|
||||
// int endM = end.getMonth() + 1;
|
||||
// int tempS = 12 - startM;
|
||||
// // 连续的年份
|
||||
// if (endY - startY == 1) {
|
||||
// // 第一年的时间获取
|
||||
// for (int i = 0; i <= tempS; i++) {
|
||||
// int month = startM + i;
|
||||
// String time = startY + "-";
|
||||
// if (month < 10) {
|
||||
// time = time + "0" + month;
|
||||
// } else {
|
||||
// time = time + month;
|
||||
// }
|
||||
// times.add(time);
|
||||
// }
|
||||
// // 第二年的时间获取
|
||||
//
|
||||
// for (int i = 1; i <= endM; i++) {
|
||||
// String time = endY + "-";
|
||||
// if (i < 10) {
|
||||
// time = time + "0" + i;
|
||||
// } else {
|
||||
// time = time + i;
|
||||
// }
|
||||
// times.add(time);
|
||||
// }
|
||||
// } else {
|
||||
// // 不连续的年份
|
||||
// // 第一年的时间获取
|
||||
// for (int i = 0; i <= tempS; i++) {
|
||||
// int month = startM + i;
|
||||
// String time = startY + "-";
|
||||
// if (month < 10) {
|
||||
// time = time + "0" + month;
|
||||
// } else {
|
||||
// time = time + month;
|
||||
// }
|
||||
// times.add(time);
|
||||
// }
|
||||
// int tempY = endY - startY;
|
||||
// // 中间年份的时间
|
||||
// for (int i = 1; i < tempY; i++) {
|
||||
// for (int j = 1; j <= 12; j++) {
|
||||
// String time = startY + i + "-";
|
||||
// if (j < 10) {
|
||||
// time = time + "0" + j;
|
||||
// } else {
|
||||
// time = time + j;
|
||||
// }
|
||||
// times.add(time);
|
||||
// }
|
||||
// }
|
||||
// // 最后一年的时间获取
|
||||
// for (int i = 1; i <= endM; i++) {
|
||||
// String time = endY + "-";
|
||||
// if (i < 10) {
|
||||
// time = time + "0" + i;
|
||||
// } else {
|
||||
// time = time + i;
|
||||
// }
|
||||
// times.add(time);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// }
|
||||
// return times;
|
||||
// }
|
||||
//
|
||||
// @SneakyThrows
|
||||
// public static List<String> getIntervalDateTime(Integer startTime, int beginDay, Integer endTime, Integer dd) {
|
||||
// List<String> list = new ArrayList<>();
|
||||
// Calendar calendar = Calendar.getInstance(Locale.CHINA);
|
||||
// calendar.set(startTime, endTime - 1, 1);
|
||||
// //年份
|
||||
// int year = calendar.get(Calendar.YEAR);
|
||||
// //月份
|
||||
// int month = calendar.get(Calendar.MONTH) + 1;
|
||||
// for (int i = beginDay; i <= dd; i++) {
|
||||
// String date = null;
|
||||
// if (month < 10 && i < 10) {
|
||||
// date = year + "-0" + month + "-0" + i;
|
||||
// }
|
||||
// if (month < 10 && i >= 10) {
|
||||
// date = year + "-0" + month + "-" + i;
|
||||
// }
|
||||
// if (month >= 10 && i < 10) {
|
||||
// date = year + "-" + month + "-0" + i;
|
||||
// }
|
||||
// if (month >= 10 && i >= 10) {
|
||||
// date = year + "-" + month + "-" + i;
|
||||
// }
|
||||
//
|
||||
// list.add(date);
|
||||
// }
|
||||
// return list;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
/**
|
||||
* 数据公共工具类
|
||||
*
|
||||
* @author qijian
|
||||
* @version 1.0.0
|
||||
* @createTime 2022/10/14 - 10:07
|
||||
*/
|
||||
public class PublicDataUtils {
|
||||
/**
|
||||
* 功能:下划线命名转驼峰命名
|
||||
* 将下划线替换为空格,将字符串根据空格分割成数组,再将每个单词首字母大写
|
||||
* @param s
|
||||
* @return
|
||||
*/
|
||||
public static String underCamel(String s)
|
||||
{
|
||||
String separator = "_";
|
||||
String under="";
|
||||
s = s.toLowerCase().replace(separator, " ");
|
||||
String sarr[]=s.split(" ");
|
||||
for(int i=0;i<sarr.length;i++)
|
||||
{
|
||||
String w=sarr[i].substring(0,1).toUpperCase()+sarr[i].substring(1);
|
||||
under +=w;
|
||||
}
|
||||
return under;
|
||||
}
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
///**
|
||||
// * 数据公共工具类
|
||||
// *
|
||||
// * @author qijian
|
||||
// * @version 1.0.0
|
||||
// * @createTime 2022/10/14 - 10:07
|
||||
// */
|
||||
//public class PublicDataUtils {
|
||||
// /**
|
||||
// * 功能:下划线命名转驼峰命名
|
||||
// * 将下划线替换为空格,将字符串根据空格分割成数组,再将每个单词首字母大写
|
||||
// * @param s
|
||||
// * @return
|
||||
// */
|
||||
// public static String underCamel(String s)
|
||||
// {
|
||||
// String separator = "_";
|
||||
// String under="";
|
||||
// s = s.toLowerCase().replace(separator, " ");
|
||||
// String sarr[]=s.split(" ");
|
||||
// for(int i=0;i<sarr.length;i++)
|
||||
// {
|
||||
// String w=sarr[i].substring(0,1).toUpperCase()+sarr[i].substring(1);
|
||||
// under +=w;
|
||||
// }
|
||||
// return under;
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,25 +1,25 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
import com.alibaba.fastjson.serializer.JSONSerializer;
|
||||
import com.alibaba.fastjson.serializer.ObjectSerializer;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
@Component
|
||||
public class TimestampAsLongSerializer implements ObjectSerializer {
|
||||
|
||||
@Override
|
||||
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
|
||||
if (object instanceof Timestamp) {
|
||||
Timestamp timestamp = (Timestamp) object;
|
||||
// 将Timestamp转换为时间戳(毫秒数)
|
||||
long time = timestamp.getTime();
|
||||
serializer.write(time);
|
||||
} else {
|
||||
serializer.write(object);
|
||||
}
|
||||
}
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
//import com.alibaba.fastjson.serializer.JSONSerializer;
|
||||
//import com.alibaba.fastjson.serializer.ObjectSerializer;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//
|
||||
//import java.io.IOException;
|
||||
//import java.lang.reflect.Type;
|
||||
//import java.sql.Timestamp;
|
||||
//
|
||||
//@Component
|
||||
//public class TimestampAsLongSerializer implements ObjectSerializer {
|
||||
//
|
||||
// @Override
|
||||
// public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
|
||||
// if (object instanceof Timestamp) {
|
||||
// Timestamp timestamp = (Timestamp) object;
|
||||
// // 将Timestamp转换为时间戳(毫秒数)
|
||||
// long time = timestamp.getTime();
|
||||
// serializer.write(time);
|
||||
// } else {
|
||||
// serializer.write(object);
|
||||
// }
|
||||
// }
|
||||
//}
|
||||
|
||||
@@ -1,427 +1,427 @@
|
||||
package com.njcn.csharmonic.utils.report;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.util.*;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class WordUtil2 {
|
||||
|
||||
|
||||
private final ResourceLoader resourceLoader;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
|
||||
public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList, HttpServletResponse response)
|
||||
throws Exception {
|
||||
byte[] docBytes = null;
|
||||
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
InputStream is = null;
|
||||
CustomXWPFDocument doc = null;
|
||||
//读取报告模板
|
||||
try {
|
||||
Resource resource = resourceLoader.getResource("classpath:" + path);
|
||||
if (!resource.exists()) {
|
||||
throw new FileNotFoundException("模板文件未找到: " + path);
|
||||
}
|
||||
is = resource.getInputStream();
|
||||
doc = new CustomXWPFDocument(is);
|
||||
if(CollUtil.isNotEmpty(tableList)){
|
||||
this.replaceInTable(doc, params,tableList);
|
||||
}else{
|
||||
this.replaceInTable(doc, params);
|
||||
}
|
||||
// 替换表格里面的变量
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
} catch (IOException e) {
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != is) {
|
||||
is.close();
|
||||
}
|
||||
}
|
||||
try {
|
||||
ServletOutputStream outputStream = response.getOutputStream();
|
||||
response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
doc.write(outputStream);
|
||||
outputStream.close();
|
||||
} catch (Exception e) {
|
||||
getError("输出稳态报告异常,原因为:" + e);
|
||||
} finally {
|
||||
if (doc != null) {
|
||||
doc.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// 辅助方法:字节数组转十六进制(便于打印排查)
|
||||
private static String bytesToHex(byte[] bytes) {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (byte b : bytes) {
|
||||
sb.append(String.format("%02X ", b));
|
||||
}
|
||||
return sb.toString().trim();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public InputStream getReportFile(String path, Map<String, Object> params, List<List<String[]>> tableList)
|
||||
throws Exception {
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
InputStream inStream = null,in = null;
|
||||
CustomXWPFDocument doc = null;
|
||||
//读取报告模板
|
||||
try {
|
||||
inStream = new ClassPathResource(path).getInputStream();
|
||||
doc = new CustomXWPFDocument(inStream);
|
||||
this.replaceInTable(doc,params,tableList);
|
||||
this.replaceInPara(doc, params);
|
||||
} catch (IOException e) {
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
}
|
||||
}
|
||||
try {
|
||||
//临时缓冲区
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
doc.write(out);
|
||||
byte[] docByteAry = out.toByteArray();
|
||||
in = new ByteArrayInputStream(docByteAry);
|
||||
out.close();
|
||||
} catch (Exception e) {
|
||||
getError("输出稳态报告异常,原因为:" + e);
|
||||
} finally {
|
||||
if (doc != null) {
|
||||
doc.close();
|
||||
}
|
||||
}
|
||||
return in;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getReportFileUrl(String path,String fileName,List<List<String[]>> tableList, Map<String, Object> params)
|
||||
throws Exception {
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
InputStream inStream = null,in = null;
|
||||
CustomXWPFDocument doc = null;
|
||||
//读取报告模板
|
||||
try {
|
||||
inStream = new ClassPathResource(path).getInputStream();;
|
||||
doc = new CustomXWPFDocument(inStream);
|
||||
if(CollUtil.isNotEmpty(tableList)){
|
||||
this.replaceInTable(doc, params,tableList);
|
||||
}else{
|
||||
this.replaceInTable(doc, params);
|
||||
}
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
//临时缓冲区
|
||||
ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
doc.write(out);
|
||||
byte[] docByteAry = out.toByteArray();
|
||||
in = new ByteArrayInputStream(docByteAry);
|
||||
out.close();
|
||||
} catch (IOException e) {
|
||||
getError("获取报告模板异常,原因为:" + e);
|
||||
} finally {
|
||||
if (null != inStream) {
|
||||
inStream.close();
|
||||
}
|
||||
if (doc != null) {
|
||||
doc.close();
|
||||
}
|
||||
}
|
||||
//上传文件服务器
|
||||
return fileStorageUtil.uploadStreamSpecifyName(in, OssPath.ONLINE_REPORT, fileName);
|
||||
}
|
||||
|
||||
|
||||
private static void getError(String e) {
|
||||
log.error(e);
|
||||
}
|
||||
/**
|
||||
* 替换段落里面的变量
|
||||
*
|
||||
* @param doc 要替换的文档
|
||||
* @param params 参数
|
||||
*/
|
||||
private void replaceInPara(CustomXWPFDocument doc, Map<String, Object> params) {
|
||||
Iterator<XWPFParagraph> iterator = doc.getParagraphsIterator();
|
||||
List<XWPFParagraph> paragraphList = new ArrayList<>();
|
||||
XWPFParagraph para;
|
||||
while (iterator.hasNext()) {
|
||||
para = iterator.next();
|
||||
paragraphList.add(para);
|
||||
}
|
||||
processParagraphs(paragraphList, params, doc);
|
||||
}
|
||||
|
||||
private void replaceInTable(CustomXWPFDocument doc, Map<String, Object> params) {
|
||||
Iterator<XWPFTable> it = doc.getTablesIterator();
|
||||
while (it.hasNext()) {
|
||||
XWPFTable table = it.next();
|
||||
List<XWPFTableRow> rows = table.getRows();
|
||||
for (XWPFTableRow row : rows) {
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
for (XWPFTableCell cell : cells) {
|
||||
List<XWPFParagraph> paragraphListTable = cell.getParagraphs();
|
||||
processParagraphs(paragraphListTable, params, doc);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void processParagraphs(List<XWPFParagraph> paragraphList, Map<String, Object> param,
|
||||
CustomXWPFDocument doc) {
|
||||
if (paragraphList != null && paragraphList.size() > 0) {
|
||||
for (XWPFParagraph paragraph : paragraphList) {
|
||||
List<XWPFRun> runs = paragraph.getRuns();
|
||||
if (runs.size() > 0) {
|
||||
for (XWPFRun run : runs) {
|
||||
String bflag = "";
|
||||
String text = run.getText(0);
|
||||
if (text != null) {
|
||||
boolean isSetText = false;
|
||||
for (Entry<String, Object> entry : param.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (text.indexOf(key) != -1) {
|
||||
isSetText = true;
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {// 文本替换
|
||||
text = text.replace(key, value.toString());
|
||||
} else if (value instanceof Map) {// 图片替换
|
||||
text = text.replace(key, "");
|
||||
Map pic = (Map) value;
|
||||
int width = Integer.parseInt(pic.get("width").toString());
|
||||
int height = Integer.parseInt(pic.get("height").toString());
|
||||
int picType = getPictureType(pic.get("type").toString());
|
||||
byte[] byteArray = (byte[]) pic.get("content");
|
||||
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray);
|
||||
try {
|
||||
String s = doc.addPictureData(byteInputStream, picType);
|
||||
|
||||
doc.createPicture(doc.getAllPictures().size() - 1, width, height,
|
||||
s,paragraph);
|
||||
bflag = "break";
|
||||
} catch (Exception e) {
|
||||
getError("文本替换发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isSetText) {
|
||||
run.setText(text, 0);
|
||||
}
|
||||
}
|
||||
if (bflag == "break") {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换段落里面的变量
|
||||
*
|
||||
* @param para 要替换的段落
|
||||
* @param params 参数
|
||||
*/
|
||||
private void replaceInPara(XWPFParagraph para, Map<String, Object> params, CustomXWPFDocument doc) {
|
||||
List<XWPFRun> runs;
|
||||
Matcher matcher;
|
||||
// if (this.matcher(para.getParagraphText()).find()) {
|
||||
runs = para.getRuns();
|
||||
int start = -1;
|
||||
int end = -1;
|
||||
String str = "";
|
||||
for (int i = 0; i < runs.size(); i++) {
|
||||
XWPFRun run = runs.get(i);
|
||||
String runText = run.toString();
|
||||
if ('$' == runText.charAt(0) && '{' == runText.charAt(1)) {
|
||||
start = i;
|
||||
}
|
||||
if ((start != -1)) {
|
||||
str += runText;
|
||||
}
|
||||
if ('}' == runText.charAt(runText.length() - 1)) {
|
||||
if (start != -1) {
|
||||
end = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
for (int i = start; i <= end; i++) {
|
||||
para.removeRun(i);
|
||||
i--;
|
||||
end--;
|
||||
}
|
||||
|
||||
for (Entry<String, Object> entry : params.entrySet()) {
|
||||
String key = entry.getKey();
|
||||
if (str.indexOf(key) != -1) {
|
||||
Object value = entry.getValue();
|
||||
if (value instanceof String) {
|
||||
str = str.replace(key, value.toString());
|
||||
para.createRun().setText(str, 0);
|
||||
break;
|
||||
} else if (value instanceof Map) {
|
||||
str = str.replace(key, "");
|
||||
Map pic = (Map) value;
|
||||
int width = Integer.parseInt(pic.get("width").toString());
|
||||
int height = Integer.parseInt(pic.get("height").toString());
|
||||
int picType = getPictureType(pic.get("type").toString());
|
||||
byte[] byteArray = (byte[]) pic.get("content");
|
||||
ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray);
|
||||
try {
|
||||
// int ind = doc.addPicture(byteInputStream,picType);
|
||||
// doc.createPicture(ind, width , height,para);
|
||||
String s = doc.addPictureData(byteInputStream, picType);
|
||||
doc.createPicture(doc.getAllPictures().size() - 1, width, height,s, para);
|
||||
para.createRun().setText(str, 0);
|
||||
break;
|
||||
} catch (Exception e) {
|
||||
getError("文件替换发生异常,异常是" + e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
* 为表格插入数据,行数不够添加新行
|
||||
*
|
||||
* @param table 需要插入数据的表格
|
||||
* @param tableList 插入数据集合
|
||||
*/
|
||||
private static void insertTable(XWPFTable table, List<String[]> tableList) {
|
||||
//删除占位符行数
|
||||
table.removeRow(1);
|
||||
if (CollUtil.isNotEmpty(tableList)) {
|
||||
// 创建行,根据需要插入的数据添加新行,不处理表头
|
||||
for (int i = 0; i < tableList.size(); i++) {
|
||||
XWPFTableRow row = table.createRow();
|
||||
List<XWPFTableCell> cells = row.getTableCells();
|
||||
for (int j = 0; j < cells.size(); j++) {
|
||||
String s = tableList.get(i)[j];
|
||||
XWPFTableCell cell = cells.get(j);
|
||||
cell.removeParagraph(0);
|
||||
XWPFParagraph paragraph = cell.addParagraph();
|
||||
paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
// 在段落中添加文本
|
||||
XWPFRun run = paragraph.createRun();
|
||||
run.setText(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 替换表格里面的变量
|
||||
*
|
||||
* @param doc 要替换的文档
|
||||
* @param tableList 存放数据顺序要与表格一致
|
||||
* @param params 参数
|
||||
*/
|
||||
private void replaceInTable(CustomXWPFDocument doc, Map<String, Object> params, List<List<String[]>> tableList) {
|
||||
Iterator<XWPFTable> iterator = doc.getTablesIterator();
|
||||
XWPFTable table;
|
||||
List<XWPFTableRow> rows;
|
||||
List<XWPFTableCell> cells;
|
||||
List<XWPFParagraph> paras;
|
||||
Integer num=0;
|
||||
while (iterator.hasNext()) {
|
||||
table = iterator.next();
|
||||
if (table.getRows().size() > 1) {
|
||||
// 判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
|
||||
if (this.matcher(table.getText()).find()||this.matcherS(table.getText()).find()) {
|
||||
rows = table.getRows();
|
||||
for (XWPFTableRow row : rows) {
|
||||
cells = row.getTableCells();
|
||||
for (XWPFTableCell cell : cells) {
|
||||
List<XWPFParagraph> paragraphListTable = cell.getParagraphs();
|
||||
processParagraphs(paragraphListTable, params, doc);
|
||||
}
|
||||
}
|
||||
}else {
|
||||
if (CollUtil.isNotEmpty(tableList.get(num))){
|
||||
insertTable(table, tableList.get(num)); // 插入数据
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 正则匹配字符串
|
||||
*
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
private Matcher matcher(String str) {
|
||||
Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}", Pattern.CASE_INSENSITIVE);
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
return matcher;
|
||||
}
|
||||
private Matcher matcherS(String str) {
|
||||
Pattern pattern = Pattern.compile("\\$(.*?)\\$");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
return matcher;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据图片类型,取得对应的图片类型代码
|
||||
*
|
||||
* @param picType
|
||||
* @return int
|
||||
*/
|
||||
private static int getPictureType(String picType) {
|
||||
int res = CustomXWPFDocument.PICTURE_TYPE_PICT;
|
||||
if (picType != null) {
|
||||
if (picType.equalsIgnoreCase("image/png")) {
|
||||
res = CustomXWPFDocument.PICTURE_TYPE_PNG;
|
||||
} else if (picType.equalsIgnoreCase("image/dib")) {
|
||||
res = CustomXWPFDocument.PICTURE_TYPE_DIB;
|
||||
} else if (picType.equalsIgnoreCase("image/emf")) {
|
||||
res = CustomXWPFDocument.PICTURE_TYPE_EMF;
|
||||
} else if (picType.equalsIgnoreCase("image/jpg") || picType.equalsIgnoreCase("image/jpeg")) {
|
||||
res = CustomXWPFDocument.PICTURE_TYPE_JPEG;
|
||||
} else if (picType.equalsIgnoreCase("image/wmf")) {
|
||||
res = CustomXWPFDocument.PICTURE_TYPE_WMF;
|
||||
}
|
||||
}
|
||||
return res;
|
||||
}
|
||||
|
||||
}
|
||||
//package com.njcn.csharmonic.utils.report;
|
||||
//
|
||||
//import cn.hutool.core.collection.CollUtil;
|
||||
//import com.njcn.oss.constant.OssPath;
|
||||
//import com.njcn.oss.utils.FileStorageUtil;
|
||||
//import lombok.RequiredArgsConstructor;
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import org.apache.poi.xwpf.usermodel.*;
|
||||
//import org.apache.tomcat.util.http.fileupload.IOUtils;
|
||||
//import org.springframework.core.io.ClassPathResource;
|
||||
//import org.springframework.core.io.Resource;
|
||||
//import org.springframework.core.io.ResourceLoader;
|
||||
//import org.springframework.stereotype.Component;
|
||||
//import org.springframework.util.FileCopyUtils;
|
||||
//
|
||||
//import javax.servlet.ServletOutputStream;
|
||||
//import javax.servlet.http.HttpServletResponse;
|
||||
//import java.io.*;
|
||||
//import java.util.*;
|
||||
//import java.util.Map.Entry;
|
||||
//import java.util.regex.Matcher;
|
||||
//import java.util.regex.Pattern;
|
||||
//
|
||||
//@Slf4j
|
||||
//@Component
|
||||
//@RequiredArgsConstructor
|
||||
//public class WordUtil2 {
|
||||
//
|
||||
//
|
||||
// private final ResourceLoader resourceLoader;
|
||||
// private final FileStorageUtil fileStorageUtil;
|
||||
//
|
||||
//
|
||||
// public void getWord(String path, Map<String, Object> params, String fileName,List<List<String[]>> tableList, HttpServletResponse response)
|
||||
// throws Exception {
|
||||
// byte[] docBytes = null;
|
||||
//
|
||||
// path = ClearPathUtil.cleanString(path);
|
||||
// InputStream is = null;
|
||||
// CustomXWPFDocument doc = null;
|
||||
// //读取报告模板
|
||||
// try {
|
||||
// Resource resource = resourceLoader.getResource("classpath:" + path);
|
||||
// if (!resource.exists()) {
|
||||
// throw new FileNotFoundException("模板文件未找到: " + path);
|
||||
// }
|
||||
// is = resource.getInputStream();
|
||||
// doc = new CustomXWPFDocument(is);
|
||||
// if(CollUtil.isNotEmpty(tableList)){
|
||||
// this.replaceInTable(doc, params,tableList);
|
||||
// }else{
|
||||
// this.replaceInTable(doc, params);
|
||||
// }
|
||||
// // 替换表格里面的变量
|
||||
// this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
// } catch (IOException e) {
|
||||
// getError("获取报告模板异常,原因为:" + e);
|
||||
// } finally {
|
||||
// if (null != is) {
|
||||
// is.close();
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
// ServletOutputStream outputStream = response.getOutputStream();
|
||||
// response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName + "\"");
|
||||
// response.setContentType("application/octet-stream;charset=UTF-8");
|
||||
// doc.write(outputStream);
|
||||
// outputStream.close();
|
||||
// } catch (Exception e) {
|
||||
// getError("输出稳态报告异常,原因为:" + e);
|
||||
// } finally {
|
||||
// if (doc != null) {
|
||||
// doc.close();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// // 辅助方法:字节数组转十六进制(便于打印排查)
|
||||
// private static String bytesToHex(byte[] bytes) {
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (byte b : bytes) {
|
||||
// sb.append(String.format("%02X ", b));
|
||||
// }
|
||||
// return sb.toString().trim();
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// public InputStream getReportFile(String path, Map<String, Object> params, List<List<String[]>> tableList)
|
||||
// throws Exception {
|
||||
// path = ClearPathUtil.cleanString(path);
|
||||
// InputStream inStream = null,in = null;
|
||||
// CustomXWPFDocument doc = null;
|
||||
// //读取报告模板
|
||||
// try {
|
||||
// inStream = new ClassPathResource(path).getInputStream();
|
||||
// doc = new CustomXWPFDocument(inStream);
|
||||
// this.replaceInTable(doc,params,tableList);
|
||||
// this.replaceInPara(doc, params);
|
||||
// } catch (IOException e) {
|
||||
// getError("获取报告模板异常,原因为:" + e);
|
||||
// } finally {
|
||||
// if (null != inStream) {
|
||||
// inStream.close();
|
||||
// }
|
||||
// }
|
||||
// try {
|
||||
// //临时缓冲区
|
||||
// ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// doc.write(out);
|
||||
// byte[] docByteAry = out.toByteArray();
|
||||
// in = new ByteArrayInputStream(docByteAry);
|
||||
// out.close();
|
||||
// } catch (Exception e) {
|
||||
// getError("输出稳态报告异常,原因为:" + e);
|
||||
// } finally {
|
||||
// if (doc != null) {
|
||||
// doc.close();
|
||||
// }
|
||||
// }
|
||||
// return in;
|
||||
// }
|
||||
//
|
||||
//
|
||||
//
|
||||
// public String getReportFileUrl(String path,String fileName,List<List<String[]>> tableList, Map<String, Object> params)
|
||||
// throws Exception {
|
||||
// path = ClearPathUtil.cleanString(path);
|
||||
// InputStream inStream = null,in = null;
|
||||
// CustomXWPFDocument doc = null;
|
||||
// //读取报告模板
|
||||
// try {
|
||||
// inStream = new ClassPathResource(path).getInputStream();;
|
||||
// doc = new CustomXWPFDocument(inStream);
|
||||
// if(CollUtil.isNotEmpty(tableList)){
|
||||
// this.replaceInTable(doc, params,tableList);
|
||||
// }else{
|
||||
// this.replaceInTable(doc, params);
|
||||
// }
|
||||
// this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
// //临时缓冲区
|
||||
// ByteArrayOutputStream out = new ByteArrayOutputStream();
|
||||
// doc.write(out);
|
||||
// byte[] docByteAry = out.toByteArray();
|
||||
// in = new ByteArrayInputStream(docByteAry);
|
||||
// out.close();
|
||||
// } catch (IOException e) {
|
||||
// getError("获取报告模板异常,原因为:" + e);
|
||||
// } finally {
|
||||
// if (null != inStream) {
|
||||
// inStream.close();
|
||||
// }
|
||||
// if (doc != null) {
|
||||
// doc.close();
|
||||
// }
|
||||
// }
|
||||
// //上传文件服务器
|
||||
// return fileStorageUtil.uploadStreamSpecifyName(in, OssPath.ONLINE_REPORT, fileName);
|
||||
// }
|
||||
//
|
||||
//
|
||||
// private static void getError(String e) {
|
||||
// log.error(e);
|
||||
// }
|
||||
// /**
|
||||
// * 替换段落里面的变量
|
||||
// *
|
||||
// * @param doc 要替换的文档
|
||||
// * @param params 参数
|
||||
// */
|
||||
// private void replaceInPara(CustomXWPFDocument doc, Map<String, Object> params) {
|
||||
// Iterator<XWPFParagraph> iterator = doc.getParagraphsIterator();
|
||||
// List<XWPFParagraph> paragraphList = new ArrayList<>();
|
||||
// XWPFParagraph para;
|
||||
// while (iterator.hasNext()) {
|
||||
// para = iterator.next();
|
||||
// paragraphList.add(para);
|
||||
// }
|
||||
// processParagraphs(paragraphList, params, doc);
|
||||
// }
|
||||
//
|
||||
// private void replaceInTable(CustomXWPFDocument doc, Map<String, Object> params) {
|
||||
// Iterator<XWPFTable> it = doc.getTablesIterator();
|
||||
// while (it.hasNext()) {
|
||||
// XWPFTable table = it.next();
|
||||
// List<XWPFTableRow> rows = table.getRows();
|
||||
// for (XWPFTableRow row : rows) {
|
||||
// List<XWPFTableCell> cells = row.getTableCells();
|
||||
// for (XWPFTableCell cell : cells) {
|
||||
// List<XWPFParagraph> paragraphListTable = cell.getParagraphs();
|
||||
// processParagraphs(paragraphListTable, params, doc);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public static void processParagraphs(List<XWPFParagraph> paragraphList, Map<String, Object> param,
|
||||
// CustomXWPFDocument doc) {
|
||||
// if (paragraphList != null && paragraphList.size() > 0) {
|
||||
// for (XWPFParagraph paragraph : paragraphList) {
|
||||
// List<XWPFRun> runs = paragraph.getRuns();
|
||||
// if (runs.size() > 0) {
|
||||
// for (XWPFRun run : runs) {
|
||||
// String bflag = "";
|
||||
// String text = run.getText(0);
|
||||
// if (text != null) {
|
||||
// boolean isSetText = false;
|
||||
// for (Entry<String, Object> entry : param.entrySet()) {
|
||||
// String key = entry.getKey();
|
||||
// if (text.indexOf(key) != -1) {
|
||||
// isSetText = true;
|
||||
// Object value = entry.getValue();
|
||||
// if (value instanceof String) {// 文本替换
|
||||
// text = text.replace(key, value.toString());
|
||||
// } else if (value instanceof Map) {// 图片替换
|
||||
// text = text.replace(key, "");
|
||||
// Map pic = (Map) value;
|
||||
// int width = Integer.parseInt(pic.get("width").toString());
|
||||
// int height = Integer.parseInt(pic.get("height").toString());
|
||||
// int picType = getPictureType(pic.get("type").toString());
|
||||
// byte[] byteArray = (byte[]) pic.get("content");
|
||||
// ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray);
|
||||
// try {
|
||||
// String s = doc.addPictureData(byteInputStream, picType);
|
||||
//
|
||||
// doc.createPicture(doc.getAllPictures().size() - 1, width, height,
|
||||
// s,paragraph);
|
||||
// bflag = "break";
|
||||
// } catch (Exception e) {
|
||||
// getError("文本替换发生异常,异常是" + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// if (isSetText) {
|
||||
// run.setText(text, 0);
|
||||
// }
|
||||
// }
|
||||
// if (bflag == "break") {
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 替换段落里面的变量
|
||||
// *
|
||||
// * @param para 要替换的段落
|
||||
// * @param params 参数
|
||||
// */
|
||||
// private void replaceInPara(XWPFParagraph para, Map<String, Object> params, CustomXWPFDocument doc) {
|
||||
// List<XWPFRun> runs;
|
||||
// Matcher matcher;
|
||||
// // if (this.matcher(para.getParagraphText()).find()) {
|
||||
// runs = para.getRuns();
|
||||
// int start = -1;
|
||||
// int end = -1;
|
||||
// String str = "";
|
||||
// for (int i = 0; i < runs.size(); i++) {
|
||||
// XWPFRun run = runs.get(i);
|
||||
// String runText = run.toString();
|
||||
// if ('$' == runText.charAt(0) && '{' == runText.charAt(1)) {
|
||||
// start = i;
|
||||
// }
|
||||
// if ((start != -1)) {
|
||||
// str += runText;
|
||||
// }
|
||||
// if ('}' == runText.charAt(runText.length() - 1)) {
|
||||
// if (start != -1) {
|
||||
// end = i;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// for (int i = start; i <= end; i++) {
|
||||
// para.removeRun(i);
|
||||
// i--;
|
||||
// end--;
|
||||
// }
|
||||
//
|
||||
// for (Entry<String, Object> entry : params.entrySet()) {
|
||||
// String key = entry.getKey();
|
||||
// if (str.indexOf(key) != -1) {
|
||||
// Object value = entry.getValue();
|
||||
// if (value instanceof String) {
|
||||
// str = str.replace(key, value.toString());
|
||||
// para.createRun().setText(str, 0);
|
||||
// break;
|
||||
// } else if (value instanceof Map) {
|
||||
// str = str.replace(key, "");
|
||||
// Map pic = (Map) value;
|
||||
// int width = Integer.parseInt(pic.get("width").toString());
|
||||
// int height = Integer.parseInt(pic.get("height").toString());
|
||||
// int picType = getPictureType(pic.get("type").toString());
|
||||
// byte[] byteArray = (byte[]) pic.get("content");
|
||||
// ByteArrayInputStream byteInputStream = new ByteArrayInputStream(byteArray);
|
||||
// try {
|
||||
// // int ind = doc.addPicture(byteInputStream,picType);
|
||||
// // doc.createPicture(ind, width , height,para);
|
||||
// String s = doc.addPictureData(byteInputStream, picType);
|
||||
// doc.createPicture(doc.getAllPictures().size() - 1, width, height,s, para);
|
||||
// para.createRun().setText(str, 0);
|
||||
// break;
|
||||
// } catch (Exception e) {
|
||||
// getError("文件替换发生异常,异常是" + e.getMessage());
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// // }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 为表格插入数据,行数不够添加新行
|
||||
// *
|
||||
// * @param table 需要插入数据的表格
|
||||
// * @param tableList 插入数据集合
|
||||
// */
|
||||
// private static void insertTable(XWPFTable table, List<String[]> tableList) {
|
||||
// //删除占位符行数
|
||||
// table.removeRow(1);
|
||||
// if (CollUtil.isNotEmpty(tableList)) {
|
||||
// // 创建行,根据需要插入的数据添加新行,不处理表头
|
||||
// for (int i = 0; i < tableList.size(); i++) {
|
||||
// XWPFTableRow row = table.createRow();
|
||||
// List<XWPFTableCell> cells = row.getTableCells();
|
||||
// for (int j = 0; j < cells.size(); j++) {
|
||||
// String s = tableList.get(i)[j];
|
||||
// XWPFTableCell cell = cells.get(j);
|
||||
// cell.removeParagraph(0);
|
||||
// XWPFParagraph paragraph = cell.addParagraph();
|
||||
// paragraph.setAlignment(ParagraphAlignment.CENTER);
|
||||
// // 在段落中添加文本
|
||||
// XWPFRun run = paragraph.createRun();
|
||||
// run.setText(s);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 替换表格里面的变量
|
||||
// *
|
||||
// * @param doc 要替换的文档
|
||||
// * @param tableList 存放数据顺序要与表格一致
|
||||
// * @param params 参数
|
||||
// */
|
||||
// private void replaceInTable(CustomXWPFDocument doc, Map<String, Object> params, List<List<String[]>> tableList) {
|
||||
// Iterator<XWPFTable> iterator = doc.getTablesIterator();
|
||||
// XWPFTable table;
|
||||
// List<XWPFTableRow> rows;
|
||||
// List<XWPFTableCell> cells;
|
||||
// List<XWPFParagraph> paras;
|
||||
// Integer num=0;
|
||||
// while (iterator.hasNext()) {
|
||||
// table = iterator.next();
|
||||
// if (table.getRows().size() > 1) {
|
||||
// // 判断表格是需要替换还是需要插入,判断逻辑有$为替换,表格无$为插入
|
||||
// if (this.matcher(table.getText()).find()||this.matcherS(table.getText()).find()) {
|
||||
// rows = table.getRows();
|
||||
// for (XWPFTableRow row : rows) {
|
||||
// cells = row.getTableCells();
|
||||
// for (XWPFTableCell cell : cells) {
|
||||
// List<XWPFParagraph> paragraphListTable = cell.getParagraphs();
|
||||
// processParagraphs(paragraphListTable, params, doc);
|
||||
// }
|
||||
// }
|
||||
// }else {
|
||||
// if (CollUtil.isNotEmpty(tableList.get(num))){
|
||||
// insertTable(table, tableList.get(num)); // 插入数据
|
||||
// }
|
||||
// num++;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 正则匹配字符串
|
||||
// *
|
||||
// * @param str
|
||||
// * @return
|
||||
// */
|
||||
// private Matcher matcher(String str) {
|
||||
// Pattern pattern = Pattern.compile("\\$\\{(.+?)\\}", Pattern.CASE_INSENSITIVE);
|
||||
// Matcher matcher = pattern.matcher(str);
|
||||
// return matcher;
|
||||
// }
|
||||
// private Matcher matcherS(String str) {
|
||||
// Pattern pattern = Pattern.compile("\\$(.*?)\\$");
|
||||
// Matcher matcher = pattern.matcher(str);
|
||||
// return matcher;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 根据图片类型,取得对应的图片类型代码
|
||||
// *
|
||||
// * @param picType
|
||||
// * @return int
|
||||
// */
|
||||
// private static int getPictureType(String picType) {
|
||||
// int res = CustomXWPFDocument.PICTURE_TYPE_PICT;
|
||||
// if (picType != null) {
|
||||
// if (picType.equalsIgnoreCase("image/png")) {
|
||||
// res = CustomXWPFDocument.PICTURE_TYPE_PNG;
|
||||
// } else if (picType.equalsIgnoreCase("image/dib")) {
|
||||
// res = CustomXWPFDocument.PICTURE_TYPE_DIB;
|
||||
// } else if (picType.equalsIgnoreCase("image/emf")) {
|
||||
// res = CustomXWPFDocument.PICTURE_TYPE_EMF;
|
||||
// } else if (picType.equalsIgnoreCase("image/jpg") || picType.equalsIgnoreCase("image/jpeg")) {
|
||||
// res = CustomXWPFDocument.PICTURE_TYPE_JPEG;
|
||||
// } else if (picType.equalsIgnoreCase("image/wmf")) {
|
||||
// res = CustomXWPFDocument.PICTURE_TYPE_WMF;
|
||||
// }
|
||||
// }
|
||||
// return res;
|
||||
// }
|
||||
//
|
||||
//}
|
||||
|
||||
@@ -135,11 +135,39 @@
|
||||
<artifactId>message-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>harmonic-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>csHarmonicBoot</finalName>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
<nonFilteredFileExtensions>
|
||||
<nonFilteredFileExtension>docx</nonFilteredFileExtension>
|
||||
</nonFilteredFileExtensions>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
|
||||
@@ -22,10 +22,10 @@ import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
/**
|
||||
* (cs_configuration)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
* (cs_configuration)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csconfiguration")
|
||||
@@ -38,10 +38,10 @@ public class CsConfigurationController extends BaseController {
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增组态项目")
|
||||
@ApiImplicitParam(name = "csConfigurationParm", value = "新增组态项目参数", required = true)
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated CsConfigurationParm csConfigurationParm){
|
||||
public HttpResult<Boolean> add(@RequestBody @Validated CsConfigurationParm csConfigurationParm) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
|
||||
boolean save = csConfigurationService.add (csConfigurationParm);
|
||||
boolean save = csConfigurationService.add(csConfigurationParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, save, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -49,23 +49,22 @@ public class CsConfigurationController extends BaseController {
|
||||
@PostMapping("/audit")
|
||||
@ApiOperation("修改组态项目")
|
||||
@ApiImplicitParam(name = "auditParm", value = "修改组态项目参数", required = true)
|
||||
public HttpResult<Boolean> audit(@RequestBody @Validated CsConfigurationParm.CsConfigurationAuditParam auditParm){
|
||||
public HttpResult<Boolean> audit(@RequestBody @Validated CsConfigurationParm.CsConfigurationAuditParam auditParm) {
|
||||
String methodDescribe = getMethodDescribe("audit");
|
||||
|
||||
boolean save = csConfigurationService.audit (auditParm);
|
||||
boolean save = csConfigurationService.audit(auditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, save, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryPage")
|
||||
@ApiOperation("组态项目分页查询")
|
||||
@ApiImplicitParam(name = "csConfigurationQueryParam", value = "组态项目查询参数", required = true)
|
||||
public HttpResult<IPage<CsConfigurationVO>> queryPage(@RequestBody @Validated CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam ){
|
||||
public HttpResult<IPage<CsConfigurationVO>> queryPage(@RequestBody @Validated CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
|
||||
IPage<CsConfigurationVO> page = csConfigurationService.queryPage (csConfigurationQueryParam);
|
||||
IPage<CsConfigurationVO> page = csConfigurationService.queryPage(csConfigurationQueryParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -73,10 +72,10 @@ public class CsConfigurationController extends BaseController {
|
||||
@PostMapping("/uploadImage")
|
||||
@ApiOperation("上传底图")
|
||||
@ApiImplicitParam(name = "file", value = "底图文件", required = true)
|
||||
public HttpResult<MinIoUploadResDTO> uploadImage(@RequestParam("file") MultipartFile issuesFile){
|
||||
public HttpResult<MinIoUploadResDTO> uploadImage(@RequestParam("file") MultipartFile issuesFile) {
|
||||
String methodDescribe = getMethodDescribe("uploadImage");
|
||||
String filePath = csConfigurationService.uploadImage(issuesFile);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,new MinIoUploadResDTO(issuesFile.getOriginalFilename(),filePath), methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, new MinIoUploadResDTO(issuesFile.getOriginalFilename(), filePath), methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.extra.template.TemplateException;
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.csharmonic.pojo.param.eventReport.ExportParam;
|
||||
import com.njcn.csharmonic.service.event.EventMonitorReportService;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
import com.njcn.csharmonic.service.event.CsEventMonitorReportService;
|
||||
import com.njcn.event.common.pojo.dto.LineDetailDataCommDTO;
|
||||
import com.njcn.event.common.service.EventMonitorReportService;
|
||||
import com.njcn.event.pojo.param.ExportParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -32,16 +38,17 @@ import java.text.ParseException;
|
||||
@RestController
|
||||
@RequestMapping("/eventReport")
|
||||
@RequiredArgsConstructor
|
||||
public class EventMonitorReportController {
|
||||
public class CsEventMonitorReportController {
|
||||
|
||||
private final EventMonitorReportService eventMonitorReportService;
|
||||
private final CsEventMonitorReportService monitorEventReportService;
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLineExport")
|
||||
@ApiOperation("监测点报告导出")
|
||||
@ApiImplicitParam(name = "exportParam", value = "监测点报告导出参数", required = true)
|
||||
public void getLineExport(@RequestBody @Validated ExportParam exportParam, HttpServletResponse response) throws IOException, InvalidFormatException, TemplateException, ParseException {
|
||||
eventMonitorReportService.getLineExport(exportParam, response);
|
||||
monitorEventReportService.getLineExport(exportParam, response);
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,10 @@ 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.CsPageParm;
|
||||
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||
import com.njcn.csharmonic.pojo.vo.CsPageVO;
|
||||
import com.njcn.csharmonic.service.CsPagePOService;
|
||||
import com.njcn.csharmonic.service.CsPageUserService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -21,48 +23,68 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* (cs_page)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
* (cs_page)表控制层
|
||||
*
|
||||
* @author xxxxx
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/cspage")
|
||||
@Api(tags = "组态项目页面")
|
||||
@AllArgsConstructor
|
||||
public class CsPagePOController extends BaseController {
|
||||
public class CsPagePOController extends BaseController {
|
||||
private final CsPagePOService csPagePOService;
|
||||
|
||||
private final CsPageUserService csPageUserService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增组态页面")
|
||||
// @ApiImplicitParam(name = "csPageParm", value = "新增组态项目参数", required = true)
|
||||
public HttpResult<Boolean> add( @Validated CsPageParm csPageParm){
|
||||
public HttpResult<Boolean> add(@Validated CsPageParm csPageParm) {
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
|
||||
boolean flag = csPagePOService.add (csPageParm);
|
||||
boolean flag = csPagePOService.add(csPageParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/audit")
|
||||
@ApiOperation("修改组态页面")
|
||||
public HttpResult<Boolean> audit( @Validated CsPageParm.CsPageParmAuditParam auditParm){
|
||||
public HttpResult<Boolean> audit(@Validated CsPageParm.CsPageParmAuditParam auditParm) {
|
||||
String methodDescribe = getMethodDescribe("audit");
|
||||
|
||||
boolean save = csPagePOService.audit (auditParm);
|
||||
boolean save = csPagePOService.audit(auditParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, save, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryPage")
|
||||
@ApiOperation("组态页面分页查询")
|
||||
@ApiImplicitParam(name = "csPageParam", value = "组态项目查询参数", required = true)
|
||||
public HttpResult<IPage<CsPageVO>> queryPage(@RequestBody @Validated CsPageParm.CsPageParmQueryParam csPageParam ){
|
||||
public HttpResult<IPage<CsPageVO>> queryPage(@RequestBody @Validated CsPageParm.CsPageParmQueryParam csPageParam) {
|
||||
String methodDescribe = getMethodDescribe("queryPage");
|
||||
|
||||
IPage<CsPageVO> page = csPagePOService.queryPage (csPageParam);
|
||||
IPage<CsPageVO> page = csPagePOService.queryPage(csPageParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/savePageIdWithUser")
|
||||
@ApiOperation("保存组态界面与用户的关系")
|
||||
public HttpResult<Boolean> savePageIdWithUser(CsPageUser csPageUser) {
|
||||
String methodDescribe = getMethodDescribe("savePageIdWithUser");
|
||||
boolean flag = csPageUserService.savePageIdWithUser(csPageUser);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getByUserId")
|
||||
@ApiOperation("根据用户id获取组件信息")
|
||||
public HttpResult<CsPageUser> getByUserId(String userId) {
|
||||
String methodDescribe = getMethodDescribe("getByUserId");
|
||||
CsPageUser csPageUser = csPageUserService.getByUserId(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csPageUser, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,14 @@ 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.harmonic.common.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.harmonic.common.service.CustomReportTableService;
|
||||
import com.njcn.harmonic.pojo.param.ReportSearchParam;
|
||||
import com.njcn.harmonic.pojo.po.ExcelRptTemp;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -44,6 +45,8 @@ public class CustomReportController extends BaseController {
|
||||
private final CustomReportService customReportService;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 替换报表数据并返回
|
||||
* @author qijian
|
||||
@@ -100,7 +103,7 @@ public class CustomReportController extends BaseController {
|
||||
@GetMapping("/getTemplateByDept")
|
||||
@ApiOperation("根据部门查询模板")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam("id") String id){
|
||||
public HttpResult<List<ReportTemplateVO>> getTemplateByDept(@RequestParam(value = "id",required = false) String id){
|
||||
String methodDescribe = getMethodDescribe("getTemplateList");
|
||||
List<ReportTemplateVO> list = customReportService.getTemplateByDept(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
@@ -21,7 +20,6 @@ import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -92,13 +90,7 @@ public class EventOverviewController extends BaseController {
|
||||
@ApiOperation("获取暂降方向统计数据")
|
||||
public HttpResult<List<Map<String,Object>>> getEventDirectionData(@RequestBody EventStatisticParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("getEventDirectionData");
|
||||
Map<String,Object> load = new HashMap<>();
|
||||
load.put("source", "load");
|
||||
load.put("times", 41);
|
||||
Map<String,Object> grid = new HashMap<>();
|
||||
grid.put("source", "grid");
|
||||
grid.put("times", 4);
|
||||
List<Map<String,Object>> list = CollUtil.newArrayList(load, grid);
|
||||
List<Map<String,Object>> list = eventOverviewService.getEventDirectionData(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,list,methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -6,13 +6,13 @@ 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.CldWarnParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.csharmonic.service.CsEventUserPOService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -82,7 +82,7 @@ public class EventUserController extends BaseController {
|
||||
@PostMapping("/frontWarnInfo")
|
||||
@ApiOperation("前置告警信息")
|
||||
@ApiImplicitParam(name = "baseParam", value = "基础查询数据", required = true)
|
||||
public HttpResult<Page<CsEventPO>> frontWarnInfo(@RequestBody BaseParam baseParam) {
|
||||
public HttpResult<Page<CsEventPO>> frontWarnInfo(@RequestBody CldWarnParam baseParam) {
|
||||
String methodDescribe = getMethodDescribe("frontWarnInfo");
|
||||
Page<CsEventPO> list = csEventUserPOService.getFrontWarnInfo(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
|
||||
@@ -13,10 +13,7 @@ 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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csharmonic.pojo.param.PqSensitiveUserParam;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.csharmonic.pojo.vo.PqSensitiveUserVo;
|
||||
@@ -24,7 +26,10 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -42,6 +47,7 @@ import java.util.List;
|
||||
public class PqSensitiveUserController extends BaseController {
|
||||
|
||||
private final IPqSensitiveUserService pqSensitiveUserService;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getList")
|
||||
@@ -59,11 +65,26 @@ public class PqSensitiveUserController extends BaseController {
|
||||
@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)
|
||||
List<PqSensitiveUser> list;
|
||||
//获取用户监测点
|
||||
List<String> keywordsLineIds = new ArrayList<>();
|
||||
List<CsLinePO> poList = csLineFeignClient.getSimpleLine().getData();
|
||||
if (CollUtil.isNotEmpty(poList)) {
|
||||
keywordsLineIds = poList.stream().map(CsLinePO::getMonitorUser).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
}
|
||||
if (CollUtil.isEmpty(keywordsLineIds)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
keywordsLineIds = ids;
|
||||
}
|
||||
}
|
||||
list = pqSensitiveUserService.list(
|
||||
new LambdaQueryWrapper<PqSensitiveUser>().in(PqSensitiveUser::getId, keywordsLineIds)
|
||||
);
|
||||
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -112,7 +112,6 @@ public class RStatLimitRateDController extends BaseController {
|
||||
public HttpResult<TotalLimitTotalStatisticsVO> totalLimitTotalStatisticsData(@RequestBody TotalLimitStatisticsParam mainLineQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("totalLimitStatisticsList");
|
||||
TotalLimitTotalStatisticsVO data = limitRateDService.totalLimitTotalStatisticsData(mainLineQueryParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, data, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -122,7 +121,6 @@ public class RStatLimitRateDController extends BaseController {
|
||||
public HttpResult<List<TotalLimitStatisticsVO>> totalLimitStatisticsList(@RequestBody TotalLimitStatisticsParam mainLineQueryParam) {
|
||||
String methodDescribe = getMethodDescribe("totalLimitStatisticsList");
|
||||
List<TotalLimitStatisticsVO> list = limitRateDService.totalLimitStatisticsList(mainLineQueryParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
|
||||
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.harmonic.common.service.ISysExcelService;
|
||||
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
|
||||
import com.njcn.harmonic.pojo.po.excel.SysExcel;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/sysExcel")
|
||||
@Api(tags = "模板类型配置")
|
||||
@AllArgsConstructor
|
||||
public class SysExcelController extends BaseController {
|
||||
|
||||
private final ISysExcelService sysExcelService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addSysExcel")
|
||||
@ApiOperation("新增")
|
||||
@ApiImplicitParam(name = "param", value = "设备数据趋势参数", required = true)
|
||||
public HttpResult<Boolean> addSysExcel(@RequestBody ExcelParam param) {
|
||||
String methodDescribe = getMethodDescribe("addSysExcel");
|
||||
Boolean result = sysExcelService.addSysExcel(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateSysExcel")
|
||||
@ApiOperation("修改")
|
||||
public HttpResult<Boolean> updateSysExcel(@RequestBody ExcelParam.UpdateExcelParam param) {
|
||||
String methodDescribe = getMethodDescribe("updateSysExcel");
|
||||
Boolean result = sysExcelService.updateSysExcel(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deleteSysExcel")
|
||||
@ApiOperation("删除")
|
||||
public HttpResult<Boolean> deleteSysExcel(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("deleteSysExcel");
|
||||
Boolean result = sysExcelService.deleteSysExcel(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/querySysExcel")
|
||||
@ApiOperation("查询")
|
||||
public HttpResult<List<SysExcel>> querySysExcel() {
|
||||
String methodDescribe = getMethodDescribe("querySysExcel");
|
||||
List<SysExcel> result = sysExcelService.querySysExcel();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.njcn.csharmonic.controller;
|
||||
|
||||
|
||||
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.service.ICsSysExcelRelationService;
|
||||
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
|
||||
import com.njcn.harmonic.pojo.param.excel.ExcelParam;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-01-27
|
||||
*/
|
||||
@RequestMapping("/sysExcelRelation")
|
||||
@Slf4j
|
||||
@RestController
|
||||
@Api(tags = "模板关系配置")
|
||||
@AllArgsConstructor
|
||||
public class SysExcelRelationController extends BaseController {
|
||||
|
||||
private final ICsSysExcelRelationService sysExcelService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryList")
|
||||
@ApiOperation("查询")
|
||||
public HttpResult<List<ReportTemplateVO>> queryList(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("queryList");
|
||||
List<ReportTemplateVO> result = sysExcelService.queryList(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/bandRelation")
|
||||
@ApiOperation("绑定关系")
|
||||
public HttpResult<Boolean> bandRelation(@RequestBody ExcelParam.ListExcelParam param) {
|
||||
String methodDescribe = getMethodDescribe("bandRelation");
|
||||
Boolean result = sysExcelService.bandRelation(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csharmonic.handler;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||
@@ -16,8 +17,11 @@ import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.pojo.dto.RealTimeDataDTO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsRtDataVO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.csharmonic.service.CsEventPOService;
|
||||
import com.njcn.csharmonic.service.ILineTargetService;
|
||||
import com.njcn.csharmonic.service.StableDataService;
|
||||
import com.njcn.csharmonic.service.TemperatureService;
|
||||
@@ -34,12 +38,10 @@ import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -64,7 +66,7 @@ public class MqttMessageHandler {
|
||||
private final TemperatureService temperatureService;
|
||||
|
||||
private final DevCapacityFeignClient devCapacityFeignClient;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
private final ChannelObjectUtil channelObjectUtil;
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
private final CsTopicFeignClient csTopicFeignClient;
|
||||
@@ -72,26 +74,61 @@ public class MqttMessageHandler {
|
||||
private static Integer mid = 1;
|
||||
private final FileFeignClient fileFeignClient;
|
||||
|
||||
CsEventPOService csEventPOService;
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askRtData/{pageId}",qos = 1)
|
||||
@MqttSubscribe(value = "/zl/askRtData/{pageId}", qos = 1)
|
||||
public void responseRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||
List<CsRtDataVO> list = lineTargetService.getLineData(pageId);
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/rtData/"+pageId,gson.toJson(list),1,false);
|
||||
publisher.send("/zl/rtData/" + pageId, gson.toJson(list), 1, false);
|
||||
}
|
||||
|
||||
@MqttSubscribe(value = "/zl/askTemperData/{devId}",qos = 1)
|
||||
@MqttSubscribe(value = "/zl/askTemperData/{devId}", qos = 1)
|
||||
public void responseTemperData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
||||
List<StatisticalDataDTO> statisticalDataDTOS = temperatureService.queryTemperature(devId);
|
||||
statisticalDataDTOS.stream().forEach(temp->{
|
||||
statisticalDataDTOS.stream().forEach(temp -> {
|
||||
temp.setClDid(getCldidName(temp.getClDid()));
|
||||
});
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/TemperData/"+devId,gson.toJson(statisticalDataDTOS),1,false);
|
||||
publisher.send("/zl/TemperData/" + devId, gson.toJson(statisticalDataDTOS), 1, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 物联平台的组态实时数据调试
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askCSConfigRtData/{pageId}", qos = 1)
|
||||
public void responseCSConfigRtData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||
List<String> lineIdList = Arrays.stream(payload.substring(1, payload.length() - 1).split(","))
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toList());
|
||||
List<CsRtDataVO> lineData = lineTargetService.getLineDataNew(pageId);
|
||||
List<CsRtDataVO> collect = lineData.stream().filter(temp -> (!CollectionUtils.isEmpty(lineIdList)) && lineIdList.contains(temp.getLineId())).collect(Collectors.toList());
|
||||
RealTimeDataDTO recallReplyDTO = new RealTimeDataDTO();
|
||||
recallReplyDTO.setCode(200);
|
||||
recallReplyDTO.setMessage(JSONObject.toJSONString(collect));
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/csConfigRtData/" + pageId, gson.toJson(recallReplyDTO), 1, false);
|
||||
}
|
||||
|
||||
@MqttSubscribe(value = "/zl/askCSConfigWarnData/{pageId}", qos = 1)
|
||||
public void responseCSConfigWarnData(String topic, @NamedValue("pageId") String pageId, MqttMessage message, @Payload String payload) {
|
||||
List<String> lineIdList = Arrays.stream(payload.substring(1, payload.length() - 1).split(","))
|
||||
.map(String::trim)
|
||||
.collect(Collectors.toList());
|
||||
// 目前暂且查最近的60条记录
|
||||
List<CsWarnDescVO> csWarnDescVOList = csEventPOService.getEventDesc(lineIdList);
|
||||
RealTimeDataDTO recallReplyDTO = new RealTimeDataDTO();
|
||||
recallReplyDTO.setCode(200);
|
||||
recallReplyDTO.setMessage(JSONObject.toJSONString(csWarnDescVOList));
|
||||
Gson gson = new Gson();
|
||||
publisher.send("/zl/TemperData/" + pageId, gson.toJson(recallReplyDTO), 1, false);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@@ -195,20 +232,21 @@ public class MqttMessageHandler {
|
||||
// }
|
||||
// publisher.send("/zl/devData/"+devId,topoDataJson,1,false);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askDevData/{devId}/{typeId}",qos = 1)
|
||||
public void responseTopoDataByType(String topic, @NamedValue("devId") String devId,@NamedValue("typeId") String typeId, MqttMessage message, @Payload String payload) {
|
||||
String topoDataJson =redisUtil.getStringByKey (devId+"#"+typeId);
|
||||
if(StringUtils.isEmpty(topoDataJson)){
|
||||
@MqttSubscribe(value = "/zl/askDevData/{devId}/{typeId}", qos = 1)
|
||||
public void responseTopoDataByType(String topic, @NamedValue("devId") String devId, @NamedValue("typeId") String typeId, MqttMessage message, @Payload String payload) {
|
||||
String topoDataJson = redisUtil.getStringByKey(devId + "#" + typeId);
|
||||
if (StringUtils.isEmpty(topoDataJson)) {
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
List<ThdDataVO> tempList = new ArrayList<>();
|
||||
|
||||
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(typeId).getData();
|
||||
data.forEach(temp->{
|
||||
if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
data.forEach(temp -> {
|
||||
if (Objects.nonNull(temp.getHarmStart()) && Objects.nonNull(temp.getHarmEnd())) {
|
||||
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||
frequencyStatisticalQueryParam.setDevId(devId);
|
||||
frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
@@ -218,12 +256,12 @@ public class MqttMessageHandler {
|
||||
List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
|
||||
tempList.addAll(thdDataVOList);
|
||||
|
||||
}else {
|
||||
} else {
|
||||
CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
commonStatisticalQueryParam.setDevId(devId);
|
||||
commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
commonStatisticalQueryParam.setValueType("avg");
|
||||
List<ThdDataVO> listFuture= stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
List<ThdDataVO> listFuture = stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
tempList.addAll(listFuture);
|
||||
}
|
||||
|
||||
@@ -231,23 +269,23 @@ public class MqttMessageHandler {
|
||||
|
||||
//过滤M相
|
||||
List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
m.stream().forEach(temp->{
|
||||
Stream.of("A","B","C").forEach(phase->{
|
||||
m.stream().forEach(temp -> {
|
||||
Stream.of("A", "B", "C").forEach(phase -> {
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(temp,thdDataVO);
|
||||
BeanUtils.copyProperties(temp, thdDataVO);
|
||||
thdDataVO.setPhase(phase);
|
||||
result.add(thdDataVO);
|
||||
});
|
||||
});
|
||||
//如果是基础数据则添加拓扑图的数据
|
||||
if(Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415",typeId)){
|
||||
if (Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415", typeId)) {
|
||||
List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect3.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
collect3.forEach((k, v) -> {
|
||||
if (!CollectionUtil.isEmpty(v)) {
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
@@ -255,11 +293,11 @@ public class MqttMessageHandler {
|
||||
});
|
||||
List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect2.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
collect2.forEach((k, v) -> {
|
||||
if (!CollectionUtil.isEmpty(v)) {
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
@@ -267,11 +305,11 @@ public class MqttMessageHandler {
|
||||
});
|
||||
List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect4.forEach((k,v)->{
|
||||
if(!CollectionUtil.isEmpty(v)){
|
||||
collect4.forEach((k, v) -> {
|
||||
if (!CollectionUtil.isEmpty(v)) {
|
||||
double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
BeanUtils.copyProperties(v.get(0), thdDataVO);
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
thdDataVO.setPhase("avg");
|
||||
result.add(thdDataVO);
|
||||
@@ -279,16 +317,16 @@ public class MqttMessageHandler {
|
||||
}
|
||||
});
|
||||
Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
|
||||
apfRmsI.forEach(temp->{
|
||||
apfRmsI.forEach(temp -> {
|
||||
ThdDataVO thdDataVO = new ThdDataVO();
|
||||
BeanUtils.copyProperties(temp,thdDataVO);
|
||||
BeanUtils.copyProperties(temp, thdDataVO);
|
||||
thdDataVO.setUnit("%");
|
||||
thdDataVO.setStatisticalName("load_Rate");
|
||||
thdDataVO.setAnotherName("负载率");
|
||||
if (capacity<=0){
|
||||
if (capacity <= 0) {
|
||||
thdDataVO.setStatisticalData(3.1415926);
|
||||
}else {
|
||||
double v = temp.getStatisticalData()*100 / capacity;
|
||||
} else {
|
||||
double v = temp.getStatisticalData() * 100 / capacity;
|
||||
thdDataVO.setStatisticalData(Double.valueOf(df.format(v)));
|
||||
}
|
||||
result.add(thdDataVO);
|
||||
@@ -299,14 +337,13 @@ public class MqttMessageHandler {
|
||||
result.addAll(notM);
|
||||
Gson gson = new Gson();
|
||||
topoDataJson = gson.toJson(result);
|
||||
redisUtil.saveByKeyWithExpire(devId+"#"+typeId, (Object) topoDataJson, 30L);
|
||||
redisUtil.saveByKeyWithExpire(devId + "#" + typeId, (Object) topoDataJson, 30L);
|
||||
}
|
||||
publisher.send("/zl/devData/"+devId+"/"+typeId,topoDataJson,1,false);
|
||||
publisher.send("/zl/devData/" + devId + "/" + typeId, topoDataJson, 1, false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public String getCldidName( String cldid) {
|
||||
public String getCldidName(String cldid) {
|
||||
|
||||
switch (cldid) {
|
||||
case "0":
|
||||
@@ -361,7 +398,7 @@ public class MqttMessageHandler {
|
||||
/**
|
||||
* 处理补召数据
|
||||
*/
|
||||
@MqttSubscribe(value = "/makeUpData/{nDid}/{lineId}",qos = 1)
|
||||
@MqttSubscribe(value = "/makeUpData/{nDid}/{lineId}", qos = 1)
|
||||
public void responseRtData(String topic, @NamedValue("nDid") String nDid, @NamedValue("lineId") String lineId, MqttMessage message, @Payload String payload) {
|
||||
//下载文件
|
||||
fileFeignClient.downloadMakeUpFile(nDid);
|
||||
|
||||
@@ -16,5 +16,5 @@ import java.util.List;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsConfigurationMapper extends BaseMapper<CsConfigurationPO> {
|
||||
Page<CsConfigurationPO> queryPage(Page<CsConfigurationPO> temppage, @Param("temp") CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam, @Param("list") List<String> list);
|
||||
Page<CsConfigurationPO> queryPage(Page<CsConfigurationPO> temppage, @Param("temp") CsConfigurationParm.CsConfigurationQueryParam csConfigurationQueryParam, @Param("list") List<String> list, @Param("userId") String userId);
|
||||
}
|
||||
@@ -2,6 +2,10 @@ package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsWarnDescVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,4 +16,5 @@ import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsEventPOMapper extends BaseMapper<CsEventPO> {
|
||||
List<CsWarnDescVO> getEventDesc(@Param("lineIdList")List<String> lineIdList, @Param("count")int count);
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csharmonic.pojo.po.CsPageUser;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据集表 Mapper 接口
|
||||
* </p>
|
||||
*/
|
||||
public interface CsPageUserMapper extends BaseMapper<CsPageUser> {
|
||||
|
||||
}
|
||||
@@ -1,36 +0,0 @@
|
||||
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,18 @@
|
||||
//package com.njcn.csharmonic.mapper;
|
||||
//
|
||||
//import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
//import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
//import com.njcn.csharmonic.pojo.po.RmpEventDetailPO;
|
||||
//import org.apache.ibatis.annotations.Mapper;
|
||||
//
|
||||
///**
|
||||
// * 暂态事件明细
|
||||
// *
|
||||
// * @author yzh
|
||||
// * @date 2022/10/12
|
||||
// */
|
||||
//@Mapper
|
||||
//@DS("sjzx")
|
||||
//public interface RmpEventDetailMapper extends BaseMapper<RmpEventDetailPO> {
|
||||
//
|
||||
//}
|
||||
@@ -7,14 +7,15 @@
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="name" jdbcType="VARCHAR" property="name" />
|
||||
<result column="status" jdbcType="INTEGER" property="status" />
|
||||
<result column="scope" jdbcType="INTEGER" property="scope" />
|
||||
<result column="create_by" jdbcType="VARCHAR" property="createBy" />
|
||||
<result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
|
||||
<result column="update_by" jdbcType="VARCHAR" property="updateBy" />
|
||||
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, `status`, create_by, create_time, update_by, update_time
|
||||
<!--@mbg.generated-->
|
||||
id, `name`, `status`, `scope`,create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
<select id="queryPage" resultMap="BaseResultMap">
|
||||
@@ -24,6 +25,14 @@
|
||||
<foreach collection="list" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
<choose>
|
||||
<when test="userId != null and userId != ''">
|
||||
AND (a.scope = 1 OR (a.scope = 0 AND a.create_by = #{userId}))
|
||||
</when>
|
||||
<otherwise>
|
||||
AND (a.scope = 1 OR a.scope = 0)
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||
AND a.name like concat(concat("%",#{temp.searchValue}),"%")
|
||||
</if>
|
||||
|
||||
@@ -15,4 +15,31 @@
|
||||
<!--@mbg.generated-->
|
||||
id, line_id, device_id, start_time, tag, wave_id
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getEventDesc" resultType="com.njcn.csharmonic.pojo.vo.CsWarnDescVO">
|
||||
SELECT
|
||||
t1.line_id id,
|
||||
t2.NAME,
|
||||
CONCAT(
|
||||
DATE_FORMAT( t1.start_time, '%Y-%m-%d %H:%i:%s' ),
|
||||
'.',
|
||||
LPAD( FLOOR( MICROSECOND( t1.start_time ) / 1000 ), 3, '0' )
|
||||
) AS timeId,
|
||||
t1.amplitude,
|
||||
t1.persist_time
|
||||
FROM
|
||||
cs_event t1,
|
||||
cs_line t2
|
||||
WHERE
|
||||
t1.line_id = t2.line_id
|
||||
and t1.line_id in
|
||||
<foreach collection="lineIdList" item="lineId" separator="," open="(" close=")">
|
||||
#{lineId}
|
||||
</foreach>
|
||||
and t1.type = 0
|
||||
order by t1.start_time DESC
|
||||
LIMIT 60
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -107,7 +107,10 @@
|
||||
AND b.type =#{ csEventUserQueryPage.type}
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||
AND b.level =#{ csEventUserQueryPage.level}
|
||||
AND b.level IN
|
||||
<foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">
|
||||
#{level}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.status != null and csEventUserQueryPage.status !=''">
|
||||
AND a.status =#{ csEventUserQueryPage.status}
|
||||
@@ -157,9 +160,11 @@
|
||||
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||
AND b.level = #{ csEventUserQueryPage.level}
|
||||
AND b.level IN
|
||||
<foreach collection="csEventUserQueryPage.level.split(',')" item="level" open="(" separator="," close=")">
|
||||
#{level}
|
||||
</foreach>
|
||||
</if>
|
||||
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.eventType != null and csEventUserQueryPage.eventType !=''">
|
||||
AND b.tag = #{csEventUserQueryPage.eventType}
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?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.CsPageUserMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -1,57 +0,0 @@
|
||||
<?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>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user