29 Commits

Author SHA1 Message Date
295fddb935 冀北污染值算法上传 2025-03-12 13:41:15 +08:00
hzj
7f6aa6f683 暂态严重度计算 2025-03-12 11:39:08 +08:00
hzj
21035dc71b 分批次插入 2025-03-12 11:31:05 +08:00
wr
e2bbfb5e08 微调 2025-03-11 19:10:43 +08:00
hzj
dddce82829 更新设备状态 2025-03-11 16:48:06 +08:00
hzj
fa90fd7aaa 暂态事件辽宁暂降幅值百分比转换 2025-03-11 13:58:39 +08:00
hzj
5f2bb475cb 暂态事件辽宁文件后缀适配大小写 2025-03-11 10:04:38 +08:00
hzj
64cf03d01c 暂态事件辽宁 2025-03-10 20:49:10 +08:00
hzj
9a8742b02c 修改bug 2025-03-10 11:10:23 +08:00
hzj
f2e50dd100 修改bug 2025-03-10 10:40:47 +08:00
cdf
228a8558ac 1.验收问题修改 2025-03-10 09:15:29 +08:00
hzj
14707fe3e9 修改bug 2025-03-08 10:43:38 +08:00
hzj
b5ee0a5182 修改bug 2025-03-08 10:31:57 +08:00
hzj
a5a1f58d30 修改bug 2025-03-08 09:54:08 +08:00
hzj
400b8cde31 修改bug 2025-03-07 15:55:55 +08:00
hzj
7220c526ce CVT功能 2025-03-07 14:29:19 +08:00
cdf
d14e83c935 1.终端模块代码调整 2025-03-06 14:55:36 +08:00
wr
0b930f1adf Merge remote-tracking branch 'origin/master' 2025-03-06 10:06:54 +08:00
wr
848bb5f6b0 微调 2025-03-06 10:05:25 +08:00
hzj
601ae475e0 调整校验 2025-03-06 09:02:12 +08:00
hzj
dd2f738c00 调整校验 2025-03-05 09:17:05 +08:00
hzj
bc3702b1f1 辽宁前置代码 2025-03-03 11:15:16 +08:00
hzj
014afd0a2a Merge remote-tracking branch 'origin/master' 2025-03-03 09:54:38 +08:00
hzj
f7c0045cf4 cvt功能开发 2025-03-03 09:54:15 +08:00
xy
9a65c1b133 sql更新 2025-02-26 11:17:01 +08:00
hzj
9da41273e5 cvt功能开发 2025-02-21 09:37:18 +08:00
hzj
e2ecf7bb04 修改算法 2025-02-17 11:25:11 +08:00
4d0490994a 告警监测点算法调整 2025-02-13 10:45:43 +08:00
e94beddcff 告警监测点算法调整 2025-02-13 10:08:54 +08:00
103 changed files with 3856 additions and 134 deletions

View File

@@ -21,7 +21,7 @@ public class GenerateCode {
private static final String TARGET_DIR = "D://code"; private static final String TARGET_DIR = "D://code";
private static final String DB_URL = "jdbc:mysql://192.168.1.24:13306/pqsinfo_zl"; private static final String DB_URL = "jdbc:mysql://192.168.1.24:13306/pqs9100";
// private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase"; // private static final String DB_URL = "jdbc:oracle:thin:@192.168.1.170:1521:pqsbase";
private static final String USERNAME = "root"; private static final String USERNAME = "root";
@@ -30,9 +30,9 @@ public class GenerateCode {
public static void main(String[] args) { public static void main(String[] args) {
List<Module> modules = Stream.of( List<Module> modules = Stream.of(
new Module("xy", "com.njcn.supervision", "survey", Stream.of( new Module("hongawen", "com.njcn.gather", "", Stream.of(
"app_version" "pq_dev_type"
).collect(Collectors.toList()), "supervision_") ).collect(Collectors.toList()), "pq_")
).collect(Collectors.toList()); ).collect(Collectors.toList());
generateJavaFile(modules); generateJavaFile(modules);
} }

View File

@@ -1,9 +1,5 @@
package com.njcn.common.utils; package com.njcn.common.utils;
import org.springframework.stereotype.Component;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
import javax.validation.constraints.Max; import javax.validation.constraints.Max;
import javax.validation.constraints.Min; import javax.validation.constraints.Min;
import java.util.ArrayList; import java.util.ArrayList;

View File

@@ -7,6 +7,7 @@ import com.njcn.echarts.json.LineGenerator;
import com.njcn.echarts.json.PieGenerator; import com.njcn.echarts.json.PieGenerator;
import com.njcn.web.utils.RestTemplateUtil; import com.njcn.web.utils.RestTemplateUtil;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
@@ -23,7 +24,8 @@ import java.util.*;
public class DrawPicUtil { public class DrawPicUtil {
//目前写死,后续作为配置 //目前写死,后续作为配置
private final String URL = "http://192.168.1.24:5174/picture"; @Value("${DrawPicUtil.URL:http://192.168.1.24:5174/picture}")
private String URL;
/** /**

View File

@@ -0,0 +1,30 @@
spring:
#nacos注册中心以及配置中心的指定
cloud:
nacos:
discovery:
ip: @service.server.url@
server-addr: @nacos.url@
namespace: @nacos.namespace@
config:
server-addr: @nacos.url@
namespace: @nacos.namespace@
file-extension: yaml
shared-configs:
- data-id: share-config.yaml
refresh: true
main:
allow-bean-definition-overriding: true
servlet:
multipart:
max-file-size: 100MB
max-request-size: 100MB
jackson:
time-zone: GMT+8

View File

@@ -6,6 +6,7 @@ import com.njcn.device.biz.commApi.fallback.CommLineClientFallbackFactory;
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO; import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO; import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
@@ -36,6 +37,14 @@ public interface CommLineClient {
@GetMapping("/getLineDetail") @GetMapping("/getLineDetail")
HttpResult<LineDTO> getLineDetail(@RequestParam("id") String id); HttpResult<LineDTO> getLineDetail(@RequestParam("id") String id);
/**
* 获取污区值监测点相关信息
*
* @author hongawen
*/
@GetMapping("/getPollutionLineInfo")
HttpResult<List<PollutionLineInfoDTO>> getPollutionLineInfo(@RequestParam("id") List<String> id);
/*** /***
* 批量获取监测点信息 * 批量获取监测点信息
* @author hongawen * @author hongawen

View File

@@ -7,6 +7,7 @@ import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO; import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO; import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.biz.utils.DeviceEnumUtil; import com.njcn.device.biz.utils.DeviceEnumUtil;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
@@ -39,6 +40,12 @@ public class CommLineClientFallbackFactory implements FallbackFactory<CommLineCl
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<List<PollutionLineInfoDTO>> getPollutionLineInfo(List<String> id) {
log.error("{}异常,降级处理,异常为:{}", "获取污区值监测点相关信息", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override @Override
public HttpResult<List<LineDTO>> getLineDetailBatch(List<String> ids) { public HttpResult<List<LineDTO>> getLineDetailBatch(List<String> ids) {
log.error("{}异常,降级处理,异常为:{}", "批量获取监测点信息", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "批量获取监测点信息", throwable.toString());

View File

@@ -0,0 +1,88 @@
package com.njcn.device.biz.pojo.dto;
import lombok.Data;
@Data
public class PollutionLineInfoDTO {
/**
* 供电公司名称
*/
private String gdName;
/**
* 所属变电站
*/
private String subStationName;
/**
* 终端名称
*/
private String devName;
/**
* 终端厂家
*/
private String manufacturer;
/**
* 终端型号
*/
private String devType;
/**
* 通讯状态
*/
private Integer comFlag;
/**
* 终端投运时间
*/
private String loginTime;
/**
* 位置,电网侧&非电网侧
*/
private String powerFlag;
/**
* 行业类型
*/
private String businessType;
/**
* 干扰源类型
*/
private String loadType;
/**
* 监测id
*/
private String lineId;
/**
* 监测对象
*/
private String objName;
/**
* 变电站
*/
private String powerSubstationName;
/**
* 电压等级
*/
private String lineVoltage;
/**
* 装置id
*/
private String deviceId;
/**
* 上送国网编号
*/
private String monitorId;
}

View File

@@ -32,6 +32,8 @@ public class TerminalQueryParam extends BaseParam {
@ApiModelProperty(value = "监测对象类型") @ApiModelProperty(value = "监测对象类型")
private String objType; private String objType;
private List<String> objTypeList;
@ApiModelProperty(value = "是否上送国网监测点") @ApiModelProperty(value = "是否上送国网监测点")
private Integer isUpToGrid; private Integer isUpToGrid;

View File

@@ -28,10 +28,19 @@ public class MonitorStatisticsController extends BaseController {
@PostMapping("/objType") @PostMapping("/objType")
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("国网上送接口") @ApiOperation("查询主网用户分类")
public HttpResult< List<List<String>>> objType(String deptId){ public HttpResult< List<List<String>>> objType(String deptId,Integer up){
String methodDescribe = getMethodDescribe("objType"); String methodDescribe = getMethodDescribe("objType");
List<List<String>> gwMonitorStatistics = monitorStatisticsService.getGwMonitorStatistics(deptId); List<List<String>> gwMonitorStatistics = monitorStatisticsService.getGwMonitorStatistics(deptId,up);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gwMonitorStatistics, methodDescribe);
}
@PostMapping("/objTypeStatis")
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("查询主网用户分类")
public HttpResult< List<List<String>>> objTypeStatis(String deptId){
String methodDescribe = getMethodDescribe("objTypeStatis");
List<List<String>> gwMonitorStatistics = monitorStatisticsService.objTypeStatistic(deptId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gwMonitorStatistics, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, gwMonitorStatistics, methodDescribe);
} }

View File

@@ -121,6 +121,22 @@ public class PmsMonitorController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
} }
/**
* 分页获取所有主网用户台账
* @author cdf
* @date 2022/11/25
*/
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/getAllMainUserPageList")
@ApiOperation("分页获取所有主网用户台账")
@ApiImplicitParam(name = "baseParam",required = true)
public HttpResult<Page<Monitor>> getAllMainUserPageList(@RequestBody TerminalQueryParam baseParam) {
String methodDescribe = getMethodDescribe("getAllMainUserPageList");
Page<Monitor> monitor= monitorService.getAllMainUserPageList(baseParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
}
/** /**
* 获取所有主网监测点 * 获取所有主网监测点
* @author cdf * @author cdf

View File

@@ -14,6 +14,7 @@ import com.njcn.common.utils.LogUtil;
import com.njcn.device.pms.annotation.TerminalOperationLogDesc; import com.njcn.device.pms.annotation.TerminalOperationLogDesc;
import com.njcn.device.pms.pojo.excel.PowerDistributionAreaExcel; import com.njcn.device.pms.pojo.excel.PowerDistributionAreaExcel;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pms.pojo.po.PowerDistributionarea; import com.njcn.device.pms.pojo.po.PowerDistributionarea;
import com.njcn.device.pms.pojo.vo.PVCapacity; import com.njcn.device.pms.pojo.vo.PVCapacity;
import com.njcn.device.pms.service.majornetwork.IPowerDistributionareaService; import com.njcn.device.pms.service.majornetwork.IPowerDistributionareaService;
@@ -58,7 +59,7 @@ public class PmsPowerDistributionareaController extends BaseController {
@PostMapping("getPowerDistributionAreaList") @PostMapping("getPowerDistributionAreaList")
@ApiOperation("分页查询台区所有信息") @ApiOperation("分页查询台区所有信息")
@ApiImplicitParam(name = "baseParam",value = "查询台区信息",required = true) @ApiImplicitParam(name = "baseParam",value = "查询台区信息",required = true)
public HttpResult<Page<PowerDistributionarea>> getList(@RequestBody @Validated BaseParam baseParam){ public HttpResult<Page<PowerDistributionarea>> getList(@RequestBody TaiZhangParam baseParam){
String methodDescribe = getMethodDescribe("getList"); String methodDescribe = getMethodDescribe("getList");
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, baseParam); LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, baseParam);
Page<PowerDistributionarea> res = iPowerDistributionareaService.getList(baseParam); Page<PowerDistributionarea> res = iPowerDistributionareaService.getList(baseParam);

View File

@@ -7,10 +7,10 @@
SELECT DISTINCT SELECT DISTINCT
monitor.Org_Id AS orgId, monitor.Org_Id AS orgId,
monitor.Org_Name AS orgName, monitor.Org_Name AS orgName,
monitor.Powerr_Id AS powerId, monitor.`Powerr_Id` AS powerId,
monitor.Powerr_Name AS powerName, monitor.`Powerr_Name` AS powerName,
monitor.id AS monitorId, monitor.id AS monitorId,
monitor.Name AS monitorName, monitor.`Name` AS monitorName,
monitor.Line_Id, monitor.Line_Id,
monitor.Line_Name, monitor.Line_Name,
pdm.Monitor_Sort AS monitorSort, pdm.Monitor_Sort AS monitorSort,
@@ -26,11 +26,11 @@
pdm.Update_By AS updateBy, pdm.Update_By AS updateBy,
pdm.Update_Time AS updateTime pdm.Update_Time AS updateTime
FROM FROM
(( (
SELECT SELECT
pm.id, pm.id,
pm.Name, pm.`Name`,
pm.Status, pm.`Status`,
pm.Org_Id, pm.Org_Id,
pm.Org_Name, pm.Org_Name,
pm.Powerr_Id, pm.Powerr_Id,
@@ -48,57 +48,11 @@
</if> </if>
</where> </where>
) UNION ALL ) AS monitor
/* (
SELECT
ppd.id,
ppd.Name,
ppd.Status,
ppd.Org_Id,
ppd.Org_Name,
ppd.Power_Station_Id,
ppd.Powerr_Name,
ppd.Line_Id,
ppd.Line_Name
FROM
pms_power_distributionarea AS ppd
) UNION ALL*/
(
SELECT
ppc.id,
ppc.Name,
ppc.Status,
ppc.Org_Id,
ppc.Org_Name,
ppc.Power_Station_Id,
ps.Power_Name,
ppc.Line_Id,
0
FROM
pms_power_client AS ppc
INNER JOIN pms_statation_stat ps ON ps.Power_Id = ppc.Power_Station_Id
AND ppc.Org_Id = ps.Org_Id
) UNION ALL
(
SELECT
ppgu.id,
ppgu.Name,
ppgu.Status,
ppgu.Org_Id,
ppgu.Org_Name,
ppgu.Power_Station_Id,
pss.Power_Name,
ppgu.Line_Id,
0
FROM
pms_power_generation_user AS ppgu
INNER JOIN pms_statation_stat AS pss ON pss.Power_Id = ppgu.Power_Station_Id
AND ppgu.Org_Id = pss.Org_Id
)) AS monitor
INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id
WHERE WHERE
monitor.Status = 1 monitor.`Status` = 1
AND pdm.Status = 1 AND pdm.`Status` = 1
AND monitor.Org_Id IN AND monitor.Org_Id IN
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=","> <foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
#{orgId} #{orgId}
@@ -131,9 +85,10 @@
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser} AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
</if> </if>
<if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''"> <if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''">
AND monitor.Name LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%') AND monitor.`Name` LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
</if> </if>
</select> </select>
<select id="getPwPhotovoltaicMonitorList" resultType="com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO"> <select id="getPwPhotovoltaicMonitorList" resultType="com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO">
SELECT DISTINCT SELECT DISTINCT
monitor.Org_Id AS orgId, monitor.Org_Id AS orgId,
@@ -176,27 +131,12 @@
</foreach> </foreach>
</if> </if>
</where> </where>
) /*UNION ALL
(
SELECT
ppd.id,
ppd.Name,
ppd.Status,
ppd.Org_Id,
ppd.Org_Name,
ppd.Power_Station_Id,
ppd.Powerr_Name,
ppd.Line_Id,
ppd.Line_Name
FROM
pms_power_distributionarea AS ppd
) )
) AS monitor*/ INNER JOIN pms_distribution_monitor AS pdm ON pm.id = pdm.Monitor_Id
INNER JOIN pms_distribution_monitor AS pdm ON monitor.id = pdm.Monitor_Id
WHERE WHERE
monitor.Status = 1 pm.Status = 1
AND pdm.Status = 1 AND pdm.Status = 1
AND monitor.Org_Id IN AND pm.Org_Id IN
<foreach collection="deptIdList" item="orgId" open="(" close=")" separator=","> <foreach collection="deptIdList" item="orgId" open="(" close=")" separator=",">
#{orgId} #{orgId}
</foreach> </foreach>
@@ -228,7 +168,7 @@
AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser} AND pdm.If_Power_User = #{pwPmsMonitorParam.ifPowerUser}
</if> </if>
<if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''"> <if test="pwPmsMonitorParam.monitorName !=null and pwPmsMonitorParam.monitorName != ''">
AND monitor.Name LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%') AND pm.Name LIKE CONCAT('%',#{pwPmsMonitorParam.monitorName},'%')
</if> </if>
</select> </select>

View File

@@ -1,16 +1,14 @@
package com.njcn.device.pms.mapper.majornetwork; package com.njcn.device.pms.mapper.majornetwork;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.dto.SimpleDTO; import com.njcn.common.pojo.dto.SimpleDTO;
import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO; import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO; import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
import com.njcn.device.pms.pojo.param.PmsDeviceInfoParam; import com.njcn.device.pms.pojo.param.*;
import com.njcn.device.pms.pojo.param.PmsMonitorInfoParam;
import com.njcn.device.pms.pojo.param.PmsMonitorParam;
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
import com.njcn.device.pms.pojo.po.Monitor; import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pms.pojo.vo.MonitorVO; import com.njcn.device.pms.pojo.vo.MonitorVO;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
@@ -108,4 +106,13 @@ public interface MonitorMapper extends BaseMapper<Monitor> {
List<Monitor> selectMonitorAndNewEnergy(@Param("orgIds")List<String> orgIds, List<Monitor> selectMonitorAndNewEnergy(@Param("orgIds")List<String> orgIds,
@Param("objIds")List<String> objIds); @Param("objIds")List<String> objIds);
/**
* 分页获取用户对象
*/
Page<Monitor> getAllObjUser(@Param("page") Page<Monitor> page, @Param("baseParam")TerminalQueryParam baseParam);
List<Monitor> getAllObjUser(@Param("baseParam")TerminalQueryParam baseParam);
} }

View File

@@ -259,4 +259,42 @@
</where> </where>
</select> </select>
<select id="getAllObjUser" resultType="com.njcn.device.pms.pojo.po.Monitor">
SELECT
monitor.Id,
monitor.NAME,
monitor.Org_Id,
monitor.Org_Name,
monitor.Operation_Name,
monitor.Powerr_Name,
monitor.Line_Name,
monitor.Voltage_Level,
monitor.Monitor_Tag,
monitor.Obj_Type,
monitor.Monitor_Object_Name,
monitor.trade_Code,
monitor.Is_Special_Supply_Electricity
FROM
pms_monitor monitor
INNER JOIN
(
SELECT max( id ) id, Monitor_Object_Name
FROM pms_monitor
where Monitor_Object_Name is not null
and Status = 1
<if test="baseParam.monitorTag!=null and baseParam.monitorTag!=''">
and monitor.Monitor_Tag = #{baseParam.monitorTag}
</if>
<if test="baseParam.objTypeList !=null and baseParam.objTypeList.size() != 0">
and monitor.Obj_Type in
<foreach collection="baseParam.objTypeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
GROUP BY Monitor_Object_Name
) t ON monitor.id = t.id
</select>
</mapper> </mapper>

View File

