1.冀北分布式光伏代码提交
2.审计日志管理代码提交修改 3.暂降推送日志,筛选添加
This commit is contained in:
@@ -25,15 +25,6 @@ public class PmsStatationStatInfoDTO implements Serializable {
|
||||
*/
|
||||
private String orgName;
|
||||
|
||||
/**
|
||||
* 母线id
|
||||
*/
|
||||
private String generatrixId;
|
||||
|
||||
/**
|
||||
* 母线名称
|
||||
*/
|
||||
private String generatrixName;
|
||||
|
||||
/**
|
||||
* 监测点id
|
||||
|
||||
@@ -79,11 +79,11 @@ public class SubstationExpend implements Serializable {
|
||||
|
||||
private List<PmsSimpleDTO> sites;
|
||||
|
||||
// public SubstationExpend(String name, String type, BigDecimal lng, BigDecimal lat, String deptId) {
|
||||
// this.name = name;
|
||||
// this.type = type;
|
||||
// this.lng = lng;
|
||||
// this.lat = lat;
|
||||
// this.deptId = deptId;
|
||||
// }
|
||||
public SubstationExpend(String name, String type, BigDecimal lng, BigDecimal lat, String deptId) {
|
||||
this.name = name;
|
||||
this.type = type;
|
||||
this.lng = lng;
|
||||
this.lat = lat;
|
||||
this.deptId = deptId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,6 +24,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -38,7 +40,7 @@ import java.util.Map;
|
||||
@Slf4j
|
||||
@Api(tags = "冀北变电站地图信息")
|
||||
@RestController
|
||||
@RequestMapping("/substationExpend")
|
||||
@RequestMapping("/pms/substationExpend")
|
||||
@RequiredArgsConstructor
|
||||
public class SubstationExpendController extends BaseController {
|
||||
|
||||
@@ -46,7 +48,7 @@ public class SubstationExpendController extends BaseController {
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getPVSubstationExpendInfo")
|
||||
@PostMapping("/getSubstationExpendInfo")
|
||||
@ApiOperation("冀北变电站地图信息")
|
||||
@ApiImplicitParam(name = "param", value = "冀北变电站地图信息参数", required = true)
|
||||
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);
|
||||
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.metadata.IPage;
|
||||
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.PmsSimpleDTO;
|
||||
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> 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);
|
||||
|
||||
@@ -229,11 +229,19 @@
|
||||
pm.Voltage_Level name,
|
||||
IFNULL(SUM(rmded.dev_effective_rate),0) doubleValue
|
||||
FROM pms_monitor pm
|
||||
LEFT JOIN r_mp_dev_evaluate_detail rmded ON pm.Terminal_Id = rmded.device_id
|
||||
WHERE pm.Terminal_Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
INNER JOIN r_mp_dev_evaluate_detail rmded ON pm.Terminal_Id = rmded.device_id
|
||||
<where>
|
||||
pm.Terminal_Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</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
|
||||
</select>
|
||||
<select id="getIntegrity" resultType="com.njcn.device.pms.pojo.dto.PmsSimpleDTO">
|
||||
@@ -241,11 +249,19 @@
|
||||
pm.Voltage_Level name,
|
||||
IFNULL(SUM(romd.data_integrity_rate),0) doubleValue
|
||||
FROM pms_monitor pm
|
||||
LEFT JOIN r_operating_monitor_d romd ON pm.Id = romd.measurement_point_id
|
||||
WHERE pm.Id IN
|
||||
INNER JOIN r_operating_monitor_d romd ON pm.Id = romd.measurement_point_id
|
||||
<where>
|
||||
pm.Id IN
|
||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||
#{item}
|
||||
</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
|
||||
</select>
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
pm.Org_Name AS orgName,
|
||||
pm.Powerr_Id AS powerId,
|
||||
pm.Powerr_Name AS powerName,
|
||||
pm.Generatrix_Id AS generatrixId,
|
||||
pm.Generatrix_Name AS generatrixName,
|
||||
pm.Id AS monitorId,
|
||||
pm.`Name` AS monitorName,
|
||||
pss.Voltage_Level AS powerVoltageLevel
|
||||
|
||||
@@ -122,12 +122,20 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
||||
List<String> monitorIds = new ArrayList<>();
|
||||
generalDeviceDTOS.stream().forEach(e -> monitorIds.addAll(e.getMonitorIdList()));
|
||||
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 = distributionMonitorMapper.statisticMonitor(lineIds);
|
||||
List<PmsSimpleDTO> pmsSimpleDTOS = monitorStatistic;
|
||||
|
||||
//根据电压等级进行分组
|
||||
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<>();
|
||||
for (Map.Entry<String, List<PmsSimpleDTO>> stringListEntry : terminalMap.entrySet()) {
|
||||
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();
|
||||
if(CollUtil.isNotEmpty(monitorList)){
|
||||
simpleDTO.setStatistics((int) monitorList.stream().mapToDouble(PmsSimpleDTO::getStatistics).sum());
|
||||
@@ -213,22 +221,14 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
||||
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;
|
||||
onlineRateStatistic.forEach(dto -> dto.setDoubleValue(new BigDecimal(dto.getDoubleValue() * 100 / sum).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
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;
|
||||
integrityStatistic.forEach(dto -> dto.setDoubleValue(new BigDecimal(dto.getDoubleValue() * 100 / s).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue()));
|
||||
ledgerStaticDTO.setIntegrityStatistics(integrityStatistic);
|
||||
@@ -247,16 +247,16 @@ public class SubstationExpendServiceImpl extends ServiceImpl<SubstationExpendMap
|
||||
List<CommunicateVO.PVCommunicateVO> info =new ArrayList<>();
|
||||
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("' ");
|
||||
// if(CollUtil.isNotEmpty(terminalIds)){
|
||||
// stringBuilder.append(" and ").append("(");
|
||||
// for (int i = 0; i < terminalIds.size(); i++) {
|
||||
// if (terminalIds.size() - i != 1) {
|
||||
// stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or ");
|
||||
// } else {
|
||||
// stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')");
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if(CollUtil.isNotEmpty(terminalIds)){
|
||||
stringBuilder.append(" and ").append("(");
|
||||
for (int i = 0; i < terminalIds.size(); i++) {
|
||||
if (terminalIds.size() - i != 1) {
|
||||
stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("' or ");
|
||||
} else {
|
||||
stringBuilder.append("dev_id = '").append(terminalIds.get(i)).append("')");
|
||||
}
|
||||
}
|
||||
}
|
||||
stringBuilder.append(" limit "+param.getLimit());
|
||||
String sql = "select * from " + InfluxDBPublicParam.PQS_COMMUNICATE + " where " + stringBuilder + InfluxDBPublicParam.TIME_ZONE;
|
||||
// 获取暂降事件
|
||||
|
||||
@@ -1,13 +1,10 @@
|
||||
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.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
@@ -16,34 +13,12 @@ import javax.validation.constraints.Pattern;
|
||||
*/
|
||||
@Data
|
||||
@ApiModel
|
||||
public class EventLogParam {
|
||||
public class EventLogParam extends BaseParam {
|
||||
|
||||
/**
|
||||
* 推送状态
|
||||
*/
|
||||
@ApiModelProperty("推送状态(0.全部1.成功2.失败)")
|
||||
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")
|
||||
public class EventPushLogs {
|
||||
|
||||
@TableId("Time_Id")
|
||||
private LocalDateTime timeId;
|
||||
@TableId("Event_Id")
|
||||
private String eventId;
|
||||
|
||||
@TableField("Line_Id")
|
||||
private String lineId;
|
||||
@TableField("start_time")
|
||||
private LocalDateTime startTime;
|
||||
|
||||
@TableField("measurement_point_id")
|
||||
private String measurementPointId;
|
||||
|
||||
@TableField("Create_Time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@@ -428,4 +428,12 @@ public interface LineMapper extends BaseMapper<Line> {
|
||||
* @date 2023/5/10
|
||||
*/
|
||||
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 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>
|
||||
|
||||
@@ -2,9 +2,12 @@ package com.njcn.device.pq.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
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.google.common.collect.Lists;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.device.pq.mapper.EventPushLogsMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.LogManageMapper;
|
||||
@@ -97,6 +100,10 @@ public class LogManageServiceImpl implements LogManageService {
|
||||
|
||||
@Override
|
||||
public Page<EventLogVO> getEventLogData(EventLogParam eventLogParam) {
|
||||
|
||||
//查询全部时间
|
||||
List<String> lineByIDs = lineMapper.getLineByIDs(eventLogParam.getSearchValue());
|
||||
|
||||
Page<EventLogVO> page = new Page<>();
|
||||
page.setSize(eventLogParam.getPageSize());
|
||||
page.setCurrent(eventLogParam.getPageNum());
|
||||
@@ -105,35 +112,44 @@ public class LogManageServiceImpl implements LogManageService {
|
||||
Page<EventPushLogs> p = new Page<>();
|
||||
p.setSize(eventLogParam.getPageSize());
|
||||
p.setCurrent(eventLogParam.getPageNum());
|
||||
LambdaQueryWrapper<EventPushLogs> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.between(EventPushLogs::getTimeId,DateUtil.beginOfDay(DateUtil.parse(eventLogParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
|
||||
wrapper.eq(EventPushLogs::getResult,eventLogParam.getResult());
|
||||
QueryWrapper<EventPushLogs> wrapper = new QueryWrapper<>();
|
||||
wrapper.between("start_time",DateUtil.beginOfDay(DateUtil.parse(eventLogParam.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
|
||||
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);
|
||||
List<EventPushLogs> rawLogs = rawPage.getRecords();
|
||||
if (CollectionUtil.isNotEmpty(rawLogs)) {
|
||||
List<String> lineIndexes = rawLogs.stream().map(EventPushLogs::getLineId).distinct().collect(Collectors.toList());
|
||||
List<EventDetail> rawEventDetailData = eventDetailFeignClient.getEventDetailLimit(lineIndexes, eventLogParam.getSearchBeginTime(), eventLogParam.getSearchEndTime(), eventLogParam.getPageSize(), eventLogParam.getPageNum()).getData();
|
||||
List<String> lineIndexes = rawLogs.stream().map(EventPushLogs::getMeasurementPointId).distinct().collect(Collectors.toList());
|
||||
|
||||
List<EventDetail> rawEventDetailData = eventDetailFeignClient.getEventDetail(lineIndexes, eventLogParam.getSearchBeginTime(), eventLogParam.getSearchEndTime()).getData();
|
||||
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));
|
||||
List<String> lineList = eventDetails.stream().map(EventDetail::getLineId).collect(Collectors.toList());
|
||||
List<AreaLineInfoVO> lineAreaInfos = lineMapper.getBaseLineAreaInfo(lineList, null, null);
|
||||
Map<String, List<AreaLineInfoVO>> areaMap = lineAreaInfos.stream().collect(Collectors.groupingBy(AreaLineInfoVO::getLineId));
|
||||
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSS");
|
||||
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;
|
||||
}
|
||||
EventLogVO eventLogVO = new EventLogVO();
|
||||
eventLogVO.setLineId(rawLog.getLineId());
|
||||
eventLogVO.setTime(dateTimeFormatter.format(rawLog.getTimeId()));
|
||||
eventLogVO.setLine(areaMap.get(rawLog.getLineId()).get(0).getLineName());
|
||||
eventLogVO.setSubstation(areaMap.get(rawLog.getLineId()).get(0).getSubName());
|
||||
eventLogVO.setPowerCompany(areaMap.get(rawLog.getLineId()).get(0).getGdName());
|
||||
Double e=eventDetailMap.get(rawLog.getLineId()).get(0).getFeatureAmplitude();
|
||||
eventLogVO.setLineId(rawLog.getMeasurementPointId());
|
||||
eventLogVO.setTime(dateTimeFormatter.format(rawLog.getStartTime()));
|
||||
eventLogVO.setLine(areaMap.get(rawLog.getMeasurementPointId()).get(0).getLineName());
|
||||
eventLogVO.setSubstation(areaMap.get(rawLog.getMeasurementPointId()).get(0).getSubName());
|
||||
eventLogVO.setPowerCompany(areaMap.get(rawLog.getMeasurementPointId()).get(0).getGdName());
|
||||
Double e=eventDetailMap.get(rawLog.getMeasurementPointId()).get(0).getFeatureAmplitude();
|
||||
BigDecimal bd = new BigDecimal(e);
|
||||
e= bd.setScale(2, BigDecimal.ROUND_DOWN).doubleValue();
|
||||
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.setCreatTime(dateTimeFormatter.format(rawLog.getCreateTime()));
|
||||
eventLogVO.setCreatTimed(dateTimeFormatter.format(rawLog.getCreateTime()));
|
||||
@@ -155,72 +171,14 @@ public class LogManageServiceImpl implements LogManageService {
|
||||
page.setRecords(list);
|
||||
}
|
||||
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) {
|
||||
boolean flag = false;
|
||||
String evenDetailTime = eventDetail.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
for (EventPushLogs log : eventPushLogs) {
|
||||
String logTime = log.getTimeId().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
if (log.getLineId().equals(eventDetail.getLineId()) && evenDetailTime.equals(logTime)) {
|
||||
String logTime = log.getStartTime().format(DateTimeFormatter.ofPattern("yyyy-MM-dd"));
|
||||
if (log.getMeasurementPointId().equals(eventDetail.getLineId())&& log.getEventId().equals(eventDetail.getEventId())&& evenDetailTime.equals(logTime)) {
|
||||
flag = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user