Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
package com.njcn.device.biz.pojo.dto;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
@@ -13,12 +14,18 @@ import java.util.List;
|
||||
@Data
|
||||
public class DeptGetChildrenDTO {
|
||||
|
||||
@ApiModelProperty(name = "deptId",value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@ApiModelProperty(name = "deptId",value = "部门名称")
|
||||
private String deptName;
|
||||
|
||||
@ApiModelProperty(name = "deptChildren",value = "子集部门code集合")
|
||||
private List<String> deptChildren;
|
||||
|
||||
@ApiModelProperty(name = "lineIds",value = "监测点信息")
|
||||
private List<String> lineIds;
|
||||
|
||||
@ApiModelProperty(name = "pwMonitorIds",value = "配网监测点信息")
|
||||
private List<String> pwMonitorIds;
|
||||
}
|
||||
|
||||
@@ -20,7 +20,6 @@ public class DeptGetLineParam {
|
||||
@ApiModelProperty(name = "deptId",value = "部门id")
|
||||
private String deptId;
|
||||
|
||||
@NotBlank(message = "系统类型不可为空")
|
||||
@ApiModelProperty(name = "serverName",value = "系统类型 0.event-boot 1.harmonic-boot")
|
||||
private String serverName;
|
||||
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.device.pms.controller.ledgerManger;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pms.service.majornetwork.IMonitorService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/4/26 10:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/commTerminal")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Api(tags = "通用台账-所有子孙部门以及监测点")
|
||||
public class DeptMonitorController extends BaseController {
|
||||
|
||||
private final IMonitorService monitorService;
|
||||
|
||||
/**
|
||||
* 通过部门获取所有子集部门所拥有的监测点
|
||||
*
|
||||
* @author wr
|
||||
* @date 2023/4/26
|
||||
*/
|
||||
@PostMapping("/deptGetLineIds")
|
||||
@ApiImplicitParam(name = "param", value = "请求参数", required = true)
|
||||
public HttpResult<List<DeptGetChildrenDTO>> deptGetLineList(@RequestBody @Validated DeptGetLineParam param) {
|
||||
String methodDescribe = getMethodDescribe("deptGetLineList");
|
||||
List<DeptGetChildrenDTO> monitor = monitorService.deptMonitor(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, monitor, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.njcn.device.pms.service.majornetwork;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorBaseDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorDTO;
|
||||
import com.njcn.device.pms.pojo.dto.PmsMonitorInfoDTO;
|
||||
@@ -133,4 +135,11 @@ public interface IMonitorService extends IService<Monitor> {
|
||||
* @return MonitorVO
|
||||
*/
|
||||
MonitorVO monitorTerminal(MonitorTerminalParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 根据部门id获取监测点信息
|
||||
* @return
|
||||
*/
|
||||
List<DeptGetChildrenDTO> deptMonitor(DeptGetLineParam param);
|
||||
}
|
||||
|
||||
@@ -9,6 +9,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.device.biz.pojo.dto.DeptGetChildrenDTO;
|
||||
import com.njcn.device.biz.pojo.param.DeptGetLineParam;
|
||||
import com.njcn.device.biz.utils.COverlimit;
|
||||
import com.njcn.device.pms.enums.PmsDeviceResponseEnum;
|
||||
import com.njcn.device.pms.mapper.majornetwork.*;
|
||||
@@ -28,6 +30,7 @@ import com.njcn.device.pq.pojo.po.Overlimit;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.SystemResponseEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.user.pojo.dto.DeptDTO;
|
||||
import com.njcn.user.pojo.po.Dept;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
@@ -37,12 +40,10 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -321,6 +322,67 @@ public class MonitorServiceImpl extends ServiceImpl<MonitorMapper, Monitor> impl
|
||||
return monitorTerminal;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DeptGetChildrenDTO> deptMonitor(DeptGetLineParam param) {
|
||||
//返回主网和配网监测信息
|
||||
List<DeptGetChildrenDTO> deviceInfos = new ArrayList<>();
|
||||
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(param.getDeptId(), Stream.of(0,1).collect(Collectors.toList())).getData();
|
||||
List<DeptDTO> directDeptInfos = deptInfos.stream()
|
||||
.filter(deptDTO -> deptDTO.getPid().equals(param.getDeptId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(directDeptInfos)) {
|
||||
//没有直接子部门,获取当前部门所有信息
|
||||
List<DeptDTO> dept = deptInfos.stream()
|
||||
.filter(deptDTO -> deptDTO.getId().equals(param.getDeptId()))
|
||||
.collect(Collectors.toList());
|
||||
deviceInfos.add(getPmsMonitor(dept.get(0), Collections.singletonList(dept.get(0).getCode())));
|
||||
}else{
|
||||
for (DeptDTO deptDTO : directDeptInfos) {
|
||||
//筛选上级部门pids包含该id的所有部门
|
||||
List<DeptDTO> descendantDeptDTO = deptInfos.stream()
|
||||
.filter(d -> d.getPids().contains(deptDTO.getId()))
|
||||
.collect(Collectors.toList());
|
||||
//形成需要查询监测点的部门索引
|
||||
List<String> deptIdList = descendantDeptDTO.stream()
|
||||
.map(DeptDTO::getCode)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
deptIdList.add(deptDTO.getCode());
|
||||
deviceInfos.add(getPmsMonitor(deptDTO, deptIdList));
|
||||
}
|
||||
}
|
||||
return deviceInfos;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取主配网监测点id集合
|
||||
* @param deptDTO
|
||||
* @param deptIdList
|
||||
* @return
|
||||
*/
|
||||
private DeptGetChildrenDTO getPmsMonitor(DeptDTO deptDTO, List<String> deptIdList) {
|
||||
DeptGetChildrenDTO pmsDeptGetChildrenDTO = new DeptGetChildrenDTO();
|
||||
pmsDeptGetChildrenDTO.setDeptId(deptDTO.getCode());
|
||||
if (deptDTO.getType() == 0) {
|
||||
pmsDeptGetChildrenDTO.setDeptName(deptDTO.getArea());
|
||||
} else {
|
||||
pmsDeptGetChildrenDTO.setDeptName(deptDTO.getName());
|
||||
}
|
||||
pmsDeptGetChildrenDTO.setDeptChildren(deptIdList);
|
||||
if(CollUtil.isNotEmpty(deptIdList)){
|
||||
//主网监测点
|
||||
List<Monitor> monitorList = this.list(new LambdaQueryWrapper<Monitor>().in(CollUtil.isNotEmpty(deptIdList),Monitor::getOrgId, deptIdList));
|
||||
//配网监测点
|
||||
List<PmsMonitorBaseDTO> pwMonitorList = iDistributionMonitorService.getMonitorByCondition(deptIdList,null);
|
||||
|
||||
pmsDeptGetChildrenDTO.setLineIds(monitorList.stream().map(Monitor::getId).distinct().collect(Collectors.toList()));
|
||||
pmsDeptGetChildrenDTO.setPwMonitorIds(pwMonitorList.stream().map(PmsMonitorBaseDTO::getMonitorId).distinct().collect(Collectors.toList()));
|
||||
}else{
|
||||
pmsDeptGetChildrenDTO.setLineIds(new ArrayList<>());
|
||||
pmsDeptGetChildrenDTO.setPwMonitorIds(new ArrayList<>());
|
||||
}
|
||||
return pmsDeptGetChildrenDTO;
|
||||
}
|
||||
|
||||
private void checkParam(MonitorParam monitorParam, boolean update) {
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.njcn.device.pq.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
import org.influxdb.annotation.Column;
|
||||
import org.influxdb.annotation.Measurement;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @version 1.0.0
|
||||
@@ -12,27 +13,25 @@ import java.time.Instant;
|
||||
* @date: 2022/06/09 11:00
|
||||
*/
|
||||
@Data
|
||||
@Measurement(name = "pqs_event_push_logs")
|
||||
@TableName("cld_event_push_log")
|
||||
public class EventPushLogs {
|
||||
|
||||
@Column(name = "time")
|
||||
private Instant timeId;
|
||||
@TableId("Time_Id")
|
||||
private LocalDateTime timeId;
|
||||
|
||||
@Column(name = "line_id")
|
||||
@TableField("Line_Id")
|
||||
private String lineId;
|
||||
|
||||
@Column(name = "create_time")
|
||||
private String createTime;
|
||||
@TableField("Create_Time")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Column(name = "update_time")
|
||||
private String updateTime;
|
||||
@TableField("Update_Time")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
@Column(name = "push_failed")
|
||||
@TableField("Push_Failed")
|
||||
private Integer pushFailed;
|
||||
|
||||
@Column(name = "result")
|
||||
@TableField("Result")
|
||||
private Integer result;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.device.pq.pojo.vo;
|
||||
|
||||
import com.njcn.device.pq.pojo.po.DevFuction;
|
||||
import com.njcn.device.pq.pojo.po.influxdb.DeviceDayFlow;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -32,6 +33,8 @@ public class TerminalDaliyFlowVO {
|
||||
private Float flowMeal;
|
||||
@ApiModelProperty(name = "deviceDayFlowsList",value = "装置日流量统计集合")
|
||||
private List<DeviceDayFlow> deviceDayFlowsList;
|
||||
@ApiModelProperty(name = "functions",value = "装置功能码集合")
|
||||
private List<DevFuction> functions;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -149,7 +149,6 @@ public class GeneralDeviceInfoController extends BaseController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "查询终端条件", required = true)
|
||||
})
|
||||
@Deprecated
|
||||
public HttpResult<List<GeneralDeviceDTO>> getPracticalRunDeviceInfo(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getPracticalRunDeviceInfo");
|
||||
List<GeneralDeviceDTO> deptDeviceInfos = generalDeviceService.getDeviceInfo(deviceInfoParam, Stream.of(0).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||
|
||||
@@ -104,7 +104,7 @@ public class OperationContrController extends BaseController {
|
||||
@PostMapping("/getNewDeviceRunStatistics")
|
||||
@ApiOperation("获取终端运行统计_新")
|
||||
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
||||
public HttpResult<Page<LineFlowMealDetailVO>> getNewDeviceRunStatistics(@RequestBody PqsParam deviceInfoParam){
|
||||
public HttpResult<Page<LineFlowMealDetailVO>> getNewDeviceRunStatistics(@RequestBody PqsParam deviceInfoParam) {
|
||||
String methodDescribe = getMethodDescribe("getDeviceRunStatistics");
|
||||
if (deviceInfoParam.getDeptIndex() == null) {
|
||||
DeviceInfoParam param = new DeviceInfoParam(RequestUtil.getDeptIndex(),null);
|
||||
|
||||
@@ -306,6 +306,18 @@ public class TerminalBaseController extends BaseController {
|
||||
terminalBaseService.downTerminalTemplate(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出台账生成的excel(离线装置)
|
||||
*
|
||||
* @author zbj
|
||||
* @date 2023/4/26
|
||||
*/
|
||||
@ApiOperation("导出台账模板(离线装置)")
|
||||
@GetMapping(value = "downTerminalAutonomeTemplate")
|
||||
public void downTerminalAutonomeTemplate(HttpServletResponse response) {
|
||||
terminalBaseService.downTerminalAutonomeTemplate(response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导入excel台账模板
|
||||
*
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
package com.njcn.device.pq.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.pq.pojo.po.EventPushLogs;
|
||||
|
||||
|
||||
public interface EventPushLogsMapper extends BaseMapper<EventPushLogs> {
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.device.pq.mapper.EventPushLogsMapper">
|
||||
|
||||
</mapper>
|
||||
@@ -38,7 +38,7 @@
|
||||
`Update_Time` updateTime
|
||||
FROM
|
||||
cld_flow_meal
|
||||
WHERE Type =0 OR Type =1 AND Flag =1
|
||||
WHERE Type =0 AND Flag =1
|
||||
</select>
|
||||
|
||||
<update id="updateByState">
|
||||
|
||||
@@ -3,39 +3,39 @@
|
||||
<mapper namespace="com.njcn.device.pq.mapper.TerminalMaintainMapper">
|
||||
|
||||
<select id="getTerminalDevInfo" resultType="TerminalMaintainVO">
|
||||
SELECT
|
||||
a.id,
|
||||
a.pid,
|
||||
a.NAME,
|
||||
a.level,
|
||||
b.run_flag,
|
||||
b.com_flag,
|
||||
e.NAME devType,
|
||||
ifnull(g.name,'/') version,
|
||||
ifnull(d.flow,(select flow from cld_flow_meal where type = 0 and flag = 1)) baseFlowMeal,
|
||||
ifnull(d1.flow,0) reamFlowMeal,
|
||||
ROUND(ifnull(mo.Actual_Value,0)/1024/1024,2) statisValue
|
||||
FROM
|
||||
pq_line a
|
||||
INNER JOIN pq_device b ON a.id = b.id
|
||||
LEFT JOIN cld_dev_meal c ON b.id = c.line_id
|
||||
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
|
||||
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
|
||||
LEFT JOIN sys_dict_data e ON b.dev_type = e.id
|
||||
LEFT JOIN cld_dev_version f on a.id = f.line_id and f.flag = 1 and f.state = 1
|
||||
LEFT JOIN cld_version g on f.version_id = g.id
|
||||
LEFT JOIN
|
||||
(select * from cld_month_flow where date_format(time_id,'%Y-%m' ) = date_format(CURRENT_TIME(),'%Y-%m')) mo on a.id = mo.Dev_Id
|
||||
where a.id in
|
||||
<foreach collection="devIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="comFlag != null">
|
||||
AND b.Com_Flag=#{comFlag}
|
||||
</if>
|
||||
<if test="devType !=null and devType != ''">
|
||||
AND b.Dev_Type =#{devType}
|
||||
</if>
|
||||
SELECT
|
||||
a.id,
|
||||
a.pid,
|
||||
a.NAME,
|
||||
a.level,
|
||||
b.run_flag,
|
||||
b.com_flag,
|
||||
e.NAME devType,
|
||||
ifnull(g.name,'/') version,
|
||||
ifnull(d.flow,(select flow from cld_flow_meal where type = 0 and flag = 1)) baseFlowMeal,
|
||||
ifnull(d1.flow,0) reamFlowMeal,
|
||||
ROUND(ifnull(mo.Actual_Value,0)/1024/1024,2) statisValue
|
||||
FROM
|
||||
pq_line a
|
||||
INNER JOIN pq_device b ON a.id = b.id
|
||||
LEFT JOIN cld_dev_meal c ON b.id = c.line_id
|
||||
LEFT JOIN cld_flow_meal d ON c.Base_Meal_Id = d.id
|
||||
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
|
||||
LEFT JOIN sys_dict_data e ON b.dev_type = e.id
|
||||
LEFT JOIN cld_dev_version f on a.id = f.line_id and f.flag = 1 and f.state = 1
|
||||
LEFT JOIN cld_version g on f.version_id = g.id
|
||||
LEFT JOIN
|
||||
(select * from cld_month_flow where date_format(time_id,'%Y-%m' ) = date_format(CURRENT_TIME(),'%Y-%m')) mo on a.id = mo.Dev_Id
|
||||
where a.id in
|
||||
<foreach collection="devIds" item="item" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="comFlag != null">
|
||||
AND b.Com_Flag=#{comFlag}
|
||||
</if>
|
||||
<if test="devType !=null and devType != ''">
|
||||
AND b.Dev_Type =#{devType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getGdAndSubList" resultType="TerminalMaintainVO">
|
||||
|
||||
@@ -181,6 +181,13 @@ public interface TerminalBaseService {
|
||||
*/
|
||||
void downTerminalTemplate(HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 导出台账生成的excel(离线装置)
|
||||
* @author zbj
|
||||
* @date 2023/4/26
|
||||
*/
|
||||
void downTerminalAutonomeTemplate(HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 将台账数据导入终端相关表
|
||||
* @param file 原始数据信息
|
||||
|
||||
@@ -53,13 +53,13 @@ public class FlowMealServiceImpl extends ServiceImpl<FlowMealMapper, FlowMeal> i
|
||||
|
||||
@Override
|
||||
public boolean updateRateOfFlowData(FlowMealParam.FlowMealUpdateParam flowMealUpdateParam) {
|
||||
checkCode(flowMealUpdateParam, true);
|
||||
if (flowMealUpdateParam.getType() ==0 ) {
|
||||
checkCode(flowMealUpdateParam, true);
|
||||
}
|
||||
FlowMeal flowMeal = new FlowMeal();
|
||||
BeanUtils.copyProperties(flowMealUpdateParam, flowMeal);
|
||||
flowMeal.setUpdateBy(RequestUtil.getUserIndex());
|
||||
flowMeal.setUpdateTime(LocalDateTime.now());
|
||||
//查询修改前的数据
|
||||
FlowMeal newFlowMeal = this.getById(flowMeal.getId());
|
||||
boolean b = this.updateById(flowMeal);
|
||||
if (b) {
|
||||
return true;
|
||||
|
||||
@@ -1,13 +1,19 @@
|
||||
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 com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.njcn.device.pq.mapper.EventPushLogsMapper;
|
||||
import com.njcn.device.pq.mapper.LineMapper;
|
||||
import com.njcn.device.pq.mapper.LogManageMapper;
|
||||
import com.njcn.device.pq.pojo.constant.DeviceValidMessage;
|
||||
import com.njcn.device.pq.pojo.param.DeviceLogParam;
|
||||
import com.njcn.device.pq.pojo.param.EventLogParam;
|
||||
import com.njcn.device.pq.pojo.po.EventPushLogs;
|
||||
import com.njcn.device.pq.pojo.po.TerminalLogs;
|
||||
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||
import com.njcn.device.pq.pojo.vo.DeviceLogVO;
|
||||
import com.njcn.device.pq.pojo.vo.EventLogVO;
|
||||
import com.njcn.device.pq.service.LogManageService;
|
||||
@@ -27,6 +33,7 @@ import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -45,6 +52,10 @@ public class LogManageServiceImpl implements LogManageService {
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
|
||||
private final EventPushLogsMapper eventPushLogsMapper;
|
||||
|
||||
private final LineMapper lineMapper;
|
||||
|
||||
@Override
|
||||
public Page<DeviceLogVO> getDeviceLogData(DeviceLogParam deviceLogParam) {
|
||||
Page<DeviceLogVO> page = new Page<>();
|
||||
@@ -90,62 +101,128 @@ public class LogManageServiceImpl implements LogManageService {
|
||||
page.setSize(eventLogParam.getPageSize());
|
||||
page.setCurrent(eventLogParam.getPageNum());
|
||||
List<EventLogVO> list = new ArrayList<>();
|
||||
/** 查询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);
|
||||
}
|
||||
}
|
||||
// influxDB改查MySQL cld_event_push_log
|
||||
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.beginOfDay(DateUtil.parse(eventLogParam.getSearchEndTime())));
|
||||
wrapper.eq(EventPushLogs::getResult,eventLogParam.getResult());
|
||||
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<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))) {
|
||||
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();
|
||||
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();
|
||||
eventLogVO.setPersistTime(String.valueOf(i));
|
||||
eventLogVO.setCreatTime(dateTimeFormatter.format(rawLog.getCreateTime()));
|
||||
eventLogVO.setCreatTimed(dateTimeFormatter.format(rawLog.getCreateTime()));
|
||||
eventLogVO.setPushFailed(rawLog.getPushFailed());
|
||||
if (rawLog.getResult()==0) {
|
||||
eventLogVO.setResult("失败");
|
||||
eventLogVO.setState("未推送");
|
||||
} else {
|
||||
eventLogVO.setResult("成功");
|
||||
eventLogVO.setState("已推送");
|
||||
}
|
||||
eventLogVO.setUpdateTime(dateTimeFormatter.format(rawLog.getUpdateTime()));
|
||||
|
||||
list.add(eventLogVO);
|
||||
}
|
||||
page.setTotal(p.getTotal());
|
||||
page.setCurrent(p.getCurrent());
|
||||
//当前页数据
|
||||
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;
|
||||
for (EventPushLogs log : eventPushLogs) {
|
||||
if (log.getLineId().equals(eventDetail.getLineId()) && eventDetail.getStartTime().isEqual(log.getTimeId())) {
|
||||
flag=true;
|
||||
}
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -53,6 +53,9 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
@@ -1531,6 +1534,45 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void downTerminalAutonomeTemplate(HttpServletResponse response) {
|
||||
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "台账信息");
|
||||
exportParams.setStyle(ExcelStyleUtil.class);
|
||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, TerminalBaseExcel.class, new ArrayList<TerminalBaseExcel>());
|
||||
List<DictData> businessList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.BUSINESS_TYPE.getName()).getData();
|
||||
List<DictData> loadTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
||||
List<DictData> manufacturerList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
||||
List<DictData> devTypeList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_TYPE.getName()).getData();
|
||||
List<DictData> frontList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.FRONT_TYPE.getName()).getData();
|
||||
List<DictData> scaleList = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||
List<Node> nodeList = nodeService.nodeAllList();
|
||||
|
||||
|
||||
//这里是自己加的 带下拉框的代码
|
||||
ExcelUtil.selectList(workbook, 8, 8, new String[]{"离线设备"});
|
||||
ExcelUtil.selectList(workbook, 9, 9, new String[]{"暂态系统", "稳态系统", "双系统"});
|
||||
ExcelUtil.selectList(workbook, 10, 10, new String[]{"投运", "热备用", "停运"});
|
||||
ExcelUtil.selectList(workbook, 11, 11, manufacturerList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
ExcelUtil.selectList(workbook, 12, 12, devTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
ExcelUtil.selectList(workbook, 17, 17, new String[]{"周期触发", "变为触发"});
|
||||
ExcelUtil.selectList(workbook, 18, 18, nodeList.stream().map(Node::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
ExcelUtil.selectList(workbook, 19, 19, frontList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
|
||||
/*母线序号*/
|
||||
ExcelUtil.selectList(workbook, 23, 23, new String[]{"1", "2", "3", "3", "4", "5", "6"});
|
||||
ExcelUtil.selectList(workbook, 24, 24, scaleList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
ExcelUtil.selectList(workbook, 25, 25, new String[]{"虚拟母线", "实际母线"});
|
||||
ExcelUtil.selectList(workbook, 27, 27, new String[]{"1", "2", "3", "3", "4", "5", "6"});
|
||||
ExcelUtil.selectList(workbook, 28, 28, new String[]{"极重要", "重要", "普通", "不重要"});
|
||||
ExcelUtil.selectList(workbook, 35, 35, new String[]{"星型接法", "三角型接法", "开口三角型接法"});
|
||||
ExcelUtil.selectList(workbook, 36, 36, new String[]{"3", "5", "10"});
|
||||
ExcelUtil.selectList(workbook, 37, 37, loadTypeList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
ExcelUtil.selectList(workbook, 38, 38, businessList.stream().map(DictData::getName).collect(Collectors.toList()).toArray(new String[]{}));
|
||||
ExcelUtil.selectList(workbook, 41, 41, new String[]{"电网侧", "非电网侧"});
|
||||
ExcelUtil.selectList(workbook, 42, 42, new String[]{"不参与统计", "参与统计"});
|
||||
PoiUtil.exportFileByWorkbook(workbook, "台账导入模板.xlsx", response);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void importTerminalBase(MultipartFile file, HttpServletResponse response) {
|
||||
@@ -1898,7 +1940,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
if (Objects.isNull(temp)) {
|
||||
temp = assembleLine(substationName, LineBaseEnum.SUB_LEVEL.getCode(), pids.get(LineBaseEnum.GD_LEVEL.getCode()), pids);
|
||||
//处理电压等级字典表
|
||||
DictData substationScale = dicDataFeignClient.getDicDataByName(terminalBaseExcel.getSubStationScale()).getData();
|
||||
DictData substationScale = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubStationScale(),DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||
if (Objects.isNull(substationScale)) {
|
||||
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典电压等级不存在"));
|
||||
continue;
|
||||
@@ -2001,7 +2043,7 @@ public class TerminalBaseServiceImpl extends ServiceImpl<LineMapper, Line> imple
|
||||
}
|
||||
}
|
||||
//处理电压等级字典表
|
||||
DictData subvScale = dicDataFeignClient.getDicDataByName(terminalBaseExcel.getSubvScale()).getData();
|
||||
DictData subvScale = dicDataFeignClient.getDicDataByNameAndType(terminalBaseExcel.getSubvScale(),DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||
if (Objects.isNull(subvScale)) {
|
||||
terminalBaseExcelMsgs.add(assembleBaseMsg(terminalBaseExcel, "字典电压等级:" + terminalBaseExcel.getSubStationScale() + "不存在"));
|
||||
continue;
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.common.pojo.dto.SimpleDTO;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.pq.mapper.DevFuctionMapper;
|
||||
import com.njcn.device.pq.mapper.TerminalMaintainMapper;
|
||||
import com.njcn.device.pq.mapper.UserMapper;
|
||||
import com.njcn.device.pq.pojo.dto.GeneralDeviceDTO;
|
||||
@@ -72,10 +73,11 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
||||
|
||||
private final IPqsTerminalLogsService iPqsTerminalLogsService;
|
||||
|
||||
private final DevFuctionMapper devFuctionMapper;
|
||||
|
||||
@Override
|
||||
public List<TerminalMaintainVO> getTerminalMainList(TerminalMainQueryParam terminalMainQueryParam) {
|
||||
List<TerminalMaintainVO> resList = new ArrayList<>();
|
||||
|
||||
DeviceInfoParam deviceInfoParam = new DeviceInfoParam();
|
||||
deviceInfoParam.setLineGrade(terminalMainQueryParam.getLineGrade());
|
||||
deviceInfoParam.setDeptIndex(deptFeignClient.getRootDept().getData().getId());
|
||||
@@ -84,7 +86,6 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
||||
deviceInfoParam.setStatisticalType(simpleDTO);
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, Objects.isNull(terminalMainQueryParam.getRunFlag()) ? null : CollUtil.newArrayList(terminalMainQueryParam.getRunFlag()), CollUtil.newArrayList(1));
|
||||
if (CollectionUtil.isNotEmpty(generalDeviceDTOList)) {
|
||||
|
||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||
List<String> devIds = generalDeviceDTO.getDeviceIndexes();
|
||||
if (CollectionUtils.isEmpty(devIds)) {
|
||||
@@ -282,12 +283,10 @@ public class TerminalMaintainServiceImpl implements TerminalMaintainService {
|
||||
public List<TerminalDaliyFlowVO> getFlowManageDetail(TerminalMainQueryParam param) {
|
||||
List<TerminalDaliyFlowVO> list = new ArrayList<>();
|
||||
TerminalDaliyFlowVO flowManageDetail = terminalMaintainMapper.getFlowManageDetail(param.getDevId());
|
||||
// if (flowManageDetail ==null) {
|
||||
// flowManageDetail = new TerminalDaliyFlowVO();
|
||||
// flowManageDetail.setBaseFlow(1024f);
|
||||
// flowManageDetail.setExtendFlow(0f);
|
||||
// flowManageDetail.setFlowMeal(1024f);
|
||||
// }
|
||||
QueryWrapper<DevFuction> funQueryWrapper = new QueryWrapper<>();
|
||||
funQueryWrapper.lambda().eq(DevFuction::getLineId,param.getDevId());
|
||||
List<DevFuction> functions = devFuctionMapper.selectList(funQueryWrapper);
|
||||
flowManageDetail.setFunctions(functions);
|
||||
List<DeviceDayFlow> deviceDayFlowList = getFlowManageDetailFromInfluxDB(param);
|
||||
float sum = (float) deviceDayFlowList.stream().mapToDouble(DeviceDayFlow::getDailyActualValue).sum();
|
||||
flowManageDetail.setDeviceDayFlowsList(deviceDayFlowList);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.event.mapper.distribution;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.event.pojo.param.UniversalFrontEndParam;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
@@ -13,7 +14,7 @@ import java.util.List;
|
||||
* @date 2022/10/31
|
||||
*/
|
||||
|
||||
public interface PwRmpEventDetailMapper {
|
||||
public interface PwRmpEventDetailMapper extends BaseMapper<RmpEventDetailPO> {
|
||||
|
||||
/**
|
||||
* 获取配网暂态事件明细
|
||||
|
||||
@@ -49,9 +49,10 @@ public class AreaInfoServiceImpl implements AreaInfoService {
|
||||
@Override
|
||||
public List<AreaSubLineVO> getAreaLineInfo(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||
List<AreaSubLineVO> resultVOList = new ArrayList<>();
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
List<String> lineIds = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||
|
||||
System.out.println(lineIds.size());
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
List<AreaLineInfoVO> resList = lineFeignClient.getBaseLineAreaInfo(lineIds).getData();
|
||||
|
||||
|
||||
@@ -298,9 +298,6 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
return TerminalRunningVO.empty();
|
||||
}
|
||||
|
||||
// List<PqsOnlinerate> pqsOnlinerateList = pqsOnlinerateQuery.selectList(Arrays.asList("dev_id", "offlinemin", "onlinemin"),
|
||||
// devIdOr(deviceIndexList),
|
||||
// timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
List<PqsOnlinerate> pqsOnlinerateList = rStatOnlinerateDMapper.getOnlineRateByDevIds(deviceIndexList,beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime()));
|
||||
|
||||
List<PqDevice> pqDeviceList = pqDeviceMapper.queryRunFlagByDeviceIndexs(deviceIndexList);
|
||||
@@ -328,8 +325,7 @@ public class AreaLineServiceImpl implements AreaLineService {
|
||||
}
|
||||
terminalRunningInfoVO.setOnlineRate(computingDeviceOnlineRate(pqsOnlinerateList).apply(deviceIndexes));
|
||||
return terminalRunningInfoVO;
|
||||
}).sorted(TerminalRunningInfoVO.sortAscAreaName())
|
||||
.collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
}).collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
Integer terminalSum = terminalRun.stream().mapToInt(TerminalRunningInfoVO::getNumberOfTerminals)
|
||||
.sum();
|
||||
|
||||
@@ -53,9 +53,8 @@ import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.ne;
|
||||
public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||
|
||||
private final PqsEventDetailQuery pqsEventDetailQuery;
|
||||
|
||||
private final EventDetailService eventDetailService;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
/**
|
||||
@@ -70,7 +69,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.RECORDING_WAVE.getCode()).getData();
|
||||
|
||||
// 获取指定部门下的监测点集合
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
if (CollUtil.isEmpty(generalDeviceDTOList)) {
|
||||
return AreaStatisticalVO.empty();
|
||||
}
|
||||
@@ -78,12 +77,6 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
if (CollUtil.isEmpty(lineIds)) {
|
||||
return AreaStatisticalVO.empty();
|
||||
}
|
||||
|
||||
// List<Clause> clauseList = new ArrayList<>(timeAnd(beginOfDay(deviceInfoParam.getSearchBeginTime()), endOfDay(deviceInfoParam.getSearchEndTime())));
|
||||
// clauseList.add(ne("wave_type",5));
|
||||
// List<EventDetail> cc = pqsEventDetailQuery.selectList(Arrays.asList("line_id", "eventass_index"),
|
||||
// lineIdOr(lineIds),clauseList);
|
||||
|
||||
//数据暂降查询
|
||||
List<RmpEventDetailPO> info = eventDetailService.list(new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIds)
|
||||
@@ -103,7 +96,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
|
||||
|
||||
deviceInfoParam.getStatisticalType().setCode(StatisticsEnum.VOLTAGE_LEVEL.getCode());
|
||||
List<GeneralDeviceDTO> voltageLevelList = generalDeviceInfoClient.getPracticalAllDeviceInfo(deviceInfoParam).getData();
|
||||
List<GeneralDeviceDTO> voltageLevelList = generalDeviceInfoClient.getPracticalRunDeviceInfo(deviceInfoParam).getData();
|
||||
VoltageStatisticsVO voltageStatisticsVO = statisticalVoltageLevelInfo(voltageLevelList, eventDetailList);
|
||||
|
||||
return AreaStatisticalVO.buildVO(areaStatisticsVO, voltageStatisticsVO, monthCalculationVOS);
|
||||
@@ -201,7 +194,7 @@ public class AreaStatisticalServiceImpl implements AreaStatisticalService {
|
||||
|
||||
calculationVO.computeSarfi90();
|
||||
return calculationVO;
|
||||
}).sorted(AreaCalculationVO.sortAscAreaName()).collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
}).collect(Collectors.toCollection(() -> Collections.synchronizedList(new ArrayList<>())));
|
||||
|
||||
// 求和暂降次数
|
||||
Long frequencySum = areaCalculation.stream().mapToLong(AreaCalculationVO::getFrequency).sum();
|
||||
|
||||
@@ -119,15 +119,11 @@ public class EventDetailServiceImpl extends ServiceImpl<EventDetailMapper, RmpEv
|
||||
|
||||
@Override
|
||||
public List<EventDetail> getEventDetailLimit(List<String> lineIndexes, String startTime, String endTime, Integer pageSize, Integer pageNum, List<String> waveType) {
|
||||
|
||||
Page<RmpEventDetailPO> pageInfo = this.page(new Page<>(pageNum, pageSize), new LambdaQueryWrapper<RmpEventDetailPO>()
|
||||
.in(RmpEventDetailPO::getMeasurementPointId, lineIndexes)
|
||||
.ge(StrUtil.isNotBlank(startTime), RmpEventDetailPO::getStartTime,DateUtil.beginOfDay(DateUtil.parse(startTime)))
|
||||
.le(StrUtil.isNotBlank(endTime), RmpEventDetailPO::getStartTime, DateUtil.endOfDay(DateUtil.parse(endTime)))
|
||||
);
|
||||
|
||||
return BeanUtil.copyToList(pageInfo.getRecords(), EventDetail.class);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.device.pms.api.MonitorClient;
|
||||
import com.njcn.device.pms.pojo.param.MonitorTerminalParam;
|
||||
import com.njcn.device.pms.pojo.po.Monitor;
|
||||
import com.njcn.device.pms.pojo.vo.MonitorVO;
|
||||
import com.njcn.event.mapper.distribution.PwRmpEventDetailMapper;
|
||||
import com.njcn.event.mapper.majornetwork.RmpEventDetailMapper;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.event.pojo.vo.RmpEventDetailVO;
|
||||
@@ -95,6 +96,8 @@ public class TransientServiceImpl implements TransientService {
|
||||
|
||||
private final RmpEventDetailMapper rmpEventDetailMapper;
|
||||
|
||||
private final PwRmpEventDetailMapper pwRmpEventDetailMapper;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
@Override
|
||||
@@ -200,6 +203,8 @@ public class TransientServiceImpl implements TransientService {
|
||||
ip=monitorVO.getIp();
|
||||
}
|
||||
|
||||
|
||||
System.out.println(eventDetail.getEventId());
|
||||
String waveName = eventDetail.getWavePath();
|
||||
String cfgPath, datPath;
|
||||
if (generalInfo.getBusinessFileStorage() == GeneralConstant.LOCAL_DISK) {
|
||||
@@ -215,7 +220,9 @@ public class TransientServiceImpl implements TransientService {
|
||||
} else {
|
||||
cfgPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.CFG;
|
||||
datPath = OssPath.WAVE_DIR + ip + StrUtil.SLASH + waveName + GeneralConstant.DAT;
|
||||
System.out.println("波形路径-------------------"+cfgPath);
|
||||
try (
|
||||
|
||||
InputStream cfgStream = fileStorageUtil.downloadStream(cfgPath);
|
||||
InputStream datStream = fileStorageUtil.downloadStream(datPath)
|
||||
) {
|
||||
@@ -321,7 +328,9 @@ public class TransientServiceImpl implements TransientService {
|
||||
if (Objects.nonNull(transientParam.getFileFlag())) {
|
||||
wrapper.eq(Objects.nonNull(transientParam.getFileFlag()), RmpEventDetailPO::getFileFlag, transientParam.getFileFlag());
|
||||
}
|
||||
Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()),wrapper);
|
||||
// Page<RmpEventDetailPO> pageInfo = eventDetailService.page(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()),wrapper);
|
||||
Page<RmpEventDetailPO> pageInfo = pwRmpEventDetailMapper.selectPage(new Page<>(transientParam.getPageNum(), transientParam.getPageSize()), wrapper);
|
||||
|
||||
List<EventDetailNew> eventDetailData=BeanUtil.copyToList(pageInfo.getRecords(),EventDetailNew.class);
|
||||
page= BeanUtil.copyProperties(pageInfo,Page.class);
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.harmonic.utils;
|
||||
import org.apache.poi.xwpf.usermodel.*;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
|
||||
import javax.servlet.ServletOutputStream;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
@@ -20,12 +21,11 @@ public class WordUtil2 {
|
||||
public void getWord(String path, Map<String, Object> params, String fileName, HttpServletResponse response)
|
||||
throws Exception {
|
||||
path = ClearPathUtil.cleanString(path);
|
||||
File file = new File(path);
|
||||
InputStream inStream = null;
|
||||
CustomXWPFDocument doc = null;
|
||||
//读取报告模板
|
||||
try {
|
||||
inStream = new FileInputStream(file);
|
||||
inStream = new ClassPathResource(path).getInputStream();;
|
||||
doc = new CustomXWPFDocument(inStream);
|
||||
this.replaceInTable(doc, params); // 替换表格里面的变量
|
||||
this.replaceInPara(doc, params); // 替换文本里面的变量
|
||||
|
||||
@@ -28,6 +28,7 @@ import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.core.io.ClassPathResource;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import sun.misc.BASE64Encoder;
|
||||
@@ -35,6 +36,7 @@ import sun.misc.BASE64Encoder;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.*;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
|
||||
|
||||
@@ -168,23 +170,20 @@ public class ExportModelController extends BaseController {
|
||||
} else {
|
||||
rtfPath = "file/reportModel.docx";
|
||||
}
|
||||
|
||||
ClassPathResource rtfPathResource=null;
|
||||
ClassPathResource picPathResource=null;
|
||||
try {
|
||||
rtfPath = getClass().getClassLoader().getResource(rtfPath).getPath();
|
||||
picPath = getClass().getClassLoader().getResource(picPath).getPath();
|
||||
rtfPathResource = new ClassPathResource(rtfPath);
|
||||
picPathResource = new ClassPathResource(picPath);
|
||||
rtfPath = rtfPath.replaceAll("%20", " ");
|
||||
picPath = picPath.replaceAll("%20", " ");
|
||||
} catch (Exception e1) {
|
||||
log.info("获取报表发生异常,异常是" + e1.getMessage());
|
||||
}
|
||||
File tmpfile = new File(rtfPath);
|
||||
if (!tmpfile.exists()) {
|
||||
return "pathfail";
|
||||
}
|
||||
|
||||
InputStream ins = null;
|
||||
try {
|
||||
ins = new FileInputStream(rtfPath);
|
||||
ins = rtfPathResource.getInputStream();
|
||||
if (null != ins) {
|
||||
flagPath = true;
|
||||
}
|
||||
@@ -207,8 +206,6 @@ public class ExportModelController extends BaseController {
|
||||
if (ObjectUtil.isNotEmpty(file)) {
|
||||
byte[] bytes = file.getBytes();
|
||||
|
||||
// byte[] image = (byte[]) session.getAttribute("image");
|
||||
// String contentType = (String) session.getAttribute("contentType");
|
||||
header.put("width", 400);
|
||||
header.put("height", 250);
|
||||
header.put("type", file.getContentType());
|
||||
@@ -217,7 +214,7 @@ public class ExportModelController extends BaseController {
|
||||
InputStream inStream = null;
|
||||
byte[] data = null;
|
||||
try {
|
||||
inStream = new FileInputStream(new File(picPath));
|
||||
inStream = picPathResource.getInputStream();
|
||||
data = new byte[inStream.available()];
|
||||
inStream.read(data);
|
||||
} catch (FileNotFoundException e) {
|
||||
|
||||
@@ -100,7 +100,7 @@ public class PollutionSubstationController extends BaseController {
|
||||
public HttpResult<List<PollutionLineDTO>> getLineRank(@RequestBody HarmonicPublicParam param) {
|
||||
String methodDescribe = getMethodDescribe("getLineRank");
|
||||
LogUtil.njcnDebug(log, "{},实体参数:{}", methodDescribe, param);
|
||||
List<PollutionLineDTO> list = pollutionSubstationService.getLineRank(param);
|
||||
List<PollutionLineDTO> list = pollutionSubstationService.getLineRankTop10(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.harmonic.mapper;
|
||||
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.harmonic.pojo.dto.PublicDTO;
|
||||
import com.njcn.harmonic.pojo.po.RMpPollutionDPO;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Param;import org.apache.ibatis.annotations.Select;
|
||||
@@ -40,4 +42,6 @@ public interface RMpPollutionDPOMapper extends BaseMapper<RMpPollutionDPO> {
|
||||
|
||||
})
|
||||
List<RMpPollutionDPO> selectMaxList(@Param("items") List<String> line, @Param("pollutionType") String pollutionType, @Param("searchBeginTime") String searchBeginTime);
|
||||
|
||||
List<PublicDTO> getTop10Line(@Param("list") List<String> lineList, @Param("start") DateTime searchBeginTime, @Param("end") DateTime searchEndTime, @Param("pollutionType") String id);
|
||||
}
|
||||
@@ -28,6 +28,23 @@
|
||||
#{item.lineId,jdbcType=VARCHAR}
|
||||
</foreach>
|
||||
</update>
|
||||
<select id="getTop10Line" resultType="com.njcn.harmonic.pojo.dto.PublicDTO">
|
||||
SELECT
|
||||
r.line_id AS id,
|
||||
MAX(r.value) AS data
|
||||
FROM r_mp_pollution_d r
|
||||
WHERE r.line_id IN
|
||||
<foreach collection="list" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
AND r.pollution_type = #{pollutionType}
|
||||
AND r.data_date between #{start} and #{end}
|
||||
GROUP BY r.line_id
|
||||
ORDER BY data DESC
|
||||
LIMIT 0,10
|
||||
</select>
|
||||
|
||||
|
||||
<insert id="batchInsert" parameterType="map">
|
||||
<!--@mbg.generated-->
|
||||
insert into r_mp_pollution_d
|
||||
|
||||
@@ -65,4 +65,7 @@ public interface PollutionSubstationService extends IService<RStatPollutionSubst
|
||||
*/
|
||||
List<PollutionLineDTO> getLineRank(HarmonicPublicParam param);
|
||||
|
||||
|
||||
List<PollutionLineDTO> getLineRankTop10(HarmonicPublicParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.harmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -570,7 +571,7 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
searchBeginTime = param.getSearchBeginTime ( ).substring (0, 10)+"%";
|
||||
}
|
||||
|
||||
if(param.getType()==0){
|
||||
if(param.getType()==0) {
|
||||
param.setServerName(generalInfo.getMicroServiceName());
|
||||
List<String> lineList = new ArrayList<>();
|
||||
PollutionParamDTO paramDTO = new PollutionParamDTO();
|
||||
@@ -646,6 +647,88 @@ public class PollutionSubstationServiceImpl extends ServiceImpl<RStatPollutionSu
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<PollutionLineDTO> getLineRankTop10 (HarmonicPublicParam param) {
|
||||
List<PollutionLineDTO> list= new ArrayList<>();
|
||||
String pollutionType = param.getStatisticalType ( ).getId ();
|
||||
if(param.getType()==0) {
|
||||
param.setServerName(generalInfo.getMicroServiceName());
|
||||
List<String> lineList = new ArrayList<>();
|
||||
PollutionParamDTO paramDTO = new PollutionParamDTO();
|
||||
if (StringUtils.isBlank(RequestUtil.getDeptIndex())) {
|
||||
return list;
|
||||
}
|
||||
List<GeneralDeviceDTO> deviceList = generalDeviceInfoClient.getPracticalRunDeviceInfo(param).getData();
|
||||
deviceList.forEach(item -> {
|
||||
if (!CollectionUtils.isEmpty(item.getLineIndexes())) {
|
||||
lineList.addAll(item.getLineIndexes());
|
||||
}
|
||||
});
|
||||
if (!CollectionUtils.isEmpty(lineList)) {
|
||||
paramDTO.setLineList(lineList);
|
||||
list = lineFeignClient.getLineInfo(paramDTO).getData();
|
||||
List<PublicDTO> result =rMpPollutionDPOMapper.getTop10Line(lineList,DateUtil.beginOfDay(DateUtil.parse(param.getSearchBeginTime())),DateUtil.endOfDay(DateUtil.parse(param.getSearchEndTime())), param.getStatisticalType().getId());
|
||||
if (!CollectionUtils.isEmpty(result)) {
|
||||
list.stream().map(list1 -> result.stream().filter(list2 -> Objects.equals(list1.getId(), list2.getId())).findAny().map(m -> {
|
||||
list1.setData(m.getData());
|
||||
return list1;
|
||||
})).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
list.sort((item1, item2) -> item2.getData().compareTo(item1.getData()));
|
||||
if (list.size() > Param.UP_LIMIT) {
|
||||
return list.subList(Param.DOWN_LIMIT, Param.UP_LIMIT);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
PmsDeviceInfoParam pmsDeviceInfoParam = new PmsDeviceInfoParam();
|
||||
pmsDeviceInfoParam.setDeptIndex(param.getDeptIndex());
|
||||
//获取统计类型
|
||||
pmsDeviceInfoParam.setStatisticalType(param.getStatisticalType());
|
||||
//获取主网台账信息
|
||||
List<PmsGeneralDeviceDTO> deviceList = pmsGeneralDeviceInfoClient.getPmsDeviceInfoWithInOrg(pmsDeviceInfoParam).getData();
|
||||
List<String> monitorIdList=new ArrayList<>();
|
||||
deviceList.forEach(dept -> {
|
||||
monitorIdList.addAll(dept.getMonitorIdList());
|
||||
});
|
||||
|
||||
if(CollectionUtil.isNotEmpty(monitorIdList)){
|
||||
//获取监测点数据
|
||||
List<RMpPollutionDPO> lineData = rMpPollutionDPOMapper.selectMaxList ( monitorIdList,pollutionType,param.getSearchBeginTime());
|
||||
|
||||
if(CollectionUtil.isEmpty(lineData)){
|
||||
return list;
|
||||
}
|
||||
|
||||
//获取主网监测点信息
|
||||
List<Monitor> data = monitorClient.getMonitorList(monitorIdList).getData();
|
||||
Map<String, Monitor> monitorMap = data.stream().collect(Collectors.toMap(Monitor::getId, Function.identity(), (key1, kye2) -> key1));
|
||||
lineData.sort((item1, item2) -> item2.getValue().compareTo(item1.getValue()));
|
||||
if (lineData.size() > Param.UP_LIMIT) {
|
||||
lineData = lineData.subList(Param.DOWN_LIMIT, Param.UP_LIMIT);
|
||||
}
|
||||
|
||||
PollutionLineDTO dto;
|
||||
for (RMpPollutionDPO lineDatum : lineData) {
|
||||
if(monitorMap.containsKey(lineDatum.getLineId())){
|
||||
Monitor monitor = monitorMap.get(lineDatum.getLineId());
|
||||
dto=new PollutionLineDTO();
|
||||
dto.setId(monitor.getId());
|
||||
dto.setName(monitor.getName());
|
||||
dto.setPowerCompany(monitor.getOrgName());
|
||||
dto.setSubstation(monitor.getPowerrId());
|
||||
dto.setSubstationId(monitor.getPowerrName());
|
||||
dto.setBusBar(monitor.getLineName());
|
||||
dto.setData(lineDatum.getValue());
|
||||
list.add(dto);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 功能描述:根据监测点id查询influxDB污染指数
|
||||
*
|
||||
|
||||
@@ -320,9 +320,6 @@ public class PollutionServiceImpl implements PollutionService {
|
||||
if (!CollUtil.isEmpty(processDataList)){
|
||||
map.put("pollutionType",dictData.getId());
|
||||
map.put("value",processDataList.stream().max(Comparator.comparing(RMpPollutionDPO::getValue)).get().getValue());
|
||||
}else {
|
||||
map.put("pollutionType",dictData.getId());
|
||||
map.put("value",0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -31,6 +31,9 @@ public interface DicDataFeignClient {
|
||||
@GetMapping("/getDicDataByName")
|
||||
HttpResult<DictData> getDicDataByName(@RequestParam("dicName") String dicName);
|
||||
|
||||
@GetMapping("/getDicDataByNameAndType")
|
||||
HttpResult<DictData> getDicDataByNameAndType(@RequestParam("dicName") String dicName ,@RequestParam("typeName") String typeName);
|
||||
|
||||
@GetMapping("/getDicDataByCode")
|
||||
HttpResult<DictData> getDicDataByCode(@RequestParam("code") String code);
|
||||
|
||||
|
||||
@@ -55,6 +55,12 @@ public class DicDataFeignClientFallbackFactory implements FallbackFactory<DicDat
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<DictData> getDicDataByNameAndType(String dicName, String typeName) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据字典名称获取字典数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<DictData> getDicDataByCode(String code) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据字典code获取字典数据",cause.toString());
|
||||
|
||||
@@ -17,6 +17,7 @@ import com.njcn.system.pojo.vo.DictDataVO;
|
||||
import com.njcn.system.service.IDictDataService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -162,6 +163,19 @@ public class DictDataController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDicDataByNameAndType")
|
||||
@ApiOperation("根据字典名称查询字典数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "dicName", value = "查询参数", required = true),
|
||||
@ApiImplicitParam(name = "typeName", value = "查询参数", required = true)
|
||||
})
|
||||
public HttpResult<DictData> getDicDataByNameAndType(@RequestParam("dicName") String dicName,@RequestParam("typeName") String typeName) {
|
||||
String methodDescribe = getMethodDescribe("getDicDataByNameAndType");
|
||||
DictData result = dictDataService.getDicDataByNameAndType(dicName,typeName);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getDicDataByCode")
|
||||
@ApiOperation("根据字典code查询字典数据")
|
||||
|
||||
@@ -12,7 +12,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author hongawen
|
||||
@@ -22,21 +22,25 @@ public interface DictDataMapper extends BaseMapper<DictData> {
|
||||
|
||||
/**
|
||||
* 分页查询字典数据
|
||||
* @param page 分页数据
|
||||
*
|
||||
* @param page 分页数据
|
||||
* @param queryWrapper 查询条件
|
||||
* @return 字典数据
|
||||
*/
|
||||
Page<DictDataVO> page(@Param("page")Page<DictDataVO> page, @Param("ew")QueryWrapper<DictDataVO> queryWrapper);
|
||||
Page<DictDataVO> page(@Param("page") Page<DictDataVO> page, @Param("ew") QueryWrapper<DictDataVO> queryWrapper);
|
||||
|
||||
/**
|
||||
* @param dictypeName 字典类型名称
|
||||
* @return 根据字典类型名称查询字典数据
|
||||
*/
|
||||
List<DictData> getDicDataByTypeName(@Param("dictypeName")String dictypeName);
|
||||
List<DictData> getDicDataByTypeName(@Param("dictypeName") String dictypeName);
|
||||
|
||||
DictData getDicDataByName(@Param("dicName")String dicName);
|
||||
DictData getDicDataByName(@Param("dicName") String dicName);
|
||||
|
||||
DictData getDicDataByNameAndType(@Param("dicName") String dicName, @Param("typeName") String typeName);
|
||||
|
||||
DictData getDicDataByCode(@Param("code") String code);
|
||||
|
||||
DictData getDicDataByCode(@Param("code")String code);
|
||||
/**
|
||||
* 根据字典类型名称&数据名称获取字典数据
|
||||
*
|
||||
@@ -44,12 +48,12 @@ public interface DictDataMapper extends BaseMapper<DictData> {
|
||||
* @param dicDataName 字典数据名称
|
||||
* @return 字典数据
|
||||
*/
|
||||
DictData getDicDataByNameAndTypeName(@Param("dicTypeName")String dicTypeName, @Param("dicDataName")String dicDataName);
|
||||
DictData getDicDataByNameAndTypeName(@Param("dicTypeName") String dicTypeName, @Param("dicDataName") String dicDataName);
|
||||
|
||||
/**
|
||||
* @param dictTypeCode 字典类型名称
|
||||
* @return 根据字典类型名称查询字典数据
|
||||
*/
|
||||
List<DictData> getDicDataByTypeCode(@Param("dictTypeCode")String dictTypeCode);
|
||||
List<DictData> getDicDataByTypeCode(@Param("dictTypeCode") String dictTypeCode);
|
||||
|
||||
}
|
||||
|
||||
@@ -32,6 +32,16 @@
|
||||
order by sys_dict_data.sort
|
||||
</select>
|
||||
|
||||
<select id="getDicDataByNameAndType" resultType="DictData">
|
||||
SELECT sys_dict_data.*
|
||||
FROM sys_dict_data sys_dict_data
|
||||
LEFT JOIN sys_dict_type sdt ON sdt.Id = sys_dict_data.Type_Id
|
||||
WHERE sys_dict_data.name = #{dicName}
|
||||
and sys_dict_data.state = 1
|
||||
and sdt.`Name`= #{typeName}
|
||||
order by sys_dict_data.sort
|
||||
</select>
|
||||
|
||||
<!-- 根据字典名称查询字典数据-->
|
||||
<select id="getDicDataByCode" resultType="DictData">
|
||||
SELECT sys_dict_data.*
|
||||
|
||||
@@ -83,6 +83,13 @@ public interface IDictDataService extends IService<DictData> {
|
||||
*/
|
||||
DictData getDicDataByName(String dicName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param dicName 字典名称,类型名称
|
||||
* @return 根据字典名称查询字典数据
|
||||
*/
|
||||
DictData getDicDataByNameAndType(String dicName,String typeName);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param code 字典code
|
||||
|
||||
@@ -144,6 +144,11 @@ public class DictDataServiceImpl extends ServiceImpl<DictDataMapper, DictData> i
|
||||
return this.baseMapper.getDicDataByName(dicName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData getDicDataByNameAndType(String dicName,String typeName) {
|
||||
return this.baseMapper.getDicDataByNameAndType(dicName,typeName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DictData getDicDataByCode(String code) {
|
||||
return this.baseMapper.getDicDataByCode(code);
|
||||
|
||||
Reference in New Issue
Block a user