@@ -19,7 +19,15 @@ public interface MonitorStatisticsService {
* @Author: wr * @Author: wr
* @Date: 2024/3/22 9:49 * @Date: 2024/3/22 9:49
*/ */
List<List<String>> getGwMonitorStatistics(String deptId); List<List<String>> getGwMonitorStatistics(String deptId,Integer up);
/**
* @Description: 国网上送统计类型数量统计
* @Author: wr
* @Date: 2024/3/22 9:49
*/
List<List<String>> objTypeStatistic(String deptId);
/** /**
* @Description: 国网上送新能源场站统计 * @Description: 国网上送新能源场站统计

View File

@@ -15,6 +15,7 @@ import com.njcn.device.pms.mapper.majornetwork.MonitorMapper;
import com.njcn.device.pms.mapper.majornetwork.PmsGeneratrixWireMapper; import com.njcn.device.pms.mapper.majornetwork.PmsGeneratrixWireMapper;
import com.njcn.device.pms.mapper.majornetwork.RStatIntegrityDMapper; import com.njcn.device.pms.mapper.majornetwork.RStatIntegrityDMapper;
import com.njcn.device.pms.mapper.majornetwork.StatationStatMapper; import com.njcn.device.pms.mapper.majornetwork.StatationStatMapper;
import com.njcn.device.pms.pojo.param.TerminalQueryParam;
import com.njcn.device.pms.pojo.param.gw.GwStatisticalParam; import com.njcn.device.pms.pojo.param.gw.GwStatisticalParam;
import com.njcn.device.pms.pojo.param.gw.GwTerminalParam; import com.njcn.device.pms.pojo.param.gw.GwTerminalParam;
import com.njcn.device.pms.pojo.po.*; import com.njcn.device.pms.pojo.po.*;
@@ -67,7 +68,7 @@ public class MonitorStatisticsServiceImpl implements MonitorStatisticsService {
private final ITerminalService terminalService; private final ITerminalService terminalService;
@Override @Override
public List<List<String>> getGwMonitorStatistics(String deptId) { public List<List<String>> getGwMonitorStatistics(String deptId,Integer up) {
List<List<String>> info = new ArrayList<>(); List<List<String>> info = new ArrayList<>();
//查询所有一级树字典 //查询所有一级树字典
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData(); List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
@@ -105,6 +106,7 @@ public class MonitorStatisticsServiceImpl implements MonitorStatisticsService {
DeptGetLineParam deptGetLineParam = new DeptGetLineParam(); DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptId); deptGetLineParam.setDeptId(deptId);
deptGetLineParam.setMonitorStateRunning(false); deptGetLineParam.setMonitorStateRunning(false);
deptGetLineParam.setSystemType(0);
List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalService.deptGetLine(deptGetLineParam); List<DeptGetChildrenMoreDTO> deptGetChildrenMoreDTOS = commTerminalService.deptGetLine(deptGetLineParam);
//部门信息循环 //部门信息循环
List<String> line; List<String> line;
@@ -115,8 +117,12 @@ public class MonitorStatisticsServiceImpl implements MonitorStatisticsService {
if (CollUtil.isEmpty(lineBaseList)) { if (CollUtil.isEmpty(lineBaseList)) {
continue; continue;
} }
List<LineDevGetDTO> upToGridList = lineBaseList.stream().filter(item -> Objects.equals(item.getIsUpToGrid(), DataStateEnum.ENABLE.getCode())) List<LineDevGetDTO> upToGridList;
.collect(Collectors.toList()); if(Objects.isNull(up) || up == 1){
upToGridList = lineBaseList.stream().filter(item -> Objects.equals(item.getIsUpToGrid(), DataStateEnum.ENABLE.getCode())).collect(Collectors.toList());
}else {
upToGridList = lineBaseList;
}
addmetWorkList(metWorkMap, upToGridList, line); addmetWorkList(metWorkMap, upToGridList, line);
addSourceLoadList(sourceLoadMap, upToGridList, line); addSourceLoadList(sourceLoadMap, upToGridList, line);
info.add(line); info.add(line);
@@ -124,6 +130,54 @@ public class MonitorStatisticsServiceImpl implements MonitorStatisticsService {
return info; return info;
} }
@Override
public List<List<String>> objTypeStatistic(String deptId) {
List<List<String>> info = new ArrayList<>();
//查询所有一级树字典
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
//监测点大类
List<SysDicTreePO> broadCategory = sysDicTreePOList.stream()
.filter(item -> Objects.equals(item.getPid(), "0"))
.filter(item -> !Objects.equals(item.getCode(), DicDataTypeEnum.DEVICE_UNIT.getCode()))
.collect(Collectors.toList());
broadCategory.sort(Comparator.comparing(SysDicTreePO::getSort));
List<String> list = new ArrayList<>();
list.add("单位");
List<String> collect = broadCategory.stream().map(SysDicTreePO::getName).collect(Collectors.toList());
list.addAll(collect);
list.add("合计");
//获取主网监测统计
Map<String, List<String>> metWorkMap = mapDicIds(broadCategory, sysDicTreePOList);
info.add(list);
TerminalQueryParam baseParam = new TerminalQueryParam();
List<Monitor> monitorList = monitorMapper.getAllObjUser(baseParam);
//筛选出国网统计信息
DeptGetLineParam deptGetLineParam = new DeptGetLineParam();
deptGetLineParam.setDeptId(deptId);
deptGetLineParam.setMonitorStateRunning(false);
deptGetLineParam.setSystemType(0);
List<DeptGetBase> deptGetChildrenMoreDTOS = commTerminalService.getDeptChildrenByParent(deptGetLineParam);
//部门信息循环
for (DeptGetBase dept : deptGetChildrenMoreDTOS) {
List<String> line = new ArrayList<>();
line.add(dept.getUnitName());
List<String> deptIds = dept.getUnitChildrenList();
if (CollUtil.isEmpty(deptIds)) {
continue;
}
List<Monitor> temList = monitorList.stream().filter(it->deptIds.contains(it.getOrgId())).collect(Collectors.toList());
metWorkMap.forEach((k,v)->{
long count = temList.stream().filter(i->v.contains(i.getObjType())).count();
line.add(String.valueOf(count));
});
info.add(line);
}
return info;
}
@Override @Override
public List<MonitorEnergy> getGwMonitorEnergy(String deptId) { public List<MonitorEnergy> getGwMonitorEnergy(String deptId) {
List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData(); List<DictData> data = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE.getCode()).getData();

View File

@@ -87,6 +87,9 @@ public interface IMonitorService extends IService<Monitor> {
Page<Monitor> getAllMonitorPageList(TerminalQueryParam baseParam); Page<Monitor> getAllMonitorPageList(TerminalQueryParam baseParam);
Page<Monitor> getAllMainUserPageList(TerminalQueryParam baseParam);
List<Monitor> getMonitorList(List<String> monitorIds); List<Monitor> getMonitorList(List<String> monitorIds);
List<Monitor> getMonitorListByMid(List<String> midIds); List<Monitor> getMonitorListByMid(List<String> midIds);

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.common.pojo.param.StatisticsBizBaseParam; import com.njcn.common.pojo.param.StatisticsBizBaseParam;
import com.njcn.device.pms.pojo.excel.PowerDistributionAreaExcel; import com.njcn.device.pms.pojo.excel.PowerDistributionAreaExcel;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pms.pojo.po.PowerDistributionarea; import com.njcn.device.pms.pojo.po.PowerDistributionarea;
import com.njcn.device.pms.pojo.vo.PVCapacity; import com.njcn.device.pms.pojo.vo.PVCapacity;
import com.njcn.web.pojo.param.BaseParam; import com.njcn.web.pojo.param.BaseParam;
@@ -28,7 +29,7 @@ public interface IPowerDistributionareaService extends IService<PowerDistributio
* 分页查询所有 * 分页查询所有
* @return * @return
*/ */
Page<PowerDistributionarea> getList(BaseParam baseParam); Page<PowerDistributionarea> getList(TaiZhangParam baseParam);
/** /**
* 查询所有 * 查询所有

View File

@@ -287,6 +287,42 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
return page; return page;
} }
@Override
public Page<Monitor> getAllMainUserPageList(TerminalQueryParam baseParam) {
List<String> objTypeIds = new ArrayList<>();
if(StrUtil.isNotBlank(baseParam.getObjType())){
if(baseParam.getObjType().equals("987654321")){
//特殊处理
List<SysDicTreePO> sysDicTreePOList = dictTreeFeignClient.queryAll().getData();
List<SysDicTreePO> typicDic =sysDicTreePOList.stream().filter(item->Objects.equals(DicTreeEnum.Power_Station.getCode(),item.getCode())||Objects.equals(DicTreeEnum.Ele_Railways.getCode(),item.getCode())||
Objects.equals(DicTreeEnum.Wind_Farms.getCode(),item.getCode())||Objects.equals(DicTreeEnum.Imp_Users.getCode(),item.getCode())).collect(Collectors.toList());
for(SysDicTreePO sysDicTreePO : typicDic){
List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getId()).getData();
List<String> ids = temList.stream().map(DictTreeVO::getId).collect(Collectors.toList());
objTypeIds.addAll(ids);
objTypeIds.add(sysDicTreePO.getId());
}
}else {
SysDicTreePO sysDicTreePO = dictTreeFeignClient.queryById(baseParam.getObjType()).getData();
if(sysDicTreePO.getPid().equals("0")){
List<DictTreeVO> temList = dictTreeFeignClient.query(sysDicTreePO.getId()).getData();
List<String> ids = temList.stream().map(DictTreeVO::getId).collect(Collectors.toList());
objTypeIds.addAll(ids);
}
objTypeIds.add(sysDicTreePO.getId());
}
baseParam.setObjTypeList(objTypeIds);
}
Page<Monitor> page = this.baseMapper.getAllObjUser(new Page<>(baseParam.getPageNum(), baseParam.getPageSize()),baseParam);
return page;
}
@Override @Override
public List<Monitor> getMonitorList(List<String> monitorIds) { public List<Monitor> getMonitorList(List<String> monitorIds) {
List<Monitor> monitorList = new ArrayList<>(); List<Monitor> monitorList = new ArrayList<>();

View File

@@ -21,6 +21,7 @@ import com.njcn.device.pms.mapper.majornetwork.PowerDistributionareaMapper;
import com.njcn.device.pms.pojo.excel.PowerDistributionAreaExcel; import com.njcn.device.pms.pojo.excel.PowerDistributionAreaExcel;
import com.njcn.device.pms.pojo.excel.PowerGenerationUserExcel; import com.njcn.device.pms.pojo.excel.PowerGenerationUserExcel;
import com.njcn.device.pms.pojo.param.PowerDistributionareaParam; import com.njcn.device.pms.pojo.param.PowerDistributionareaParam;
import com.njcn.device.pms.pojo.param.TaiZhangParam;
import com.njcn.device.pms.pojo.po.GeneratrixWire; import com.njcn.device.pms.pojo.po.GeneratrixWire;
import com.njcn.device.pms.pojo.po.PowerDistributionarea; import com.njcn.device.pms.pojo.po.PowerDistributionarea;
import com.njcn.device.pms.pojo.po.PowerGenerationUser; import com.njcn.device.pms.pojo.po.PowerGenerationUser;
@@ -82,16 +83,18 @@ public class PowerDistributionareaServiceImpl extends ServiceImpl<PowerDistribut
@Override @Override
public Page<PowerDistributionarea> getList(BaseParam baseParam) { public Page<PowerDistributionarea> getList(TaiZhangParam baseParam) {
List<Dept> deptInfo = deptFeignClient.getAllDept().getData(); List<String> deptInfo = deptFeignClient.getDepSonSelfCodetByDeptId(baseParam.getOrgId()).getData();
List<String> deptIds = deptInfo.stream().map(Dept::getCode).collect(Collectors.toList());
LambdaQueryWrapper<PowerDistributionarea> lambdaQueryWrapper = new LambdaQueryWrapper<>(); LambdaQueryWrapper<PowerDistributionarea> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.eq(PowerDistributionarea::getStatus,DataStateEnum.ENABLE.getCode()) lambdaQueryWrapper.eq(PowerDistributionarea::getStatus,DataStateEnum.ENABLE.getCode())
.in(CollUtil.isNotEmpty(deptIds),PowerDistributionarea::getOrgId,deptIds) .in(CollUtil.isNotEmpty(deptInfo),PowerDistributionarea::getOrgId,deptInfo)
.and(StrUtil.isNotBlank(baseParam.getSearchValue()), .and(StrUtil.isNotBlank(baseParam.getSearchValue()),
i->i.like(PowerDistributionarea::getName,baseParam.getSearchValue()) i->i.like(PowerDistributionarea::getName,baseParam.getSearchValue())
.or() .or()
.like(PowerDistributionarea::getPowerrName,baseParam.getSearchValue()) .like(PowerDistributionarea::getPowerrName,baseParam.getSearchValue())
.or()
.like(PowerDistributionarea::getLineName,baseParam.getSearchValue())
.or() .or()
.like(PowerDistributionarea::getOrgName,baseParam.getSearchValue())).orderByDesc(PowerDistributionarea::getCreateTime); .like(PowerDistributionarea::getOrgName,baseParam.getSearchValue())).orderByDesc(PowerDistributionarea::getCreateTime);

View File

@@ -0,0 +1,24 @@
package com.njcn.device.pq.api;
import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.CvtRelationFeignClientFallbackFactory;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
/**
* 告警管理Feign客户端
*
* @author yzh
* @date 2022/9/19
*/
@FeignClient(value = ServerInfo.DEVICE, path = "/cvtBind", fallbackFactory = CvtRelationFeignClientFallbackFactory.class, contextId = "cvtBind")
public interface CvtRelationFeignClient {
@PostMapping("queryByLineId")
HttpResult<CvtHarmonicCorrectionFactorsDTO> queryByLineId(@RequestParam("lineId") String lineId);
}

View File

@@ -1,12 +1,16 @@
package com.njcn.device.pq.api; package com.njcn.device.pq.api;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.ServerInfo; import com.njcn.common.pojo.constant.ServerInfo;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.pq.api.fallback.DeviceFeignClientFallbackFactory; import com.njcn.device.pq.api.fallback.DeviceFeignClientFallbackFactory;
import com.njcn.device.pq.api.fallback.LineFeignClientFallbackFactory; import com.njcn.device.pq.api.fallback.LineFeignClientFallbackFactory;
import com.njcn.device.pq.pojo.dto.DevComFlagDTO;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RequestParam;
/** /**
@@ -33,4 +37,8 @@ public interface DeviceFeignClient {
@RequestParam("thisTimeCheck") String thisTimeCheck, @RequestParam("thisTimeCheck") String thisTimeCheck,
@RequestParam("nextTimeCheck") String nextTimeCheck); @RequestParam("nextTimeCheck") String nextTimeCheck);
@PostMapping("/updateDevComFlag")
@ApiOperation("修改装置通讯状态")
HttpResult<Boolean> updateDevComFlag(@RequestBody DevComFlagDTO devComFlagDTO);
} }

View File

@@ -31,7 +31,7 @@ import java.util.Map;
path = "/line", path = "/line",
fallbackFactory = LineFeignClientFallbackFactory.class, fallbackFactory = LineFeignClientFallbackFactory.class,
contextId = "line") contextId = "line")
public interface LineFeignClient { public interface LineFeignClient {
/** /**
* 获取终端状态信息 * 获取终端状态信息

View File

@@ -0,0 +1,43 @@
package com.njcn.device.pq.api.fallback;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.CvtRelationFeignClient;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 告警管理熔断降级
* @author yzh
* @date 2022/9/19
*/
@Slf4j
@Component
public class CvtRelationFeignClientFallbackFactory implements FallbackFactory<CvtRelationFeignClient> {
@Override
public CvtRelationFeignClient create(Throwable throwable) {
//判断抛出异常是否为解码器抛出的业务异常
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
if (throwable.getCause() instanceof BusinessException) {
BusinessException businessException = (BusinessException) throwable.getCause();
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
}
Enum<?> finalExceptionEnum = exceptionEnum;
return new CvtRelationFeignClient() {
@Override
public HttpResult<CvtHarmonicCorrectionFactorsDTO> queryByLineId(String lineId) {
log.error("{}异常,降级处理,异常为:{}", "监测点获取Cvt系数", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
};
}
}

View File

@@ -5,6 +5,7 @@ import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult; import com.njcn.common.pojo.response.HttpResult;
import com.njcn.device.biz.utils.DeviceEnumUtil; import com.njcn.device.biz.utils.DeviceEnumUtil;
import com.njcn.device.pq.api.DeviceFeignClient; import com.njcn.device.pq.api.DeviceFeignClient;
import com.njcn.device.pq.pojo.dto.DevComFlagDTO;
import feign.hystrix.FallbackFactory; import feign.hystrix.FallbackFactory;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@@ -31,6 +32,12 @@ public class DeviceFeignClientFallbackFactory implements FallbackFactory<DeviceF
log.error("{}异常,降级处理,异常为:{}", "技术监督修改装置定检时间", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "技术监督修改装置定检时间", throwable.toString());
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public HttpResult<Boolean> updateDevComFlag(DevComFlagDTO devComFlagDTO) {
log.error("{}异常,降级处理,异常为:{}", "修改设备状态", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
}; };
} }
} }

View File

@@ -49,6 +49,8 @@ public enum PvDeviceResponseEnum {
PROJECT_OR_NOT("A00550","项目名称为空,请检查信息是否存在!"), PROJECT_OR_NOT("A00550","项目名称为空,请检查信息是否存在!"),
PROVINCE_OR_NOT("A00550","省级名称为空,请检查信息是否存在!"), PROVINCE_OR_NOT("A00550","省级名称为空,请检查信息是否存在!"),
GD_OR_NOT("A00550","供电公司名称为空,请检查信息是否存在!"), GD_OR_NOT("A00550","供电公司名称为空,请检查信息是否存在!"),
OVER_LIMIT("A00550","前置机配置设备过多"),
NO_DEVICE("A00550","前置机下无设备"),
; ;

View File

@@ -0,0 +1,165 @@
package com.njcn.device.pq.pojo.dto;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class CvtHarmonicCorrectionFactorsDTO {
private String id;
/**
* cvt名称
*/
private String cvtName;
/**
* cvt型号
*/
private String cvtModel;
private BigDecimal h2;
private BigDecimal h3;
private BigDecimal h4;
private BigDecimal h5;
private BigDecimal h6;
private BigDecimal h7;
private BigDecimal h8;
private BigDecimal h9;
private BigDecimal h10;
private BigDecimal h11;
private BigDecimal h12;
private BigDecimal h13;
private BigDecimal h14;
private BigDecimal h15;
private BigDecimal h16;
private BigDecimal h17;
private BigDecimal h18;
private BigDecimal h19;
private BigDecimal h20;
private BigDecimal h21;
private BigDecimal h22;
private BigDecimal h23;
private BigDecimal h24;
private BigDecimal h25;
private BigDecimal h26;
private BigDecimal h27;
private BigDecimal h28;
private BigDecimal h29;
private BigDecimal h30;
private BigDecimal h31;
private BigDecimal h32;
private BigDecimal h33;
private BigDecimal h34;
private BigDecimal h35;
private BigDecimal h36;
private BigDecimal h37;
private BigDecimal h38;
private BigDecimal h39;
private BigDecimal h40;
private BigDecimal h41;
private BigDecimal h42;
private BigDecimal h43;
private BigDecimal h44;
private BigDecimal h45;
private BigDecimal h46;
private BigDecimal h47;
private BigDecimal h48;
private BigDecimal h49;
private BigDecimal h50;
/**
* 创建用户
*/
@TableField(fill = FieldFill.INSERT)
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime;
/**
* 更新用户
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime updateTime;
}

View File

@@ -38,6 +38,8 @@ public class DeviceInfo {
private String series; private String series;
//终端识别码 //终端识别码
private String devKey; private String devKey;
private Integer processNo;
// //
private List<MonitorInfo> monitorData; private List<MonitorInfo> monitorData;

View File

@@ -0,0 +1,212 @@
package com.njcn.device.pq.pojo.param;
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.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.*;
import java.math.BigDecimal;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class CvtHarmonicCorrectionFactorsParam {
/**
* cvt名称
*/
@Pattern(regexp = PatternRegex.DES32_REGEX, message = "cvt名称过长")
private String cvtName;
/**
* cvt型号
*/
@Pattern(regexp = PatternRegex.DES32_REGEX, message = "cvt型号")
private String cvtModel;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h2;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h3;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h4;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h5;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h6;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h7;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h8;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h9;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h10;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h11;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h12;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h13;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h14;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h15;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h16;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h17;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h18;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h19;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h20;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h21;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h22;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h23;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h24;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h25;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h26;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h27;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h28;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h29;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h30;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h31;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h32;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h33;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h34;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h35;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h36;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h37;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h38;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h39;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h40;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h41;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h42;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h43;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h44;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h45;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h46;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h47;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h48;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h49;
@Digits(integer = 2, fraction = 4, message = "CVT参数格式错误应为X.XXXX")
@NotNull(message = "CVT参数不能不为空")
private BigDecimal h50;
@Data
@EqualsAndHashCode(callSuper = true)
public static class CvtHarmonicCorrectionFactorsParamUpdateParam extends CvtHarmonicCorrectionFactorsParam {
/**
* 表Id
*/
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String id;
}
/**
* 前置查询
*/
@Data
@EqualsAndHashCode(callSuper = true)
public static class CvtHarmonicCorrectionFactorsParamQueryParam extends BaseParam {
}
}

View File

@@ -0,0 +1,47 @@
package com.njcn.device.pq.pojo.param;
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.njcn.common.pojo.constant.PatternRegex;
import com.njcn.web.constant.ValidMessage;
import lombok.Data;
import lombok.EqualsAndHashCode;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;
/**
*
* Description:
* Date: 2025/02/11 上午 9:22【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class CvtLineRelationParam {
/**
* 监测点id
*/
private String lineId;
/**
* cvt系数表id
*/
private String cvtId;
@Data
@EqualsAndHashCode(callSuper = true)
public static class CvtLineRelationUpdateParam extends CvtLineRelationParam {
/**
* 表Id
*/
@NotBlank(message = ValidMessage.ID_NOT_BLANK)
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
private String id;
}
}

