监测点统计,终端运行统计接口
This commit is contained in:
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.device.pq.pojo.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModel;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import io.swagger.models.auth.In;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@ApiModel
|
||||||
|
@NoArgsConstructor
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
public class PqsParam extends DeviceInfoParam.BusinessParam {
|
||||||
|
@ApiModelProperty("当前页码")
|
||||||
|
private Integer pageNum;
|
||||||
|
@ApiModelProperty("当前页条数")
|
||||||
|
private Integer pageSize;
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.device.pq.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import org.influxdb.annotation.Column;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("pqs_onlinerate")
|
||||||
|
public class OnlineRate extends BaseEntity {
|
||||||
|
|
||||||
|
@Column(name="Id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@Column(name="Create_Time")
|
||||||
|
private LocalDateTime createTime;
|
||||||
|
|
||||||
|
@Column(name="Dev_Id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@Column(name="Offline_Min")
|
||||||
|
private String offlineMin;
|
||||||
|
|
||||||
|
@Column(name="Online_Min")
|
||||||
|
private String onlineMin;
|
||||||
|
|
||||||
|
private Double onlineRate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package com.njcn.device.pq.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.njcn.db.bo.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@TableName("pqs_month_flow")
|
||||||
|
public class PqsMonthFlow extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
private String actualValue;
|
||||||
|
|
||||||
|
private String devId;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.device.pq.pojo.vo;
|
package com.njcn.device.pq.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -18,6 +19,18 @@ public class LineFlowMealDetailVO implements Serializable {
|
|||||||
@ApiModelProperty("id")
|
@ApiModelProperty("id")
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点对应的设备id")
|
||||||
|
private String DeviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点对应的设备名称")
|
||||||
|
private String DeviceName;
|
||||||
|
|
||||||
|
@ApiModelProperty("供电公司")
|
||||||
|
private String ElectricPowerCompany;
|
||||||
|
|
||||||
|
@ApiModelProperty("变电站")
|
||||||
|
private String Substation;
|
||||||
|
|
||||||
@ApiModelProperty("pid")
|
@ApiModelProperty("pid")
|
||||||
private String pid;
|
private String pid;
|
||||||
|
|
||||||
@@ -37,6 +50,7 @@ public class LineFlowMealDetailVO implements Serializable {
|
|||||||
private Integer comFlag;
|
private Integer comFlag;
|
||||||
|
|
||||||
@ApiModelProperty("最新更新时间")
|
@ApiModelProperty("最新更新时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
|
||||||
private LocalDateTime updateTime;
|
private LocalDateTime updateTime;
|
||||||
|
|
||||||
@ApiModelProperty("在线率")
|
@ApiModelProperty("在线率")
|
||||||
@@ -45,6 +59,12 @@ public class LineFlowMealDetailVO implements Serializable {
|
|||||||
@ApiModelProperty("数据完整性")
|
@ApiModelProperty("数据完整性")
|
||||||
private Float integrity;
|
private Float integrity;
|
||||||
|
|
||||||
|
@ApiModelProperty("理论数据量")
|
||||||
|
private Integer due;
|
||||||
|
|
||||||
|
@ApiModelProperty("实际数据量")
|
||||||
|
private Integer real;
|
||||||
|
|
||||||
@ApiModelProperty("套餐流量")
|
@ApiModelProperty("套餐流量")
|
||||||
private Float flowMeal;
|
private Float flowMeal;
|
||||||
|
|
||||||
|
|||||||
@@ -21,4 +21,10 @@ public class LineInfluxDbInegrityVO implements Serializable {
|
|||||||
@Column(name = "integrity")
|
@Column(name = "integrity")
|
||||||
private Double integrity;
|
private Double integrity;
|
||||||
|
|
||||||
|
@Column(name = "due")
|
||||||
|
private Integer due;
|
||||||
|
|
||||||
|
@Column(name = "real")
|
||||||
|
private Integer real;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,12 @@ public class LineStatisticsDetailVO implements Serializable {
|
|||||||
@ApiModelProperty("监测点总数")
|
@ApiModelProperty("监测点总数")
|
||||||
private Integer lineNum;
|
private Integer lineNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置总数")
|
||||||
|
private Integer DeviceNum;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置新增总数")
|
||||||
|
private Integer addDeviceNum;
|
||||||
|
|
||||||
@ApiModelProperty("监测点新增数")
|
@ApiModelProperty("监测点新增数")
|
||||||
private Integer addLineNum;
|
private Integer addLineNum;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.device.pq.controller;
|
package com.njcn.device.pq.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
@@ -7,9 +8,11 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.device.pq.pojo.param.PqsParam;
|
||||||
import com.njcn.device.pq.pojo.vo.*;
|
import com.njcn.device.pq.pojo.vo.*;
|
||||||
import com.njcn.device.pq.service.LineService;
|
import com.njcn.device.pq.service.LineService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@@ -43,8 +46,10 @@ public class OperationContrController extends BaseController {
|
|||||||
@PostMapping("/getLineDistribution")
|
@PostMapping("/getLineDistribution")
|
||||||
@ApiOperation("获取监测点分布")
|
@ApiOperation("获取监测点分布")
|
||||||
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
||||||
public HttpResult<List<LineDistributionVO>> getLineDistribution(@RequestBody @Validated DeviceInfoParam deviceInfoParam) {
|
public HttpResult<List<LineDistributionVO>> getLineDistribution(@RequestBody DeviceInfoParam deviceInfoParam) {
|
||||||
String methodDescribe = getMethodDescribe("getLineDistribution");
|
String methodDescribe = getMethodDescribe("getLineDistribution");
|
||||||
|
DeviceInfoParam param = new DeviceInfoParam(RequestUtil.getDeptIndex(),null);
|
||||||
|
deviceInfoParam.setDeptIndex(param.getDeptIndex());
|
||||||
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
|
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
|
||||||
List<LineDistributionVO> result = lineService.getLineDistribution(deviceInfoParam);
|
List<LineDistributionVO> result = lineService.getLineDistribution(deviceInfoParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
@@ -54,7 +59,7 @@ public class OperationContrController extends BaseController {
|
|||||||
@PostMapping("/getLineStatisticsDetail")
|
@PostMapping("/getLineStatisticsDetail")
|
||||||
@ApiOperation("获取监测点统计")
|
@ApiOperation("获取监测点统计")
|
||||||
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
||||||
public HttpResult<List<LineStatisticsDetailVO>> getLineStatisticsDetail(@RequestBody @Validated DeviceInfoParam.BusinessParam deviceInfoParam) {
|
public HttpResult<List<LineStatisticsDetailVO>> getLineStatisticsDetail(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
String methodDescribe = getMethodDescribe("getLineStatisticsDetail");
|
String methodDescribe = getMethodDescribe("getLineStatisticsDetail");
|
||||||
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
|
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
|
||||||
List<LineStatisticsDetailVO> result = lineService.getLineStatisticsDetail(deviceInfoParam);
|
List<LineStatisticsDetailVO> result = lineService.getLineStatisticsDetail(deviceInfoParam);
|
||||||
@@ -83,6 +88,36 @@ public class OperationContrController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getDeviceRunStatistics")
|
||||||
|
@ApiOperation("获取终端运行统计")
|
||||||
|
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
||||||
|
public HttpResult<List<LineFlowMealDetailVO>> getDeviceRunStatistics(@RequestBody DeviceInfoParam.BusinessParam deviceInfoParam){
|
||||||
|
String methodDescribe = getMethodDescribe("getDeviceRunStatistics");
|
||||||
|
DeviceInfoParam param = new DeviceInfoParam(RequestUtil.getDeptIndex(),null);
|
||||||
|
deviceInfoParam.setDeptIndex(param.getDeptIndex());
|
||||||
|
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
|
||||||
|
// deviceInfoParam.setDeptIndex("db2ba5e64d77f8e94ea5e6bb267407a2");
|
||||||
|
List<LineFlowMealDetailVO> result = lineService.getDeviceRunStatistics(deviceInfoParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getNewDeviceRunStatistics")
|
||||||
|
@ApiOperation("获取终端运行统计_新")
|
||||||
|
@ApiImplicitParam(name = "deviceInfoParam", value = "实体", required = true)
|
||||||
|
public HttpResult<Page<LineFlowMealDetailVO>> getNewDeviceRunStatistics(@RequestBody PqsParam deviceInfoParam){
|
||||||
|
String methodDescribe = getMethodDescribe("getDeviceRunStatistics");
|
||||||
|
DeviceInfoParam param = new DeviceInfoParam(RequestUtil.getDeptIndex(),null);
|
||||||
|
deviceInfoParam.setDeptIndex(param.getDeptIndex());
|
||||||
|
LogUtil.njcnDebug(log, "{},参数集合:{}", methodDescribe, deviceInfoParam);
|
||||||
|
Page<LineFlowMealDetailVO> result = lineService.getNewDeviceRunStatistics(deviceInfoParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/getLineStaticsView")
|
@PostMapping("/getLineStaticsView")
|
||||||
@ApiOperation("获取详细的监测点统计")
|
@ApiOperation("获取详细的监测点统计")
|
||||||
|
|||||||
@@ -3,6 +3,8 @@ package com.njcn.device.pq.mapper;
|
|||||||
|
|
||||||
import cn.hutool.core.date.DateTime;
|
import cn.hutool.core.date.DateTime;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.common.pojo.dto.SimpleDTO;
|
import com.njcn.common.pojo.dto.SimpleDTO;
|
||||||
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
import com.njcn.device.pq.pojo.bo.BaseLineInfo;
|
||||||
import com.njcn.device.pq.pojo.bo.DeviceType;
|
import com.njcn.device.pq.pojo.bo.DeviceType;
|
||||||
@@ -408,4 +410,10 @@ public interface LineMapper extends BaseMapper<Line> {
|
|||||||
"</script>"
|
"</script>"
|
||||||
})
|
})
|
||||||
Integer queryOnlineSubstaion(@Param("items") List<String> deviceIds);
|
Integer queryOnlineSubstaion(@Param("items") List<String> deviceIds);
|
||||||
|
|
||||||
|
LineStateVO getDeviceStatus(List<String> deviceIndexes);
|
||||||
|
|
||||||
|
List<LineFlowMealDetailVO> getDeviceRunStatistics(@Param("list") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
||||||
|
|
||||||
|
Page<LineFlowMealDetailVO> getNewDeviceRunStatistics(Page<LineFlowMealDetailVO> page,@Param("devs") List<String> list, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.njcn.device.pq.mapper;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.pq.pojo.po.OnlineRate;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
public interface OnlineRateMapper extends BaseMapper<OnlineRate> {
|
||||||
|
|
||||||
|
List<OnlineRate> getOnlineRateByDevId(@Param("list") List<String> devIndexs, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTimem);
|
||||||
|
}
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package com.njcn.device.pq.mapper;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DateTime;
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.device.pq.pojo.po.PqsMonthFlow;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
public interface PqsMonthFlowMapper extends BaseMapper<PqsMonthFlow> {
|
||||||
|
|
||||||
|
float getStatisValueFlow(@Param("devId")String id, @Param("startTime") DateTime startTime, @Param("endTime") DateTime endTimem);
|
||||||
|
}
|
||||||
@@ -274,10 +274,10 @@
|
|||||||
<foreach collection="ids" separator="," open="(" close=")" item="item">
|
<foreach collection="ids" separator="," open="(" close=")" item="item">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
<if test="deviceInfoParam.monitorFlag!=2">
|
<if test="deviceInfoParam.monitorFlag!=2 and deviceInfoParam.monitorFlag!=null">
|
||||||
and t2.Monitor_Flag = #{deviceInfoParam.monitorFlag}
|
and t2.Monitor_Flag = #{deviceInfoParam.monitorFlag}
|
||||||
</if>
|
</if>
|
||||||
<if test="deviceInfoParam.powerFlag!=2">
|
<if test="deviceInfoParam.powerFlag!=2 and deviceInfoParam.powerFlag!=null ">
|
||||||
and t2.Power_Flag = #{deviceInfoParam.powerFlag}
|
and t2.Power_Flag = #{deviceInfoParam.powerFlag}
|
||||||
</if>
|
</if>
|
||||||
<if test="deviceInfoParam.lineGrade!='' and deviceInfoParam.lineGrade!=null">
|
<if test="deviceInfoParam.lineGrade!='' and deviceInfoParam.lineGrade!=null">
|
||||||
@@ -674,6 +674,22 @@
|
|||||||
AND A5.Pid = A6.Id AND A6.`Name` = F.Area_Code
|
AND A5.Pid = A6.Id AND A6.`Name` = F.Area_Code
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDeviceStatus" resultType="LineStateVO">
|
||||||
|
SELECT
|
||||||
|
count(IF( device.Run_Flag = 0, IF ( device.Com_Flag = 1, 1, NULL ), NULL )) normalStateNum,
|
||||||
|
count(IF( device.Run_Flag = 0, IF ( device.Com_Flag = 0, 1, NULL ), NULL )) suspendStateNum,
|
||||||
|
count( device.Run_Flag = 1 OR NULL ) hotSpareStateNum,
|
||||||
|
count( device.Run_Flag = 2 OR NULL ) offStreamStateNum
|
||||||
|
FROM
|
||||||
|
pq_device device
|
||||||
|
WHERE
|
||||||
|
device.id IN
|
||||||
|
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getLineStatisticsDetail" resultType="LineStateVO">
|
<select id="getLineStatisticsDetail" resultType="LineStateVO">
|
||||||
SELECT
|
SELECT
|
||||||
count(IF( device.Run_Flag = 0, IF ( device.Com_Flag = 1, 1, NULL ), NULL )) normalStateNum,
|
count(IF( device.Run_Flag = 0, IF ( device.Com_Flag = 1, 1, NULL ), NULL )) normalStateNum,
|
||||||
@@ -726,6 +742,30 @@
|
|||||||
AND A.Pid = B.Id
|
AND A.Pid = B.Id
|
||||||
AND B.Pid = D.Id
|
AND B.Pid = D.Id
|
||||||
</select>
|
</select>
|
||||||
|
<select id="getDeviceRunStatistics" resultType="com.njcn.device.pq.pojo.vo.LineFlowMealDetailVO">
|
||||||
|
select t.*
|
||||||
|
from (SELECT a.id,
|
||||||
|
a.pid,
|
||||||
|
a.pids,
|
||||||
|
a.NAME name,
|
||||||
|
a.level,
|
||||||
|
a.update_Time updateTime,
|
||||||
|
b.run_flag runFlag,
|
||||||
|
b.com_flag comFlag,
|
||||||
|
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal
|
||||||
|
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
|
||||||
|
where a.id in
|
||||||
|
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
)t
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getLineRunStatistics" resultType="LineFlowMealDetailVO">
|
<select id="getLineRunStatistics" resultType="LineFlowMealDetailVO">
|
||||||
select t.*
|
select t.*
|
||||||
from (SELECT a.id,
|
from (SELECT a.id,
|
||||||
@@ -736,11 +776,19 @@
|
|||||||
a.update_Time updateTime,
|
a.update_Time updateTime,
|
||||||
b.run_flag runFlag,
|
b.run_flag runFlag,
|
||||||
b.com_flag comFlag,
|
b.com_flag comFlag,
|
||||||
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) +
|
b.id deviceId,
|
||||||
ifnull(d1.flow, 0) flowMeal
|
dev.name deviceName,
|
||||||
|
sub.name substation,
|
||||||
|
elc.name electricPowerCompany,
|
||||||
|
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
|
||||||
|
m.Actual_Value statisValue
|
||||||
FROM pq_line a
|
FROM pq_line a
|
||||||
INNER JOIN pq_line vol ON a.pid = vol.id
|
INNER JOIN pq_line vol ON a.pid = vol.id
|
||||||
|
INNER JOIN pq_line dev ON vol.pid = dev.id
|
||||||
INNER JOIN pq_device b ON vol.pid = b.id
|
INNER JOIN pq_device b ON vol.pid = b.id
|
||||||
|
INNER JOIN pq_line sub ON dev.pid = sub.id
|
||||||
|
INNER JOIN pq_line elc ON sub.pid = elc.id
|
||||||
|
LEFT JOIN pqs_month_flow m ON b.id = m.Dev_Id
|
||||||
LEFT JOIN cld_dev_meal c ON b.id = c.line_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 d ON c.Base_Meal_Id = d.id
|
||||||
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
|
LEFT JOIN cld_flow_meal d1 ON c.Ream_Meal_Id = d1.id
|
||||||
@@ -749,7 +797,47 @@
|
|||||||
<foreach item="item" collection="list" separator="," open="(" close=")">
|
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
)t
|
and
|
||||||
|
m.Create_Time between #{startTime} and #{endTime}
|
||||||
|
) t
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getNewDeviceRunStatistics" resultType="LineFlowMealDetailVO">
|
||||||
|
select t.*
|
||||||
|
from (SELECT
|
||||||
|
a.id,
|
||||||
|
a.pid,
|
||||||
|
a.pids,
|
||||||
|
a.NAME name,
|
||||||
|
a.level,
|
||||||
|
a.update_Time updateTime,
|
||||||
|
b.run_flag runFlag,
|
||||||
|
b.com_flag comFlag,
|
||||||
|
b.id deviceId,
|
||||||
|
dev.name deviceName,
|
||||||
|
sub.name substation,
|
||||||
|
elc.name electricPowerCompany,
|
||||||
|
ifnull(d.flow, (select flow from cld_flow_meal where type = 0 and flag = 1)) + ifnull(d1.flow, 0) flowMeal,
|
||||||
|
m.Actual_Value statisValue
|
||||||
|
FROM pq_line a
|
||||||
|
INNER JOIN pq_line vol ON a.pid = vol.id
|
||||||
|
INNER JOIN pq_line dev ON vol.pid = dev.id
|
||||||
|
INNER JOIN pq_device b ON vol.pid = b.id
|
||||||
|
INNER JOIN pq_line sub ON dev.pid = sub.id
|
||||||
|
INNER JOIN pq_line elc ON sub.pid = elc.id
|
||||||
|
LEFT JOIN pqs_month_flow m ON b.id = m.Dev_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
|
||||||
|
where a.id in
|
||||||
|
<foreach item="item" collection="devs" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
and
|
||||||
|
m.Create_Time between #{startTime} and #{endTime}
|
||||||
|
) t
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getFlowLineInfoByTableList" resultType="LineFlowMealDetailVO">
|
<select id="getFlowLineInfoByTableList" resultType="LineFlowMealDetailVO">
|
||||||
@@ -936,4 +1024,5 @@
|
|||||||
and d.com_flag = #{comFlag}
|
and d.com_flag = #{comFlag}
|
||||||
and a.state = 1
|
and a.state = 1
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?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.OnlineRateMapper">
|
||||||
|
|
||||||
|
<select id="getOnlineRateByDevId" resultType="OnlineRate">
|
||||||
|
select sum(online_min)/(sum(online_min) +sum(offline_min))*100 as online_rate
|
||||||
|
from pqs_onlinerate
|
||||||
|
where Create_Time between #{startTime} and #{endTime}
|
||||||
|
and
|
||||||
|
Dev_Id IN
|
||||||
|
<foreach item="item" collection="list" separator="," open="(" close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by Dev_Id ;
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?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.PqsMonthFlowMapper">
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getStatisValueFlow" resultType="java.lang.Float">
|
||||||
|
select sum(Actual_Value)
|
||||||
|
from pqs_month_flow
|
||||||
|
where Create_Time between #{startTime} and #{endTime}
|
||||||
|
and
|
||||||
|
Dev_Id = #{devId};
|
||||||
|
</select>
|
||||||
|
</mapper>
|
||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.njcn.device.pq.service;
|
package com.njcn.device.pq.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
|
import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
|
||||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.device.pq.pojo.param.PqsParam;
|
||||||
import com.njcn.device.pq.pojo.po.Line;
|
import com.njcn.device.pq.pojo.po.Line;
|
||||||
import com.njcn.device.pq.pojo.po.LineDetail;
|
import com.njcn.device.pq.pojo.po.LineDetail;
|
||||||
import com.njcn.device.pq.pojo.po.Overlimit;
|
import com.njcn.device.pq.pojo.po.Overlimit;
|
||||||
@@ -114,6 +117,16 @@ public interface LineService {
|
|||||||
*/
|
*/
|
||||||
List<LineFlowMealDetailVO> getLineRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam);
|
List<LineFlowMealDetailVO> getLineRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取终端运行统计
|
||||||
|
* @param deviceInfoParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
|
||||||
|
List<LineFlowMealDetailVO> getDeviceRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取详细的统计数据
|
* 获取详细的统计数据
|
||||||
* @param startTime 起始时间
|
* @param startTime 起始时间
|
||||||
@@ -192,4 +205,6 @@ public interface LineService {
|
|||||||
* @Date: 2022/11/9
|
* @Date: 2022/11/9
|
||||||
*/
|
*/
|
||||||
Integer getLineCountBySubstation(String subIndex);
|
Integer getLineCountBySubstation(String subIndex);
|
||||||
|
|
||||||
|
Page<LineFlowMealDetailVO>getNewDeviceRunStatistics(PqsParam deviceInfoParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -272,6 +272,9 @@ public class GeneralDeviceService {
|
|||||||
dataType.add(1);
|
dataType.add(1);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
/**
|
||||||
|
* 数据类型(0:暂态系统;1:稳态系统;2:两个系统)
|
||||||
|
*/
|
||||||
deviceType.setDataType(dataType);
|
deviceType.setDataType(dataType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -283,54 +286,73 @@ public class GeneralDeviceService {
|
|||||||
* @param devModel 终端模型
|
* @param devModel 终端模型
|
||||||
* @return 部门分类终端信息
|
* @return 部门分类终端信息
|
||||||
*/
|
*/
|
||||||
public List<GeneralDeviceDTO> getDeviceInfo(DeviceInfoParam deviceInfoParam, List<Integer> runFlag, List<Integer> devModel) {
|
public List<GeneralDeviceDTO> getDeviceInfo(DeviceInfoParam deviceInfoParam,
|
||||||
|
List<Integer> runFlag,
|
||||||
|
List<Integer> devModel)
|
||||||
|
{
|
||||||
//定义待返回终端信息
|
//定义待返回终端信息
|
||||||
List<GeneralDeviceDTO> deviceInfos = new ArrayList<>();
|
List<GeneralDeviceDTO> deviceInfos = new ArrayList<>();
|
||||||
//初始化终端查询条件
|
//初始化终端查询条件
|
||||||
DeviceType deviceType = new DeviceType();
|
DeviceType deviceType = new DeviceType();
|
||||||
if (CollectionUtil.isEmpty(devModel)) {
|
if (CollectionUtil.isEmpty(devModel)) {
|
||||||
|
/**
|
||||||
|
* 终端模型(0:虚拟设备;1:实际设备;2:离线设备;)默认是实际设备
|
||||||
|
*/
|
||||||
deviceType.setDevModel(null);
|
deviceType.setDevModel(null);
|
||||||
} else {
|
} else {
|
||||||
deviceType.setDevModel(devModel);
|
deviceType.setDevModel(devModel);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isEmpty(runFlag)) {
|
if (CollectionUtil.isEmpty(runFlag)) {
|
||||||
|
/**
|
||||||
|
* 终端状态(0:投运;1:热备用;2:停运)
|
||||||
|
*/
|
||||||
deviceType.setRunFlag(null);
|
deviceType.setRunFlag(null);
|
||||||
} else {
|
} else {
|
||||||
deviceType.setRunFlag(runFlag);
|
deviceType.setRunFlag(runFlag);
|
||||||
}
|
}
|
||||||
filterDataType(deviceType, deviceInfoParam.getServerName());
|
filterDataType(deviceType, deviceInfoParam.getServerName());
|
||||||
|
|
||||||
//初始化部门筛选条件
|
// 初始化部门筛选条件
|
||||||
List<Integer> deptType = WebUtil.filterDeptType();
|
List<Integer> deptType = WebUtil.filterDeptType();
|
||||||
//获取包括当前部门的后代所有部门信息
|
// 获取包括当前部门的后代所有部门信息
|
||||||
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(deviceInfoParam.getDeptIndex(), deptType).getData();
|
List<DeptDTO> deptInfos = deptFeignClient.getDeptDescendantIndexes(deviceInfoParam.getDeptIndex(), deptType).getData();
|
||||||
|
// 过滤非直接后代部门,集合直接子部门
|
||||||
List<DeptDTO> directDeptInfos = deptInfos.stream()
|
List<DeptDTO> directDeptInfos = deptInfos.stream()
|
||||||
.filter(deptDTO -> deptDTO.getPid().equals(deviceInfoParam.getDeptIndex())).sorted(Comparator.comparing(DeptDTO::getSort))
|
.filter(deptDTO -> deptDTO.getPid().equals(deviceInfoParam.getDeptIndex())).sorted(Comparator.comparing(DeptDTO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
if (CollectionUtil.isEmpty(directDeptInfos)) {
|
if (CollectionUtil.isEmpty(directDeptInfos)) {
|
||||||
//没有直接子部门,获取当前部门所有信息
|
// 没有直接子部门(树的最底层),获取当前部门所有信息
|
||||||
List<DeptDTO> dept = deptInfos.stream()
|
// List<DeptDTO> dept = deptInfos.stream()
|
||||||
.filter(deptDTO -> deptDTO.getId().equals(deviceInfoParam.getDeptIndex()))
|
// .filter(deptDTO -> deptDTO.getId().equals(deviceInfoParam.getDeptIndex()))
|
||||||
.collect(Collectors.toList());
|
// .collect(Collectors.toList());
|
||||||
deviceInfos.add(getGeneralDeviceInfo(dept.get(0), deviceType, Collections.singletonList(deviceInfoParam.getDeptIndex()), deviceInfoParam));
|
deviceInfos.add(getGeneralDeviceInfo(
|
||||||
|
// dept.get(0),
|
||||||
|
deptInfos.get(0),
|
||||||
|
deviceType,
|
||||||
|
Collections.singletonList(deviceInfoParam.getDeptIndex()),
|
||||||
|
deviceInfoParam));
|
||||||
} else {
|
} else {
|
||||||
for (DeptDTO deptDTO : directDeptInfos) {
|
for (DeptDTO directDeptDTO : directDeptInfos) {
|
||||||
//筛选上级部门pids包含该id的所有部门
|
//筛选上级部门pids包含该id的所有部门 直接子部门下属所有部门
|
||||||
List<DeptDTO> descendantDeptDTO = deptInfos.stream()
|
List<DeptDTO> descendantDeptDTO = deptInfos.stream()
|
||||||
.filter(d -> d.getPids().contains(deptDTO.getId()))
|
.filter(d -> d.getPids().contains(directDeptDTO.getId()))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
//形成需要查询监测点的部门索引
|
//形成需要查询监测点的部门索引
|
||||||
List<String> indexes = descendantDeptDTO.stream()
|
List<String> indexes = descendantDeptDTO.stream()
|
||||||
.map(DeptDTO::getId)
|
.map(DeptDTO::getId)
|
||||||
.distinct()
|
.distinct()
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
indexes.add(deptDTO.getId());
|
indexes.add(directDeptDTO.getId());
|
||||||
deviceInfos.add(getGeneralDeviceInfo(deptDTO, deviceType, indexes, deviceInfoParam));
|
GeneralDeviceDTO generalDeviceInfo = getGeneralDeviceInfo(directDeptDTO, deviceType, indexes, deviceInfoParam);
|
||||||
|
deviceInfos.add(generalDeviceInfo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//判断统计类型
|
//判断统计类型
|
||||||
|
if (deviceInfoParam.getStatisticalType()==null) {
|
||||||
|
deviceInfoParam.setStatisticalType(new SimpleDTO());
|
||||||
|
}
|
||||||
StatisticsEnum statisticsEnum = StatisticsEnum.getStatisticsEnumByCode(deviceInfoParam.getStatisticalType().getCode());
|
StatisticsEnum statisticsEnum = StatisticsEnum.getStatisticsEnumByCode(deviceInfoParam.getStatisticalType().getCode());
|
||||||
switch (statisticsEnum) {
|
switch (statisticsEnum) {
|
||||||
case VOLTAGE_LEVEL:
|
case VOLTAGE_LEVEL:
|
||||||
@@ -345,22 +367,39 @@ public class GeneralDeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private GeneralDeviceDTO getGeneralDeviceInfo(DeptDTO deptDTO, DeviceType deviceType, List<String> ids, DeviceInfoParam deviceInfoParam) {
|
/**
|
||||||
|
* 根据部门id集合获取监测点信息
|
||||||
|
*
|
||||||
|
* @param directDeptDTO 入参deptIndex的直接子部门
|
||||||
|
* @param deviceType
|
||||||
|
* @param ids 直接子部门以及后代部门id集合
|
||||||
|
* @param deviceInfoParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private GeneralDeviceDTO getGeneralDeviceInfo(DeptDTO directDeptDTO,
|
||||||
|
DeviceType deviceType,
|
||||||
|
List<String> ids,
|
||||||
|
DeviceInfoParam deviceInfoParam)
|
||||||
|
{
|
||||||
GeneralDeviceDTO generalDeviceDTO = new GeneralDeviceDTO();
|
GeneralDeviceDTO generalDeviceDTO = new GeneralDeviceDTO();
|
||||||
generalDeviceDTO.setIndex(deptDTO.getId());
|
generalDeviceDTO.setIndex(directDeptDTO.getId());
|
||||||
if (deptDTO.getType() == 0) {
|
// type:部门类型 0-非自定义;1-web自定义;2-App自定义;3-web测试
|
||||||
generalDeviceDTO.setName(deptDTO.getArea());
|
if (directDeptDTO.getType() == 0) {
|
||||||
|
generalDeviceDTO.setName(directDeptDTO.getArea());
|
||||||
} else {
|
} else {
|
||||||
generalDeviceDTO.setName(deptDTO.getName());
|
generalDeviceDTO.setName(directDeptDTO.getName());
|
||||||
}
|
}
|
||||||
|
// 根据部门ids集合查询是否绑定监测点 部门和监测点关联关系中间表:pq_dept_line 可以一对多
|
||||||
List<DeptLine> deptLines = deptLineService.selectDeptBindLines(ids);
|
List<DeptLine> deptLines = deptLineService.selectDeptBindLines(ids);
|
||||||
//返回空数据
|
// 返回空数据
|
||||||
if (CollectionUtil.isEmpty(deptLines)) {
|
if (CollectionUtil.isEmpty(deptLines)) {
|
||||||
return generalDeviceDTO;
|
return generalDeviceDTO;
|
||||||
}
|
}
|
||||||
//获取line详细数据
|
// 提取该部门及其子部门所有监测点id
|
||||||
List<Line> lines = terminalBaseService.getLineByCondition(deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList()), deviceInfoParam);
|
List<String> lineIds = deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList());
|
||||||
//返回空数据
|
// 获取line详细数据 :根据监测点id,获取所有监测点 联查 pq_line、pq_line_detail
|
||||||
|
List<Line> lines = terminalBaseService.getLineByCondition(lineIds, deviceInfoParam);
|
||||||
|
// 返回空数据
|
||||||
if (CollectionUtil.isEmpty(lines)) {
|
if (CollectionUtil.isEmpty(lines)) {
|
||||||
return generalDeviceDTO;
|
return generalDeviceDTO;
|
||||||
}
|
}
|
||||||
@@ -370,16 +409,18 @@ public class GeneralDeviceService {
|
|||||||
String[] idsArray = line.getPids().split(",");
|
String[] idsArray = line.getPids().split(",");
|
||||||
return idsArray[4];
|
return idsArray[4];
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
//再根据终端条件筛选合法终端信息
|
// 再根据终端条件筛选合法终端信息 联查:pq_line t1,pq_device t2
|
||||||
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds, deviceType, deviceInfoParam.getManufacturer());
|
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds,
|
||||||
|
deviceType,
|
||||||
//筛选出母线id,理论上监测点的pids中第六个id为母线id
|
deviceInfoParam.getManufacturer());
|
||||||
|
//筛选出母线id,理论上监测点的pids中第六个id为母线id 联查: pq_line t1 ,pq_voltage t2
|
||||||
List<String> voltageIds = lines.stream().map(line -> {
|
List<String> voltageIds = lines.stream().map(line -> {
|
||||||
String[] idsArray = line.getPids().split(",");
|
String[] idsArray = line.getPids().split(",");
|
||||||
return idsArray[5];
|
return idsArray[5];
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
//再根据电压等级筛选合法母线信息
|
//再根据电压等级筛选合法母线信息
|
||||||
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds, deviceInfoParam.getScale());
|
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds,
|
||||||
|
deviceInfoParam.getScale());
|
||||||
//筛选最终的数据
|
//筛选最终的数据
|
||||||
dealDeviceData(generalDeviceDTO, lines, devices, voltages);
|
dealDeviceData(generalDeviceDTO, lines, devices, voltages);
|
||||||
return generalDeviceDTO;
|
return generalDeviceDTO;
|
||||||
@@ -400,7 +441,8 @@ public class GeneralDeviceService {
|
|||||||
for (Line line : lines) {
|
for (Line line : lines) {
|
||||||
String[] idsArray = line.getPids().split(",");
|
String[] idsArray = line.getPids().split(",");
|
||||||
//监测点同时满足条件筛选后的终端、母线信息,才是最终的结果
|
//监测点同时满足条件筛选后的终端、母线信息,才是最终的结果
|
||||||
if (devIds.contains(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]) && volIds.contains(idsArray[LineBaseEnum.SUB_V_LEVEL.getCode()])) {
|
if (devIds.contains(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]) &&
|
||||||
|
volIds.contains(idsArray[LineBaseEnum.SUB_V_LEVEL.getCode()])) {
|
||||||
gdIndexes.add(idsArray[LineBaseEnum.GD_LEVEL.getCode()]);
|
gdIndexes.add(idsArray[LineBaseEnum.GD_LEVEL.getCode()]);
|
||||||
subIndexes.add(idsArray[LineBaseEnum.SUB_LEVEL.getCode()]);
|
subIndexes.add(idsArray[LineBaseEnum.SUB_LEVEL.getCode()]);
|
||||||
deviceIndexes.add(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]);
|
deviceIndexes.add(idsArray[LineBaseEnum.DEVICE_LEVEL.getCode()]);
|
||||||
|
|||||||
@@ -6,6 +6,8 @@ import cn.hutool.core.date.DateUtil;
|
|||||||
import cn.hutool.core.util.StrUtil;
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||||
import com.njcn.common.pojo.enums.common.ServerEnum;
|
import com.njcn.common.pojo.enums.common.ServerEnum;
|
||||||
@@ -19,6 +21,7 @@ import com.njcn.device.pq.pojo.dto.PollutionLineDTO;
|
|||||||
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
import com.njcn.device.pq.pojo.dto.PollutionParamDTO;
|
||||||
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
import com.njcn.device.pq.pojo.dto.PollutionSubstationDTO;
|
||||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
|
import com.njcn.device.pq.pojo.param.PqsParam;
|
||||||
import com.njcn.device.pq.pojo.po.*;
|
import com.njcn.device.pq.pojo.po.*;
|
||||||
import com.njcn.device.pq.pojo.vo.*;
|
import com.njcn.device.pq.pojo.vo.*;
|
||||||
import com.njcn.device.pq.mapper.*;
|
import com.njcn.device.pq.mapper.*;
|
||||||
@@ -45,6 +48,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import java.time.Instant;
|
import java.time.Instant;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@@ -89,6 +93,10 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
|
|
||||||
private final TerminalBaseService terminalBaseService;
|
private final TerminalBaseService terminalBaseService;
|
||||||
|
|
||||||
|
private final OnlineRateMapper onlineRateMapper;
|
||||||
|
|
||||||
|
private final PqsMonthFlowMapper pqsMonthFlowMapper;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -279,17 +287,28 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
return lineDistributionVOList;
|
return lineDistributionVOList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LineStatisticsDetailVO> getLineStatisticsDetail(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
public List<LineStatisticsDetailVO> getLineStatisticsDetail(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
List<LineStatisticsDetailVO> lineStatisticsDetailList = new ArrayList<>();
|
List<LineStatisticsDetailVO> lineStatisticsDetailList = new ArrayList<>();
|
||||||
int lineTail = 0, lineSaveTail = 0, normalStateTail = 0, suspendStateTail = 0, offStreamStateTail = 0, hotSpareStateTail = 0;
|
int deviceAddNumTail=0,deviceNumTail = 0, lineTail = 0, lineSaveTail = 0, normalStateTail = 0, suspendStateTail = 0, offStreamStateTail = 0, hotSpareStateTail = 0;
|
||||||
|
|
||||||
//按照条件获取实际运行终端综合信息
|
//按照条件获取实际运行终端综合信息
|
||||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||||
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
for (GeneralDeviceDTO generalDeviceDTO : generalDeviceDTOList) {
|
||||||
LineStatisticsDetailVO lineStatisticsDetail = new LineStatisticsDetailVO();
|
LineStatisticsDetailVO lineStatisticsDetail = new LineStatisticsDetailVO();
|
||||||
|
// 区域id
|
||||||
lineStatisticsDetail.setId(generalDeviceDTO.getIndex());
|
lineStatisticsDetail.setId(generalDeviceDTO.getIndex());
|
||||||
|
// 区域/电压等级/干扰源类型/终端厂家
|
||||||
lineStatisticsDetail.setAreaName(generalDeviceDTO.getName());
|
lineStatisticsDetail.setAreaName(generalDeviceDTO.getName());
|
||||||
|
// 区域监测点总数
|
||||||
lineStatisticsDetail.setLineNum(generalDeviceDTO.getLineIndexes().size());
|
lineStatisticsDetail.setLineNum(generalDeviceDTO.getLineIndexes().size());
|
||||||
|
// 区域装置总数
|
||||||
|
lineStatisticsDetail.setDeviceNum(generalDeviceDTO.getDeviceIndexes().size());
|
||||||
|
// 总计装置总数
|
||||||
|
deviceNumTail += generalDeviceDTO.getDeviceIndexes().size();
|
||||||
|
// 总计监测点总数
|
||||||
lineTail += generalDeviceDTO.getLineIndexes().size();
|
lineTail += generalDeviceDTO.getLineIndexes().size();
|
||||||
if (generalDeviceDTO.getLineIndexes().size() > 0) {
|
if (generalDeviceDTO.getLineIndexes().size() > 0) {
|
||||||
//获取监测点新增数
|
//获取监测点新增数
|
||||||
@@ -300,10 +319,23 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
||||||
int countNum = lineMapper.selectCount(lineQueryWrapper);
|
int countNum = lineMapper.selectCount(lineQueryWrapper);
|
||||||
lineSaveTail += countNum;
|
lineSaveTail += countNum;
|
||||||
|
// 监测点新增数
|
||||||
lineStatisticsDetail.setAddLineNum(countNum);
|
lineStatisticsDetail.setAddLineNum(countNum);
|
||||||
|
|
||||||
|
// 获取装置新增数量
|
||||||
|
QueryWrapper<Line> deviceQueryWrapper = new QueryWrapper<>();
|
||||||
|
deviceQueryWrapper.in("pq_line.id", generalDeviceDTO.getDeviceIndexes());
|
||||||
|
deviceQueryWrapper.between("pq_line.Create_Time",
|
||||||
|
DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())),
|
||||||
|
DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
||||||
|
int deviceAddNum = lineMapper.selectCount(deviceQueryWrapper);
|
||||||
|
deviceAddNumTail += deviceAddNum;
|
||||||
|
lineStatisticsDetail.setAddDeviceNum(deviceAddNum);
|
||||||
|
|
||||||
LineStateVO lineStateVO;
|
LineStateVO lineStateVO;
|
||||||
//获取状态
|
//获取状态
|
||||||
lineStateVO = lineMapper.getLineStatisticsDetail(generalDeviceDTO.getLineIndexes());
|
// lineStateVO = lineMapper.getLineStatisticsDetail(generalDeviceDTO.getLineIndexes());
|
||||||
|
lineStateVO = lineMapper.getDeviceStatus(generalDeviceDTO.getDeviceIndexes());
|
||||||
BeanUtil.copyProperties(lineStateVO, lineStatisticsDetail);
|
BeanUtil.copyProperties(lineStateVO, lineStatisticsDetail);
|
||||||
normalStateTail += lineStateVO.getNormalStateNum();
|
normalStateTail += lineStateVO.getNormalStateNum();
|
||||||
suspendStateTail += lineStateVO.getSuspendStateNum();
|
suspendStateTail += lineStateVO.getSuspendStateNum();
|
||||||
@@ -315,11 +347,14 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
lineStatisticsDetail.setOffStreamStateNum(0);
|
lineStatisticsDetail.setOffStreamStateNum(0);
|
||||||
lineStatisticsDetail.setNormalStateNum(0);
|
lineStatisticsDetail.setNormalStateNum(0);
|
||||||
lineStatisticsDetail.setSuspendStateNum(0);
|
lineStatisticsDetail.setSuspendStateNum(0);
|
||||||
|
lineStatisticsDetail.setAddDeviceNum(0);
|
||||||
}
|
}
|
||||||
lineStatisticsDetailList.add(lineStatisticsDetail);
|
lineStatisticsDetailList.add(lineStatisticsDetail);
|
||||||
}
|
}
|
||||||
LineStatisticsDetailVO lineStatisticsDetailVO = new LineStatisticsDetailVO();
|
LineStatisticsDetailVO lineStatisticsDetailVO = new LineStatisticsDetailVO();
|
||||||
lineStatisticsDetailVO.setAreaName("总计");
|
lineStatisticsDetailVO.setAreaName("总计");
|
||||||
|
lineStatisticsDetailVO.setAddDeviceNum(deviceAddNumTail);
|
||||||
|
lineStatisticsDetailVO.setDeviceNum(deviceNumTail);
|
||||||
lineStatisticsDetailVO.setLineNum(lineTail);
|
lineStatisticsDetailVO.setLineNum(lineTail);
|
||||||
lineStatisticsDetailVO.setAddLineNum(lineSaveTail);
|
lineStatisticsDetailVO.setAddLineNum(lineSaveTail);
|
||||||
lineStatisticsDetailVO.setNormalStateNum(normalStateTail);
|
lineStatisticsDetailVO.setNormalStateNum(normalStateTail);
|
||||||
@@ -355,6 +390,64 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
return lineStatisticsTableList;
|
return lineStatisticsTableList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Page<LineFlowMealDetailVO> getNewDeviceRunStatistics( PqsParam deviceInfoParam) {
|
||||||
|
List<LineFlowMealDetailVO> deviceList = new ArrayList<>();
|
||||||
|
Page<LineFlowMealDetailVO> page = new Page();
|
||||||
|
List<GeneralDeviceDTO> deviceInfoList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||||
|
for (GeneralDeviceDTO generalDeviceDTO : deviceInfoList) {
|
||||||
|
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||||
|
List<String> deviceIndexes = generalDeviceDTO.getDeviceIndexes();
|
||||||
|
if (CollectionUtils.isEmpty(deviceIndexes)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 监测点流量统计
|
||||||
|
// deviceList = lineMapper.getNewDeviceRunStatistics(lineIndexes,
|
||||||
|
// DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())),
|
||||||
|
// DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())),
|
||||||
|
// (deviceInfoParam.getPageNum()-1)*deviceInfoParam.getPageSize(),
|
||||||
|
// deviceInfoParam.getPageSize());
|
||||||
|
|
||||||
|
page = lineMapper.getNewDeviceRunStatistics(
|
||||||
|
new Page(deviceInfoParam.getPageNum(), deviceInfoParam.getPageSize()),
|
||||||
|
lineIndexes,
|
||||||
|
DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())),
|
||||||
|
DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
||||||
|
if (CollectionUtil.isNotEmpty(page.getRecords())){
|
||||||
|
for (LineFlowMealDetailVO device : page.getRecords()) {
|
||||||
|
BigDecimal b = new BigDecimal((device.getFlowMeal()-device.getStatisValue())/device.getFlowMeal()*100);
|
||||||
|
device.setFlowProportion(b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return page;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LineFlowMealDetailVO> getDeviceRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
|
ArrayList<LineFlowMealDetailVO> lineFlowMealDetailList = new ArrayList<>();
|
||||||
|
List<GeneralDeviceDTO> deviceInfoList = generalDeviceService.getDeviceInfo(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||||
|
for (GeneralDeviceDTO generalDeviceDTO : deviceInfoList) {
|
||||||
|
List<String> lineIndexes = generalDeviceDTO.getLineIndexes();
|
||||||
|
List<String> deviceIndexes = generalDeviceDTO.getDeviceIndexes();
|
||||||
|
if (CollectionUtils.isEmpty(deviceIndexes)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
LineFlowMealDetailVO lineFlowMealDetailVO = new LineFlowMealDetailVO();
|
||||||
|
lineFlowMealDetailVO.setId(generalDeviceDTO.getIndex());
|
||||||
|
lineFlowMealDetailVO.setName(generalDeviceDTO.getName());
|
||||||
|
lineFlowMealDetailVO.setLevel(1);
|
||||||
|
//组装父级数据树
|
||||||
|
List<LineFlowMealDetailVO> treeList = getFlowTreeData(lineIndexes, deviceIndexes, deviceInfoParam);
|
||||||
|
lineFlowMealDetailVO.setChildren(treeList);
|
||||||
|
lineFlowMealDetailList.add(lineFlowMealDetailVO);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return lineFlowMealDetailList;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<LineFlowMealDetailVO> getLineRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
public List<LineFlowMealDetailVO> getLineRunStatistics(DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
List<LineFlowMealDetailVO> lineFlowMealDetailList = new ArrayList<>();
|
List<LineFlowMealDetailVO> lineFlowMealDetailList = new ArrayList<>();
|
||||||
@@ -377,6 +470,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
return lineFlowMealDetailList;
|
return lineFlowMealDetailList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public LineStaticsViewVO getLineStaticsView(String startTime, String endTime, String lineId) {
|
public LineStaticsViewVO getLineStaticsView(String startTime, String endTime, String lineId) {
|
||||||
//根据监测点id获取终端id
|
//根据监测点id获取终端id
|
||||||
@@ -404,52 +499,70 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
/**
|
/**
|
||||||
* 获取父级每层数据
|
* 获取父级每层数据
|
||||||
*/
|
*/
|
||||||
private List<LineFlowMealDetailVO> getFlowTreeData(List<String> lineIndexes, List<String> devIndexs, DeviceInfoParam.BusinessParam steadyParam) {
|
private List<LineFlowMealDetailVO> getFlowTreeData(List<String> lineIndexes, List<String> devIndexs, DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
//在线率
|
// 在线率(设备)
|
||||||
List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVO = getOnlineData(devIndexs, steadyParam);
|
List<LineInfluxDbOnlineVO> lineInfluxDbOnlineVO = getOnlineData(devIndexs, deviceInfoParam);
|
||||||
//数据完整性
|
// 数据完整性(监测点)
|
||||||
List<LineInfluxDbInegrityVO> lineInfluxDbInegrityVO = getInegrityData(lineIndexes, steadyParam);
|
List<LineInfluxDbInegrityVO> lineInfluxDbInegrityVO = getInegrityData(lineIndexes, deviceInfoParam);
|
||||||
//监测点集合
|
// 监测点运行统计
|
||||||
List<LineFlowMealDetailVO> monitorList = lineMapper.getLineRunStatistics(lineIndexes, DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchEndTime())));
|
List<LineFlowMealDetailVO> monitorList = lineMapper.getLineRunStatistics(lineIndexes, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
||||||
|
// List<LineFlowMealDetailVO> monitorList = lineMapper.getDeviceRunStatistics(devIndexs, DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
||||||
for (LineFlowMealDetailVO lineFlowMealDetailVO : monitorList) {
|
for (LineFlowMealDetailVO lineFlowMealDetailVO : monitorList) {
|
||||||
for (LineInfluxDbInegrityVO lineInfluxDbInegrity : lineInfluxDbInegrityVO) {
|
for (LineInfluxDbInegrityVO lineInfluxDbInegrity : lineInfluxDbInegrityVO) {
|
||||||
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbInegrity.getLineId())) {
|
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbInegrity.getLineId())) {
|
||||||
BigDecimal flow = new BigDecimal(lineInfluxDbInegrity.getIntegrity().floatValue());
|
lineFlowMealDetailVO.setDue(lineInfluxDbInegrity.getDue());
|
||||||
lineFlowMealDetailVO.setIntegrity(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
lineFlowMealDetailVO.setReal(lineInfluxDbInegrity.getReal());
|
||||||
|
} else {
|
||||||
|
lineFlowMealDetailVO.setDue(1440);
|
||||||
|
lineFlowMealDetailVO.setReal(1440);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//母线集合
|
// 母线集合
|
||||||
List<LineFlowMealDetailVO> busBarList = lineMapper.getFlowLineInfoByTableList(monitorList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineFlowMealDetailVO> busBarList = lineMapper.getFlowLineInfoByTableList(monitorList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
//终端集合
|
// 终端集合
|
||||||
List<LineFlowMealDetailVO> deviceList = lineMapper.getFlowLineRunStatistics(busBarList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()), DateUtil.endOfDay(DateUtil.parse(steadyParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchEndTime())));
|
List<LineFlowMealDetailVO> deviceList = lineMapper.getFlowLineRunStatistics(busBarList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()), DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime())), DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime())));
|
||||||
for (LineFlowMealDetailVO lineFlowMealDetailVO : deviceList) {
|
for (LineFlowMealDetailVO lineFlowMealDetailVO : deviceList) {
|
||||||
System.out.println(lineFlowMealDetailVO.getId());
|
int deviceDue=0,deviceReal=0;
|
||||||
Float staticsValue = getStatisValueFlow(lineFlowMealDetailVO.getId(), steadyParam);
|
Float staticsValue = getStatisValueFlow(lineFlowMealDetailVO.getId(), deviceInfoParam);
|
||||||
BigDecimal b = new BigDecimal(staticsValue);
|
BigDecimal b = new BigDecimal(staticsValue);
|
||||||
float f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
float f1 = b.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
|
||||||
lineFlowMealDetailVO.setStatisValue(f1);
|
lineFlowMealDetailVO.setStatisValue(f1);
|
||||||
BigDecimal flow = new BigDecimal(f1 / lineFlowMealDetailVO.getFlowMeal() * 100);
|
BigDecimal flow = new BigDecimal(f1 / lineFlowMealDetailVO.getFlowMeal() * 100);
|
||||||
//获取流量占比
|
// 获取流量占比
|
||||||
lineFlowMealDetailVO.setFlowProportion(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
lineFlowMealDetailVO.setFlowProportion(flow.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||||
|
|
||||||
|
// 在线率
|
||||||
for (LineInfluxDbOnlineVO lineInfluxDbOnline : lineInfluxDbOnlineVO) {
|
for (LineInfluxDbOnlineVO lineInfluxDbOnline : lineInfluxDbOnlineVO) {
|
||||||
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbOnline.getDevIndex())) {
|
if (lineFlowMealDetailVO.getId().equals(lineInfluxDbOnline.getDevIndex())) {
|
||||||
BigDecimal flowValue = new BigDecimal(lineInfluxDbOnline.getOnlineRate().floatValue());
|
BigDecimal flowValue = new BigDecimal(lineInfluxDbOnline.getOnlineRate().floatValue());
|
||||||
lineFlowMealDetailVO.setOnlineRate(flowValue.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
lineFlowMealDetailVO.setOnlineRate(flowValue.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 数据完整性
|
||||||
|
for (LineFlowMealDetailVO monitor : monitorList) {
|
||||||
|
if (monitor.getDeviceId().equals(lineFlowMealDetailVO.getId())){
|
||||||
|
deviceDue+=monitor.getDue();
|
||||||
|
deviceReal+=monitor.getReal();
|
||||||
}
|
}
|
||||||
//变电站集合
|
}
|
||||||
|
float integrity = BigDecimal.valueOf((double) deviceReal / deviceDue).setScale(2, RoundingMode.HALF_UP).floatValue();
|
||||||
|
lineFlowMealDetailVO.setIntegrity(integrity);
|
||||||
|
|
||||||
|
}
|
||||||
|
// 变电站集合
|
||||||
List<LineFlowMealDetailVO> substationList = lineMapper.getFlowLineInfoByTableList(deviceList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineFlowMealDetailVO> substationList = lineMapper.getFlowLineInfoByTableList(deviceList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
//供电公司集合
|
// 供电公司集合
|
||||||
List<LineFlowMealDetailVO> powerCompanyList = lineMapper.getFlowLineInfoByTableList(substationList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineFlowMealDetailVO> powerCompanyList = lineMapper.getFlowLineInfoByTableList(substationList.stream().map(LineFlowMealDetailVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
|
|
||||||
setFlowChildesList(substationList, deviceList);
|
setFlowChildesList(substationList, deviceList);
|
||||||
|
|
||||||
setFlowDeChildesList(deviceList, monitorList);
|
// setFlowDeChildesList(deviceList, monitorList);
|
||||||
|
|
||||||
powerCompanyList.stream().peek(item -> item.setChildren(getFlowChildCategoryList(item, substationList))).collect(Collectors.toList());
|
powerCompanyList.stream()
|
||||||
|
.peek(item -> item.setChildren(getFlowChildCategoryList(item, substationList)))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
return powerCompanyList;
|
return powerCompanyList;
|
||||||
}
|
}
|
||||||
@@ -470,9 +583,9 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setFlowChildesList(List<LineFlowMealDetailVO> item, List<LineFlowMealDetailVO> childes) {
|
private void setFlowChildesList(List<LineFlowMealDetailVO> item, List<LineFlowMealDetailVO> childrenList) {
|
||||||
Map<String, List<LineFlowMealDetailVO>> groupLine;
|
Map<String, List<LineFlowMealDetailVO>> groupLine;
|
||||||
groupLine = childes.stream().collect(Collectors.groupingBy(steadyQualifyVO -> {
|
groupLine = childrenList.stream().collect(Collectors.groupingBy(steadyQualifyVO -> {
|
||||||
String[] pid = steadyQualifyVO.getPids().split(",");
|
String[] pid = steadyQualifyVO.getPids().split(",");
|
||||||
return pid[LineBaseEnum.SUB_LEVEL.getCode()];
|
return pid[LineBaseEnum.SUB_LEVEL.getCode()];
|
||||||
}));
|
}));
|
||||||
@@ -494,15 +607,15 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
* 获取父级每层数据
|
* 获取父级每层数据
|
||||||
*/
|
*/
|
||||||
private List<LineStatisticsTableVO> getTreeData(List<String> lineIndexes, DeviceInfoParam.BusinessParam steadyParam) {
|
private List<LineStatisticsTableVO> getTreeData(List<String> lineIndexes, DeviceInfoParam.BusinessParam steadyParam) {
|
||||||
//监测点集合
|
// 监测点集合
|
||||||
List<LineStatisticsTableVO> monitorList = lineMapper.getLineStatisticsTableData(lineIndexes);
|
List<LineStatisticsTableVO> monitorList = lineMapper.getLineStatisticsTableData(lineIndexes);
|
||||||
//母线集合
|
// 母线集合
|
||||||
List<LineStatisticsTableVO> busBarList = lineMapper.getLineInfoByTableList(monitorList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineStatisticsTableVO> busBarList = lineMapper.getLineInfoByTableList(monitorList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
//终端集合
|
// 终端集合
|
||||||
List<LineStatisticsTableVO> deviceList = lineMapper.getLineInfoByTableList(busBarList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineStatisticsTableVO> deviceList = lineMapper.getLineInfoByTableList(busBarList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
//变电站集合
|
// 变电站集合
|
||||||
List<LineStatisticsTableVO> substationList = lineMapper.getLineInfoByTableList(deviceList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineStatisticsTableVO> substationList = lineMapper.getLineInfoByTableList(deviceList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
//供电公司集合
|
// 供电公司集合
|
||||||
List<LineStatisticsTableVO> powerCompanyList = lineMapper.getLineInfoByTableList(substationList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
List<LineStatisticsTableVO> powerCompanyList = lineMapper.getLineInfoByTableList(substationList.stream().map(LineStatisticsTableVO::getPid).distinct().collect(Collectors.toList()));
|
||||||
|
|
||||||
setChildesList(substationList, monitorList);
|
setChildesList(substationList, monitorList);
|
||||||
@@ -533,20 +646,20 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<LineInfluxDbOnlineVO> getOnlineData(List<String> devIndexs, DeviceInfoParam.BusinessParam deviceInfoParam) {
|
public List<LineInfluxDbOnlineVO> getOnlineData(List<String> devIndexs, DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
//组装sql语句
|
// 组装sql语句
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and ");
|
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and ");
|
||||||
|
|
||||||
for (int i = 0; i < devIndexs.size(); i++) {
|
for (int i = 0; i < devIndexs.size(); i++) {
|
||||||
if (devIndexs.size() - i != 1) {
|
if (devIndexs.size() - i != 1) {
|
||||||
stringBuilder.append("dev_index ='").append(devIndexs.get(i)).append("' or ");
|
stringBuilder.append("dev_id ='").append(devIndexs.get(i)).append("' or ");
|
||||||
} else {
|
} else {
|
||||||
stringBuilder.append("dev_index ='").append(devIndexs.get(i)).append("' ");
|
stringBuilder.append("dev_id ='").append(devIndexs.get(i)).append("' ");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
stringBuilder.append(InfluxDBPublicParam.TIME_ZONE);
|
// stringBuilder.append(InfluxDBPublicParam.TIME_ZONE);
|
||||||
String sql = "select sum(onlinemin)/(sum(onlinemin) +sum(offlinemin))*100 as onlinerate from pqs_onlinerate where " + stringBuilder.toString() + "group by dev_index";
|
String sql = "select sum(online_min)/(sum(online_min) +sum(offline_min))*100 as online_rate from pqs_onlinerate where " + stringBuilder.toString() + " group by dev_id "+InfluxDBPublicParam.TIME_ZONE;
|
||||||
//获取暂降事件
|
// 获取暂降事件
|
||||||
QueryResult result = influxDbUtils.query(sql);
|
QueryResult result = influxDbUtils.query(sql);
|
||||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||||
List<LineInfluxDbOnlineVO> eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbOnlineVO.class);
|
List<LineInfluxDbOnlineVO> eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbOnlineVO.class);
|
||||||
@@ -554,7 +667,7 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
}
|
}
|
||||||
|
|
||||||
public List<LineInfluxDbInegrityVO> getInegrityData(List<String> lineIndexes, DeviceInfoParam.BusinessParam deviceInfoParam) {
|
public List<LineInfluxDbInegrityVO> getInegrityData(List<String> lineIndexes, DeviceInfoParam.BusinessParam deviceInfoParam) {
|
||||||
//组装sql语句
|
// 组装sql语句
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and ");
|
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(deviceInfoParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(deviceInfoParam.getSearchEndTime()))).append("' and ");
|
||||||
for (int i = 0; i < lineIndexes.size(); i++) {
|
for (int i = 0; i < lineIndexes.size(); i++) {
|
||||||
@@ -565,8 +678,9 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
String sql = "select sum(real)/(sum(due))*100 as integrity from pqs_integrity where " + stringBuilder.toString() + "group by line_id";
|
//String sql = "select sum(real)/(sum(due))*100 as integrity from pqs_integrity where " + stringBuilder.toString() + "group by line_id";
|
||||||
//获取暂降事件
|
String sql = "select due as due, real as real from pqs_integrity where " + stringBuilder.toString() + "group by line_id";
|
||||||
|
// 获取暂降事件
|
||||||
QueryResult result = influxDbUtils.query(sql);
|
QueryResult result = influxDbUtils.query(sql);
|
||||||
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
InfluxDBResultMapper influxDBResultMapper = new InfluxDBResultMapper();
|
||||||
List<LineInfluxDbInegrityVO> eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbInegrityVO.class);
|
List<LineInfluxDbInegrityVO> eventDetailList = influxDBResultMapper.toPOJO(result, LineInfluxDbInegrityVO.class);
|
||||||
@@ -629,8 +743,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
//组装sql语句
|
//组装sql语句
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
StringBuilder stringBuilder = new StringBuilder();
|
||||||
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(steadyParam.getSearchEndTime()))).append("' and ");
|
stringBuilder.append("time >= '").append(DateUtil.beginOfDay(DateUtil.parse(steadyParam.getSearchBeginTime()))).append("' and ").append("time <= '").append(DateUtil.endOfDay(DateUtil.parse(steadyParam.getSearchEndTime()))).append("' and ");
|
||||||
stringBuilder.append("line_id ='").append(lineIndex).append("' ");
|
stringBuilder.append("device_id ='").append(lineIndex).append("' ");
|
||||||
String sql = "select sum(statis_value)/1024/1024 as statisValue from pqs_statis_flow where " + stringBuilder.toString() + " group by line_id tz('Asia/Shanghai')";
|
String sql = "select sum(actual_value)/1024/1024 as statisValue from pqs_month_flow where " + stringBuilder.toString() + " group by device_id tz('Asia/Shanghai')";
|
||||||
//获取统计流量
|
//获取统计流量
|
||||||
Float staticsValue = 0f;
|
Float staticsValue = 0f;
|
||||||
QueryResult result = influxDbUtils.query(sql);
|
QueryResult result = influxDbUtils.query(sql);
|
||||||
@@ -676,7 +790,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
DeviceAbnormalVO deviceAbnormalVO = new DeviceAbnormalVO();
|
DeviceAbnormalVO deviceAbnormalVO = new DeviceAbnormalVO();
|
||||||
//获取所有监测点
|
//获取所有监测点
|
||||||
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(conditionBusinessParam, null, Stream.of(1).collect(Collectors.toList()));
|
List<GeneralDeviceDTO> generalDeviceDTOList = generalDeviceService.getDeviceInfo(conditionBusinessParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||||
List<String> lineIndexs = generalDeviceDTOList.stream().flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
List<String> lineIndexs = generalDeviceDTOList.stream()
|
||||||
|
.flatMap(dto -> dto.getLineIndexes().stream()).collect(Collectors.toList());
|
||||||
if (conditionBusinessParam.getTimeFlag() == 0) {
|
if (conditionBusinessParam.getTimeFlag() == 0) {
|
||||||
List<String> intervalTime = this.getIntervalTime(conditionBusinessParam.getSearchBeginTime(), conditionBusinessParam.getSearchEndTime());
|
List<String> intervalTime = this.getIntervalTime(conditionBusinessParam.getSearchBeginTime(), conditionBusinessParam.getSearchEndTime());
|
||||||
List<AbnomalCommuncateVO> abnomalCommuncateVOS = new ArrayList<>();
|
List<AbnomalCommuncateVO> abnomalCommuncateVOS = new ArrayList<>();
|
||||||
@@ -823,6 +938,8 @@ public class LineServiceImpl extends ServiceImpl<LineMapper, Line> implements Li
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据用户选择的时间区间返回月份日期
|
* 根据用户选择的时间区间返回月份日期
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user