1.冀北分布式光伏代码提交
2.审计日志管理代码提交修改 3.暂降推送日志,筛选添加
This commit is contained in:
@@ -25,15 +25,6 @@ public class PmsStatationStatInfoDTO implements Serializable {
|
|||||||
*/
|
*/
|
||||||
private String orgName;
|
private String orgName;
|
||||||
|
|
||||||
/**
|
|
||||||
* 母线id
|
|
||||||
*/
|
|
||||||
private String generatrixId;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 母线名称
|
|
||||||
*/
|
|
||||||
private String generatrixName;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点id
|
* 监测点id
|
||||||
|
|||||||
@@ -79,11 +79,11 @@ public class SubstationExpend implements Serializable {
|
|||||||
|
|
||||||
private List<PmsSimpleDTO> sites;
|
private List<PmsSimpleDTO> sites;
|
||||||
|
|
||||||
// public SubstationExpend(String name, String type, BigDecimal lng, BigDecimal lat, String deptId) {
|
public SubstationExpend(String name, String type, BigDecimal lng, BigDecimal lat, String deptId) {
|
||||||
// this.name = name;
|
this.name = name;
|
||||||
// this.type = type;
|
this.type = type;
|
||||||
// this.lng = lng;
|
this.lng = lng;
|
||||||
// this.lat = lat;
|
this.lat = lat;
|
||||||
// this.deptId = deptId;
|
this.deptId = deptId;
|
||||||
// }
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
@@ -38,7 +40,7 @@ import java.util.Map;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@Api(tags = "冀北变电站地图信息")
|
@Api(tags = "冀北变电站地图信息")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/substationExpend")
|
@RequestMapping("/pms/substationExpend")
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
public class SubstationExpendController extends BaseController {
|
public class SubstationExpendController extends BaseController {
|
||||||
|
|
||||||
@@ -46,7 +48,7 @@ public class SubstationExpendController extends BaseController {
|
|||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getPVSubstationExpendInfo")
|
@PostMapping("/getSubstationExpendInfo")
|
||||||
@ApiOperation("冀北变电站地图信息")
|
@ApiOperation("冀北变电站地图信息")
|
||||||
@ApiImplicitParam(name = "param", value = "冀北变电站地图信息参数", required = true)
|
@ApiImplicitParam(name = "param", value = "冀北变电站地图信息参数", required = true)
|
||||||
public HttpResult<Map<String, List<SubstationExpend>>> getSubstationExpendInfo(@RequestBody StatisticsBizBaseParam param) {
|
public HttpResult<Map<String, List<SubstationExpend>>> getSubstationExpendInfo(@RequestBody StatisticsBizBaseParam param) {
|
||||||
@@ -74,5 +76,31 @@ public class SubstationExpendController extends BaseController {
|
|||||||
List<CommunicateVO.PVCommunicateVO> communicationStatus = substationExpendService.getCommunicationStatus(param);
|
List<CommunicateVO.PVCommunicateVO> communicationStatus = substationExpendService.getCommunicationStatus(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, communicationStatus, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, communicationStatus, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/insert")
|
||||||
|
@ApiOperation("变电站信息")
|
||||||
|
@ApiImplicitParam(name = "insert", value = "变电站信息", required = true)
|
||||||
|
public HttpResult<Boolean> insert(@RequestBody StatisticsBizBaseParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("insert");
|
||||||
|
List<SubstationExpend> list = Arrays.asList(
|
||||||
|
new SubstationExpend("500kV天马变电站", "1fa650685c77db1656c70f9db4a2edc6",new BigDecimal(119.292327),new BigDecimal(40.215015),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("500kV昌黎变电站", "1fa650685c77db1656c70f9db4a2edc6",new BigDecimal(118.990809),new BigDecimal(40.016014),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV陈官屯变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.998356),new BigDecimal(39.990971),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV小营变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.298044),new BigDecimal(39.814401),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV深河变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.453054),new BigDecimal(39.940208),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV杜庄变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.540182),new BigDecimal(40.026883),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV平方变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.173903),new BigDecimal(39.730601),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV肖营子变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.866099),new BigDecimal(40.279209),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV丰钢变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(118.913885),new BigDecimal(39.663569),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV碣石变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.191153),new BigDecimal(39.723464),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV龙家店变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.062243),new BigDecimal(39.719279),"17439407bfee299b7e38f2e54a8f6d28"),
|
||||||
|
new SubstationExpend("220kV仙螺岛变电站", "1b7b58ed8fcc2992b95334eaa9010c41",new BigDecimal(119.446926),new BigDecimal(39.792502),"17439407bfee299b7e38f2e54a8f6d28")
|
||||||
|
);
|
||||||
|
|
||||||
|
boolean b = substationExpendService.saveBatch(list);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, b, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ 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.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||||
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
|
import com.njcn.device.pms.pojo.dto.PmsSimpleDTO;
|
||||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||||
@@ -73,9 +74,9 @@ public interface DistributionMonitorMapper extends BaseMapper<DistributionMonito
|
|||||||
|
|
||||||
List<PmsSimpleDTO> statisticTerminal(@Param("list") List<String> terminalIds);
|
List<PmsSimpleDTO> statisticTerminal(@Param("list") List<String> terminalIds);
|
||||||
|
|
||||||
List<PmsSimpleDTO> getOnlineRate(@Param("list") List<String> terminalIds);
|
List<PmsSimpleDTO> getOnlineRate(@Param("list") List<String> terminalIds,@Param("param") StatisticsBizBaseParam param);
|
||||||
|
|
||||||
List<PmsSimpleDTO> getIntegrity(@Param("list") List<String> terminalIds);
|
List<PmsSimpleDTO> getIntegrity(@Param("list") List<String> terminalIds,@Param("param")StatisticsBizBaseParam param);
|
||||||
|
|
||||||
|
|
||||||
List<PmsMonitorBaseDTO> getDisMonitorAllList(@Param("subId") String subId,@Param("type") Integer type);
|
List<PmsMonitorBaseDTO> getDisMonitorAllList(@Param("subId") String subId,@Param("type") Integer type);
|
||||||
|
|||||||
@@ -229,11 +229,19 @@
|
|||||||
pm.Voltage_Level name,
|
pm.Voltage_Level name,
|
||||||
IFNULL(SUM(rmded.dev_effective_rate),0) doubleValue
|
IFNULL(SUM(rmded.dev_effective_rate),0) doubleValue
|
||||||
FROM pms_monitor pm
|
FROM pms_monitor pm
|
||||||
LEFT JOIN r_mp_dev_evaluate_detail rmded ON pm.Terminal_Id = rmded.device_id
|
INNER JOIN r_mp_dev_evaluate_detail rmded ON pm.Terminal_Id = rmded.device_id
|
||||||
WHERE pm.Terminal_Id IN
|
<where>
|
||||||
|
pm.Terminal_Id IN
|
||||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<if test="param.startTime != null and param.startTime != ''">
|
||||||
|
AND DATE_FORMAT(data_date, '%Y-%m-%d') >= DATE_FORMAT(#{param.startTime}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
<if test="param.endTime != null and param.endTime != ''">
|
||||||
|
AND DATE_FORMAT(data_date, '%Y-%m-%d') <= DATE_FORMAT(#{param.endTime}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
GROUP BY pm.Voltage_Level
|
GROUP BY pm.Voltage_Level
|
||||||
</select>
|
</select>
|
||||||
<select id="getIntegrity" resultType="com.njcn.device.pms.pojo.dto.PmsSimpleDTO">
|
<select id="getIntegrity" resultType="com.njcn.device.pms.pojo.dto.PmsSimpleDTO">
|
||||||
@@ -241,11 +249,19 @@
|
|||||||
pm.Voltage_Level name,
|
pm.Voltage_Level name,
|
||||||
IFNULL(SUM(romd.data_integrity_rate),0) doubleValue
|
IFNULL(SUM(romd.data_integrity_rate),0) doubleValue
|
||||||
FROM pms_monitor pm
|
FROM pms_monitor pm
|
||||||
LEFT JOIN r_operating_monitor_d romd ON pm.Id = romd.measurement_point_id
|
INNER JOIN r_operating_monitor_d romd ON pm.Id = romd.measurement_point_id
|
||||||
WHERE pm.Id IN
|
<where>
|
||||||
|
pm.Id IN
|
||||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
|
<if test="param.startTime != null and param.startTime != ''">
|
||||||
|
AND DATE_FORMAT(data_date, '%Y-%m-%d') >= DATE_FORMAT(#{param.startTime}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
<if test="param.endTime != null and param.endTime != ''">
|
||||||
|
AND DATE_FORMAT(data_date, '%Y-%m-%d') <= DATE_FORMAT(#{param.endTime}, '%Y-%m-%d')
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
GROUP BY pm.Voltage_Level
|
GROUP BY pm.Voltage_Level
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -9,8 +9,6 @@
|
|||||||
pm.Org_Name AS orgName,
|
pm.Org_Name AS orgName,
|
||||||
pm.Powerr_Id AS powerId,
|
pm.Powerr_Id AS powerId,
|
||||||
pm.Powerr_Name AS powerName,
|
pm.Powerr_Name AS powerName,
|
||||||
pm.Generatrix_Id AS generatrixId,
|
|
||||||
pm.Generatrix_Name AS generatrixName,
|
|
||||||
pm.Id AS monitorId,
|
pm.Id AS monitorId,
|
||||||
pm.`Name` AS monitorName,
|
pm.`Name` AS monitorName,
|
||||||
pss.Voltage_Level AS powerVoltageLevel
|
pss.Voltage_Level AS powerVoltageLevel
|
||||||
|
|||||||
@@ -122,12 +122,20 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
|||||||
List<String> monitorIds = new ArrayList<>();
|
List<String> monitorIds = new ArrayList<>();
|
||||||
generalDeviceDTOS.stream().forEach(e -> monitorIds.addAll(e.getMonitorIdList()));
|
generalDeviceDTOS.stream().forEach(e -> monitorIds.addAll(e.getMonitorIdList()));
|
||||||
List<PmsSimpleDTO> monitorStatistic = distributionMonitorMapper.statisticMonitor(monitorIds);
|
List<PmsSimpleDTO> monitorStatistic = distributionMonitorMapper.statisticMonitor(monitorIds);
|
||||||
ledgerStaticDTO.setMonitorStatistics(monitorStatistic);
|
Map<String, Long> collect1 = monitorStatistic.stream().collect(Collectors.groupingBy(PmsSimpleDTO::getName, Collectors.counting()));
|
||||||
|
List<PmsSimpleDTO> monitor=new ArrayList<>();
|
||||||
|
PmsSimpleDTO pDto;
|
||||||
|
for (Map.Entry<String, Long> stringLongEntry : collect1.entrySet()) {
|
||||||
|
pDto=new PmsSimpleDTO();
|
||||||
|
pDto.setName(stringLongEntry.getKey());
|
||||||
|
pDto.setStatistics(Math.toIntExact(stringLongEntry.getValue()));
|
||||||
|
monitor.add(pDto);
|
||||||
|
}
|
||||||
|
ledgerStaticDTO.setMonitorStatistics(monitor);
|
||||||
|
|
||||||
|
|
||||||
//获取所有监测点信息
|
//获取所有监测点信息
|
||||||
List<String> lineIds = generalDeviceDTOS.stream().flatMap(dto -> dto.getMonitorIdList().stream()).collect(Collectors.toList());
|
List<PmsSimpleDTO> pmsSimpleDTOS = monitorStatistic;
|
||||||
List<PmsSimpleDTO> pmsSimpleDTOS = distributionMonitorMapper.statisticMonitor(lineIds);
|
|
||||||
|
|
||||||
//根据电压等级进行分组
|
//根据电压等级进行分组
|
||||||
Map<String, List<PmsSimpleDTO>> voltageMap = pmsSimpleDTOS.stream().collect(Collectors.groupingBy(
|
Map<String, List<PmsSimpleDTO>> voltageMap = pmsSimpleDTOS.stream().collect(Collectors.groupingBy(
|
||||||
@@ -191,7 +199,7 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
|||||||
List<PmsSimpleDTO.PmsSimpleOrg> terminal=new ArrayList<>();
|
List<PmsSimpleDTO.PmsSimpleOrg> terminal=new ArrayList<>();
|
||||||
for (Map.Entry<String, List<PmsSimpleDTO>> stringListEntry : terminalMap.entrySet()) {
|
for (Map.Entry<String, List<PmsSimpleDTO>> stringListEntry : terminalMap.entrySet()) {
|
||||||
if(StrUtil.isNotBlank(stringListEntry.getKey())){
|
if(StrUtil.isNotBlank(stringListEntry.getKey())){
|
||||||
List<PmsSimpleDTO> monitorList = stringListEntry.getValue().stream().filter(x -> dto.getMonitorIdList().contains(x.getId())).collect(Collectors.toList());
|
List<PmsSimpleDTO> monitorList = stringListEntry.getValue().stream().filter(x -> dto.getTerminalIdList().contains(x.getId())).collect(Collectors.toList());
|
||||||
PmsSimpleDTO.PmsSimpleOrg simpleDTO=new PmsSimpleDTO.PmsSimpleOrg();
|
PmsSimpleDTO.PmsSimpleOrg simpleDTO=new PmsSimpleDTO.PmsSimpleOrg();
|
||||||
if(CollUtil.isNotEmpty(monitorList)){
|
if(CollUtil.isNotEmpty(monitorList)){
|
||||||
simpleDTO.setStatistics((int) monitorList.stream().mapToDouble(PmsSimpleDTO::getStatistics).sum());
|
simpleDTO.setStatistics((int) monitorList.stream().mapToDouble(PmsSimpleDTO::getStatistics).sum());
|
||||||
@@ -213,22 +221,14 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
|||||||
ledgerStaticDTO.setTerminalStatisticsByDept(list);
|
ledgerStaticDTO.setTerminalStatisticsByDept(list);
|
||||||
|
|
||||||
|
|
||||||
// // 根据单位统计终端数量
|
|
||||||
// HashMap<String,List<PmsSimpleDTO>> terminalsMap = new HashMap<>();
|
|
||||||
// for (PmsGeneralDeviceDTO generalDeviceDTO : generalDeviceDTOS) {
|
|
||||||
// List<PmsSimpleDTO> terminals = distributionMonitorMapper.statisticTerminal(terminalIds);
|
|
||||||
// terminalsMap.put(generalDeviceDTO.getName(),terminals);
|
|
||||||
// }
|
|
||||||
// ledgerStaticDTO.setTerminalStatisticsByDept(terminalsMap);
|
|
||||||
|
|
||||||
// 统计在线率
|
// 统计在线率
|
||||||
List<PmsSimpleDTO> onlineRateStatistic = distributionMonitorMapper.getOnlineRate(terminalIds);
|
List<PmsSimpleDTO> onlineRateStatistic = distributionMonitorMapper.getOnlineRate(terminalIds,param);
|
||||||
double sum = onlineRateStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum()!=0?onlineRateStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum():3.14159;
|
double sum = onlineRateStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum()!=0?onlineRateStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum():3.14159;
|
||||||
onlineRateStatistic.forEach(dto -> dto.setDoubleValue(new BigDecimal(dto.getDoubleValue() * 100 / sum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
onlineRateStatistic.forEach(dto -> dto.setDoubleValue(new BigDecimal(dto.getDoubleValue() * 100 / sum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||||
ledgerStaticDTO.setOnlineRateStatistics(onlineRateStatistic);
|
ledgerStaticDTO.setOnlineRateStatistics(onlineRateStatistic);
|
||||||
|
|
||||||
// 完整性
|
// 完整性
|
||||||
List<PmsSimpleDTO> integrityStatistic = distributionMonitorMapper.getIntegrity(terminalIds);
|
List<PmsSimpleDTO> integrityStatistic = distributionMonitorMapper.getIntegrity(monitorIds,param);
|
||||||
double s = integrityStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum()!=0?integrityStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum():3.14159;
|
double s = integrityStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum()!=0?integrityStatistic.stream().mapToDouble(PmsSimpleDTO::getDoubleValue).sum():3.14159;
|
||||||
integrityStatistic.forEach(dto -> dto.setDoubleValue(new BigDecimal(dto.getDoubleValue() * 100 / s).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
integrityStatistic.forEach(dto -> dto.setDoubleValue(new BigDecimal(dto.getDoubleValue() * 100 / s).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||||
ledgerStaticDTO.setIntegrityStatistics(integrityStatistic);
|
ledgerStaticDTO.setIntegrityStatistics(integrityStatistic);
|
||||||
@@ -247,16 +247,16 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
|||||||
List<CommunicateVO.PVCommunicateVO> info =new ArrayList<>();
|
List<CommunicateVO.PVCommunicateVO> info =new ArrayList<>();
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(param.getEndTime()))).append("' ");
|
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(param.getStartTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(param.getEndTime()))).append("' ");
|
||||||
// if(CollUtil.isNotEmpty(terminalIds)){
|
if(CollUtil.isNotEmpty(terminalIds)){
|
||||||
// stringBuilder.append(" and ").append("(");
|
stringBuilder.append(" and ").append("(");
|
||||||
// for (int i = 0; i < terminalIds.size(); i++) {
|
for (int i = 0; i < terminalIds.size(); i++) {
|
||||||
// if (terminalIds.size() - i != 1) {
|
if (terminalIds.size() - i != 1) {
|
||||||
// stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or ");
|
stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or ");
|
||||||
// } else {
|
} else {
|
||||||
// stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')");
|
stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')");
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
// }
|
}
|
||||||
stringBuilder.append(" limit "+param.getLimit());
|
stringBuilder.append(" limit "+param.getLimit());
|
||||||
String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder + InfluxDBPublicParam.TIME_ZONE;
|
String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder + InfluxDBPublicParam.TIME_ZONE;
|
||||||
// 获取暂降事件
|
// 获取暂降事件
|
||||||
|
|||||||
@@ -1,13 +1,10 @@
|
|||||||
package com.njcn.device.pq.pojo.param;
|
package com.njcn.device.pq.pojo.param;
|
||||||
|
|
||||||
import com.njcn.common.pojo.constant.PatternRegex;
|
import com.njcn.web.pojo.param.BaseParam;
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.hibernate.validator.constraints.Range;
|
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
|
||||||
import javax.validation.constraints.Pattern;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
@@ -16,34 +13,12 @@ import javax.validation.constraints.Pattern;
|
|||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
@ApiModel
|
@ApiModel
|
||||||
public class EventLogParam {
|
public class EventLogParam extends BaseParam {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 推送状态
|
* 推送状态
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty("推送状态(0.全部1.成功2.失败)")
|
@ApiModelProperty("推送状态(0.全部1.成功2.失败)")
|
||||||
private Integer result;
|
private Integer result;
|
||||||
/**
|
|
||||||
* 开始时间
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("开始时间")
|
|
||||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
|
||||||
private String searchBeginTime;
|
|
||||||
/**
|
|
||||||
* 结束时间
|
|
||||||
*/
|
|
||||||
@ApiModelProperty("结束时间")
|
|
||||||
@Pattern(regexp = PatternRegex.TIME_FORMAT, message = "时间格式错误")
|
|
||||||
private String searchEndTime;
|
|
||||||
|
|
||||||
@ApiModelProperty("页码")
|
|
||||||
@NotNull(message = "页码不可为空")
|
|
||||||
@Range(min = 1,message = "页码必须大于0")
|
|
||||||
private Integer pageNum;
|
|
||||||
|
|
||||||
@ApiModelProperty("条数")
|
|
||||||
@NotNull(message = "条数不可为空")
|
|
||||||
@Range(min = 1,message = "条数必须大于0")
|
|
||||||
private Integer pageSize;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,11 +16,14 @@ import java.time.LocalDateTime;
|
|||||||
@TableName("cld_event_push_log")
|
@TableName("cld_event_push_log")
|
||||||
public class EventPushLogs {
|
public class EventPushLogs {
|
||||||
|
|
||||||
@TableId("Time_Id")
|
@TableId("Event_Id")
|
||||||
private LocalDateTime timeId;
|
private String eventId;
|
||||||
|
|
||||||
@TableField("Line_Id")
|
@TableField("start_time")
|
||||||
private String lineId;
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
@TableField("measurement_point_id")
|
||||||
|
private String measurementPointId;
|
||||||
|
|
||||||
@TableField("Create_Time")
|
@TableField("Create_Time")
|
||||||
private LocalDateTime createTime;
|
private LocalDateTime createTime;
|
||||||
|
|||||||
@@ -428,4 +428,12 @@ public interface LineMapper extends BaseMapper<Line> {
|
|||||||
* @date 2023/5/10
|
* @date 2023/5/10
|
||||||
*/
|
*/
|
||||||
List<LineDevGetDTO> getLineBySubStation(@Param("subId")String subId);
|
List<LineDevGetDTO> getLineBySubStation(@Param("subId")String subId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件进行监测筛选出监测点id
|
||||||
|
* @author wr
|
||||||
|
* @date 2023/5/25
|
||||||
|
*/
|
||||||
|
List<String> getLineByIDs(@Param("searchValue")String searchValue);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1084,5 +1084,29 @@
|
|||||||
|
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getLineByIDs" resultType="java.lang.String">
|
||||||
|
SELECT DISTINCT
|
||||||
|
line.id
|
||||||
|
FROM
|
||||||
|
pq_line line,
|
||||||
|
pq_line voltage,
|
||||||
|
pq_line device,
|
||||||
|
pq_line substation,
|
||||||
|
pq_line gd
|
||||||
|
|
||||||
|
<where>
|
||||||
|
line.pid = voltage.id
|
||||||
|
AND voltage.pid = device.id
|
||||||
|
AND device.pid = substation.id
|
||||||
|
AND substation.pid = gd.id
|
||||||
|
<if test="searchValue!=null and searchValue!=''">
|
||||||
|
and (
|
||||||
|
gd.name like CONCAT('%', #{searchValue}, '%')
|
||||||
|
or substation.name like CONCAT('%', #{searchValue}, '%')
|
||||||
|
or line.NAME like CONCAT('%', #{searchValue},'%')
|
||||||
|
)
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -2,9 +2,12 @@ package com.njcn.device.pq.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.google.common.collect.Lists;
|
import com.google.common.collect.Lists;
|
||||||
|
import com.njcn.db.constant.DbConstant;
|
||||||
import com.njcn.device.pq.mapper.EventPushLogsMapper;
|
import com.njcn.device.pq.mapper.EventPushLogsMapper;
|
||||||
import com.njcn.device.pq.mapper.LineMapper;
|
import com.njcn.device.pq.mapper.LineMapper;
|
||||||
import com.njcn.device.pq.mapper.LogManageMapper;
|
import com.njcn.device.pq.mapper.LogManageMapper;
|
||||||
@@ -97,6 +100,10 @@ public class LogManageServiceImpl implements LogManageService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<EventLogVO> getEventLogData(EventLogParam eventLogParam) {
|
public Page<EventLogVO> getEventLogData(EventLogParam eventLogParam) {
|
||||||
|
|
||||||
|
//查询全部时间
|
||||||
|
List<String> lineByIDs = lineMapper.getLineByIDs(eventLogParam.getSearchValue());
|
||||||
|
|
||||||
Page<EventLogVO> page = new Page<>();
|
Page<EventLogVO> page = new Page<>();
|
||||||
page.setSize(eventLogParam.getPageSize());
|
page.setSize(eventLogParam.getPageSize());
|
||||||
page.setCurrent(eventLogParam.getPageNum());
|
page.setCurrent(eventLogParam.getPageNum());
|
||||||
@@ -105,35 +112,44 @@ public class LogManageServiceImpl implements LogManageService {
|
|||||||
Page<EventPushLogs> p = new Page<>();
|
Page<EventPushLogs> p = new Page<>();
|
||||||
p.setSize(eventLogParam.getPageSize());
|
p.setSize(eventLogParam.getPageSize());
|
||||||
p.setCurrent(eventLogParam.getPageNum());
|
p.setCurrent(eventLogParam.getPageNum());
|
||||||
LambdaQueryWrapper<EventPushLogs> wrapper = new LambdaQueryWrapper<>();
|
QueryWrapper<EventPushLogs> wrapper = new QueryWrapper<>();
|
||||||
wrapper.between(EventPushLogs::getTimeId,DateUtil.beginOfDay(DateUtil.parse(eventLogParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
|
wrapper.between("start_time",DateUtil.beginOfDay(DateUtil.parse(eventLogParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
|
||||||
wrapper.eq(EventPushLogs::getResult,eventLogParam.getResult());
|
wrapper.eq(eventLogParam.getResult()!=null,"Result",eventLogParam.getResult());
|
||||||
|
wrapper.in("measurement_point_id",lineByIDs);
|
||||||
|
if (ObjectUtil.isAllNotEmpty(eventLogParam.getSortBy(), eventLogParam.getOrderBy())) {
|
||||||
|
wrapper.orderBy(true, eventLogParam.getOrderBy().equals(DbConstant.ASC), StrUtil.toUnderlineCase(eventLogParam.getSortBy()));
|
||||||
|
} else {
|
||||||
|
//没有排序参数,默认根据sort字段排序,没有排序字段的,根据updateTime更新时间排序
|
||||||
|
wrapper.orderBy(true, false, "start_time");
|
||||||
|
}
|
||||||
Page<EventPushLogs> rawPage = eventPushLogsMapper.selectPage(p, wrapper);
|
Page<EventPushLogs> rawPage = eventPushLogsMapper.selectPage(p, wrapper);
|
||||||
List<EventPushLogs> rawLogs = rawPage.getRecords();
|
List<EventPushLogs> rawLogs = rawPage.getRecords();
|
||||||
if (CollectionUtil.isNotEmpty(rawLogs)) {
|
if (CollectionUtil.isNotEmpty(rawLogs)) {
|
||||||
List<String> lineIndexes = rawLogs.stream().map(EventPushLogs::getLineId).distinct().collect(Collectors.toList());
|
List<String> lineIndexes = rawLogs.stream().map(EventPushLogs::getMeasurementPointId).distinct().collect(Collectors.toList());
|
||||||
List<EventDetail> rawEventDetailData = eventDetailFeignClient.getEventDetailLimit(lineIndexes, eventLogParam.getSearchBeginTime(), eventLogParam.getSearchEndTime(), eventLogParam.getPageSize(), eventLogParam.getPageNum()).getData();
|
|
||||||
|
List<EventDetail> rawEventDetailData = eventDetailFeignClient.getEventDetail(lineIndexes, eventLogParam.getSearchBeginTime(), eventLogParam.getSearchEndTime()).getData();
|
||||||
List<EventDetail> eventDetails = rawEventDetailData.stream().filter(eventDetail -> filterLineIdAndTime(eventDetail, rawLogs)).collect(Collectors.toList());
|
List<EventDetail> eventDetails = rawEventDetailData.stream().filter(eventDetail -> filterLineIdAndTime(eventDetail, rawLogs)).collect(Collectors.toList());
|
||||||
|
|
||||||
Map<String, List<EventDetail>> eventDetailMap = eventDetails.stream().collect(Collectors.groupingBy(EventDetail::getLineId));
|
Map<String, List<EventDetail>> eventDetailMap = eventDetails.stream().collect(Collectors.groupingBy(EventDetail::getLineId));
|
||||||
List<String> lineList = eventDetails.stream().map(EventDetail::getLineId).collect(Collectors.toList());
|
List<String> lineList = eventDetails.stream().map(EventDetail::getLineId).collect(Collectors.toList());
|
||||||
List<AreaLineInfoVO> lineAreaInfos = lineMapper.getBaseLineAreaInfo(lineList, null, null);
|
List<AreaLineInfoVO> lineAreaInfos = lineMapper.getBaseLineAreaInfo(lineList, null, null);
|
||||||
Map<String, List<AreaLineInfoVO>> areaMap = lineAreaInfos.stream().collect(Collectors.groupingBy(AreaLineInfoVO::getLineId));
|
Map<String, List<AreaLineInfoVO>> areaMap = lineAreaInfos.stream().collect(Collectors.groupingBy(AreaLineInfoVO::getLineId));
|
||||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||||
for (EventPushLogs rawLog : rawLogs) {
|
for (EventPushLogs rawLog : rawLogs) {
|
||||||
if (Objects.isNull(areaMap.get(rawLog.getLineId()).get(0)) || Objects.isNull(eventDetailMap.get(rawLog.getLineId()).get(0))) {
|
if (Objects.isNull(areaMap.get(rawLog.getMeasurementPointId()).get(0)) || Objects.isNull(eventDetailMap.get(rawLog.getMeasurementPointId()).get(0))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
EventLogVO eventLogVO = new EventLogVO();
|
EventLogVO eventLogVO = new EventLogVO();
|
||||||
eventLogVO.setLineId(rawLog.getLineId());
|
eventLogVO.setLineId(rawLog.getMeasurementPointId());
|
||||||
eventLogVO.setTime(dateTimeFormatter.format(rawLog.getTimeId()));
|
eventLogVO.setTime(dateTimeFormatter.format(rawLog.getStartTime()));
|
||||||
eventLogVO.setLine(areaMap.get(rawLog.getLineId()).get(0).getLineName());
|
eventLogVO.setLine(areaMap.get(rawLog.getMeasurementPointId()).get(0).getLineName());
|
||||||
eventLogVO.setSubstation(areaMap.get(rawLog.getLineId()).get(0).getSubName());
|
eventLogVO.setSubstation(areaMap.get(rawLog.getMeasurementPointId()).get(0).getSubName());
|
||||||
eventLogVO.setPowerCompany(areaMap.get(rawLog.getLineId()).get(0).getGdName());
|
eventLogVO.setPowerCompany(areaMap.get(rawLog.getMeasurementPointId()).get(0).getGdName());
|
||||||
Double e=eventDetailMap.get(rawLog.getLineId()).get(0).getFeatureAmplitude();
|
Double e=eventDetailMap.get(rawLog.getMeasurementPointId()).get(0).getFeatureAmplitude();
|
||||||
BigDecimal bd = new BigDecimal(e);
|
BigDecimal bd = new BigDecimal(e);
|
||||||
e= bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
|
e= bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
|
||||||
eventLogVO.setEventValue(String.valueOf(e*100));
|
eventLogVO.setEventValue(String.valueOf(e*100));
|
||||||
double i = eventDetailMap.get(rawLog.getLineId()).get(0).getDuration();
|
double i = eventDetailMap.get(rawLog.getMeasurementPointId()).get(0).getDuration();
|
||||||
eventLogVO.setPersistTime(String.valueOf(i));
|
eventLogVO.setPersistTime(String.valueOf(i));
|
||||||
eventLogVO.setCreatTime(dateTimeFormatter.format(rawLog.getCreateTime()));
|
eventLogVO.setCreatTime(dateTimeFormatter.format(rawLog.getCreateTime()));
|
||||||
eventLogVO.setCreatTimed(dateTimeFormatter.format(rawLog.getCreateTime()));
|
eventLogVO.setCreatTimed(dateTimeFormatter.format(rawLog.getCreateTime()));
|
||||||
@@ -155,72 +171,14 @@ public class LogManageServiceImpl implements LogManageService {
|
|||||||
page.setRecords(list);
|
page.setRecords(list);
|
||||||
}
|
}
|
||||||
return page;
|
return page;
|
||||||
|
|
||||||
|
|
||||||
// /** 查询event_push_logs表数据*/
|
|
||||||
// List<EventPushLogs> eventPushLogs = getEventPushLogs(eventLogParam.getSearchBeginTime(), eventLogParam.getSearchEndTime(), eventLogParam.getResult());
|
|
||||||
// //待分页数据总量
|
|
||||||
// page.setTotal(eventPushLogs.size());
|
|
||||||
// //分页总页数
|
|
||||||
// int pages = (int)Math.ceil(eventPushLogs.size()*1.0/eventLogParam.getPageSize());
|
|
||||||
// page.setPages(pages);
|
|
||||||
// if (!CollectionUtils.isEmpty(eventPushLogs)) {
|
|
||||||
// List<String> lineIndexes = eventPushLogs.stream().map(EventPushLogs::getLineId).collect(Collectors.toList());
|
|
||||||
// lineIndexes = lineIndexes.stream().distinct().collect(Collectors.toList());
|
|
||||||
// /** 分页查询pqs_eventdetail表数据*/
|
|
||||||
// List<EventDetail> eventDetailData = eventDetailFeignClient.getEventDetailLimit(lineIndexes, eventLogParam.getSearchBeginTime(), eventLogParam.getSearchEndTime(), eventLogParam.getPageSize(), eventLogParam.getPageNum()).getData();
|
|
||||||
// if (!CollectionUtils.isEmpty(eventDetailData)) {
|
|
||||||
// for (EventPushLogs pushLogs: eventPushLogs) {
|
|
||||||
// for (EventDetail eventDetail: eventDetailData) {
|
|
||||||
// if (pushLogs.getLineId().equals(eventDetail.getLineId()) && pushLogs.getTimeId().equals(eventDetail.getStartTime())) {
|
|
||||||
// EventLogVO event = logManageMapper.getEventLogData(pushLogs.getLineId());
|
|
||||||
// if (Objects.isNull(event)) {
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
// EventLogVO eventLogVO = new EventLogVO();
|
|
||||||
// eventLogVO.setLineId(pushLogs.getLineId());
|
|
||||||
// LocalDateTime localDateTime = LocalDateTime.ofInstant(pushLogs.getTimeId(), ZoneId.systemDefault());
|
|
||||||
// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
|
||||||
// String format = dateTimeFormatter.format(localDateTime);
|
|
||||||
// eventLogVO.setTime(format);
|
|
||||||
// eventLogVO.setLine(event.getLine());
|
|
||||||
// eventLogVO.setSubstation(event.getSubstation());
|
|
||||||
// eventLogVO.setPowerCompany(event.getPowerCompany());
|
|
||||||
// Double e = eventDetail.getFeatureAmplitude();
|
|
||||||
// BigDecimal bd = new BigDecimal(e);
|
|
||||||
// e= bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
|
|
||||||
// eventLogVO.setEventValue(String.valueOf(e*100));
|
|
||||||
// double i = eventDetail.getDuration() / 1000;
|
|
||||||
// eventLogVO.setPersistTime(String.valueOf(i));
|
|
||||||
// eventLogVO.setCreatTime(pushLogs.getCreateTime());
|
|
||||||
// eventLogVO.setCreatTimed(pushLogs.getCreateTime());
|
|
||||||
// eventLogVO.setPushFailed(pushLogs.getPushFailed());
|
|
||||||
// if (pushLogs.getResult()==0) {
|
|
||||||
// eventLogVO.setResult("失败");
|
|
||||||
// eventLogVO.setState("未推送");
|
|
||||||
// } else {
|
|
||||||
// eventLogVO.setResult("成功");
|
|
||||||
// eventLogVO.setState("已推送");
|
|
||||||
// }
|
|
||||||
// eventLogVO.setUpdateTime(pushLogs.getUpdateTime());
|
|
||||||
//
|
|
||||||
// list.add(eventLogVO);
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// //当前页数据
|
|
||||||
// page.setRecords(list);
|
|
||||||
// }
|
|
||||||
// return page;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean filterLineIdAndTime(EventDetail eventDetail, List<EventPushLogs> eventPushLogs) {
|
private boolean filterLineIdAndTime(EventDetail eventDetail, List<EventPushLogs> eventPushLogs) {
|
||||||
boolean flag = false;
|
boolean flag = false;
|
||||||
String evenDetailTime = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
String evenDetailTime = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
for (EventPushLogs log : eventPushLogs) {
|
for (EventPushLogs log : eventPushLogs) {
|
||||||
String logTime = log.getTimeId().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
String logTime = log.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||||
if (log.getLineId().equals(eventDetail.getLineId()) && evenDetailTime.equals(logTime)) {
|
if (log.getMeasurementPointId().equals(eventDetail.getLineId())&& log.getEventId().equals(eventDetail.getEventId())&& evenDetailTime.equals(logTime)) {
|
||||||
flag = true;
|
flag = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.njcn.event.pojo.param;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2023/5/24 9:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EventTypeParam extends StatisticsBizBaseParam {
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "type", value = "区分主配网")
|
||||||
|
private Integer pointType=0; //监测点名称
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|||||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.event.pojo.param.EventTypeParam;
|
||||||
import com.njcn.event.pojo.param.REventMParam;
|
import com.njcn.event.pojo.param.REventMParam;
|
||||||
import com.njcn.event.pojo.vo.RArrayVO;
|
import com.njcn.event.pojo.vo.RArrayVO;
|
||||||
import com.njcn.event.pojo.vo.RStatEventMVO;
|
import com.njcn.event.pojo.vo.RStatEventMVO;
|
||||||
@@ -18,9 +19,7 @@ import com.njcn.web.controller.BaseController;
|
|||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -101,6 +100,13 @@ public class RStatEventOrgController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, getAllRStatEventOrgIcon, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, getAllRStatEventOrgIcon, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getEventOrg")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("查询当前部门暂态指标信息")
|
||||||
|
public HttpResult<List<RArrayVO>> getEventOrg(@RequestBody EventTypeParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getEventOrg");
|
||||||
|
List<RArrayVO> list = rStatEventOrgMService.getEventOrg(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
import com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper;
|
import com.njcn.event.mapper.majornetwork.RStatEventOrgMMapper;
|
||||||
|
import com.njcn.event.pojo.param.EventTypeParam;
|
||||||
import com.njcn.event.pojo.param.REventMParam;
|
import com.njcn.event.pojo.param.REventMParam;
|
||||||
import com.njcn.event.pojo.po.RStatEventOrgM;
|
import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||||
import com.njcn.event.pojo.vo.RArrayVO;
|
import com.njcn.event.pojo.vo.RArrayVO;
|
||||||
@@ -21,6 +22,7 @@ import com.njcn.system.enums.DicDataTypeEnum;
|
|||||||
import com.njcn.system.pojo.po.DictData;
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.user.api.DeptFeignClient;
|
import com.njcn.user.api.DeptFeignClient;
|
||||||
import com.njcn.user.pojo.dto.DeptDTO;
|
import com.njcn.user.pojo.dto.DeptDTO;
|
||||||
|
import com.njcn.user.pojo.po.Dept;
|
||||||
import com.njcn.web.utils.WebUtil;
|
import com.njcn.web.utils.WebUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
@@ -362,6 +364,66 @@ public class RStatEventOrgMServiceImpl extends ServiceImpl<RStatEventOrgMMapper,
|
|||||||
return arrayVOList;
|
return arrayVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RArrayVO> getEventOrg(EventTypeParam param) {
|
||||||
|
List<RArrayVO> info=new ArrayList<>();
|
||||||
|
//获取当前部门信息
|
||||||
|
Dept dept = deptFeignClient.getDeptById(param.getId()).getData();
|
||||||
|
|
||||||
|
List<DictData> eventTypeData = dicDataFeignClient.getDicDataByTypeCode(
|
||||||
|
DicDataTypeEnum.EVENT_STATIS.getCode()).getData();
|
||||||
|
Map<String, DictData> eventTypeMap = eventTypeData.stream()
|
||||||
|
.collect(Collectors.toMap(DictData::getId, Function.identity()));
|
||||||
|
|
||||||
|
DictData distributionData=new DictData();
|
||||||
|
//获取配网信息
|
||||||
|
if(param.getPointType()==0){
|
||||||
|
distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.MAINNET_POINT.getCode()).getData();
|
||||||
|
}else{
|
||||||
|
distributionData = dicDataFeignClient.getDicDataByCode(DicDataEnum.DISTRIBUTION_POINT.getCode()).getData();
|
||||||
|
}
|
||||||
|
|
||||||
|
List<RStatEventOrgM> rStatEventOrgMS = statEventOrgMMapper.selectList(new LambdaQueryWrapper<RStatEventOrgM>()
|
||||||
|
.eq(RStatEventOrgM::getDataType, distributionData.getId())
|
||||||
|
.in(RStatEventOrgM::getOrgNo, dept.getCode())
|
||||||
|
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatEventOrgM::getDataDate, param.getStartTime())
|
||||||
|
.le(StrUtil.isNotBlank(param.getEndTime()), RStatEventOrgM::getDataDate, param.getEndTime())
|
||||||
|
);
|
||||||
|
Map<String, RStatEventOrgM> eventOrgMMap = rStatEventOrgMS.stream().collect(Collectors.toMap(RStatEventOrgM::getEventType, Function.identity(), (Key1, kye2) -> Key1));
|
||||||
|
eventOrgMMap.forEach((key, value) -> {
|
||||||
|
if (eventTypeMap.containsKey(key)) {
|
||||||
|
RArrayVO arrayVO = new RArrayVO();
|
||||||
|
DictData data = eventTypeMap.get(key);
|
||||||
|
arrayVO.setRowName(data.getName());
|
||||||
|
arrayVO.setSort(data.getSort());
|
||||||
|
List<Object> a=new ArrayList<>();
|
||||||
|
//累计超标占比
|
||||||
|
a.add(value.getEventMeasurementRatioAccrued());
|
||||||
|
a.add(100-value.getEventMeasurementRatioAccrued());
|
||||||
|
a.add(value.getEventMeasurementAccrued());
|
||||||
|
arrayVO.setColumns(a);
|
||||||
|
info.add(arrayVO);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
List<DictData> notEventOrg = eventTypeData.stream().filter(r -> !eventOrgMMap.containsKey(r.getId()))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
for (DictData dictData : notEventOrg) {
|
||||||
|
RArrayVO arrayVO = new RArrayVO();
|
||||||
|
arrayVO.setRowName(dictData.getName());
|
||||||
|
arrayVO.setSort(dictData.getSort());
|
||||||
|
List<Object> a=new ArrayList<>();
|
||||||
|
//累计超标占比
|
||||||
|
a.add(0);
|
||||||
|
a.add(100);
|
||||||
|
a.add(0);
|
||||||
|
arrayVO.setColumns(a);
|
||||||
|
info.add(arrayVO);
|
||||||
|
}
|
||||||
|
info.sort(Comparator.comparing(rStatEventMVO -> rStatEventMVO.getSort()));
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 便利赋值
|
* 便利赋值
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -442,20 +442,24 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
@Override
|
@Override
|
||||||
public Page<DetailVO> getContinueTime(WaveTypeParam waveTypeParam) {
|
public Page<DetailVO> getContinueTime(WaveTypeParam waveTypeParam) {
|
||||||
List<String> lineIds =new ArrayList<>();
|
List<String> lineIds =new ArrayList<>();
|
||||||
String eventType="";
|
|
||||||
List<DetailVO> result = new ArrayList<>();
|
List<DetailVO> result = new ArrayList<>();
|
||||||
if(waveTypeParam.getType()==0){
|
if(waveTypeParam.getType()==0){
|
||||||
//pq系统
|
//pq系统
|
||||||
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData();
|
List<GeneralDeviceDTO> deviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(waveTypeParam).getData();
|
||||||
lineIds =deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
lineIds =deviceDTOList.stream().flatMap(list -> list.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
}else{
|
}else if(waveTypeParam.getType()==1){
|
||||||
//pms系统
|
//pms系统
|
||||||
PmsDeviceInfoParam param=new PmsDeviceInfoParam();
|
PmsDeviceInfoParam param=new PmsDeviceInfoParam();
|
||||||
param.setDeptIndex(waveTypeParam.getDeptIndex());
|
param.setDeptIndex(waveTypeParam.getDeptIndex());
|
||||||
param.setStatisticalType(waveTypeParam.getStatisticalType());
|
param.setStatisticalType(waveTypeParam.getStatisticalType());
|
||||||
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(param).getData();
|
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(param).getData();
|
||||||
lineIds =data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
|
lineIds =data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
|
||||||
eventType=dicDataFeignClient.getDicDataByCode(DicDataEnum.VOLTAGE_DIP.getCode()).getData().getId();
|
}else{
|
||||||
|
PmsDeviceInfoParam param=new PmsDeviceInfoParam();
|
||||||
|
param.setDeptIndex(waveTypeParam.getDeptIndex());
|
||||||
|
param.setStatisticalType(waveTypeParam.getStatisticalType());
|
||||||
|
List<PmsGeneralDeviceDTO> data = pmsGeneralDeviceInfoClient.getPwPmsDeviceInfoWithOrgId(param).getData();
|
||||||
|
lineIds =data.stream().flatMap(list -> list.getMonitorIdList().stream()).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(lineIds)) {
|
if (CollectionUtil.isEmpty(lineIds)) {
|
||||||
@@ -463,9 +467,10 @@ public class ReportServiceImpl implements ReportService {
|
|||||||
}
|
}
|
||||||
Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
|
Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(waveTypeParam.getPageNum(), waveTypeParam.getPageSize()), new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||||
.eq(StrUtil.isNotBlank(eventType),RmpEventDetailPO::getEventType,eventType)
|
.eq(StrUtil.isNotBlank(waveTypeParam.getStatisticalType().getId()),RmpEventDetailPO::getEventType,waveTypeParam.getStatisticalType().getId())
|
||||||
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime())))
|
.ge(StringUtils.isNotBlank(waveTypeParam.getSearchBeginTime()), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(waveTypeParam.getSearchBeginTime())))
|
||||||
.le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
|
.le(StringUtils.isNotBlank(waveTypeParam.getSearchEndTime()), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(waveTypeParam.getSearchEndTime())))
|
||||||
|
.orderByDesc(RmpEventDetailPO::getStartTime)
|
||||||
);
|
);
|
||||||
List<EventDetailNew> info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class);
|
List<EventDetailNew> info =BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class);
|
||||||
if (CollectionUtil.isNotEmpty(info)) {
|
if (CollectionUtil.isNotEmpty(info)) {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.event.service.majornetwork;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
|
import com.njcn.event.pojo.param.EventTypeParam;
|
||||||
import com.njcn.event.pojo.param.REventMParam;
|
import com.njcn.event.pojo.param.REventMParam;
|
||||||
import com.njcn.event.pojo.po.RStatEventOrgM;
|
import com.njcn.event.pojo.po.RStatEventOrgM;
|
||||||
import com.njcn.event.pojo.vo.RArrayVO;
|
import com.njcn.event.pojo.vo.RArrayVO;
|
||||||
@@ -50,4 +51,11 @@ public interface RStatEventOrgMService extends IService<RStatEventOrgM> {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param);
|
List<RStatEventMVO> getPwRStatHarmonicOrgMIcon(REventMParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据当前单位查询当前信息
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<RArrayVO> getEventOrg(EventTypeParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.harmonic.controller.distribution;
|
|||||||
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.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.harmonic.pojo.param.OverviewParam;
|
import com.njcn.harmonic.pojo.param.OverviewParam;
|
||||||
@@ -91,4 +92,13 @@ public class PwOverviewController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, groupVOS, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, groupVOS, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@PostMapping("/getPVVoltage")
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@ApiOperation("高低电压问题(冀北)")
|
||||||
|
@ApiImplicitParam(name = "param", value = "条件参数", required = true)
|
||||||
|
public HttpResult<List<List<Object>>> getPVVoltage(@RequestBody StatisticsBizBaseParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getPVVoltage");
|
||||||
|
List<List<Object>> pvVoltage = rStatOrgPvPowerQualityService.getPVVoltage(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pvVoltage, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,17 +9,16 @@
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
measurement_point_id,
|
measurement_point_id,
|
||||||
data_date,
|
|
||||||
sum( is_v_dev_warn + is_freq_warn + is_unbalance_warn + is_v_warn + is_flicker_warn + is_sag_warn + is_interrupt_warn + is_swell_warn ) AS num
|
sum( is_v_dev_warn + is_freq_warn + is_unbalance_warn + is_v_warn + is_flicker_warn + is_sag_warn + is_interrupt_warn + is_swell_warn ) AS num
|
||||||
FROM
|
FROM
|
||||||
r_mp_target_warn_d
|
r_mp_target_warn_d rmtwd
|
||||||
<where>
|
<where>
|
||||||
is_effective = 1 AND is_warn = 1
|
is_effective = 1 AND is_warn = 1
|
||||||
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
||||||
AND rmphd.data_date >= #{param.startTime} AND rmshd.data_date >= #{param.startTime}
|
AND rmtwd.data_date >= #{param.startTime} AND rmtwd.data_date >= #{param.startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
||||||
AND rmphd.data_date <= #{param.endTime} AND rmshd.data_date <= #{param.endTime}
|
AND rmtwd.data_date <= #{param.endTime} AND rmtwd.data_date <= #{param.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="id != null and id.size > 0">
|
<if test="id != null and id.size > 0">
|
||||||
AND measurement_point_id IN
|
AND measurement_point_id IN
|
||||||
@@ -29,10 +28,9 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
measurement_point_id,
|
measurement_point_id
|
||||||
data_date
|
|
||||||
HAVING
|
HAVING
|
||||||
num > 1
|
num > 0
|
||||||
) x UNION ALL
|
) x UNION ALL
|
||||||
SELECT
|
SELECT
|
||||||
count(*)
|
count(*)
|
||||||
@@ -40,17 +38,16 @@
|
|||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
measurement_point_id,
|
measurement_point_id,
|
||||||
data_date,
|
|
||||||
sum( is_v_dev_warn + is_freq_warn + is_unbalance_warn + is_v_warn + is_flicker_warn + is_sag_warn + is_interrupt_warn + is_swell_warn ) AS num
|
sum( is_v_dev_warn + is_freq_warn + is_unbalance_warn + is_v_warn + is_flicker_warn + is_sag_warn + is_interrupt_warn + is_swell_warn ) AS num
|
||||||
FROM
|
FROM
|
||||||
r_mp_target_warn_d
|
r_mp_target_warn_d rmtwd
|
||||||
<where>
|
<where>
|
||||||
is_effective = 1 AND is_harmonic = 1
|
is_effective = 1 AND is_harmonic = 1
|
||||||
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
<if test="param!=null and param.startTime != null and param.startTime !=''">
|
||||||
AND rmphd.data_date >= #{param.startTime} AND rmshd.data_date >= #{param.startTime}
|
AND rmtwd.data_date >= #{param.startTime} AND rmtwd.data_date >= #{param.startTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
<if test="param!=null and param.endTime != null and param.endTime != ''">
|
||||||
AND rmphd.data_date <= #{param.endTime} AND rmshd.data_date <= #{param.endTime}
|
AND rmtwd.data_date <= #{param.endTime} AND rmtwd.data_date <= #{param.endTime}
|
||||||
</if>
|
</if>
|
||||||
<if test="id != null and id.size > 0">
|
<if test="id != null and id.size > 0">
|
||||||
AND measurement_point_id IN
|
AND measurement_point_id IN
|
||||||
@@ -60,10 +57,9 @@
|
|||||||
</if>
|
</if>
|
||||||
</where>
|
</where>
|
||||||
GROUP BY
|
GROUP BY
|
||||||
measurement_point_id,
|
measurement_point_id
|
||||||
data_date
|
|
||||||
HAVING
|
HAVING
|
||||||
num > 1
|
num > 0
|
||||||
) x
|
) x
|
||||||
</select>
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -543,7 +543,6 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
|||||||
dto.setPowerCompany(power.getOrgName());
|
dto.setPowerCompany(power.getOrgName());
|
||||||
dto.setSubstation(power.getPowerName());
|
dto.setSubstation(power.getPowerName());
|
||||||
dto.setSubstationId(power.getPowerId());
|
dto.setSubstationId(power.getPowerId());
|
||||||
dto.setBusBar(power.getGeneratrixName());
|
|
||||||
if(CollectionUtil.isNotEmpty(lineMap)){
|
if(CollectionUtil.isNotEmpty(lineMap)){
|
||||||
if(lineMap.containsKey(power.getMonitorId())){
|
if(lineMap.containsKey(power.getMonitorId())){
|
||||||
dto.setData(lineMap.get(power.getMonitorId()));
|
dto.setData(lineMap.get(power.getMonitorId()));
|
||||||
|
|||||||
@@ -53,9 +53,11 @@ public class PVOverviewServiceImpl implements PVOverviewService {
|
|||||||
List<DeptGetChildrenDTO> data = commTerminalGeneralClient.deptGetLineList(deptGetLineParam).getData();
|
List<DeptGetChildrenDTO> data = commTerminalGeneralClient.deptGetLineList(deptGetLineParam).getData();
|
||||||
if(CollUtil.isNotEmpty(data)){
|
if(CollUtil.isNotEmpty(data)){
|
||||||
List<String> monitorIds = data.stream().flatMap(dto -> dto.getLineIds().stream()).collect(Collectors.toList());
|
List<String> monitorIds = data.stream().flatMap(dto -> dto.getLineIds().stream()).collect(Collectors.toList());
|
||||||
return pvOverviewMapper.selectPVSynthesisCount(param, monitorIds);
|
List<Integer> integers = pvOverviewMapper.selectPVSynthesisCount(param, monitorIds);
|
||||||
|
integers.add(monitorIds.size());
|
||||||
|
return integers;
|
||||||
}
|
}
|
||||||
return new ArrayList<Integer>(2){{add(0);add(0);}};
|
return new ArrayList<Integer>(3){{add(0);add(0);add(0);}};
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -109,7 +111,6 @@ public class PVOverviewServiceImpl implements PVOverviewService {
|
|||||||
dto.setPowerCompany(power.getOrgName());
|
dto.setPowerCompany(power.getOrgName());
|
||||||
dto.setSubstation(power.getPowerName());
|
dto.setSubstation(power.getPowerName());
|
||||||
dto.setSubstationId(power.getPowerId());
|
dto.setSubstationId(power.getPowerId());
|
||||||
dto.setBusBar(power.getGeneratrixName());
|
|
||||||
dto.setPowerVoltageLevel(power.getPowerVoltageLevel());
|
dto.setPowerVoltageLevel(power.getPowerVoltageLevel());
|
||||||
dto.setData(substationDPO.getValue());
|
dto.setData(substationDPO.getValue());
|
||||||
return dto;
|
return dto;
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.harmonic.service.specialanalysis;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.common.pojo.param.StatisticsBizBaseParam;
|
||||||
import com.njcn.harmonic.pojo.param.OverviewParam;
|
import com.njcn.harmonic.pojo.param.OverviewParam;
|
||||||
import com.njcn.harmonic.pojo.param.PowerQualityParam;
|
import com.njcn.harmonic.pojo.param.PowerQualityParam;
|
||||||
import com.njcn.harmonic.pojo.po.RStatOrgPvPowerQualityQPO;
|
import com.njcn.harmonic.pojo.po.RStatOrgPvPowerQualityQPO;
|
||||||
@@ -56,4 +57,11 @@ public interface RStatOrgPvPowerQualityService extends IService<RStatOrgPvPowerQ
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<OverviewVO.IcoVO> getBackTheTide(OverviewParam param);
|
List<OverviewVO.IcoVO> getBackTheTide(OverviewParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高低电压问题(冀北)
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<List<Object>> getPVVoltage(StatisticsBizBaseParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,26 @@ package com.njcn.harmonic.service.specialanalysis.impl;
|
|||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
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.common.pojo.enums.response.CommonResponseEnum;
|
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.param.StatisticsBizBaseParam;
|
||||||
|
import com.njcn.device.biz.commApi.CommTerminalGeneralClient;
|
||||||
|
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||||
|
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||||
|
import com.njcn.device.pms.api.PmsGeneralDeviceInfoClient;
|
||||||
import com.njcn.device.pms.api.PwMonitorClient;
|
import com.njcn.device.pms.api.PwMonitorClient;
|
||||||
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
import com.njcn.device.pms.pojo.dto.PwPmsMonitorDTO;
|
||||||
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
import com.njcn.device.pms.pojo.param.PwPmsMonitorParam;
|
||||||
import com.njcn.harmonic.mapper.specialanalysis.*;
|
import com.njcn.harmonic.mapper.specialanalysis.*;
|
||||||
import com.njcn.harmonic.pojo.param.OverviewParam;
|
import com.njcn.harmonic.pojo.param.OverviewParam;
|
||||||
import com.njcn.harmonic.pojo.param.PowerQualityParam;
|
import com.njcn.harmonic.pojo.param.PowerQualityParam;
|
||||||
|
import com.njcn.harmonic.pojo.po.RStatOrgPvPowerQualityMPO;
|
||||||
import com.njcn.harmonic.pojo.po.RStatOrgPvPowerQualityQPO;
|
import com.njcn.harmonic.pojo.po.RStatOrgPvPowerQualityQPO;
|
||||||
import com.njcn.harmonic.pojo.vo.OverviewVO;
|
import com.njcn.harmonic.pojo.vo.OverviewVO;
|
||||||
import com.njcn.harmonic.pojo.vo.RStatOrgPvDetailVO;
|
import com.njcn.harmonic.pojo.vo.RStatOrgPvDetailVO;
|
||||||
@@ -27,6 +36,7 @@ import com.njcn.user.api.DeptFeignClient;
|
|||||||
import com.njcn.user.pojo.dto.DeptDTO;
|
import com.njcn.user.pojo.dto.DeptDTO;
|
||||||
import com.njcn.user.pojo.po.Dept;
|
import com.njcn.user.pojo.po.Dept;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.math3.analysis.function.Add;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -48,6 +58,8 @@ public class RStatOrgPvPowerQualityServiceImpl extends ServiceImpl<RStatOrgPvPow
|
|||||||
private final DeptFeignClient deptFeignClient;
|
private final DeptFeignClient deptFeignClient;
|
||||||
private final PwMonitorClient pwMonitorClient;
|
private final PwMonitorClient pwMonitorClient;
|
||||||
private final RStatOrgPvPowerQualityMMapper rStatOrgPvPowerQualityMMapper;
|
private final RStatOrgPvPowerQualityMMapper rStatOrgPvPowerQualityMMapper;
|
||||||
|
private final CommTerminalGeneralClient commTerminalGeneralClient;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<RStatOrgPvPowerStreamVO> getPowerQualityStream(PowerQualityParam param) {
|
public Page<RStatOrgPvPowerStreamVO> getPowerQualityStream(PowerQualityParam param) {
|
||||||
@@ -440,6 +452,90 @@ public class RStatOrgPvPowerQualityServiceImpl extends ServiceImpl<RStatOrgPvPow
|
|||||||
return vos;
|
return vos;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<List<Object>> getPVVoltage(StatisticsBizBaseParam param) {
|
||||||
|
//获取部门信息
|
||||||
|
Dept dept = deptFeignClient.getDeptById(param.getId()).getData();
|
||||||
|
DeptGetLineParam deptGetLineParam =new DeptGetLineParam();
|
||||||
|
deptGetLineParam.setDeptId(param.getId());
|
||||||
|
List<DeptGetChildrenDTO> data = commTerminalGeneralClient.deptGetLineList(deptGetLineParam).getData();
|
||||||
|
|
||||||
|
List<String> monitorIds = data.stream().flatMap(dto -> dto.getPwMonitorIds().stream()).collect(Collectors.toList());
|
||||||
|
ArrayList<List<Object>> info = new ArrayList<List<Object>>(2) {
|
||||||
|
{
|
||||||
|
new ArrayList<Object>() {{
|
||||||
|
add(0);
|
||||||
|
add(0);
|
||||||
|
add(monitorIds.size());
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
new ArrayList<Object>() {{
|
||||||
|
add(0);
|
||||||
|
add(0);
|
||||||
|
add(monitorIds.size());
|
||||||
|
}};
|
||||||
|
}
|
||||||
|
};
|
||||||
|
if(CollUtil.isNotEmpty(monitorIds)){
|
||||||
|
//获取台区电能质量事件类型
|
||||||
|
List<DictData> areaType = dicDataFeignClient.getDicDataByTypeCode(DicDataTypeEnum.AREA_PQ_EVENT_TYPE.getCode()).getData();
|
||||||
|
//typeIDOne:高压 typeIDTwe是低压
|
||||||
|
List<String> typeIDOne=new ArrayList<>();
|
||||||
|
//取出电压相关的字典
|
||||||
|
for (DictData dictData : areaType) {
|
||||||
|
|
||||||
|
//电压 电压越上限15%以上
|
||||||
|
if (DicDataEnum.EVENT_TYPE_T.getCode().equals(dictData.getCode())) {
|
||||||
|
typeIDOne.add(dictData.getId());
|
||||||
|
}
|
||||||
|
//电压 电压越上限7%-15%
|
||||||
|
if (DicDataEnum.EVENT_TYPE_R.getCode().equals(dictData.getCode())) {
|
||||||
|
typeIDOne.add(dictData.getId());
|
||||||
|
}
|
||||||
|
//电压 超标3%-10%
|
||||||
|
if (DicDataEnum.EVENT_TYPE_Z.getCode().equals(dictData.getCode())) {
|
||||||
|
typeIDOne.add(dictData.getId());
|
||||||
|
}
|
||||||
|
//电压 超标10%以下
|
||||||
|
if (DicDataEnum.EVENT_TYPE_X.getCode().equals(dictData.getCode())) {
|
||||||
|
typeIDOne.add(dictData.getId());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<RStatOrgPvPowerQualityMPO> rStatOrgPvPowerQualityMPOS = rStatOrgPvPowerQualityMMapper.selectList(new LambdaQueryWrapper<RStatOrgPvPowerQualityMPO>()
|
||||||
|
.in(CollUtil.isNotEmpty(typeIDOne), RStatOrgPvPowerQualityMPO::getAreaPqEventType, typeIDOne)
|
||||||
|
.eq(ObjectUtil.isNotNull(dept), RStatOrgPvPowerQualityMPO::getOrgNo, dept.getCode())
|
||||||
|
.ge(StrUtil.isNotBlank(param.getStartTime()), RStatOrgPvPowerQualityMPO::getDataDate, DateUtil.beginOfDay(DateUtil.parse(param.getStartTime())))
|
||||||
|
.le(StrUtil.isNotBlank(param.getEndTime()), RStatOrgPvPowerQualityMPO::getDataDate, DateUtil.endOfDay(DateUtil.parse(param.getEndTime())))
|
||||||
|
);
|
||||||
|
Map<String, RStatOrgPvPowerQualityMPO> count = rStatOrgPvPowerQualityMPOS.stream().collect(Collectors.toMap(RStatOrgPvPowerQualityMPO::getAreaPqEventType, Function.identity(), (Key1, kye2) -> Key1));
|
||||||
|
List<Object> list1=new ArrayList<>();
|
||||||
|
List<Object> list2=new ArrayList<>();
|
||||||
|
for (int i = 0; i < typeIDOne.size(); i++) {
|
||||||
|
if(i<2){
|
||||||
|
if(count.containsKey(typeIDOne.get(i))){
|
||||||
|
list1.add(count.get(typeIDOne.get(i)).getTotalMonitorNum());
|
||||||
|
}else{
|
||||||
|
list1.add(0);
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
if(count.containsKey(typeIDOne.get(i))){
|
||||||
|
list2.add(count.get(typeIDOne.get(i)).getTotalMonitorNum());
|
||||||
|
}else{
|
||||||
|
list2.add(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
list1.add(monitorIds.size());
|
||||||
|
list2.add(monitorIds.size());
|
||||||
|
info.clear();
|
||||||
|
info.add(list1);
|
||||||
|
info.add(list2);
|
||||||
|
}
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 潮流倒送对象赋值
|
* 潮流倒送对象赋值
|
||||||
* @param areaMap
|
* @param areaMap
|
||||||
|
|||||||
@@ -1,19 +1,25 @@
|
|||||||
package com.njcn.system.enums;
|
package com.njcn.system.enums;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.Getter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @version 1.0.0
|
* @version 1.0.0
|
||||||
* @author: chenchao
|
* @author: chenchao
|
||||||
* @date: 2022/07/15 16:21
|
* @date: 2022/07/15 16:21
|
||||||
*/
|
*/
|
||||||
|
@Getter
|
||||||
public enum AuditLogEnum {
|
public enum AuditLogEnum {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 审计日志模块异常响应码
|
* 审计日志模块异常响应码
|
||||||
*/
|
*/
|
||||||
NOT_FIND_FILE("A0300", "文件未备份,请先备份文件"),
|
NOT_FIND_FILE("A0300", "文件未备份或者备份文件为空,请先备份文件"),
|
||||||
LOG_EXCEPTION("A0301", "导入旧日志文件异常"),
|
LOG_EXCEPTION("A0301", "导入旧日志文件异常"),
|
||||||
LOG_EXCEPTIONTIME("A0302", "导入旧日志文件异常:缺少时间范围"),
|
LOG_EXCEPTIONTIME("A0302", "导入旧日志文件异常:缺少时间范围"),
|
||||||
DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败")
|
DELETE_DATA("A0303", "导入旧日志文件异常:删除数据失败"),
|
||||||
|
MULTIPLE_CLICKS_LOGFILEWRITER("A0304", "当前文件备份数据未结束,请勿多次点击"),
|
||||||
|
MULTIPLE_CLICKS_RECOVERLOGFILE("A0303", "当前文件恢复数据未结束,请勿多次点击")
|
||||||
;
|
;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -8,13 +8,13 @@ import com.njcn.system.mapper.UserLogMapper;
|
|||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
// 有个很重要的点 DemoDataListener 不能被spring管理,要每次读取excel都要new,然后里面用到spring可以构造方法传进去
|
||||||
public class DemoDataListener implements ReadListener<UserLogExcel> {
|
public class DataListener implements ReadListener<UserLogExcel> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收
|
* 每隔5条存储数据库,实际使用中可以100条,然后清理list ,方便内存回收
|
||||||
*/
|
*/
|
||||||
private static final int BATCH_COUNT = 5000;
|
private static final int BATCH_COUNT = 1000;
|
||||||
/**
|
/**
|
||||||
* 缓存的数据
|
* 缓存的数据
|
||||||
*/
|
*/
|
||||||
@@ -29,7 +29,7 @@ public class DemoDataListener implements ReadListener<UserLogExcel> {
|
|||||||
*
|
*
|
||||||
* @param userLogMapper
|
* @param userLogMapper
|
||||||
*/
|
*/
|
||||||
public DemoDataListener(UserLogMapper userLogMapper) {
|
public DataListener(UserLogMapper userLogMapper) {
|
||||||
this.userLogMapper = userLogMapper;
|
this.userLogMapper = userLogMapper;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -31,7 +31,7 @@ public interface AuditMapper {
|
|||||||
/**
|
/**
|
||||||
* 获取审计日志统计列表
|
* 获取审计日志统计列表
|
||||||
*/
|
*/
|
||||||
List<AuditLogCusVO> selectCensusAuditLog(@Param("auditParam") AuditParam auditParam);
|
Page<AuditLogCusVO> selectCensusAuditLog(Page<AuditLogCusVO> page,@Param("auditParam") AuditParam auditParam);
|
||||||
/**
|
/**
|
||||||
* 根据时间删除日志
|
* 根据时间删除日志
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -80,7 +80,7 @@
|
|||||||
WHERE ${ew.sqlSegment}
|
WHERE ${ew.sqlSegment}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
<select id="selectCensusAuditLog" resultType="AuditLogCusVO">
|
<select id="selectCensusAuditLog" resultType="com.njcn.system.pojo.vo.AuditLogCusVO">
|
||||||
SELECT
|
SELECT
|
||||||
login_name LoginName,
|
login_name LoginName,
|
||||||
operate_type operateType,
|
operate_type operateType,
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.io.FileUtil;
|
import cn.hutool.core.io.FileUtil;
|
||||||
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.alibaba.excel.EasyExcel;
|
import com.alibaba.excel.EasyExcel;
|
||||||
import com.alibaba.excel.ExcelWriter;
|
import com.alibaba.excel.ExcelWriter;
|
||||||
@@ -15,11 +16,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.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.google.common.collect.Lists;
|
|
||||||
import com.njcn.common.config.GeneralInfo;
|
import com.njcn.common.config.GeneralInfo;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.enums.AuditLogEnum;
|
import com.njcn.system.enums.AuditLogEnum;
|
||||||
import com.njcn.system.excel.DemoDataListener;
|
import com.njcn.system.excel.DataListener;
|
||||||
import com.njcn.system.excel.UserLogExcel;
|
import com.njcn.system.excel.UserLogExcel;
|
||||||
import com.njcn.system.mapper.AuditMapper;
|
import com.njcn.system.mapper.AuditMapper;
|
||||||
import com.njcn.system.mapper.UserLogMapper;
|
import com.njcn.system.mapper.UserLogMapper;
|
||||||
@@ -37,7 +38,6 @@ import org.apache.commons.fileupload.disk.DiskFileItemFactory;
|
|||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.http.MediaType;
|
import org.springframework.http.MediaType;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
import org.springframework.web.multipart.commons.CommonsMultipartFile;
|
||||||
|
|
||||||
@@ -64,14 +64,15 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
private String urls;
|
private String urls;
|
||||||
private final GeneralInfo generalInfo;
|
private final GeneralInfo generalInfo;
|
||||||
|
|
||||||
|
private final RedisUtil redisUtil;
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogVO> getAuditLog(AuditParam auditParam) {
|
public Page<AuditLogVO> getAuditLog(AuditParam auditParam) {
|
||||||
List<AuditLogVO> auditLogVOS = new ArrayList<>();
|
List<AuditLogVO> auditLogVOS = new ArrayList<>();
|
||||||
|
|
||||||
Page<UserLog> info = this.page(new Page<>(auditParam.getPageNum(), auditParam.getPageSize()), new LambdaQueryWrapper<UserLog>()
|
Page<UserLog> info = this.page(new Page<>(auditParam.getPageNum(), auditParam.getPageSize()), new LambdaQueryWrapper<UserLog>()
|
||||||
.eq(StrUtil.isNotBlank(auditParam.getLoginName()), UserLog::getLoginName, auditParam.getLoginName())
|
.eq(StrUtil.isNotBlank(auditParam.getLoginName()), UserLog::getLoginName, auditParam.getLoginName())
|
||||||
.eq(auditParam.getType() != null, UserLog::getLoginName, auditParam.getType())
|
.eq(auditParam.getType() != null, UserLog::getType, auditParam.getType())
|
||||||
.eq(StrUtil.isNotBlank(auditParam.getOperateType()), UserLog::getLoginName, auditParam.getLoginName())
|
.eq(StrUtil.isNotBlank(auditParam.getOperateType()), UserLog::getOperateType, auditParam.getOperateType())
|
||||||
.ge(StrUtil.isNotBlank(auditParam.getSearchBeginTime()), UserLog::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(auditParam.getSearchBeginTime())))
|
.ge(StrUtil.isNotBlank(auditParam.getSearchBeginTime()), UserLog::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(auditParam.getSearchBeginTime())))
|
||||||
.le(StrUtil.isNotBlank(auditParam.getSearchEndTime()), UserLog::getCreateTime, DateUtil.endOfDay(DateUtil.parse(auditParam.getSearchEndTime())))
|
.le(StrUtil.isNotBlank(auditParam.getSearchEndTime()), UserLog::getCreateTime, DateUtil.endOfDay(DateUtil.parse(auditParam.getSearchEndTime())))
|
||||||
);
|
);
|
||||||
@@ -118,6 +119,12 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void logFileWriter() {
|
public void logFileWriter() {
|
||||||
|
//限制多次点击
|
||||||
|
String logFileWriter = redisUtil.getStringByKey("logFileWriter");
|
||||||
|
if(StrUtil.isNotBlank(logFileWriter)|| ObjectUtil.equals(logFileWriter,"1")){
|
||||||
|
throw new BusinessException(AuditLogEnum.MULTIPLE_CLICKS_LOGFILEWRITER);
|
||||||
|
}
|
||||||
|
redisUtil.saveByKey("logFileWriter","1");
|
||||||
LocalDateTime nowDate = LocalDateTime.now();
|
LocalDateTime nowDate = LocalDateTime.now();
|
||||||
LocalDateTime agoDate = nowDate.minusMonths(6).with(TemporalAdjusters.firstDayOfMonth());
|
LocalDateTime agoDate = nowDate.minusMonths(6).with(TemporalAdjusters.firstDayOfMonth());
|
||||||
String date = agoDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
String date = agoDate.format(DateTimeFormatter.ISO_LOCAL_DATE);
|
||||||
@@ -125,6 +132,7 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
String endTime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH_mm_ss").format(nowDate);
|
String endTime = DateTimeFormatter.ofPattern("yyyy-MM-dd HH_mm_ss").format(nowDate);
|
||||||
//文件名
|
//文件名
|
||||||
QueryWrapper<UserLog> aa = new QueryWrapper<>();
|
QueryWrapper<UserLog> aa = new QueryWrapper<>();
|
||||||
|
aa.select("id");
|
||||||
aa.ge("sys_user_log.update_time", date);
|
aa.ge("sys_user_log.update_time", date);
|
||||||
aa.le("sys_user_log.update_time", endTime);
|
aa.le("sys_user_log.update_time", endTime);
|
||||||
String nowTime = date + "至" + endTime;
|
String nowTime = date + "至" + endTime;
|
||||||
@@ -169,10 +177,12 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
redisUtil.delete("recoverLogFile");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
} finally {
|
} finally {
|
||||||
excelWriter.finish();
|
excelWriter.finish();
|
||||||
}
|
}
|
||||||
|
redisUtil.delete("logFileWriter");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -193,8 +203,13 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void recoverLogFile() {
|
public void recoverLogFile() {
|
||||||
|
String logFileWriter = redisUtil.getStringByKey("recoverLogFile");
|
||||||
|
if(StrUtil.isNotBlank(logFileWriter)|| ObjectUtil.equals(logFileWriter,"1")){
|
||||||
|
throw new BusinessException(AuditLogEnum.MULTIPLE_CLICKS_LOGFILEWRITER);
|
||||||
|
}
|
||||||
|
redisUtil.saveByKey("recoverLogFile","1");
|
||||||
File newFile = getLastFile();
|
File newFile = getLastFile();
|
||||||
if (!newFile.exists()) {
|
if (FileUtil.isEmpty(newFile)) {
|
||||||
throw new BusinessException(AuditLogEnum.NOT_FIND_FILE);
|
throw new BusinessException(AuditLogEnum.NOT_FIND_FILE);
|
||||||
}
|
}
|
||||||
FileInputStream in = null;
|
FileInputStream in = null;
|
||||||
@@ -211,38 +226,24 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
.ge(UserLog::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(splitTime[0])))
|
.ge(UserLog::getCreateTime, DateUtil.beginOfDay(DateUtil.parse(splitTime[0])))
|
||||||
.le(UserLog::getCreateTime, splitTime[1].replace("_", ":"));
|
.le(UserLog::getCreateTime, splitTime[1].replace("_", ":"));
|
||||||
this.remove(le);
|
this.remove(le);
|
||||||
EasyExcel.read(newFile, UserLogExcel.class, new DemoDataListener(this.getBaseMapper()))
|
EasyExcel.read(newFile, UserLogExcel.class, new DataListener(this.getBaseMapper()))
|
||||||
.excelType(ExcelTypeEnum.XLSX).doReadAll();
|
.excelType(ExcelTypeEnum.XLSX).doReadAll();
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
redisUtil.delete("recoverLogFile");
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new ExcelImportException(e.getMessage(), e);
|
throw new ExcelImportException(e.getMessage(), e);
|
||||||
} finally {
|
} finally {
|
||||||
IOUtils.closeQuietly(in);
|
IOUtils.closeQuietly(in);
|
||||||
}
|
}
|
||||||
|
redisUtil.delete("recoverLogFile");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<AuditLogCusVO> censusAuditLog(AuditParam auditParam) {
|
public Page<AuditLogCusVO> censusAuditLog(AuditParam auditParam) {
|
||||||
List<AuditLogCusVO> auditLogVOS = new ArrayList<>();
|
|
||||||
|
|
||||||
Page<AuditLogCusVO> page = new Page<>();
|
|
||||||
page.setSize(auditParam.getPageSize());
|
|
||||||
page.setCurrent(auditParam.getPageNum());
|
|
||||||
//待分页数据总量
|
//待分页数据总量
|
||||||
List<AuditLogCusVO> auditLogCusVOS = auditMapper.selectCensusAuditLog(auditParam);
|
Page<AuditLogCusVO> page = auditMapper.selectCensusAuditLog(new Page<>(auditParam.getPageNum(), auditParam.getPageSize()), auditParam);
|
||||||
page.setTotal(auditLogCusVOS.size());
|
|
||||||
//分页总页数
|
|
||||||
int pages = (int) Math.ceil(page.getTotal() * 1.0 / auditParam.getPageSize());
|
|
||||||
page.setPages(pages);
|
|
||||||
|
|
||||||
if (!CollectionUtils.isEmpty(auditLogCusVOS)) {
|
|
||||||
List<List<AuditLogCusVO>> pageList = Lists.partition(auditLogCusVOS, auditParam.getPageSize());
|
|
||||||
auditLogVOS = pageList.get(auditParam.getPageNum() - 1);
|
|
||||||
}
|
|
||||||
page.setRecords(auditLogVOS);
|
|
||||||
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -292,8 +293,6 @@ public class AuditServiceImpl extends ServiceImpl<UserLogMapper, UserLog> implem
|
|||||||
*/
|
*/
|
||||||
public File getLastFile() {
|
public File getLastFile() {
|
||||||
File parentFile = new File(generalInfo.getBusinessTempPath());
|
File parentFile = new File(generalInfo.getBusinessTempPath());
|
||||||
// Date date = FileUtil.lastModifiedTime(parentFile);
|
|
||||||
// System.out.println(">>>>>>>>>>当前文件夹最后修改时间>>>>>>>>>" + date);
|
|
||||||
|
|
||||||
//文件夹下的所有子文件数组
|
//文件夹下的所有子文件数组
|
||||||
File[] files = parentFile.listFiles();
|
File[] files = parentFile.listFiles();
|
||||||
|
|||||||
Reference in New Issue
Block a user