View File

@@ -23,7 +23,6 @@ import java.util.List;
@ApiModel @ApiModel
public class NodeDeviceParam { public class NodeDeviceParam {
/** /**
* 服务器IP * 服务器IP
*/ */
@@ -31,4 +30,6 @@ public class NodeDeviceParam {
private String ip; private String ip;
private List<Integer> runFlag; private List<Integer> runFlag;
private String devId;
} }

View File

@@ -0,0 +1,187 @@
package com.njcn.device.pq.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.njcn.db.bo.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@TableName(value = "cvt_harmonic_correction_factors")
@Data
public class CvtHarmonicCorrectionFactors extends BaseEntity {
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* cvt名称
*/
@TableField(value = "cvt_name")
private String cvtName;
/**
* cvt型号
*/
@TableField(value = "cvt_model")
private String cvtModel;
@TableField(value = "h2")
private BigDecimal h2;
@TableField(value = "h3")
private BigDecimal h3;
@TableField(value = "h4")
private BigDecimal h4;
@TableField(value = "h5")
private BigDecimal h5;
@TableField(value = "h6")
private BigDecimal h6;
@TableField(value = "h7")
private BigDecimal h7;
@TableField(value = "h8")
private BigDecimal h8;
@TableField(value = "h9")
private BigDecimal h9;
@TableField(value = "h10")
private BigDecimal h10;
@TableField(value = "h11")
private BigDecimal h11;
@TableField(value = "h12")
private BigDecimal h12;
@TableField(value = "h13")
private BigDecimal h13;
@TableField(value = "h14")
private BigDecimal h14;
@TableField(value = "h15")
private BigDecimal h15;
@TableField(value = "h16")
private BigDecimal h16;
@TableField(value = "h17")
private BigDecimal h17;
@TableField(value = "h18")
private BigDecimal h18;
@TableField(value = "h19")
private BigDecimal h19;
@TableField(value = "h20")
private BigDecimal h20;
@TableField(value = "h21")
private BigDecimal h21;
@TableField(value = "h22")
private BigDecimal h22;
@TableField(value = "h23")
private BigDecimal h23;
@TableField(value = "h24")
private BigDecimal h24;
@TableField(value = "h25")
private BigDecimal h25;
@TableField(value = "h26")
private BigDecimal h26;
@TableField(value = "h27")
private BigDecimal h27;
@TableField(value = "h28")
private BigDecimal h28;
@TableField(value = "h29")
private BigDecimal h29;
@TableField(value = "h30")
private BigDecimal h30;
@TableField(value = "h31")
private BigDecimal h31;
@TableField(value = "h32")
private BigDecimal h32;
@TableField(value = "h33")
private BigDecimal h33;
@TableField(value = "h34")
private BigDecimal h34;
@TableField(value = "h35")
private BigDecimal h35;
@TableField(value = "h36")
private BigDecimal h36;
@TableField(value = "h37")
private BigDecimal h37;
@TableField(value = "h38")
private BigDecimal h38;
@TableField(value = "h39")
private BigDecimal h39;
@TableField(value = "h40")
private BigDecimal h40;
@TableField(value = "h41")
private BigDecimal h41;
@TableField(value = "h42")
private BigDecimal h42;
@TableField(value = "h43")
private BigDecimal h43;
@TableField(value = "h44")
private BigDecimal h44;
@TableField(value = "h45")
private BigDecimal h45;
@TableField(value = "h46")
private BigDecimal h46;
@TableField(value = "h47")
private BigDecimal h47;
@TableField(value = "h48")
private BigDecimal h48;
@TableField(value = "h49")
private BigDecimal h49;
@TableField(value = "h50")
private BigDecimal h50;
}

View File

@@ -0,0 +1,34 @@
package com.njcn.device.pq.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 lombok.Data;
/**
*
* Description:
* Date: 2025/02/11 上午 9:22【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@TableName(value = "cvt_line_relation")
public class CvtLineRelation {
@TableId(value = "id", type = IdType.ASSIGN_UUID)
private String id;
/**
* 监测点id
*/
@TableField(value = "line_id")
private String lineId;
/**
* cvt系数表id
*/
@TableField(value = "cvt_id")
private String cvtId;
}

View File

@@ -0,0 +1,24 @@
package com.njcn.device.pq.pojo.po;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;
import java.io.Serializable;
/**
* Description:
* Date: 2025/01/22 下午 1:53【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@TableName("pq_device_process")
public class DeviceProcess implements Serializable {
private static final long serialVersionUID = 1L;
//设备id
private String id;
//设备设备所在前置机进程号
private Integer processNo;
}

View File

@@ -55,6 +55,14 @@ public class Node extends BaseEntity {
*/ */
private Integer nodeDevNum; private Integer nodeDevNum;
/**
* 前置机支持最大进程数量
*/
private Integer maxProcessNum;
/** /**
* 排序 * 排序
*/ */

View File

@@ -0,0 +1,165 @@
package com.njcn.device.pq.pojo.vo;
import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.deser.LocalDateTimeDeserializer;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.njcn.db.bo.BaseEntity;
import lombok.Data;
import java.math.BigDecimal;
import java.time.LocalDateTime;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
public class CvtHarmonicCorrectionFactorsVO {
private String id;
/**
* cvt名称
*/
private String cvtName;
/**
* cvt型号
*/
private String cvtModel;
private BigDecimal h2;
private BigDecimal h3;
private BigDecimal h4;
private BigDecimal h5;
private BigDecimal h6;
private BigDecimal h7;
private BigDecimal h8;
private BigDecimal h9;
private BigDecimal h10;
private BigDecimal h11;
private BigDecimal h12;
private BigDecimal h13;
private BigDecimal h14;
private BigDecimal h15;
private BigDecimal h16;
private BigDecimal h17;
private BigDecimal h18;
private BigDecimal h19;
private BigDecimal h20;
private BigDecimal h21;
private BigDecimal h22;
private BigDecimal h23;
private BigDecimal h24;
private BigDecimal h25;
private BigDecimal h26;
private BigDecimal h27;
private BigDecimal h28;
private BigDecimal h29;
private BigDecimal h30;
private BigDecimal h31;
private BigDecimal h32;
private BigDecimal h33;
private BigDecimal h34;
private BigDecimal h35;
private BigDecimal h36;
private BigDecimal h37;
private BigDecimal h38;
private BigDecimal h39;
private BigDecimal h40;
private BigDecimal h41;
private BigDecimal h42;
private BigDecimal h43;
private BigDecimal h44;
private BigDecimal h45;
private BigDecimal h46;
private BigDecimal h47;
private BigDecimal h48;
private BigDecimal h49;
private BigDecimal h50;
/**
* 创建用户
*/
@TableField(fill = FieldFill.INSERT)
private String createBy;
/**
* 创建时间
*/
@TableField(fill = FieldFill.INSERT)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime createTime;
/**
* 更新用户
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
private String updateBy;
/**
* 更新时间
*/
@TableField(fill = FieldFill.INSERT_UPDATE)
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonDeserialize(using = LocalDateTimeDeserializer.class)
@JsonSerialize(using = LocalDateTimeSerializer.class)
private LocalDateTime updateTime;
}

View File

@@ -45,6 +45,15 @@
<version>1.0.0</version> <version>1.0.0</version>
<scope>compile</scope> <scope>compile</scope>
</dependency> </dependency>
<dependency>
<groupId>com.njcn.platform</groupId>
<artifactId>message-api</artifactId>
<version>1.0.0</version>
<scope>compile</scope>
</dependency>
</dependencies> </dependencies>
</project> </project>

View File

@@ -7,6 +7,7 @@ import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil; import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO; import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.pq.service.LineService; import com.njcn.device.pq.service.LineService;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@@ -41,6 +42,15 @@ public class CommLineController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getPollutionLineInfo")
@ApiOperation("获取污区值监测点相关信息")
public HttpResult<List<PollutionLineInfoDTO>> getPollutionLineInfo(@RequestParam("id") List<String> id) {
String methodDescribe = getMethodDescribe("getPollutionLineInfo");
List<PollutionLineInfoDTO> result = lineService.getPollutionLineInfo(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getLineAllDetail") @GetMapping("/getLineAllDetail")
@ApiOperation("获取监测点id取超标监测点信息") @ApiOperation("获取监测点id取超标监测点信息")

View File

@@ -179,7 +179,7 @@ public class CommTerminalController extends BaseController {
public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) { public HttpResult<List<DeptGetDeviceDTO>> deptGetDevice(@RequestBody @Validated DeptGetLineParam deptGetLineParam) {
TimeInterval timer = new TimeInterval(); TimeInterval timer = new TimeInterval();
String methodDescribe = getMethodDescribe("deptGetDevice"); String methodDescribe = getMethodDescribe("deptGetDevice");
List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam,0); List<DeptGetDeviceDTO> result = commTerminalService.deptGetDevice(deptGetLineParam,3);
log.info("运行时长" + timer.intervalSecond()); log.info("运行时长" + timer.intervalSecond());
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }

View File

@@ -0,0 +1,116 @@
package com.njcn.device.pq.controller;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import com.njcn.device.pq.pojo.param.CvtHarmonicCorrectionFactorsParam;
import com.njcn.device.pq.pojo.param.NodeParam;
import com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors;
import com.njcn.device.pq.pojo.vo.CvtHarmonicCorrectionFactorsVO;
import com.njcn.device.pq.service.CvtHarmonicCorrectionFactorsService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* Description:
* Date: 2025/02/10 下午 1:53【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Validated
@Slf4j
@Api(tags = "cvt系数配置")
@RestController
@RequestMapping("/cvt")
@RequiredArgsConstructor
public class CvtHarmonicCorrectionFactorsController extends BaseController {
private final CvtHarmonicCorrectionFactorsService cvtHarmonicCorrectionFactorsService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增cvt系数")
@ApiImplicitParam(value = "cvt系数信息",name = "cvtHarmonicCorrectionFactorsParam",required = true)
@PostMapping("add")
public HttpResult<Boolean> add(@Validated @RequestBody CvtHarmonicCorrectionFactorsParam cvtHarmonicCorrectionFactorsParam){
String methodDescribe = getMethodDescribe("add");
boolean result = cvtHarmonicCorrectionFactorsService.add(cvtHarmonicCorrectionFactorsParam);
if (result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("修改cvt系数")
@ApiImplicitParam(value = "cvt系数信息",name = "updateParam",required = true)
@PostMapping("updateCvt")
public HttpResult<Boolean> updateCvt(@Validated @RequestBody CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamUpdateParam updateParam){
String methodDescribe = getMethodDescribe("updateCvt");
boolean result = cvtHarmonicCorrectionFactorsService.updateCvt(updateParam);
if (result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("分页查询")
@ApiImplicitParam(value = "cvt系数信息",name = "queryParam",required = true)
@PostMapping("queryPage")
public HttpResult<Page<CvtHarmonicCorrectionFactorsVO>> queryPage(@Validated @RequestBody CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamQueryParam queryParam){
String methodDescribe = getMethodDescribe("queryPage");
Page<CvtHarmonicCorrectionFactorsVO> result = cvtHarmonicCorrectionFactorsService.queryPage(queryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("列表查询")
@PostMapping("queryList")
public HttpResult<List<CvtHarmonicCorrectionFactorsDTO>> queryList( @Validated @RequestBody CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamQueryParam queryParam){
String methodDescribe = getMethodDescribe("queryList");
List<CvtHarmonicCorrectionFactorsDTO> result = cvtHarmonicCorrectionFactorsService.queryList(queryParam);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("根据id查询")
@PostMapping("queryById")
public HttpResult<CvtHarmonicCorrectionFactorsDTO> queryById( @RequestParam String id){
String methodDescribe = getMethodDescribe("queryById");
CvtHarmonicCorrectionFactorsDTO result = new CvtHarmonicCorrectionFactorsDTO();
CvtHarmonicCorrectionFactors cvt = cvtHarmonicCorrectionFactorsService.getById(id);
BeanUtils.copyProperties(result,cvt);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("根据id删除")
@PostMapping("deleteById")
public HttpResult<Boolean> deleteById( @RequestParam String id){
String methodDescribe = getMethodDescribe("deleteById");
boolean result = cvtHarmonicCorrectionFactorsService.removeById(id);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -0,0 +1,64 @@
package com.njcn.device.pq.controller;
import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.constant.OperateType;
import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import com.njcn.device.pq.pojo.param.CvtHarmonicCorrectionFactorsParam;
import com.njcn.device.pq.pojo.param.CvtLineRelationParam;
import com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors;
import com.njcn.device.pq.pojo.vo.CvtHarmonicCorrectionFactorsVO;
import com.njcn.device.pq.service.CvtHarmonicCorrectionFactorsService;
import com.njcn.device.pq.service.CvtLineRelationService;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
/**
* Description:
* Date: 2025/02/11 上午 9:29【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Validated
@Slf4j
@Api(tags = "cvt系数绑定")
@RestController
@RequestMapping("/cvtBind")
@RequiredArgsConstructor
public class CvtLineRelationController extends BaseController {
private final CvtLineRelationService cvtLineRelationService;
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("新增cvt系数绑定")
@ApiImplicitParam(value = "cvt系数绑定信息",name = "cvtLineRelationParam",required = true)
@PostMapping("add")
public HttpResult<Boolean> add(@Validated @RequestBody CvtLineRelationParam cvtLineRelationParam){
String methodDescribe = getMethodDescribe("add");
boolean result = cvtLineRelationService.add(cvtLineRelationParam);
if (result){
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
} else {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, false, methodDescribe);
}
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
@ApiOperation("根据监测点id查询绑定cvt系数")
@PostMapping("queryByLineId")
public HttpResult<CvtHarmonicCorrectionFactorsDTO> queryByLineId(@RequestParam String lineId){
String methodDescribe = getMethodDescribe("queryByLineId");
CvtHarmonicCorrectionFactorsDTO result = cvtLineRelationService.queryByLineId(lineId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
}
}

View File

@@ -49,6 +49,14 @@ public class NodeDeviceController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
} }
@ApiOperation("一键分配装置所属进程号")
@OperateInfo(info = LogEnum.BUSINESS_MEDIUM)
@PostMapping("oneKeyDistribution")
public HttpResult<Boolean> oneKeyDistribution(@RequestParam("nodeId") String nodeId){
String methodDescribe = getMethodDescribe("oneKeyDistribution");
nodeDeviceService.oneKeyDistribution(nodeId);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}

View File

@@ -17,11 +17,14 @@ import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO; import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.po.Line; import com.njcn.device.pq.pojo.po.Line;
import com.njcn.device.pq.pojo.vo.LineDetailDataVO;
import com.njcn.device.pq.pojo.vo.LineWiringDiagramVO; import com.njcn.device.pq.pojo.vo.LineWiringDiagramVO;
import com.njcn.device.pq.pojo.vo.TerminalBaseVO; import com.njcn.device.pq.pojo.vo.TerminalBaseVO;
import com.njcn.device.pq.pojo.vo.TerminalVO; import com.njcn.device.pq.pojo.vo.TerminalVO;
import com.njcn.device.pq.service.LineService;
import com.njcn.device.pq.service.TerminalBaseService; import com.njcn.device.pq.service.TerminalBaseService;
import com.njcn.device.pq.service.impl.GeneralDeviceService; import com.njcn.device.pq.service.impl.GeneralDeviceService;
import com.njcn.message.constant.DeviceRebootType;
import com.njcn.poi.util.PoiUtil; import com.njcn.poi.util.PoiUtil;
import com.njcn.web.controller.BaseController; import com.njcn.web.controller.BaseController;
import io.swagger.annotations.*; import io.swagger.annotations.*;
@@ -56,7 +59,7 @@ public class TerminalBaseController extends BaseController {
private final TerminalBaseService terminalBaseService; private final TerminalBaseService terminalBaseService;
private final GeneralDeviceService generalDeviceService; private final GeneralDeviceService generalDeviceService;
private final LineService lineService;
/** /**
* 终端新增操作 * 终端新增操作
@@ -117,6 +120,15 @@ public class TerminalBaseController extends BaseController {
} }
} }
terminalBaseService.addTerminal(addTerminalParam); terminalBaseService.addTerminal(addTerminalParam);
//新增终端后发送消息给前置重启设备
if (Objects.nonNull(addTerminalParam.getDeviceParam())) {
addTerminalParam.getDeviceParam().forEach(temp->{
Line line = terminalBaseService.queryTerminalByName(temp.getName());
terminalBaseService.askRestartDevice(line.getId(), DeviceRebootType.ADD_TERMINAL);
});
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@@ -145,7 +157,14 @@ public class TerminalBaseController extends BaseController {
@GetMapping("/terminalSyncDeleteFly") @GetMapping("/terminalSyncDeleteFly")
public HttpResult<Boolean> terminalSyncDeleteFly(@RequestParam("lineId") String lineId) { public HttpResult<Boolean> terminalSyncDeleteFly(@RequestParam("lineId") String lineId) {
String methodDescribe = getMethodDescribe("terminalSyncDeleteFly"); String methodDescribe = getMethodDescribe("terminalSyncDeleteFly");
//获取设备id
LineDetailDataVO lineDetailData = lineService.getLineDetailData(lineId);
String devId =lineDetailData.getDevId();
Boolean b = terminalBaseService.terminalSyncDeleteFly(lineId); Boolean b = terminalBaseService.terminalSyncDeleteFly(lineId);
//删除监测点即修改终端通知前置重启
terminalBaseService.askRestartDevice(devId,DeviceRebootType.LEDGER_MODIFY);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
} }
@@ -192,6 +211,9 @@ public class TerminalBaseController extends BaseController {
public HttpResult<Object> delTerminal(@RequestParam("id") String id) { public HttpResult<Object> delTerminal(@RequestParam("id") String id) {
String methodDescribe = getMethodDescribe("delTerminal"); String methodDescribe = getMethodDescribe("delTerminal");
terminalBaseService.delTerminal(id); terminalBaseService.delTerminal(id);
// 删除终端通知前置重启
terminalBaseService.askRestartDevice(id,DeviceRebootType.DELETE_TERMINAL);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
} }
@@ -412,4 +434,31 @@ public class TerminalBaseController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe); return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
} }
@ApiOperation("请求前置重启进程")
@PostMapping(value = "askRestartProcess")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
@ApiImplicitParams({
@ApiImplicitParam(name = "processNo", value = "进程号", required = true),
@ApiImplicitParam(name = "deviceRebootType", value = "重启类型", required = true)
})
public HttpResult<Object> askRestartProcess(@RequestParam("processNo")Integer processNo,@RequestParam("processType")String processType,@RequestParam("deviceRebootType")String deviceRebootType) {
String methodDescribe = getMethodDescribe("askRestartProcess");
terminalBaseService.askRestartProcess(processNo,processType,deviceRebootType);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
@ApiOperation("请求前置设备进程")
@PostMapping(value = "askRestartDevice")
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.DELETE)
@ApiImplicitParams({
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
@ApiImplicitParam(name = "deviceRebootType", value = "重启类型", required = true)
})
public HttpResult<Object> askRestartDevice(@RequestParam("devId")String devId,@RequestParam("deviceRebootType")String deviceRebootType) {
String methodDescribe = getMethodDescribe("askRestartDevice");
terminalBaseService.askRestartDevice(devId,deviceRebootType);
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
} }

View File

@@ -0,0 +1,20 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors;
import com.njcn.device.pq.pojo.vo.CvtHarmonicCorrectionFactorsVO;
import org.apache.ibatis.annotations.Param;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CvtHarmonicCorrectionFactorsMapper extends BaseMapper<CvtHarmonicCorrectionFactors> {
Page<CvtHarmonicCorrectionFactorsVO> queryPage(Page<Object> objectPage,@Param("ew") QueryWrapper<CvtHarmonicCorrectionFactorsVO> queryWrapper);
}

View File

@@ -0,0 +1,15 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.device.pq.pojo.po.CvtLineRelation;
/**
*
* Description:
* Date: 2025/02/11 上午 9:22【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CvtLineRelationMapper extends BaseMapper<CvtLineRelation> {
}

View File

@@ -3,6 +3,7 @@ package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.pq.pojo.po.Device; import com.njcn.device.pq.pojo.po.Device;
import com.njcn.device.pq.pojo.vo.DevDetail; import com.njcn.device.pq.pojo.vo.DevDetail;
import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO; import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
@@ -85,4 +86,6 @@ public interface DeviceMapper extends BaseMapper<Device> {
List<DevDetail> selectDevByIds(@Param("ids") List<String> ids); List<DevDetail> selectDevByIds(@Param("ids") List<String> ids);
void updateDeviceRunFlag(@Param("id")String deviceId, @Param("runFlag")Integer status); void updateDeviceRunFlag(@Param("id")String deviceId, @Param("runFlag")Integer status);
List<PollutionLineInfoDTO> getPollutionDeviceInfo(@Param("id")List<String> devId);
} }

View File

@@ -0,0 +1,29 @@
package com.njcn.device.pq.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.pojo.po.Device;
import com.njcn.device.pq.pojo.po.DeviceProcess;
import com.njcn.device.pq.pojo.vo.DevDetail;
import com.njcn.device.pq.pojo.vo.LineInfluxDbOnlineVO;
import com.njcn.device.pq.pojo.vo.RunManageVO;
import com.njcn.device.pq.pojo.vo.RunTimeVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author cdf
* @since 2022-01-04
*/
public interface DeviceProcessMapper extends BaseMapper<DeviceProcess> {
}

View File

@@ -0,0 +1,77 @@
<?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.device.pq.mapper.CvtHarmonicCorrectionFactorsMapper">
<resultMap id="BaseResultMap" type="com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors">
<!--@mbg.generated-->
<!--@Table cvt_harmonic_correction_factors-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="cvt_name" jdbcType="VARCHAR" property="cvtName" />
<result column="cvt_model" jdbcType="VARCHAR" property="cvtModel" />
<result column="h2" jdbcType="DECIMAL" property="h2" />
<result column="h3" jdbcType="DECIMAL" property="h3" />
<result column="h4" jdbcType="DECIMAL" property="h4" />
<result column="h5" jdbcType="DECIMAL" property="h5" />
<result column="h6" jdbcType="DECIMAL" property="h6" />
<result column="h7" jdbcType="DECIMAL" property="h7" />
<result column="h8" jdbcType="DECIMAL" property="h8" />
<result column="h9" jdbcType="DECIMAL" property="h9" />
<result column="h10" jdbcType="DECIMAL" property="h10" />
<result column="h11" jdbcType="DECIMAL" property="h11" />
<result column="h12" jdbcType="DECIMAL" property="h12" />
<result column="h13" jdbcType="DECIMAL" property="h13" />
<result column="h14" jdbcType="DECIMAL" property="h14" />
<result column="h15" jdbcType="DECIMAL" property="h15" />
<result column="h16" jdbcType="DECIMAL" property="h16" />
<result column="h17" jdbcType="DECIMAL" property="h17" />
<result column="h18" jdbcType="DECIMAL" property="h18" />
<result column="h19" jdbcType="DECIMAL" property="h19" />
<result column="h20" jdbcType="DECIMAL" property="h20" />
<result column="h21" jdbcType="DECIMAL" property="h21" />
<result column="h22" jdbcType="DECIMAL" property="h22" />
<result column="h23" jdbcType="DECIMAL" property="h23" />
<result column="h24" jdbcType="DECIMAL" property="h24" />
<result column="h25" jdbcType="DECIMAL" property="h25" />
<result column="h26" jdbcType="DECIMAL" property="h26" />
<result column="h27" jdbcType="DECIMAL" property="h27" />
<result column="h28" jdbcType="DECIMAL" property="h28" />
<result column="h29" jdbcType="DECIMAL" property="h29" />
<result column="h30" jdbcType="DECIMAL" property="h30" />
<result column="h31" jdbcType="DECIMAL" property="h31" />
<result column="h32" jdbcType="DECIMAL" property="h32" />
<result column="h33" jdbcType="DECIMAL" property="h33" />
<result column="h34" jdbcType="DECIMAL" property="h34" />
<result column="h35" jdbcType="DECIMAL" property="h35" />
<result column="h36" jdbcType="DECIMAL" property="h36" />
<result column="h37" jdbcType="DECIMAL" property="h37" />
<result column="h38" jdbcType="DECIMAL" property="h38" />
<result column="h39" jdbcType="DECIMAL" property="h39" />
<result column="h40" jdbcType="DECIMAL" property="h40" />
<result column="h41" jdbcType="DECIMAL" property="h41" />
<result column="h42" jdbcType="DECIMAL" property="h42" />
<result column="h43" jdbcType="DECIMAL" property="h43" />
<result column="h44" jdbcType="DECIMAL" property="h44" />
<result column="h45" jdbcType="DECIMAL" property="h45" />
<result column="h46" jdbcType="DECIMAL" property="h46" />
<result column="h47" jdbcType="DECIMAL" property="h47" />
<result column="h48" jdbcType="DECIMAL" property="h48" />
<result column="h49" jdbcType="DECIMAL" property="h49" />
<result column="h50" jdbcType="DECIMAL" property="h50" />
<result column="Create_By" jdbcType="CHAR" property="createBy" />
<result column="Create_Time" jdbcType="TIMESTAMP" property="createTime" />
<result column="Update_By" jdbcType="CHAR" property="updateBy" />
<result column="Update_Time" jdbcType="TIMESTAMP" property="updateTime" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, cvt_name, cvt_model, h2, h3, h4, h5, h6, h7, h8, h9, h10, h11, h12, h13, h14,
h15, h16, h17, h18, h19, h20, h21, h22, h23, h24, h25, h26, h27, h28, h29, h30, h31,
h32, h33, h34, h35, h36, h37, h38, h39, h40, h41, h42, h43, h44, h45, h46, h47, h48,
h49, h50, Create_By, Create_Time, Update_By, Update_Time
</sql>
<select id="queryPage" resultType="com.njcn.device.pq.pojo.vo.CvtHarmonicCorrectionFactorsVO">
SELECT cvt_harmonic_correction_factors.*
FROM cvt_harmonic_correction_factors cvt_harmonic_correction_factors
WHERE ${ew.sqlSegment}
</select>
</mapper>

View File

@@ -0,0 +1,15 @@
<?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.device.pq.mapper.CvtLineRelationMapper">
<resultMap id="BaseResultMap" type="com.njcn.device.pq.pojo.po.CvtLineRelation">
<!--@mbg.generated-->
<!--@Table cvt_line_relation-->
<id column="id" jdbcType="VARCHAR" property="id" />
<result column="line_id" jdbcType="VARCHAR" property="lineId" />
<result column="cvt_id" jdbcType="VARCHAR" property="cvtId" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
id, line_id, cvt_id
</sql>
</mapper>

View File

@@ -340,4 +340,45 @@
bdName, bdName,
devName devName
</select> </select>
<select id="getPollutionDeviceInfo" resultType="com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO">
SELECT
line.id lineId,
gdinfo.NAME AS gdName,
substation.NAME AS subStationName,
device.NAME AS devName,
deviceDetail.Com_Flag AS comFlag,
lineDetail.power_Flag AS powerFlag,
lineDetail.business_type AS businessType,
lineDetail.load_type AS loadtype,
lineDetail.obj_name AS objName,
lineDetail.power_substation_name AS powerSubstationName,
deviceDetail.manufacturer AS manufacturer,
deviceDetail.dev_Type AS devType,
deviceDetail.login_Time AS loginTime,
deviceDetail.id deviceId,
pv.scale lineVoltage,
lineDetail.monitor_id monitorId
FROM
pq_line line,
pq_line_detail lineDetail,
pq_line subv,
pq_line device,
pq_device deviceDetail,
pq_line substation,
pq_line gdinfo,
pq_voltage pv
WHERE line.id in
<foreach collection="id" close=")" item="item" open="(" separator=",">
#{item}
</foreach>
AND line.id = lineDetail.id
AND line.pid = subv.id
AND subv.pid = device.id
AND device.id = deviceDetail.id
AND device.pid = substation.id
AND substation.pid = gdinfo.id
AND subv.id = pv.id
</select>
</mapper> </mapper>

View File

@@ -0,0 +1,7 @@
<?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.device.pq.mapper.DeviceProcessMapper">
</mapper>

View File

@@ -14,17 +14,22 @@
s2.Name manufacturer, s2.Name manufacturer,
pq_device.Com_Flag status, pq_device.Com_Flag status,
pq_device.Series series, pq_device.Series series,
pq_device_process.process_no processNo,
pq_device.Dev_Key devKey pq_device.Dev_Key devKey
FROM FROM
pq_node pq_node
LEFT JOIN pq_device ON pq_node.Id = pq_device.Node_Id LEFT JOIN pq_device ON pq_node.Id = pq_device.Node_Id
LEFT JOIN pq_line on pq_device.id = pq_line.id LEFT JOIN pq_line on pq_device.id = pq_line.id
LEFT JOIN pq_device_process on pq_device_process.id = pq_device.id
LEFT JOIN sys_dict_data s1 ON pq_device.Dev_Type = s1.id LEFT JOIN sys_dict_data s1 ON pq_device.Dev_Type = s1.id
LEFT JOIN sys_dict_data s2 ON pq_device.Manufacturer = s2.id LEFT JOIN sys_dict_data s2 ON pq_device.Manufacturer = s2.id
<where> <where>
<if test="nodeDeviceParam.ip!=null and nodeDeviceParam.ip != ''"> <if test="nodeDeviceParam.ip!=null and nodeDeviceParam.ip != ''">
pq_node.ip=#{nodeDeviceParam.ip} pq_node.ip=#{nodeDeviceParam.ip}
</if> </if>
<if test="nodeDeviceParam.devId!=null and nodeDeviceParam.devId != ''">
pq_device.id=#{nodeDeviceParam.devId}
</if>
<if test="nodeDeviceParam.runFlag!=null and nodeDeviceParam.runFlag.size()!=0"> <if test="nodeDeviceParam.runFlag!=null and nodeDeviceParam.runFlag.size()!=0">
AND pq_device.Run_Flag in AND pq_device.Run_Flag in
<foreach collection="nodeDeviceParam.runFlag" open="(" close=")" item="item" separator=","> <foreach collection="nodeDeviceParam.runFlag" open="(" close=")" item="item" separator=",">

View File

@@ -158,8 +158,10 @@
gd.name electricPowerCompany, gd.name electricPowerCompany,
b.IP DeviceIP, b.IP DeviceIP,
b.id deviceId, b.id deviceId,
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal, -- ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
ifnull(convert(m.Actual_Value/1024/1024,decimal(7,2)),0) statisValue -- ifnull(convert(m.Actual_Value/1024/1024,decimal(7,2)),0) statisValue
COALESCE(d.flow, (SELECT flow FROM cld_flow_meal WHERE type = 0 AND flag = 1)) + COALESCE(d1.flow, 0) AS flowMeal,
COALESCE(CAST(m.Actual_Value / 1024 / 1024 AS DECIMAL(7, 2)), 0) AS statisValue
FROM pq_line a FROM pq_line a
INNER JOIN pq_line sub ON sub.id = a.pid INNER JOIN pq_line sub ON sub.id = a.pid
INNER JOIN pq_line gd ON gd.id = sub.pid INNER JOIN pq_line gd ON gd.id = sub.pid

View File

@@ -0,0 +1,30 @@
package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import com.njcn.device.pq.pojo.param.CvtHarmonicCorrectionFactorsParam;
import com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.pq.pojo.vo.CvtHarmonicCorrectionFactorsVO;
import java.util.List;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CvtHarmonicCorrectionFactorsService extends IService<CvtHarmonicCorrectionFactors>{
boolean add(CvtHarmonicCorrectionFactorsParam cvtHarmonicCorrectionFactorsParam);
boolean updateCvt(CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamUpdateParam updateParam);
Page<CvtHarmonicCorrectionFactorsVO> queryPage(CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamQueryParam queryParam);
List<CvtHarmonicCorrectionFactorsDTO> queryList(CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamQueryParam queryParam);
}

View File

@@ -0,0 +1,21 @@
package com.njcn.device.pq.service;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import com.njcn.device.pq.pojo.param.CvtLineRelationParam;
import com.njcn.device.pq.pojo.po.CvtLineRelation;
import com.baomidou.mybatisplus.extension.service.IService;
/**
*
* Description:
* Date: 2025/02/11 上午 9:22【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CvtLineRelationService extends IService<CvtLineRelation>{
boolean add(CvtLineRelationParam cvtLineRelationParam);
CvtHarmonicCorrectionFactorsDTO queryByLineId(String lineId);
}

View File

@@ -0,0 +1,16 @@
package com.njcn.device.pq.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.biz.pojo.po.DeviceBak;
import com.njcn.device.pq.pojo.po.DeviceProcess;
/**
* 监测点类
* @author denghuajun
* @date 2022/2/23
*
*/
public interface DeviceProcessService extends IService<DeviceProcess> {
}

View File

@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO; import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineDTO; import com.njcn.device.biz.pojo.dto.PollutionLineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.pq.pojo.dto.PollutionParamDTO; import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.param.*;
@@ -234,4 +235,10 @@ public interface LineService extends IService<Line> {
List<String> getLevelMonitorByDept(@RequestParam("level") String level, @RequestParam("deptId")String deptId); List<String> getLevelMonitorByDept(@RequestParam("level") String level, @RequestParam("deptId")String deptId);
/**
* 获取污区值监测点相关信息
* @author hongawen
*/
List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> id);
} }

View File

@@ -16,4 +16,6 @@ import java.util.List;
public interface NodeDeviceService { public interface NodeDeviceService {
List<DeviceInfo> nodeDeviceList(NodeDeviceParam nodeDeviceParam); List<DeviceInfo> nodeDeviceList(NodeDeviceParam nodeDeviceParam);
void oneKeyDistribution(String nodeId);
} }

View File

@@ -49,6 +49,14 @@ public interface TerminalBaseService {
*/ */
TerminalVO queryTerminal(String id); TerminalVO queryTerminal(String id);
/**
* 终端查询操作
* @param devName 设备名称
* @author cdf
* @date 2021/7/19
*/
Line queryTerminalByName(String devName);
/** /**
* 终端删除操作 * 终端删除操作
* @param id 设备id * @param id 设备id
@@ -275,4 +283,9 @@ public interface TerminalBaseService {
* @return * @return
*/ */
Boolean terminalSyncDeleteFly(String lineId); Boolean terminalSyncDeleteFly(String lineId);
//通知前置重启设备
void askRestartProcess(Integer processNo,String processType,String deviceRebootType);
void askRestartDevice(String devId, String deviceRebootType);
} }

View File

@@ -186,7 +186,7 @@ public class CommTerminalServiceImpl implements CommTerminalService {
public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type) { public List<DeptGetDeviceDTO> deptGetDevice(DeptGetLineParam deptGetLineParam,Integer type) {
List<DeptGetDeviceDTO> result = new ArrayList<>(); List<DeptGetDeviceDTO> result = new ArrayList<>();
List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam); List<DeptGetBase> temDept = getDeptChildrenByParent(deptGetLineParam);
Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),3,deptGetLineParam.getLineRunFlag()); Map<String, List<LineDevGetDTO>> map = deptLineService.lineDevGet(filterDataTypeNew(deptGetLineParam.getServerName()),type,deptGetLineParam.getLineRunFlag());
temDept.forEach(item -> { temDept.forEach(item -> {
DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO(); DeptGetDeviceDTO deptGetDeviceDTO = new DeptGetDeviceDTO();
deptGetDeviceDTO.setUnitId(item.getUnitId()); deptGetDeviceDTO.setUnitId(item.getUnitId());

View File

@@ -0,0 +1,136 @@
package com.njcn.device.pq.service.impl;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.common.pojo.constant.PatternRegex;
import com.njcn.common.pojo.enums.common.DataStateEnum;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pms.pojo.po.Monitor;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import com.njcn.device.pq.pojo.param.CvtHarmonicCorrectionFactorsParam;
import com.njcn.device.pq.pojo.vo.CvtHarmonicCorrectionFactorsVO;
import com.njcn.web.constant.ValidMessage;
import com.njcn.web.factory.PageFactory;
import com.njcn.web.utils.RequestUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.pq.mapper.CvtHarmonicCorrectionFactorsMapper;
import com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors;
import com.njcn.device.pq.service.CvtHarmonicCorrectionFactorsService;
import org.springframework.transaction.annotation.Transactional;
/**
*
* Description:
* Date: 2025/02/10 下午 1:45【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class CvtHarmonicCorrectionFactorsServiceImpl extends ServiceImpl<CvtHarmonicCorrectionFactorsMapper, CvtHarmonicCorrectionFactors> implements CvtHarmonicCorrectionFactorsService{
@Override
@Transactional(rollbackFor = Exception.class)
public boolean add(CvtHarmonicCorrectionFactorsParam cvtHarmonicCorrectionFactorsParam) {
//校验
checkParam(cvtHarmonicCorrectionFactorsParam, false);
CvtHarmonicCorrectionFactors cvtHarmonicCorrectionFactors = new CvtHarmonicCorrectionFactors();
BeanUtils.copyProperties(cvtHarmonicCorrectionFactorsParam,cvtHarmonicCorrectionFactors);
boolean save = this.save(cvtHarmonicCorrectionFactors);
return save;
}
@Override
public boolean updateCvt(CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamUpdateParam updateParam) {
//校验
checkParam(updateParam, true);
CvtHarmonicCorrectionFactors cvtHarmonicCorrectionFactors = new CvtHarmonicCorrectionFactors();
BeanUtils.copyProperties(updateParam,cvtHarmonicCorrectionFactors);
boolean update = this.updateById(cvtHarmonicCorrectionFactors);
return update;
}
@Override
public Page<CvtHarmonicCorrectionFactorsVO> queryPage(CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamQueryParam queryParam) {
QueryWrapper<CvtHarmonicCorrectionFactorsVO> queryWrapper = new QueryWrapper<>();
if (Objects.nonNull(queryParam)) {
if (StringUtils.isNotEmpty(queryParam.getSearchBeginTime()) && StringUtils.isNotEmpty(queryParam.getSearchEndTime())) {
queryWrapper.between("cvt_harmonic_correction_factors.create_time",
DateUtil.beginOfDay(DateUtil.parse(queryParam.getSearchBeginTime())),
DateUtil.endOfDay(DateUtil.parse(queryParam.getSearchEndTime())));
}
queryWrapper.and(temp->temp.like("cvt_harmonic_correction_factors.cvt_name", queryParam.getSearchValue())
.or()
.like("cvt_harmonic_correction_factors.cvt_model", queryParam.getSearchValue()));
}
queryWrapper
.orderByDesc("cvt_harmonic_correction_factors.Update_Time");
Page<CvtHarmonicCorrectionFactorsVO> page = this.baseMapper.queryPage(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
return page;
}
@Override
public List<CvtHarmonicCorrectionFactorsDTO> queryList(CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamQueryParam queryParam) {
List<CvtHarmonicCorrectionFactorsDTO> result = new ArrayList<>();
List<CvtHarmonicCorrectionFactors> list = this.lambdaQuery().and(item -> item.like(CvtHarmonicCorrectionFactors::getCvtName, queryParam.getSearchValue()).or()
.like(CvtHarmonicCorrectionFactors::getCvtModel, queryParam.getSearchValue())).list();
if(CollectionUtil.isNotEmpty(list)){
result = list.stream().map(temp->{
CvtHarmonicCorrectionFactorsDTO cvtHarmonicCorrectionFactorsDTO = new CvtHarmonicCorrectionFactorsDTO();
BeanUtils.copyProperties(temp,cvtHarmonicCorrectionFactorsDTO);
return cvtHarmonicCorrectionFactorsDTO;
}).collect(Collectors.toList());
}
return result;
}
private void checkParam(CvtHarmonicCorrectionFactorsParam cvtHarmonicCorrectionFactorsParam, Boolean updateFlag) {
// Pattern pattern = Pattern.compile(PatternRegex.SPECIALCHARACTER);
// if(pattern.matcher(cvtHarmonicCorrectionFactorsParam.getCvtName()).find()){
// throw new BusinessException(ValidMessage.NAME_SPECIAL_REGEX);
// }
// if(pattern.matcher(cvtHarmonicCorrectionFactorsParam.getCvtModel()).find()){
// throw new BusinessException(ValidMessage.NAME_SPECIAL_REGEX);
// }
LambdaQueryWrapper<CvtHarmonicCorrectionFactors> lambdaQueryWrapper = new LambdaQueryWrapper<>();
lambdaQueryWrapper.and(item->item.eq(CvtHarmonicCorrectionFactors::getCvtName,cvtHarmonicCorrectionFactorsParam.getCvtName()).or()
.eq(CvtHarmonicCorrectionFactors::getCvtModel,cvtHarmonicCorrectionFactorsParam.getCvtModel()));
if (updateFlag) {
if (cvtHarmonicCorrectionFactorsParam instanceof CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamUpdateParam) {
//修改
lambdaQueryWrapper.ne(CvtHarmonicCorrectionFactors::getId, ((CvtHarmonicCorrectionFactorsParam.CvtHarmonicCorrectionFactorsParamUpdateParam) cvtHarmonicCorrectionFactorsParam).getId());
}
}
int count = this.count(lambdaQueryWrapper);
if (count > 0) {
throw new BusinessException("存在同名cvt名称或cvt型号");
}
}
}

View File

@@ -0,0 +1,59 @@
package com.njcn.device.pq.service.impl;
import com.njcn.device.pq.pojo.dto.CvtHarmonicCorrectionFactorsDTO;
import com.njcn.device.pq.pojo.param.CvtLineRelationParam;
import com.njcn.device.pq.pojo.po.CvtHarmonicCorrectionFactors;
import com.njcn.device.pq.service.CvtHarmonicCorrectionFactorsService;
import lombok.AllArgsConstructor;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
import java.util.Objects;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.pq.pojo.po.CvtLineRelation;
import com.njcn.device.pq.mapper.CvtLineRelationMapper;
import com.njcn.device.pq.service.CvtLineRelationService;
/**
*
* Description:
* Date: 2025/02/11 上午 9:22【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@AllArgsConstructor
public class CvtLineRelationServiceImpl extends ServiceImpl<CvtLineRelationMapper, CvtLineRelation> implements CvtLineRelationService{
private final CvtHarmonicCorrectionFactorsService cvtHarmonicCorrectionFactorsService;
@Override
public boolean add(CvtLineRelationParam cvtLineRelationParam) {
CvtLineRelation one = this.lambdaQuery().eq(CvtLineRelation::getLineId, cvtLineRelationParam.getLineId()).one();
if(Objects.isNull(one)){
CvtLineRelation cvtLineRelation = new CvtLineRelation();
BeanUtils.copyProperties(cvtLineRelationParam,cvtLineRelation);
this.save(cvtLineRelation);
}else {
one.setCvtId(cvtLineRelationParam.getCvtId());
this.updateById(one);
}
return true;
}
@Override
public CvtHarmonicCorrectionFactorsDTO queryByLineId(String lineId) {
CvtHarmonicCorrectionFactorsDTO cvtHarmonicCorrectionFactorsDTO = new CvtHarmonicCorrectionFactorsDTO();
CvtLineRelation one = this.lambdaQuery().eq(CvtLineRelation::getLineId, lineId).one();
if(Objects.nonNull(one)&& StringUtils.isNotEmpty(one.getCvtId())){
CvtHarmonicCorrectionFactors byId = cvtHarmonicCorrectionFactorsService.getById(one.getCvtId());
BeanUtils.copyProperties(byId,cvtHarmonicCorrectionFactorsDTO);
}
return cvtHarmonicCorrectionFactorsDTO;
}
}

View File

@@ -0,0 +1,23 @@
package com.njcn.device.pq.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.device.biz.pojo.po.DeviceBak;
import com.njcn.device.pq.mapper.DeviceBakMapper;
import com.njcn.device.pq.mapper.DeviceProcessMapper;
import com.njcn.device.pq.pojo.po.Device;
import com.njcn.device.pq.pojo.po.DeviceProcess;
import com.njcn.device.pq.service.DeviceProcessService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* Description:
* Date: 2025/01/22 下午 1:59【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
@RequiredArgsConstructor
public class DeviceProcessServiceImpl extends ServiceImpl<DeviceProcessMapper, DeviceProcess> implements DeviceProcessService {
}

View File

@@ -19,6 +19,7 @@ import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.enums.DeviceResponseEnum; import com.njcn.device.biz.enums.DeviceResponseEnum;
import com.njcn.device.biz.pojo.dto.LineALLInfoDTO; import com.njcn.device.biz.pojo.dto.LineALLInfoDTO;
import com.njcn.device.biz.pojo.dto.LineDTO; import com.njcn.device.biz.pojo.dto.LineDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.biz.pojo.po.Overlimit; import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.device.pq.enums.LineBaseEnum; import com.njcn.device.pq.enums.LineBaseEnum;
import com.njcn.device.pq.mapper.*; import com.njcn.device.pq.mapper.*;
@@ -738,6 +739,39 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
return result; return result;
} }
@Override
public List<PollutionLineInfoDTO> getPollutionLineInfo(List<String> lineId) {
List<PollutionLineInfoDTO> pollutionLineInfoDTOList;
// 获取终端信息
pollutionLineInfoDTOList = deviceMapper.getPollutionDeviceInfo(lineId);
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_MANUFACTURER.getCode()).getData();
List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_TYPE.getCode()).getData();
List<DictData> businessTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.BUSINESS_TYPE.getCode()).getData();
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getCode()).getData();
List<DictData> voltageList = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.DEV_VOLTAGE_STAND.getCode()).getData();
for (PollutionLineInfoDTO pollutionLineInfoDTO : pollutionLineInfoDTOList) {
// 制造厂商
Optional<DictData> temp = manufacturerList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getManufacturer())).findAny();
pollutionLineInfoDTO.setManufacturer(temp.map(DictData::getName).orElse(null));
// 终端类型
Optional<DictData> temp1 = devTypeList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getDevType())).findAny();
pollutionLineInfoDTO.setDevType(temp1.map(DictData::getName).orElse(null));
// 行业类型
Optional<DictData> temp2 = businessTypeList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getBusinessType())).findAny();
pollutionLineInfoDTO.setBusinessType(temp2.map(DictData::getName).orElse(null));
// 干扰源类型
Optional<DictData> temp3 = loadTypeList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getLoadType())).findAny();
pollutionLineInfoDTO.setLoadType(temp3.map(DictData::getName).orElse(null));
// 电压等级
Optional<DictData> temp4 = voltageList.stream().filter(item -> item.getId().equals(pollutionLineInfoDTO.getLineVoltage())).findAny();
pollutionLineInfoDTO.setLineVoltage(temp4.map(DictData::getName).orElse(null));
// 电网侧
pollutionLineInfoDTO.setPowerFlag(pollutionLineInfoDTO.getPowerFlag().equals("0") ? "电网侧" : "非电网侧");
}
return pollutionLineInfoDTOList;
}
@Override @Override
public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) { public List<Overlimit> getOverLimitByList(PollutionParamDTO pollutionParamDTO) {
return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList()); return overlimitMapper.selectBatchIds(pollutionParamDTO.getLineList());

View File

@@ -1,15 +1,28 @@
package com.njcn.device.pq.service.impl; package com.njcn.device.pq.service.impl;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.device.pq.enums.PvDeviceResponseEnum;
import com.njcn.device.pq.mapper.DeviceMapper;
import com.njcn.device.pq.mapper.LineMapper; import com.njcn.device.pq.mapper.LineMapper;
import com.njcn.device.pq.mapper.NodeMapper; import com.njcn.device.pq.mapper.NodeMapper;
import com.njcn.device.pq.pojo.dto.DeviceInfo; import com.njcn.device.pq.pojo.dto.DeviceInfo;
import com.njcn.device.pq.pojo.dto.MonitorInfo; import com.njcn.device.pq.pojo.dto.MonitorInfo;
import com.njcn.device.pq.pojo.param.NodeDeviceParam; import com.njcn.device.pq.pojo.param.NodeDeviceParam;
import com.njcn.device.pq.pojo.po.Device;
import com.njcn.device.pq.pojo.po.DeviceProcess;
import com.njcn.device.pq.pojo.po.Node;
import com.njcn.device.pq.service.DeviceProcessService;
import com.njcn.device.pq.service.IDeviceService;
import com.njcn.device.pq.service.NodeDeviceService; import com.njcn.device.pq.service.NodeDeviceService;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/** /**
* Description: * Description:
@@ -23,6 +36,8 @@ import java.util.List;
public class NodeDeviceServiceImpl implements NodeDeviceService { public class NodeDeviceServiceImpl implements NodeDeviceService {
private final NodeMapper nodeMapper; private final NodeMapper nodeMapper;
private final LineMapper lineMapper; private final LineMapper lineMapper;
private final IDeviceService iDeviceService;
private final DeviceProcessService deviceProcessService;
@Override @Override
public List<DeviceInfo> nodeDeviceList(NodeDeviceParam nodeDeviceParam) { public List<DeviceInfo> nodeDeviceList(NodeDeviceParam nodeDeviceParam) {
@@ -34,4 +49,37 @@ public class NodeDeviceServiceImpl implements NodeDeviceService {
return list; return list;
} }
@Override
public void oneKeyDistribution(String nodeId) {
Node node = nodeMapper.selectById(nodeId);
Integer nodeDevNum = node.getNodeDevNum();
Integer maxProcessNum = node.getMaxProcessNum();
List<Device> list = iDeviceService.lambdaQuery().eq(Device::getNodeId, nodeId).list();
if(CollectionUtils.isEmpty(list)){
throw new BusinessException(PvDeviceResponseEnum.NO_DEVICE);
}
List<String> deviceIdList = list.stream().map(Device::getId).collect(Collectors.toList());
List<DeviceProcess> deviceProcessList = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, deviceIdList).list();
Integer devNum = list.size();
if(nodeDevNum<devNum){
throw new BusinessException(PvDeviceResponseEnum.OVER_LIMIT);
}
//单个进程支持最大装置数
int maxDevNum = nodeDevNum / maxProcessNum;
List<List<DeviceProcess>> partition = ListUtils.partition(deviceProcessList, maxProcessNum);
for (int i = 0; i < partition.size(); i++) {
int processNo = i+1;
partition.get(i).forEach(temp->{
temp.setProcessNo(processNo);
});
}
List<DeviceProcess> collect = partition.stream().flatMap(List::stream).collect(Collectors.toList());
//更新进程号
deviceProcessService.updateBatchById(collect);
}
} }

View File

@@ -37,6 +37,7 @@ import com.njcn.device.pq.pojo.bo.excel.NodeExcel;
import com.njcn.device.pq.pojo.bo.excel.OracleTerminalExcel; import com.njcn.device.pq.pojo.bo.excel.OracleTerminalExcel;
import com.njcn.device.pq.pojo.bo.excel.OverLimitExcel; import com.njcn.device.pq.pojo.bo.excel.OverLimitExcel;
import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel; import com.njcn.device.pq.pojo.bo.excel.TerminalBaseExcel;
import com.njcn.device.pq.pojo.dto.DeviceInfo;
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO; import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
import com.njcn.device.pq.pojo.param.*; import com.njcn.device.pq.pojo.param.*;
import com.njcn.device.pq.pojo.param.oracle.*; import com.njcn.device.pq.pojo.param.oracle.*;
@@ -45,6 +46,10 @@ import com.njcn.device.pq.pojo.vo.*;
import com.njcn.device.pq.service.*; import com.njcn.device.pq.service.*;
import com.njcn.device.pq.utils.DeviceUtil; import com.njcn.device.pq.utils.DeviceUtil;
import com.njcn.device.pq.utils.ExcelStyleUtil; import com.njcn.device.pq.utils.ExcelStyleUtil;
import com.njcn.message.api.ProduceFeignClient;
import com.njcn.message.constant.DeviceRebootType;
import com.njcn.message.message.DeviceRebootMessage;
import com.njcn.message.message.ProcessRebootMessage;
import com.njcn.oss.constant.OssPath; import com.njcn.oss.constant.OssPath;
import com.njcn.oss.utils.FileStorageUtil; import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.poi.excel.ExcelUtil; import com.njcn.poi.excel.ExcelUtil;
@@ -107,7 +112,9 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
private final FileStorageUtil fileStorageUtil; private final FileStorageUtil fileStorageUtil;
private final RedisUtil redisUtil; private final RedisUtil redisUtil;
private final NodeDeviceService nodeDeviceService;
private final DeviceProcessService deviceProcessService;
private final ProduceFeignClient produceFeignClient;
@Value("${oracle.isSync}") @Value("${oracle.isSync}")
private Boolean isSync; private Boolean isSync;
@@ -274,8 +281,39 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
deviceDetail.setUpdateTime(LocalDateTime.now()); deviceDetail.setUpdateTime(LocalDateTime.now());
//处理装置识别码秘钥 //处理装置识别码秘钥
coderM3d(deviceDetail,false); coderM3d(deviceDetail, false);
deviceMapper.insert(deviceDetail); deviceMapper.insert(deviceDetail);
//添加装置进程号
Node nodeById = nodeService.getNodeById(deviceDetail.getNodeId());
List<Device> devices = deviceMapper.selectList(new QueryWrapper<Device>().lambda().eq(Device::getNodeId, deviceDetail.getNodeId()));
Integer maxNodeDevNum = nodeById.getNodeDevNum();
Integer maxProcessNum = nodeById.getMaxProcessNum();
if (devices.size() >= maxNodeDevNum) {
throw new BusinessException(PvDeviceResponseEnum.OVER_LIMIT);
}
List<String> deviceIdList = devices.stream().map(Device::getId).collect(Collectors.toList());
List<DeviceProcess> deviceProcessList = deviceProcessService.lambdaQuery().in(DeviceProcess::getId, deviceIdList).list();
Map<Integer, Integer> processCountMap = null;
if (Objects.nonNull(maxProcessNum)) {
processCountMap = new HashMap<>();
for (int i = 0; i < maxProcessNum; i++) {
Integer processNum = i + 1;
long count = deviceProcessList.stream().filter(temp -> Objects.equals(temp.getProcessNo(), processNum)).count();
Integer processCount = Math.toIntExact(count);
processCountMap.put(processNum, processCount);
}
}
//获取数量最少的线程号
Optional<Integer> minKey = processCountMap.entrySet()
.stream()
.min(Comparator.comparingInt(e -> e.getValue()))
.map(Map.Entry::getKey);
DeviceProcess deviceProcess = new DeviceProcess();
deviceProcess.setId(device.getId());
deviceProcess.setProcessNo(minKey.orElse(1));
deviceProcessService.saveOrUpdate(deviceProcess);
//装置功能 //装置功能
List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData(); List<DictData> funList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_FUN.getName()).getData();
if (CollectionUtil.isEmpty(funList)) { if (CollectionUtil.isEmpty(funList)) {
@@ -1192,6 +1230,12 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
} }
@Override
public Line queryTerminalByName(String devName) {
Line one = this.lambdaQuery().eq(Line::getName, devName).one();
return one;
}
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Boolean delTerminal(String id) { public Boolean delTerminal(String id) {
@@ -3515,5 +3559,68 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
throw new BusinessException("字典转换异常"); throw new BusinessException("字典转换异常");
} }
}
@Override
public void askRestartProcess(Integer processNum,String processType, String processRebootType) {
ProcessRebootMessage procesRebootMessage = new ProcessRebootMessage();
procesRebootMessage.setIndex(processNum);
List<ProcessRebootMessage.RebootData> list = new ArrayList<>();
ProcessRebootMessage.RebootData rebootData = new ProcessRebootMessage.RebootData();
rebootData.setFun(processType);
rebootData.setProcessNum(processNum);
rebootData.setFrontType(processRebootType);
list.add(rebootData);
procesRebootMessage.setData(list);
produceFeignClient.askRestartProcess(procesRebootMessage);
}
@Override
public void askRestartDevice(String devId, String deviceRebootType) {
DeviceProcess one = deviceProcessService.lambdaQuery().eq(DeviceProcess::getId, devId).one();
DeviceRebootMessage deviceRebootMessage = new DeviceRebootMessage();
deviceRebootMessage.setCode(deviceRebootType);
if(Objects.equals(deviceRebootType, DeviceRebootType.DELETE_TERMINAL)){
DeviceRebootMessage.DeviceInfo deviceInfo = new DeviceRebootMessage.DeviceInfo();
deviceInfo.setId(devId);
List<DeviceRebootMessage.DeviceInfo> list = new ArrayList<>();
list.add(deviceInfo);
deviceRebootMessage.setData(list);
deviceRebootMessage.setIndex(one.getProcessNo());
produceFeignClient.askRestartDevice(deviceRebootMessage);
//删除设备进程关系
deviceProcessService.removeById(devId);
}else {
NodeDeviceParam nodeDeviceParam = new NodeDeviceParam();
nodeDeviceParam.setDevId(devId);
List<DeviceInfo> deviceInfos = nodeDeviceService.nodeDeviceList(nodeDeviceParam);
if (CollectionUtil.isNotEmpty(deviceInfos)){
deviceRebootMessage.setIndex(one.getProcessNo());
DeviceInfo deviceInfo = deviceInfos.get(0);
DeviceRebootMessage.DeviceInfo deviceInfo1 = new DeviceRebootMessage.DeviceInfo();
BeanUtils.copyProperties(deviceInfo,deviceInfo1);
List<DeviceRebootMessage.DeviceInfo.MonitorInfo> monitorInfoList=deviceInfo.getMonitorData().stream().map(tempMonitorInfo->{
DeviceRebootMessage.DeviceInfo.MonitorInfo m = new DeviceRebootMessage.DeviceInfo.MonitorInfo();
BeanUtils.copyProperties(tempMonitorInfo,m);
return m;
}).collect(Collectors.toList());
deviceInfo1.setMonitorData(monitorInfoList);
List<DeviceRebootMessage.DeviceInfo> list = new ArrayList<>();
list.add(deviceInfo1);
deviceRebootMessage.setData(list);
produceFeignClient.askRestartDevice(deviceRebootMessage);
}
}
} }
} }

View File

@@ -0,0 +1,37 @@
package com.njcn.event.pojo.dto;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
@Data
@NoArgsConstructor
@AllArgsConstructor
public class EventCount implements Serializable {
private String lineId;
/**
* 暂升次数 1.1~1.8
* 10ms ~ 1min
*/
private int upCounts;
/**
* 暂降次数 0.1~0.9
* 10ms ~ 1min
*/
private int downCounts;
/**
* 短时中断 0~0.1
* 10ms ~ 1min
*/
private int breakCounts;
public EventCount(String lineId) {
this.lineId = lineId;
}
}

View File

@@ -0,0 +1,36 @@
package com.njcn.event.utils;
import java.text.DecimalFormat;
/**
* Description:暂态事件工具类
* Date: 2025/03/12 上午 9:26【需求编号】
*
* @author clam
* @version V1.0.0
*/
public class EventUtil {
/**
* @Description: 暂态严重度计算
* @Param: persisttime持续时间毫秒eventvaule暂减深度
* @return: java.lang.String
* @Author: clam
* @Date: 2025/03/12
*/
public static String getYzd(Float persisttime, Float eventvaule) {
float yzd;
DecimalFormat df = new DecimalFormat("0.000");// 格式化小数
if (persisttime <= 20) {
yzd = 1 - eventvaule;
} else if (persisttime > 20 && persisttime <= 200) {
yzd = 2 * (1 - eventvaule);
} else if (persisttime > 200 && persisttime <= 500) {
yzd = 3.3f * (1 - eventvaule);
} else if (persisttime > 500 && persisttime <= 10000) {
yzd = 5 * (1 - eventvaule);
} else {
yzd = 10 * (1 - eventvaule);
}
return df.format(yzd);
}
}

View File

@@ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.event.utils.EventUtil;
import com.njcn.event.mapper.majornetwork.EventDetailMapper; import com.njcn.event.mapper.majornetwork.EventDetailMapper;
import com.njcn.event.pojo.dto.EventDeatilDTO; import com.njcn.event.pojo.dto.EventDeatilDTO;
import com.njcn.event.pojo.po.EventDetail; import com.njcn.event.pojo.po.EventDetail;
@@ -133,10 +134,12 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
rmpEventDetailPO.setEventType(data.getId()); rmpEventDetailPO.setEventType(data.getId());
rmpEventDetailPO.setStartTime(deatilDTO.getStartTime()); rmpEventDetailPO.setStartTime(deatilDTO.getStartTime());
rmpEventDetailPO.setDuration(deatilDTO.getDuration()/1000); rmpEventDetailPO.setDuration(deatilDTO.getDuration()/1000);
rmpEventDetailPO.setFeatureAmplitude(deatilDTO.getAmplitude()); rmpEventDetailPO.setFeatureAmplitude(deatilDTO.getAmplitude()/100);
rmpEventDetailPO.setPhase(deatilDTO.getPhase()); rmpEventDetailPO.setPhase(deatilDTO.getPhase());
rmpEventDetailPO.setWavePath(deatilDTO.getWavePath()); rmpEventDetailPO.setWavePath(deatilDTO.getWavePath());
rmpEventDetailPO.setEventDescribe(" "); rmpEventDetailPO.setEventDescribe(" ");
String severity = EventUtil.getYzd(deatilDTO.getDuration().floatValue(),(deatilDTO.getAmplitude().floatValue()/100));
rmpEventDetailPO.setSeverity(Double.valueOf(severity));
rmpEventDetailPO.setCreateTime(LocalDateTime.now()); rmpEventDetailPO.setCreateTime(LocalDateTime.now());
RmpEventDetailPO one = this.lambdaQuery().eq(RmpEventDetailPO::getLineId, rmpEventDetailPO.getLineId()).eq(RmpEventDetailPO::getStartTime, rmpEventDetailPO.getStartTime()).one(); RmpEventDetailPO one = this.lambdaQuery().eq(RmpEventDetailPO::getLineId, rmpEventDetailPO.getLineId()).eq(RmpEventDetailPO::getStartTime, rmpEventDetailPO.getStartTime()).one();

View File

@@ -196,7 +196,7 @@ public class TransientServiceImpl implements TransientService {
ip = monitorVO.getIp(); ip = monitorVO.getIp();
} }
String waveName = eventDetail.getWavePath(); String waveName = eventDetail.getWavePath();
String cfgPath, datPath; String cfgPath, datPath,cfgPath2,datPath2;
if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) { if (generalInfo.getBusinessWaveFileStorage() == GeneralConstant.LOCAL_DISK) {
cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG; cfgPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.CFG;
datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT; datPath = generalInfo.getBusinessWavePath() + File.separator + ip + File.separator + waveName + GeneralConstant.DAT;
@@ -210,6 +210,9 @@ public class TransientServiceImpl implements TransientService {
} else { } else {
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG; cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT; datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
//适配文件后缀小写
cfgPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG.toLowerCase();
datPath2 = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT.toLowerCase();
log.info("文件服务器波形文件路径----"+cfgPath); log.info("文件服务器波形文件路径----"+cfgPath);
try ( try (
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath); InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath);
@@ -220,7 +223,17 @@ public class TransientServiceImpl implements TransientService {
} }
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1); waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID); try {
InputStream cfgStream = fileStorageUtil.getFileStream(cfgPath2);
InputStream datStream = fileStorageUtil.getFileStream(datPath2);
if (Objects.isNull(cfgStream) || Objects.isNull(datStream)) {
throw new BusinessException(WaveFileResponseEnum.ANALYSE_WAVE_NOT_FOUND);
}
waveDataDTO = waveFileComponent.getComtrade(cfgStream, datStream, 1);
}catch (Exception e1){
throw new BusinessException(WaveFileResponseEnum.WAVE_DATA_INVALID);
}
} }
} }
waveDataDTO = waveFileComponent.getValidData(waveDataDTO); waveDataDTO = waveFileComponent.getValidData(waveDataDTO);
@@ -382,7 +395,7 @@ public class TransientServiceImpl implements TransientService {
List<DictData> typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData(); List<DictData> typeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.EVENT_TYPE.getName()).getData();
for (EventDetailNew eventDetail : eventDetailData) { for (EventDetailNew eventDetail : eventDetailData) {
DecimalFormat df = new DecimalFormat("#0.000"); DecimalFormat df = new DecimalFormat("#0.000");
eventDetail.setSeverity(Double.parseDouble(df.format(eventDetail.getSeverity()))); eventDetail.setSeverity(Double.parseDouble(df.format(Objects.isNull(eventDetail.getSeverity())?0.00:eventDetail.getSeverity())));
for (AreaLineInfoVO areaLineInfoVO : r) { for (AreaLineInfoVO areaLineInfoVO : r) {
if (eventDetail.getLineId().equals(areaLineInfoVO.getLineId())) { if (eventDetail.getLineId().equals(areaLineInfoVO.getLineId())) {
eventDetail.setLineId(areaLineInfoVO.getLineId()); eventDetail.setLineId(areaLineInfoVO.getLineId());

View File

@@ -443,7 +443,8 @@ public class HistoryResultServiceImpl implements HistoryResultService {
//谐波电压含有率 //谐波电压含有率
if (number == 1) { if (number == 1) {
targetName = "基波电压幅值"; targetName = "基波电压幅值";
sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_harmrate_v WHERE " + stringBuilder + //修改幅值表
sql = "SELECT time as time, v_1 as aValue ," + InfluxDBTableConstant.PHASIC_TYPE + " FROM data_v WHERE " + stringBuilder +
" and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');"; " and (phasic_type ='A' or phasic_type ='B' or phasic_type ='C') order by time asc tz('Asia/Shanghai');";
unit.add(pqsDeviceUnit.getPhaseVoltage()); unit.add(pqsDeviceUnit.getPhaseVoltage());
} else { } else {

View File

@@ -56,13 +56,12 @@ public class RMpWpPowerDetailMServiceImpl extends ServiceImpl<RMpWpPowerDetailMM
@Override @Override
public Page<RMpWpPowerDetailVO> getWindFarmDetailInfo(PowerQualityParam.PowerQualityInfoParam param) { public Page<RMpWpPowerDetailVO> getWindFarmDetailInfo(PowerQualityParam.PowerQualityInfoParam param) {
//获取部门id集合 //获取部门id集合
List<DeptDTO> deptDTOS = deptFeignClient.getDepSonDetailByDeptId(param.getId()).getData(); List<String> codeIds = deptFeignClient.getDepSonSelfCodetByDeptId(param.getId()).getData();
List<String> deptIds = deptDTOS.stream().map(DeptDTO::getCode).collect(Collectors.toList());
//根据条件查询单位下面的所有配网监测点 //根据条件查询单位下面的所有配网监测点
PmsMonitorParam pmsMonitorParam = new PmsMonitorParam(); PmsMonitorParam pmsMonitorParam = new PmsMonitorParam();
//单位id //单位id
pmsMonitorParam.setOrgIds(deptIds); pmsMonitorParam.setOrgIds(codeIds);
pmsMonitorParam.setMonitorTag(param.getMonitorTag()); pmsMonitorParam.setMonitorTag(param.getMonitorTag());
pmsMonitorParam.setIsSpecialMonitor(1); pmsMonitorParam.setIsSpecialMonitor(1);

View File

@@ -6,6 +6,7 @@ import com.njcn.prepare.harmonic.api.liteflow.fallback.LiteFlowFeignClientFallba
import com.njcn.prepare.harmonic.pojo.bo.BaseParam; import com.njcn.prepare.harmonic.pojo.bo.BaseParam;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient; import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.scheduling.annotation.Async;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
@@ -23,6 +24,9 @@ public interface LiteFlowFeignClient {
@PostMapping("/measurementPointExecutor") @PostMapping("/measurementPointExecutor")
void measurementPointExecutor(@RequestBody BaseParam baseParam); void measurementPointExecutor(@RequestBody BaseParam baseParam);
@ApiOperation("监测点算法执行链(按小时执行的任务)")
@PostMapping("/measurementPointExecutorByHour")
public void measurementPointExecutorByHour(@RequestBody BaseParam baseParam);
@ApiOperation("单位监测点算法执行链") @ApiOperation("单位监测点算法执行链")
@PostMapping("/orgPointExecutor") @PostMapping("/orgPointExecutor")
void orgPointExecutor(@RequestBody BaseParam baseParam); void orgPointExecutor(@RequestBody BaseParam baseParam);

View File

@@ -28,6 +28,12 @@ public class LiteFlowFeignClientFallbackFactory implements FallbackFactory<LiteF
throw new BusinessException(finalExceptionEnum); throw new BusinessException(finalExceptionEnum);
} }
@Override
public void measurementPointExecutorByHour(BaseParam baseParam) {
log.error("{}异常,降级处理,异常为:{}", "监测点算法(按小时)执行链: ", throwable.toString());
throw new BusinessException(finalExceptionEnum);
}
@Override @Override
public void orgPointExecutor(BaseParam baseParam) { public void orgPointExecutor(BaseParam baseParam) {
log.error("{}异常,降级处理,异常为:{}", "单位监测点算法执行链: ", throwable.toString()); log.error("{}异常,降级处理,异常为:{}", "单位监测点算法执行链: ", throwable.toString());

View File

@@ -32,15 +32,15 @@ public class BaseParam implements Serializable {
private boolean repair; private boolean repair;
@ApiModelProperty(name = "beginTime",value = "补招起始日期_yyyy-MM-dd") @ApiModelProperty(name = "beginTime",value = "补招起始日期_yyyy-MM-dd(按小时跑的任务可加时分秒)")
private String beginTime; private String beginTime;
@ApiModelProperty(name = "endTime",value = "补招截止日期_yyyy-MM-dd") @ApiModelProperty(name = "endTime",value = "补招截止日期_yyyy-MM-dd(按小时跑的任务可加时分秒)")
private String endTime; private String endTime;
@ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd") @ApiModelProperty(name = "dataDate",value = "时间日期_yyyy-MM-dd(按小时跑的任务可加时分秒)")
private String dataDate; private String dataDate;

View File

@@ -0,0 +1,27 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class GdPollution implements Serializable {
/**
* 供电公司名称
*/
@Excel(name = "供电公司", width = 30, needMerge = true)
private String gdName;
/**
* 变电站集合
* name不要赋值
*/
@ExcelCollection(name = "")
private List<SubstationPollution> substationPollutionList;
}

View File

@@ -0,0 +1,80 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
@Data
public class LineItemPollution implements Serializable {
/**
* 终端名称
*/
@Excel(name = "终端名称", width = 30, replace = "/_null")
private String devName;
/**
* 终端厂家
*/
@Excel(name = "终端厂家", width = 30, replace = "/_null")
private String manufacturer;
/**
* 终端型号
*/
@Excel(name = "终端型号", width = 30, replace = "/_null")
private String devType;
/**
* 终端投运时间
*/
@Excel(name = "投运时间", width = 30, replace = "/_null")
private String loginTime;
/**
* 监测点名称
*/
@Excel(name = "监测点名称", width = 30, replace = "/_null")
private String lineName;
/**
* 统计间隔
*/
@Excel(name = "统计间隔", width = 30, replace = "/_null")
private Integer interval;
/**
* 谐波电压污染值
*/
@Excel(name = "污染值", width = 20, replace = "/_null")
private String vHarmonicValue;
/**
* 暂升次数 1.1~1.8
* 10ms ~ 1min
*/
private int upCounts;
/**
* 暂降次数 0.1~0.9
* 10ms ~ 1min
*/
@Excel(name = "电压暂降(次)", width = 20)
private int downCounts;
/**
* 短时中断 0~0.1
* 10ms ~ 1min
*/
@Excel(name = "短时中断(次)", width = 20)
private int breakCounts;
/**
* 备注
*/
@Excel(name = "备注", width = 30, replace = "/_null")
private String remark;
}

View File

@@ -0,0 +1,145 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
@Data
public class LinePollution implements Serializable {
/**
* 供电公司名称
*/
@Excel(name = "供电公司", width = 30)
private String gdName;
/**
* 所属变电站
*/
@Excel(name = "变电站", width = 30)
private String subStationName;
/**
* 终端名称
*/
@Excel(name = "终端名称", width = 30)
private String devName;
/**
* 终端厂家
*/
@Excel(name = "终端厂家", width = 30)
private String manufacturer;
/**
* 终端型号
*/
@Excel(name = "终端型号", width = 30)
private String devType;
/**
* 终端投运时间
*/
@Excel(name = "投运时间", width = 30)
private String loginTime;
/**
* 监测点索引
*/
private String lineId;
/**
* 监测点名称
*/
@Excel(name = "监测点名称", width = 30)
private String lineName;
/**
* 位置,电网侧&非电网侧
*/
@Excel(name = "监测位置", width = 30)
private String powerFlag;
/**
* 新增
* 监测点电压等级
*/
@Excel(name = "监测点电压等级", width = 30)
private String lineVoltage;
/**
* 干扰源类型
*/
@Excel(name = "干扰源类型", width = 30)
private String loadType;
/**
* 监测对象
*/
@Excel(name = "监测对象名称", width = 30)
private String objName;
/**
* 统计间隔
*/
@Excel(name = "统计间隔", width = 30)
private Integer interval;
/**
* 新增
* 在线率
*/
@Excel(name = "在线率(%)", width = 30)
private Double onlineRate;
/**
* 新增
* 完整性
*/
@Excel(name = "完整率(%)", width = 30)
private Double integrity;
/**
* 谐波电压污染值
*/
@Excel(name = "污染值", width = 20)
private String vHarmonicValue;
/**
* 暂升次数 1.1~1.8
* 10ms ~ 1min
*/
private int upCounts;
/**
* 暂降次数 0.1~0.9
* 10ms ~ 1min
*/
@Excel(name = "电压暂降(次)", width = 20)
private int downCounts;
/**
* 短时中断 0~0.1
* 10ms ~ 1min
*/
@Excel(name = "短时中断(次)", width = 20)
private int breakCounts;
@Excel(name = "是否关联敏感用户", width = 30, replace = "/_null")
private String isMg;
@Excel(name = "敏感及重要用户", width = 30,replace = "/_null")
private String importUser;
@Excel(name = "一类监测点", width = 30,replace = "/_null")
private String monitorId;
// /**
// * 备注
// */
// @Excel(name = "备注", width = 30, replace = "/_null")
// private String remark;
}

View File

@@ -0,0 +1,85 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import lombok.Data;
import java.io.Serializable;
@Data
public class LoadTypeLineItemPollution implements Serializable {
/**
* 所属变电站
*/
@Excel(name = "变电站", width = 30, needMerge = true)
private String subStationName;
/**
* 终端名称
*/
@Excel(name = "终端名称", width = 30, replace = "/_null")
private String devName;
/**
* 终端厂家
*/
@Excel(name = "终端厂家", width = 30, replace = "/_null")
private String manufacturer;
/**
* 终端型号
*/
@Excel(name = "终端型号", width = 30, replace = "/_null")
private String devType;
/**
* 终端投运时间
*/
@Excel(name = "投运时间", width = 30, replace = "/_null")
private String loginTime;
/**
* 监测点名称
*/
@Excel(name = "监测点名称", width = 30, replace = "/_null")
private String lineName;
/**
* 统计间隔
*/
@Excel(name = "统计间隔", width = 30, replace = "/_null")
private Integer interval;
/**
* 谐波电压污染值
*/
@Excel(name = "测点污染值", width = 20, replace = "/_null")
private String vHarmonicValue;
/**
* 暂升次数 1.1~1.8
* 10ms ~ 1min
*/
private int upCounts;
/**
* 暂降次数 0.1~0.9
* 10ms ~ 1min
*/
@Excel(name = "电压暂降(次)", width = 20)
private int downCounts;
/**
* 短时中断 0~0.1
* 10ms ~ 1min
*/
@Excel(name = "短时中断(次)", width = 20)
private int breakCounts;
/**
* 备注
*/
@Excel(name = "备注", width = 30, replace = "/_null")
private String remark;
}

View File

@@ -0,0 +1,44 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class ObjPollution implements Serializable {
/**
* 对象名称
*/
@Excel(name = "用户名称", width = 30, needMerge = true)
private String objName;
/**
* 干扰源类型
*/
@Excel(name = "干扰源类型", width = 30, needMerge = true)
private String loadType;
/**
* 行业类型
*/
@Excel(name = "行业类型", width = 30, needMerge = true)
private String businessType;
/**
* 用户污染值
*/
@Excel(name = "用户污染值", width = 30, needMerge = true)
private String objValue;
/**
* 下面监测点详细污染值
*/
@ExcelCollection(name = "")
private List<LoadTypeLineItemPollution> lineItemPollutionList;
}

View File

@@ -0,0 +1,34 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class PowerFlagPollution implements Serializable {
/**
* 监测位置
*/
@Excel(name = "监测位置", width = 30, needMerge = true)
private String powerFlag;
/**
* 监测污染值
*/
@Excel(name = "监测污染值", width = 30, needMerge = true, replace = "/_null")
private String powerValue;
/**
* 当前位置下,各测点的污染数据
*/
@ExcelCollection(name = "")
private List<LineItemPollution> lineItemPollutionList;
}

View File

@@ -0,0 +1,34 @@
package com.njcn.prepare.harmonic.pojo.bo.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import cn.afterturn.easypoi.excel.annotation.ExcelCollection;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class SubstationPollution implements Serializable {
/**
* 所属变电站
*/
@Excel(name = "变电站", width = 30, needMerge = true)
private String subStationName;
/**
* 电站污染值
*/
@Excel(name = "电站污染值", width = 30, needMerge = true)
private String subStationValue;
/**
* 电网侧&非电网侧
* name不要赋值
*/
@ExcelCollection(name = "")
private List<PowerFlagPollution> powerFlagPollutionList;
}

View File

@@ -0,0 +1,53 @@
package com.njcn.prepare.harmonic.pojo.mysql;
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 java.time.LocalDateTime;
import lombok.Data;
/**
*
* Description:
* Date: 2025/03/06 下午 2:07【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Data
@TableName(value = "cvt_job_log")
public class CvtJobLog {
/**
* 执行日期
*/
@TableId(value = "excute_date_time")
private LocalDateTime excuteDateTime;
/**
* 记录数
*/
@TableField(value = "`row_count`")
private Integer rowCount;
/**
* 状态0-执行中、1-成功、2-失败)
*/
@TableField(value = "`state`")
private Integer state;
@TableField(value = "update_time")
private LocalDateTime updateTime;
@TableField(value = "duration")
private Double duration;
public CvtJobLog(LocalDateTime excuteDateTime, Integer rowCount, Integer state, LocalDateTime updateTime, Double duration) {
this.excuteDateTime = excuteDateTime;
this.rowCount = rowCount;
this.state = state;
this.updateTime = updateTime;
this.duration = duration;
}
}

View File

@@ -4,12 +4,16 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DatePattern; import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.StrPool; import cn.hutool.core.text.StrPool;
import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.StrUtil;
import com.njcn.common.pojo.annotation.OperateInfo; import com.njcn.common.pojo.annotation.OperateInfo;
import com.njcn.common.pojo.enums.common.LogEnum; import com.njcn.common.pojo.enums.common.LogEnum;
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
import com.njcn.common.pojo.exception.BusinessException; import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.common.pojo.response.HttpResult;
import com.njcn.common.utils.HttpResultUtil;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient; import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.*; import com.njcn.device.biz.pojo.dto.*;
import com.njcn.device.biz.pojo.param.DeptGetLineParam; import com.njcn.device.biz.pojo.param.DeptGetLineParam;
@@ -140,6 +144,41 @@ public class ExecutionCenter extends BaseController {
dealResponse(calculatedParam, liteflowResponse, methodDescribe); dealResponse(calculatedParam, liteflowResponse, methodDescribe);
} }
} }
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("监测点算法执行链(按小时执行的算法)")
@PostMapping("/measurementPointExecutorByHour")
@Async("asyncExecutor")
public HttpResult<Boolean> measurementPointExecutorByHour(@RequestBody BaseParam baseParam) {
String methodDescribe = getMethodDescribe("measurementPointExecutorByHour");
//手动判断参数是否合法,
CalculatedParam calculatedParam = judgeExecuteParam(baseParam);
// 测点索引
if (CollectionUtils.isEmpty(calculatedParam.getIdList())) {
calculatedParam.setIdList(commTerminalGeneralClient.getRunMonitorIds().getData());
}
LiteflowResponse liteflowResponse;
if (baseParam.isRepair()) {
//补招时,起始日期、截止日期必填
DateTime startDate = DateUtil.parse(baseParam.getBeginTime(), DatePattern.NORM_DATETIME_FORMAT);
DateTime endDate = DateUtil.parse(baseParam.getEndTime(), DatePattern.NORM_DATETIME_FORMAT);
long betweenHour = DateUtil.between(startDate, endDate, DateUnit.HOUR);
//递增日期执行算法链
for (int i = 0; i < betweenHour; i++) {
if (i != 0) {
startDate = DateUtil.offsetHour(startDate, 1);
}
calculatedParam.setDataDate(DateUtil.format(startDate, DatePattern.NORM_DATETIME_FORMATTER));
liteflowResponse = flowExecutor.execute2Resp("measurement_point_hour", calculatedParam);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
} else {
//非补招
calculatedParam.setDataDate(DateUtil.format(DateUtil.offsetHour( DateUtil.parse(baseParam.getDataDate(), DatePattern.NORM_DATETIME_FORMAT),-1), DatePattern.NORM_DATETIME_FORMATTER));
liteflowResponse = flowExecutor.execute2Resp("measurement_point_hour", calculatedParam);
dealResponse(calculatedParam, liteflowResponse, methodDescribe);
}
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, true, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON) @OperateInfo(info = LogEnum.BUSINESS_COMMON)
@ApiOperation("装置算法执行链") @ApiOperation("装置算法执行链")

View File

@@ -0,0 +1,44 @@
package com.njcn.prepare.executor;
import com.njcn.prepare.harmonic.service.mysql.cvt.IDataHarmRateVCvtService;
import com.yomahub.liteflow.annotation.LiteflowComponent;
import com.yomahub.liteflow.annotation.LiteflowMethod;
import com.yomahub.liteflow.core.NodeComponent;
import com.yomahub.liteflow.enums.LiteFlowMethodEnum;
import com.yomahub.liteflow.enums.NodeTypeEnum;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import javax.annotation.Resource;
/**
* @author xy
* @version 1.0.0
* @date 2025年1月16日
*/
@Slf4j
@LiteflowComponent
@RequiredArgsConstructor
public class MeasurementHourExecutor extends BaseExecutor {
@Resource
private IDataHarmRateVCvtService dataHarmRateVCvtService;
/**
* 监测点cvt转换算法()
* @author hzj
*/
@LiteflowMethod(value = LiteFlowMethodEnum.IS_ACCESS, nodeId = "dataHarmRateVCvt", nodeType = NodeTypeEnum.COMMON)
public boolean dataVCvtAccess(NodeComponent bindCmp) {
return isAccess(bindCmp);
}
@LiteflowMethod(value = LiteFlowMethodEnum.PROCESS, nodeId = "dataHarmRateVCvt", nodeType = NodeTypeEnum.COMMON)
public void dataVCvtProcess(NodeComponent bindCmp) {
dataHarmRateVCvtService.dataHarmRateVCvtHandler(bindCmp.getRequestData());
}
}

View File

@@ -74,7 +74,6 @@ public interface InfluxdbPOConverter {
@Mapping(source = "v48", target = "harmonicVoltageContent48Max" ,numberFormat = "#.000") @Mapping(source = "v48", target = "harmonicVoltageContent48Max" ,numberFormat = "#.000")
@Mapping(source = "v49", target = "harmonicVoltageContent49Max" ,numberFormat = "#.000") @Mapping(source = "v49", target = "harmonicVoltageContent49Max" ,numberFormat = "#.000")
@Mapping(source = "v50", target = "harmonicVoltageContent50Max" ,numberFormat = "#.000") @Mapping(source = "v50", target = "harmonicVoltageContent50Max" ,numberFormat = "#.000")
public RMpHarmonicVRateReportD dataVPOTORMpHarmonicPReportDPOMax(DataHarmRateV dataVPO); public RMpHarmonicVRateReportD dataVPOTORMpHarmonicPReportDPOMax(DataHarmRateV dataVPO);
@Mapping(source = "v1", target = "fundamentalVoltageMin",numberFormat = "#.000") @Mapping(source = "v1", target = "fundamentalVoltageMin",numberFormat = "#.000")

View File

@@ -0,0 +1,18 @@
package com.njcn.prepare.harmonic.mapper.mysql;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.njcn.prepare.harmonic.pojo.mysql.CvtJobLog;
import java.time.LocalDateTime;
/**
*
* Description:
* Date: 2025/03/06 下午 2:07【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CvtJobLogMapper extends BaseMapper<CvtJobLog> {
LocalDateTime getNewTime();
}

View File

@@ -0,0 +1,26 @@
package com.njcn.prepare.harmonic.mapper.mysql;
import cn.hutool.core.date.DateTime;
import com.njcn.event.pojo.dto.EventCount;
import com.njcn.harmonic.pojo.vo.IntegrityVO;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* <p>
* Mapper 接口
* </p>
*
* @author xuyang
* @since 2024-01-25
*/
public interface EventMapper {
List<EventCount> getEventCount(@Param("startTime") DateTime startTime, @Param("endTime")DateTime endTime);
List<IntegrityVO> getIntegrity(@Param("startTime") DateTime startTime, @Param("endTime")DateTime endTime);
List<IntegrityVO> getOnlineRate(@Param("startTime") DateTime startTime, @Param("endTime")DateTime endTime);
}

View File

@@ -0,0 +1,43 @@
<?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.prepare.harmonic.mapper.mysql.EventMapper">
<select id="getEventCount" resultType="com.njcn.event.pojo.dto.EventCount">
SELECT
measurement_point_id lineId,
SUM(CASE WHEN feature_amplitude &gt;= 0 AND feature_amplitude &lt; 0.1 THEN 1 ELSE 0 END) AS breakCounts,
SUM(CASE WHEN feature_amplitude &gt;= 0.1 AND feature_amplitude &lt; 0.9 THEN 1 ELSE 0 END) AS downCounts,
SUM(CASE WHEN feature_amplitude &gt;= 1.1 THEN 1 ELSE 0 END) AS upCounts
FROM
r_mp_event_detail
where start_time between #{startTime} and #{endTime}
GROUP BY measurement_point_id
</select>
<select id="getIntegrity" resultType="com.njcn.harmonic.pojo.vo.IntegrityVO">
SELECT
line_index id,
LEAST(ROUND(SUM(real_time) / SUM(due_time), 2) * 100,100) integrityData
FROM
`r_stat_integrity_d`
WHERE time_id between #{startTime} and #{endTime}
GROUP BY line_index
</select>
<select id="getOnlineRate" resultType="com.njcn.harmonic.pojo.vo.IntegrityVO">
SELECT
dev_index id,
LEAST(
ROUND(
SUM(online_min) / (SUM(online_min) + SUM(offline_min)),
2
) * 100,
100
) integrityData
FROM
`r_stat_onlinerate_d`
WHERE time_id between #{startTime} and #{endTime}
GROUP BY dev_index
</select>
</mapper>

View File

@@ -0,0 +1,21 @@
<?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.prepare.harmonic.mapper.mysql.CvtJobLogMapper">
<resultMap id="BaseResultMap" type="com.njcn.prepare.harmonic.pojo.mysql.CvtJobLog">
<!--@mbg.generated-->
<result column="excute_date_time" jdbcType="TIMESTAMP" property="excuteDateTime" />
<result column="row_count" jdbcType="INTEGER" property="rowCount" />
<result column="state" jdbcType="TINYINT" property="state" />
<result column="update_time" jdbcType="TIMESTAMP" property="updateTime" />
<result column="duration" jdbcType="INTEGER" property="duration" />
</resultMap>
<sql id="Base_Column_List">
<!--@mbg.generated-->
excute_date_time, `row_count`, `state`, update_time, duration
</sql>
<select id="getNewTime" resultType="java.time.LocalDateTime">
select excute_date_time from cvt_job_log order by excute_date_time desc limit 1;
</select>
</mapper>

View File

@@ -0,0 +1,6 @@
package com.njcn.prepare.harmonic.service.influxdb;
public interface IPollutionCalc {
void calcAllLineValue();
}

View File

@@ -0,0 +1,477 @@
package com.njcn.prepare.harmonic.service.influxdb.impl;
import cn.afterturn.easypoi.excel.ExcelExportUtil;
import cn.afterturn.easypoi.excel.entity.ExportParams;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import com.njcn.common.utils.HarmonicTimesUtil;
import com.njcn.common.utils.PubUtils;
import com.njcn.device.biz.commApi.CommLineClient;
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
import com.njcn.device.biz.pojo.dto.LineDevGetDTO;
import com.njcn.device.biz.pojo.dto.PollutionLineInfoDTO;
import com.njcn.device.biz.pojo.po.Overlimit;
import com.njcn.event.api.EventDetailFeignClient;
import com.njcn.event.pojo.dto.EventCount;
import com.njcn.harmonic.pojo.vo.IntegrityVO;
import com.njcn.influx.constant.InfluxDbSqlConstant;
import com.njcn.influx.imapper.DataHarmRateVMapper;
import com.njcn.influx.imapper.DataVMapper;
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
import com.njcn.influx.pojo.po.DataHarmRateV;
import com.njcn.influx.pojo.po.DataV;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.prepare.harmonic.mapper.mysql.EventMapper;
import com.njcn.prepare.harmonic.pojo.bo.excel.*;
import com.njcn.prepare.harmonic.service.influxdb.IPollutionCalc;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.poi.ss.usermodel.Workbook;
import org.springframework.stereotype.Service;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.lang.reflect.Field;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@Service
@RequiredArgsConstructor
@Slf4j
public class PollutionCalcImpl implements IPollutionCalc {
private final CommTerminalGeneralClient commTerminalGeneralClient;
private final CommLineClient commLineClient;
private final DataVMapper dataVMapper;
private final DataHarmRateVMapper dataHarmRateVMapper;
private final EventDetailFeignClient eventDetailFeignClient;
private final EventMapper eventMapper;
/**
* 监测点污染值计算,谐波电压&谐波电流
* 1、获取所有监测点
* 2、根据指标获取对应的污染值目前仅做谐波电压
* 注:目前仅支持获取昨天的
*/
@Override
public void calcAllLineValue() {
// LocalDate yesterday = LocalDate.now().minusDays(1);
// String yesterdayDate = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.of(yesterday)), DatePattern.NORM_DATE_PATTERN);
List<String> lineIdList = commTerminalGeneralClient.getRunMonitorIds().getData();
// List<String> lineIdList = Stream.of("2886ec28f6ea8b0444ce18849f2e5736").collect(Collectors.toList());
// 获取所有监测点的暂态数据 由于暂态事件较少暂时查询最近30天的
// LocalDate last30Day = LocalDate.now().minusDays(31);
// String startDate = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.of(last30Day)), DatePattern.NORM_DATE_PATTERN);
String startDate = "2025-02-10";
String yesterdayDate = "2025-03-10";
List<EventCount> eventCounts = getEventCount(lineIdList, startDate, yesterdayDate);
Map<String, EventCount> eventMap = eventCounts.stream().collect(Collectors.toMap(EventCount::getLineId, pojo -> pojo));
// 获取所有监测点的元信息
List<PollutionLineInfoDTO> lineInfoDTOList = commLineClient.getPollutionLineInfo(lineIdList).getData();
// String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.of(yesterday)), DatePattern.NORM_DATETIME_PATTERN);
// String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.of(yesterday)), DatePattern.NORM_DATETIME_PATTERN);
String beginDay = "2025-02-10 00:00:00";
String endDay = "2025-03-10 23:59:59";
//获取监测点的数据完整性
List<IntegrityVO> integrityList = getIntegrity(startDate, yesterdayDate);
Map<String, IntegrityVO> integrityMap = integrityList.stream().collect(Collectors.toMap(IntegrityVO::getId, pojo -> pojo));
//获取装置在线率
List<IntegrityVO> onlineRateList = getOnlineRate(startDate, yesterdayDate);
Map<String, IntegrityVO> onlineRateMap = onlineRateList.stream().collect(Collectors.toMap(IntegrityVO::getId, pojo -> pojo));
List<LinePollution> linePollutionList = new ArrayList<>();
long startTime = System.currentTimeMillis();
if (CollUtil.isNotEmpty(lineIdList)) {
System.out.println("总共" + lineIdList.size() + "个监测点参与污染值计算,开始执行");
// 获取谐波电压数据&总畸变率&越限限值计算基础污染值
for (int i = 0; i < lineIdList.size(); i++) {
String lineId = lineIdList.get(i);
LinePollution linePollution = new LinePollution();
linePollution.setLineId(lineId);
//获取监测点数据完整性
IntegrityVO vo = integrityMap.get(lineId);
linePollution.setIntegrity(Objects.isNull(vo) ? 0.0 : vo.getIntegrityData());
//获取监测点限值
Overlimit overlimit = commTerminalGeneralClient.getOverLimitData(lineId).getData();
LineDevGetDTO lineDetailData = commTerminalGeneralClient.getMonitorDetail(lineId).getData();
if (Objects.isNull(overlimit) || Objects.isNull(lineDetailData)) {
// 如果没有查到限值跳过,后期需要记录这种异常
continue;
}
linePollution.setLineName(lineDetailData.getPointName());
linePollution.setInterval(lineDetailData.getInterval());
// 计算谐波电压的污染值
linePollution.setVHarmonicValue(PubUtils.doubleRound(2, calcVAllPollutionValue(linePollution, overlimit, beginDay, endDay) * linePollution.getInterval()) + "");
// 获取暂态数据
// statisticsEvent(linePollution);
BeanUtil.copyProperties(eventMap.get(lineId), linePollution);
//获取该监测点其他元信息
Optional<PollutionLineInfoDTO> any = lineInfoDTOList.stream().filter(item -> item.getLineId().equals(lineId)).findAny();
if (any.isPresent()) {
PollutionLineInfoDTO data = any.get();
BeanUtil.copyProperties(data, linePollution, true);
// if (data.getComFlag() == 0) {
// linePollution.setRemark("终端通讯状态为中断!");
// }
IntegrityVO vo2 = onlineRateMap.get(data.getDeviceId());
linePollution.setOnlineRate(Objects.isNull(vo2) ? 0.0 : vo2.getIntegrityData());
}
linePollutionList.add(linePollution);
}
}
List<LinePollution> finalLinePollutionList = new ArrayList<>(linePollutionList);
// 全部监测点计算完毕后根据污染值从大到小进行排序
finalLinePollutionList.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getVHarmonicValue())));
Collections.reverse(finalLinePollutionList);
// 监测点的污染值计算完毕后输出到指定目录。目前目录是写死的待后期调整成配置可供用户选择下载。todo...
// 导出监测点污染值
String folder = "c:\\njcn";
File file = new File(folder);
if (!file.exists()) {
boolean mkdirs = file.mkdirs();
if (!mkdirs) {
System.out.println("无法创建文件夹");
return;
}
}
String fileName = folder + "\\监测点谐波电压污染值" + yesterdayDate + ".xlsx";
ExportParams exportParams = new ExportParams();
exportLinePollution(exportParams, LinePollution.class, finalLinePollutionList, fileName);
// 处理干扰源用户的报告
List<LinePollution> loadTypeLineList = new ArrayList<>(linePollutionList);
/**
* 1、首先过滤重要变电站、一类变电站、跨省计量关点 todo...待优化
* 2、过滤后以监测对象分组统计数据有多个测点的需要出结果
*/
List<String> loadTypeSubStation = Stream.of("重要变电站", "一类变电站", "跨省计量关点").collect(Collectors.toList());
loadTypeLineList = loadTypeLineList.stream().filter(item -> !loadTypeSubStation.contains(item.getLoadType())).collect(Collectors.toList());
// 监测对象分组
Map<String, List<LinePollution>> loadTypeMap = loadTypeLineList.stream().collect(Collectors.groupingBy(LinePollution::getObjName));
List<ObjPollution> objPollutions = new ArrayList<>();
Set<String> objNameSet = loadTypeMap.keySet();
for (String objName : objNameSet) {
ObjPollution objPollution = new ObjPollution();
List<LinePollution> linePollutions = loadTypeMap.get(objName);
objPollution.setObjName(linePollutions.get(0).getObjName());
objPollution.setLoadType(linePollutions.get(0).getLoadType());
// objPollution.setBusinessType(linePollutions.get(0).getBusinessType());
// 求出平均污染值
double objValue = linePollutions.stream()
.mapToDouble(o -> Double.parseDouble(o.getVHarmonicValue()))
.sum();
objPollution.setObjValue(PubUtils.doubleRound(2, objValue) + "");
// 处理该监测对象下面监测点的信息
List<LoadTypeLineItemPollution> loadTypeLineItemPollutions = new ArrayList<>();
for (LinePollution linePollution : linePollutions) {
LoadTypeLineItemPollution loadTypeLineItemPollution = new LoadTypeLineItemPollution();
BeanUtil.copyProperties(linePollution, loadTypeLineItemPollution, true);
loadTypeLineItemPollutions.add(loadTypeLineItemPollution);
}
objPollution.setLineItemPollutionList(loadTypeLineItemPollutions);
objPollutions.add(objPollution);
}
fileName = folder + "\\用户谐波电压污染值" + yesterdayDate + ".xlsx";
exportParams = new ExportParams();
// 排序
objPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getObjValue())));
Collections.reverse(objPollutions);
exportLinePollution(exportParams, ObjPollution.class, objPollutions, fileName);
// 整合变电站待导出的数据
List<GdPollution> gdPollutionList = new ArrayList<>();
// 以供电公司分组
Map<String, List<LinePollution>> gdMap = linePollutionList.stream()
.collect(Collectors.groupingBy(LinePollution::getGdName));
// 同一供电公司以变电站分组
Set<String> gdNameSet = gdMap.keySet();
for (String gdName : gdNameSet) {
// 初始化gd实体
GdPollution gdPollution = new GdPollution();
gdPollution.setGdName(gdName);
List<LinePollution> gdLinePollution = gdMap.get(gdName);
// 以变电站分组
Map<String, List<LinePollution>> subMap = gdLinePollution.stream()
.collect(Collectors.groupingBy(LinePollution::getSubStationName));
Set<String> subNameMap = subMap.keySet();
List<SubstationPollution> substationPollutions = new ArrayList<>();
for (String subName : subNameMap) {
// 初始化变电站实体
SubstationPollution substationPollution = new SubstationPollution();
substationPollution.setSubStationName(subName);
List<LinePollution> subLinePollution = subMap.get(subName);
// 需要区分电网侧、非电网侧
Map<String, List<LinePollution>> powerFlagLinePollution = subLinePollution.stream().collect(Collectors.groupingBy(LinePollution::getPowerFlag));
List<PowerFlagPollution> powerFlagPollutionList = new ArrayList<>();
// 电网侧
List<LinePollution> temp = powerFlagLinePollution.get("电网侧");
PowerFlagPollution powerFlagPollution1 = new PowerFlagPollution();
powerFlagPollution1.setPowerFlag("电网侧");
List<LineItemPollution> lineItemPollutionList1 = new ArrayList<>();
if (CollUtil.isNotEmpty(temp)) {
// 计算电网侧下所有监测点平均污染值
double subValue = temp.stream()
.mapToDouble(o -> Double.parseDouble(o.getVHarmonicValue()))
.average()
.orElse(0.0);
// 电网侧污染值
powerFlagPollution1.setPowerValue(PubUtils.doubleRound(2, subValue) + "");
// 设备信息
for (LinePollution linePollution : temp) {
LineItemPollution lineItemPollution = new LineItemPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
lineItemPollutionList1.add(lineItemPollution);
}
} else {
// 仅有非电网侧时,电网侧赋予空置
LineItemPollution lineItemPollution = new LineItemPollution();
lineItemPollutionList1.add(lineItemPollution);
}
// 设备信息注入监测位置对象中
powerFlagPollution1.setLineItemPollutionList(lineItemPollutionList1);
powerFlagPollutionList.add(powerFlagPollution1);
// 非电网侧
List<LinePollution> temp1 = powerFlagLinePollution.get("非电网侧");
PowerFlagPollution powerFlagPollution2 = new PowerFlagPollution();
powerFlagPollution2.setPowerFlag("非电网侧");
List<LineItemPollution> lineItemPollutionList2 = new ArrayList<>();
if (CollUtil.isNotEmpty(temp1)) {
// 计算非电网侧下所有监测点平均污染值
double subValue = temp1.stream()
.mapToDouble(o -> Double.parseDouble(o.getVHarmonicValue()))
.average()
.orElse(0.0);
powerFlagPollution2.setPowerValue(PubUtils.doubleRound(2, subValue) + "");
for (LinePollution linePollution : temp1) {
LineItemPollution lineItemPollution = new LineItemPollution();
BeanUtil.copyProperties(linePollution, lineItemPollution, true);
lineItemPollutionList2.add(lineItemPollution);
}
} else {
// 仅有非电网侧时,电网侧赋予空置
LineItemPollution lineItemPollution = new LineItemPollution();
lineItemPollutionList2.add(lineItemPollution);
}
// 设备信息注入监测位置对象中
powerFlagPollution2.setLineItemPollutionList(lineItemPollutionList2);
powerFlagPollutionList.add(powerFlagPollution2);
substationPollution.setPowerFlagPollutionList(powerFlagPollutionList);
// 如果电网侧有污染值,就作为变电站的污染值,否则就用非电网侧的污染值作为该变电站污染值
if (Objects.nonNull(powerFlagPollution1.getPowerValue())) {
substationPollution.setSubStationValue(powerFlagPollution1.getPowerValue());
} else {
substationPollution.setSubStationValue(powerFlagPollution2.getPowerValue());
}
substationPollutions.add(substationPollution);
}
// 针对这个供电公司下的变电站污染值排序
substationPollutions.sort(Comparator.comparingDouble(o -> Double.parseDouble(o.getSubStationValue())));
Collections.reverse(substationPollutions);
// List<SubstationPollution> finalSubstation = substationPollutions.stream().sorted((Comparator.comparingDouble(SubstationPollution::getSubStationValue))
// .reversed())
// .collect(Collectors.toList());
gdPollution.setSubstationPollutionList(substationPollutions);
gdPollutionList.add(gdPollution);
}
fileName = folder + "\\变电站谐波电压污染值" + yesterdayDate + ".xlsx";
exportParams = new ExportParams();
exportLinePollution(exportParams, GdPollution.class, gdPollutionList, fileName);
long endTime = System.currentTimeMillis();
long time = (endTime - startTime) / 1000;
System.out.println("程序执行完毕,总耗时:" + time + "");
}
/**
* 输出下载文件
*
* @param exportParams excel配置信息
* @param pojoClass 映射对象
* @param dataSet 数据集
* @param fileName 文件名
*/
private void exportLinePollution(ExportParams exportParams, Class<?> pojoClass, Collection<?> dataSet, String fileName) {
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, pojoClass, dataSet);
File outFile = new File(fileName);
try (FileOutputStream fos = new FileOutputStream(outFile)) {
workbook.write(fos);
System.out.println("文档输出成功");
} catch (IOException e) {
System.out.println("文档输出异常");
} finally {
try {
workbook.close();
} catch (IOException exception) {
System.out.println("关闭通道失败");
}
}
}
/**
* 计算谐波电压的污染值包含了电压总畸变率和谐波电压2~25次
*
* @param linePollution 监测点信息
* @param overlimit 当前监测点限值
*/
private double calcVAllPollutionValue(LinePollution linePollution, Overlimit overlimit, String startTime, String endTime) {
//最大值
InfluxQueryWrapper dataVQueryWrapper = new InfluxQueryWrapper(DataV.class);
dataVQueryWrapper.eq(DataV::getLineId, linePollution.getLineId())
.eq(DataV::getValueType, InfluxDbSqlConstant.CP95)
.ne(DataHarmRateV::getPhaseType, InfluxDBTableConstant.PHASE_TYPE_T)
.max(DataV::getVThd)
.groupBy("time(" + linePollution.getInterval() + "m)")
.between(DataV::getTime, startTime, endTime);
List<DataV> vthResultList = dataVMapper.getStatisticsByWraper(dataVQueryWrapper);
// 计算时间范围内指标越限百分比
// 总畸变率的限值
List<Double> thdValueList = vthResultList.stream().map(DataV::getVThd).collect(Collectors.toList());
double thdPollutionValue = calcPollutionValue(overlimit.getUbalance(), thdValueList);
// 谐波电压2~50次的数据获取并计算
InfluxQueryWrapper harmRateVQueryWrapper = new InfluxQueryWrapper(DataHarmRateV.class);
harmRateVQueryWrapper.maxSamePrefixAndSuffix(InfluxDbSqlConstant.V, "", HarmonicTimesUtil.harmonicTimesList(2, 50, 1));
harmRateVQueryWrapper.eq(DataHarmRateV::getLineId, linePollution.getLineId())
.eq(DataHarmRateV::getValueType, InfluxDbSqlConstant.CP95)
.ne(DataHarmRateV::getPhaseType, InfluxDBTableConstant.PHASE_TYPE_T)
.groupBy("time(" + linePollution.getInterval() + "m)")
.between(DataHarmRateV::getTime, startTime, endTime);
List<DataHarmRateV> dataHarmRateVList = dataHarmRateVMapper.getStatisticsByWraper(harmRateVQueryWrapper);
double harmRateVPollutionValue = calcHarmRateVPollutionValue(overlimit, dataHarmRateVList);
return thdPollutionValue + harmRateVPollutionValue;
}
/**
* 计算谐波电压2~50的越限污染值
*
* @param overlimit 限值
* @param dataHarmRateVList 2~50次的谐波电压值
* @return 谐波电压污染值
*/
private double calcHarmRateVPollutionValue(Overlimit overlimit, List<DataHarmRateV> dataHarmRateVList) {
List<Double> pollutionValue = new ArrayList<>();
// 2次
for (int i = 2; i < 51; i++) {
Float limitValue = getValueByFieldName(overlimit, "uharm" + i);
int finalI = i;
List<Double> valueList = dataHarmRateVList.stream().map(item -> {
Float valueByFieldName = getValueByFieldName(item, "v" + finalI);
if (Objects.isNull(valueByFieldName)) {
return 0.0;
} else {
return (double) valueByFieldName;
}
}).collect(Collectors.toList());
pollutionValue.add(calcPollutionValue(limitValue, valueList));
}
return pollutionValue.stream().mapToDouble(Double::doubleValue).sum();
}
/**
* 获取当前组数据的污染值
*
* @param limit 限值
* @param valueList 参考数据
* @return 污染值
*/
private double calcPollutionValue(Float limit, List<Double> valueList) {
double pollutionValue = 0;
// 没有限值的直接返回
if (Objects.isNull(limit) || limit == 0.0f) {
return pollutionValue;
}
// 计算每个数值的越限百分比MOP
List<Double> overLimitPercentList = valueList.stream().map(value -> {
if (Objects.isNull(value)) {
return 0.0;
}
return value * 100 / limit;
}).collect(Collectors.toList());
// 计算每个越限百分比对应的污染值,并求和返回
if (CollUtil.isNotEmpty(overLimitPercentList)) {
pollutionValue = overLimitPercentList.stream().map(item -> {
double value = 0;
if (item >= 100.0 && item < 120.0) {
value = 0.1;
} else if (item >= 120.0 && item < 160.0) {
value = 0.2;
} else if (item >= 160.0 && item < 200.0) {
value = 0.3;
} else if (item >= 200.0) {
value = 0.4;
}
return value;
}).mapToDouble(Double::doubleValue).sum();
}
return pollutionValue;
}
/**
* 根据标记获取属性对应的值
*
* @return 值
*/
public static Float getValueByFieldName(Object obj, String fieldName) {
try {
Field field = obj.getClass().getDeclaredField(fieldName);
field.setAccessible(true);
Object val = field.get(obj);
if (Objects.isNull(val)) {
return null;
}
if (val instanceof Double) {
Double doubleValue = (Double) val;
return doubleValue.floatValue();
}
return (float) field.get(obj);
} catch (NoSuchFieldException | IllegalAccessException e) {
return 0.0f;
}
}
public List<EventCount> getEventCount(List<String> ids, String startDate, String endDate) {
DateTime startTime = DateUtil.beginOfDay(DateUtil.parse(startDate));
DateTime endTime = DateUtil.endOfDay(DateUtil.parse(endDate));
List<EventCount> eventCounts = eventMapper.getEventCount(startTime, endTime);
Map<String, EventCount> eventMap = eventCounts.stream().collect(Collectors.toMap(EventCount::getLineId, pojo -> pojo));
List<EventCount> eventCountList = new ArrayList<>();
for (String id : ids) {
EventCount eventCountTemp = eventMap.get(id);
if (Objects.isNull(eventCountTemp)) {
eventCountTemp = new EventCount(id);
}
eventCountList.add(eventCountTemp);
}
return eventCountList;
}
public List<IntegrityVO> getIntegrity(String startDate, String endDate) {
DateTime startTime = DateUtil.beginOfDay(DateUtil.parse(startDate));
DateTime endTime = DateUtil.endOfDay(DateUtil.parse(endDate));
return eventMapper.getIntegrity(startTime, endTime);
}
public List<IntegrityVO> getOnlineRate(String startDate, String endDate) {
DateTime startTime = DateUtil.beginOfDay(DateUtil.parse(startDate));
DateTime endTime = DateUtil.endOfDay(DateUtil.parse(endDate));
return eventMapper.getOnlineRate(startTime, endTime);
}
}

View File

@@ -72,7 +72,7 @@ public class RMpTargetWarnDServiceImpl extends MppServiceImpl<RMpTargetWarnDMapp
//本年的rm值 //本年的rm值
List<AlarmDetailDayDTO> rmList = alarmDetailService.getAvgDiffData(time,list); List<AlarmDetailDayDTO> rmList = alarmDetailService.getAvgDiffData(time,list);
//本年的CL值 //本年的CL值
List<AlarmDetailDayDTO> clList = rStatDataVDMapper.getAvgDayData(PublicUtil.getLastYearDay(time),time,list); List<AlarmDetailDayDTO> clList = rStatDataVDMapper.getAvgDayData(PublicUtil.getYesterday(time),time,list);
//本年的RL值 //本年的RL值
if (!CollectionUtils.isEmpty(rmList)){ if (!CollectionUtils.isEmpty(rmList)){
rlList = rmList.stream().map(item->{ rlList = rmList.stream().map(item->{

View File

@@ -89,6 +89,7 @@ public class RStatDevSignalDPOServiceImpl extends MppServiceImpl<RStatDevSignalD
} else { } else {
rStatDevSignal.setRunStatus("0"); rStatDevSignal.setRunStatus("0");
} }
rStatDevSignal.setUpdateTime(calculatedParam.getDataDate());
rStatDevSignalList.add(rStatDevSignal); rStatDevSignalList.add(rStatDevSignal);
}); });
if (CollectionUtil.isNotEmpty(rStatDevSignalList)){ if (CollectionUtil.isNotEmpty(rStatDevSignalList)){

View File

@@ -79,7 +79,7 @@ public class AlarmDetailServiceImpl extends MppServiceImpl<AlarmMapper, RMpTarge
@Override @Override
public List<AlarmDetailDayDTO> getAvgDiffData(String time,List<String> list) { public List<AlarmDetailDayDTO> getAvgDiffData(String time,List<String> list) {
String endTime = PublicUtil.getLastYearDay(time); String endTime = PublicUtil.getYesterday(time);
//计算本年的rm值 //计算本年的rm值
return this.baseMapper.getAvgDiffData(endTime,time,list); return this.baseMapper.getAvgDiffData(endTime,time,list);
} }

View File

@@ -957,7 +957,7 @@ public class DayDataServiceImpl implements DayDataService {
* @param endTime 结束时间 * @param endTime 结束时间
* @return * @return
*/ */
public List<DataV> getDataV(List<String> lineIndex, String startTime, String endTime) { public List<DataV> getDataV(List<String> lineIndex, String startTime, String endTime) {
List<DataV> result = new ArrayList<>(); List<DataV> result = new ArrayList<>();
//最小值 //最小值
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class); InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataV.class);

View File

@@ -155,6 +155,8 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
freqCount++; freqCount++;
} }
/*,监测点的接线方式,如果是星形接线这个指标要判断,角形界面则不判断,默认它是正常的*/ /*,监测点的接线方式,如果是星形接线这个指标要判断,角形界面则不判断,默认它是正常的*/
//河北没有线电压修改成先改成全部都是有效的线电压
if (Objects.equals("0", data.getPtType())) { if (Objects.equals("0", data.getPtType())) {
if (rmsLimit.getLowerLimit() * (voltage / 1.732) <= rmsMin && rmsMax <= rmsLimit.getUpperLimit() * (voltage / 1.732)) { if (rmsLimit.getLowerLimit() * (voltage / 1.732) <= rmsMin && rmsMax <= rmsLimit.getUpperLimit() * (voltage / 1.732)) {
phaseVoltageCount++; phaseVoltageCount++;
@@ -164,17 +166,17 @@ public class RMpMonitorEvaluateDServiceImpl extends MppServiceImpl<RMpMonitorEva
rmsflag = true; rmsflag = true;
phaseVoltageCount++; phaseVoltageCount++;
} }
if (Objects.equals("1", data.getPtPhaseType())) { // if (Objects.equals("1", data.getPtPhaseType())) {
if (rms_lvrLimit.getLowerLimit() * voltage <= rmsLvrMin && rmsLvrMax <= rms_lvrLimit.getUpperLimit() * voltage) { // if (rms_lvrLimit.getLowerLimit() * voltage <= rmsLvrMin && rmsLvrMax <= rms_lvrLimit.getUpperLimit() * voltage) {
lineVoltageCount++; // lineVoltageCount++;
rmsLvrflag = true; // rmsLvrflag = true;
} // }
//
} else { // } else {
rmsLvrflag = true; rmsLvrflag = true;
lineVoltageCount++; lineVoltageCount++;
} // }
if (Objects.equals("1", data.getPtPhaseType()) && Objects.equals("0", data.getPtType())) { if (Objects.equals("1", data.getPtPhaseType()) && Objects.equals("0", data.getPtType())) {
if (v_unbalanceLimit.getLowerLimit() <= vUnbalanceMin && vUnbalanceMax <= v_unbalanceLimit.getUpperLimit() if (v_unbalanceLimit.getLowerLimit() <= vUnbalanceMin && vUnbalanceMax <= v_unbalanceLimit.getUpperLimit()
) { ) {

View File

@@ -0,0 +1,20 @@
package com.njcn.prepare.harmonic.service.mysql.cvt;
import com.njcn.prepare.harmonic.pojo.mysql.CvtJobLog;
import com.baomidou.mybatisplus.extension.service.IService;
import java.time.LocalDateTime;
/**
*
* Description:
* Date: 2025/03/06 下午 2:07【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface CvtJobLogService extends IService<CvtJobLog>{
LocalDateTime getNewTime();
}

View File

@@ -0,0 +1,15 @@
package com.njcn.prepare.harmonic.service.mysql.cvt;
import com.njcn.prepare.harmonic.pojo.bo.CalculatedParam;
/**
* Description:
* Date: 2025/02/24 上午 9:10【需求编号】
*
* @author clam
* @version V1.0.0
*/
public interface IDataHarmRateVCvtService {
void dataHarmRateVCvtHandler(CalculatedParam requestData);
}

View File

@@ -0,0 +1,28 @@
package com.njcn.prepare.harmonic.service.mysql.cvt.impl;
import com.njcn.prepare.harmonic.mapper.mysql.CvtJobLogMapper;
import org.springframework.stereotype.Service;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.njcn.prepare.harmonic.pojo.mysql.CvtJobLog;
import com.njcn.prepare.harmonic.service.mysql.cvt.CvtJobLogService;
/**
*
* Description:
* Date: 2025/03/06 下午 2:07【需求编号】
*
* @author clam
* @version V1.0.0
*/
@Service
public class CvtJobLogServiceImpl extends ServiceImpl<CvtJobLogMapper, CvtJobLog> implements CvtJobLogService{
@Override
public LocalDateTime getNewTime() {
return this.getBaseMapper().getNewTime();
}
}

Some files were not shown because too many files have changed in this diff Show More