合格率报告功能
This commit is contained in:
@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -113,4 +114,12 @@ public interface GeneralDeviceInfoClient {
|
|||||||
*/
|
*/
|
||||||
@PostMapping("/getOnlineRateByDevIds")
|
@PostMapping("/getOnlineRateByDevIds")
|
||||||
HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
|
HttpResult<List<RStatOnlinerateVO>> getOnlineRateByDevIds(@RequestBody OnlineRateParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@PostMapping("/deptGetRunLine")
|
||||||
|
HttpResult<List<String>> deptGetRunLine(@RequestParam("deptId")String deptId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,34 @@
|
|||||||
|
package com.njcn.device.pq.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.pq.api.fallback.DeviceTreeClientFallbackFactory;
|
||||||
|
import com.njcn.device.pq.api.fallback.LineIntegrityClientFallbackFactory;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点数据完整性
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.DEVICE,
|
||||||
|
path = "/LineIntegrityData",
|
||||||
|
fallbackFactory = LineIntegrityClientFallbackFactory.class,
|
||||||
|
contextId = "LineIntegrityData")
|
||||||
|
public interface LineIntegrityClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@PostMapping("/getIntegrityByLineIds")
|
||||||
|
HttpResult<List<RStatIntegrityD>> getIntegrityByLineIds(@RequestBody List<String> lineIds, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime);
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.device.pq.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.device.pq.api.fallback.LineIntegrityClientFallbackFactory;
|
||||||
|
import com.njcn.device.pq.api.fallback.OverLimitFallbackFactory;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点数据完整性
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.DEVICE,
|
||||||
|
path = "/overLimit",
|
||||||
|
fallbackFactory = OverLimitFallbackFactory.class,contextId = "overLimit")
|
||||||
|
public interface OverLimitClient {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@PostMapping("/getOverLimitByLineIds")
|
||||||
|
HttpResult<List<Overlimit>> getOverLimitByLineIds(@RequestBody List<String> lineIds);
|
||||||
|
}
|
||||||
@@ -86,6 +86,12 @@ public class GeneralDeviceInfoClientFallbackFactory implements FallbackFactory<G
|
|||||||
log.error("{}异常,降级处理,异常为:{}", "获取终端在线率(谐波专用)", throwable.toString());
|
log.error("{}异常,降级处理,异常为:{}", "获取终端在线率(谐波专用)", throwable.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<String>> deptGetRunLine(String deptId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "获取单位投运监测点", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.njcn.device.pq.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||||
|
import com.njcn.device.pq.api.AlarmClient;
|
||||||
|
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警管理熔断降级
|
||||||
|
* @author yzh
|
||||||
|
* @date 2022/9/19
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class LineIntegrityClientFallbackFactory implements FallbackFactory<LineIntegrityClient> {
|
||||||
|
@Override
|
||||||
|
public LineIntegrityClient create(Throwable throwable) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (throwable.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||||
|
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new LineIntegrityClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<RStatIntegrityD>> getIntegrityByLineIds(List<String> lineIds,String startTime,String endTime) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "获取监测点数据完整性", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.njcn.device.pq.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.device.biz.utils.DeviceEnumUtil;
|
||||||
|
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||||
|
import com.njcn.device.pq.api.OverLimitClient;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 告警管理熔断降级
|
||||||
|
* @author yzh
|
||||||
|
* @date 2022/9/19
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class OverLimitFallbackFactory implements FallbackFactory<OverLimitClient> {
|
||||||
|
@Override
|
||||||
|
public OverLimitClient create(Throwable throwable) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (throwable.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) throwable.getCause();
|
||||||
|
exceptionEnum = DeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new OverLimitClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<Overlimit>> getOverLimitByLineIds(List<String> lineIds) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}", "监测点限值", throwable.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -9,6 +9,7 @@ import java.time.LocalDateTime;
|
|||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.springframework.data.annotation.Transient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -34,5 +35,8 @@ public class RStatIntegrityD {
|
|||||||
|
|
||||||
private Integer realTime;
|
private Integer realTime;
|
||||||
|
|
||||||
|
@Transient
|
||||||
|
private Float integrityData;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -283,9 +283,10 @@ public class GeneralDeviceInfoController extends BaseController {
|
|||||||
@PostMapping("/deptGetRunLine")
|
@PostMapping("/deptGetRunLine")
|
||||||
@ApiOperation("根据单位获取投运监测点")
|
@ApiOperation("根据单位获取投运监测点")
|
||||||
@ApiImplicitParam(name = "deptId", value = "单位部门索引", required = true)
|
@ApiImplicitParam(name = "deptId", value = "单位部门索引", required = true)
|
||||||
public HttpResult<List<RStatOnlinerateVO>> deptGetRunLine(@RequestParam("deptId")String deptId) {
|
public HttpResult<List<String>> deptGetRunLine(@RequestParam("deptId")String deptId) {
|
||||||
String methodDescribe = getMethodDescribe("deptGetRunLine");
|
String methodDescribe = getMethodDescribe("deptGetRunLine");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,null,methodDescribe);
|
List<String> runLineIds = generalDeviceService.deptGetRunLine(deptId,Stream.of(0).collect(Collectors.toList()));
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS,runLineIds,methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
package com.njcn.device.pq.controller;
|
package com.njcn.device.pq.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
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;
|
||||||
@@ -8,7 +10,9 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
import com.njcn.device.pq.pojo.param.DeviceInfoParam;
|
||||||
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
import com.njcn.device.pq.pojo.param.LineIntegrityDataParam;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
import com.njcn.device.pq.pojo.vo.LineIntegrityDataVO;
|
||||||
|
import com.njcn.device.pq.service.IRStatIntegrityDService;
|
||||||
import com.njcn.device.pq.service.LineIntegrityDataService;
|
import com.njcn.device.pq.service.LineIntegrityDataService;
|
||||||
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
import com.njcn.harmonic.pojo.vo.IntegrityIconVO;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -18,10 +22,8 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -40,6 +42,8 @@ public class LineIntegrityDataController extends BaseController {
|
|||||||
|
|
||||||
private final LineIntegrityDataService lineIntegrityDataService;
|
private final LineIntegrityDataService lineIntegrityDataService;
|
||||||
|
|
||||||
|
private final IRStatIntegrityDService irStatIntegrityDService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监测点数据完整性
|
* 监测点数据完整性
|
||||||
@@ -65,4 +69,23 @@ public class LineIntegrityDataController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, integrityIconVO, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, integrityIconVO, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过监测点集合查询监测点数据完整性
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getIntegrityByLineIds")
|
||||||
|
@ApiOperation("通过监测点集合查询监测点数据完整性")
|
||||||
|
@ApiImplicitParam(name = "lineIds", value = "监测点集合", required = true)
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<List<RStatIntegrityD>> getIntegrityByLineIds(@RequestBody List<String> lineIds, @RequestParam("startTime")String startTime, @RequestParam("endTime")String endTime) {
|
||||||
|
String methodDescribe = getMethodDescribe("getIntegrityByLineIds");
|
||||||
|
QueryWrapper<RStatIntegrityD> queryWrapper = new QueryWrapper<>();
|
||||||
|
queryWrapper.select("sum(real_time)/sum(due_time) as integrityData","line_index").in("line_index",lineIds).between("time_id",startTime,endTime).groupBy("line_index");
|
||||||
|
List<RStatIntegrityD> rStatIntegrityDList = irStatIntegrityDService.list(queryWrapper);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rStatIntegrityDList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
package com.njcn.device.pq.controller;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.device.pq.pojo.param.AlarmStrategyParam;
|
||||||
|
import com.njcn.device.pq.pojo.vo.AlarmStrategyVO;
|
||||||
|
import com.njcn.device.pq.service.AlarmStrategyService;
|
||||||
|
import com.njcn.device.pq.service.IOverLimitService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import springfox.documentation.annotations.ApiIgnore;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点限值
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/overLimit")
|
||||||
|
@Api(tags = "监测点限值")
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OverLimitController extends BaseController {
|
||||||
|
|
||||||
|
private final IOverLimitService iOverLimitService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getOverLimitByLineIds")
|
||||||
|
@ApiOperation("监测点集合获取限值")
|
||||||
|
@ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
|
||||||
|
@ApiIgnore
|
||||||
|
public HttpResult<List<Overlimit>> getOverLimitByLineIds(@RequestBody List<String> lineIds){
|
||||||
|
String methodDescribe = getMethodDescribe("getOverLimitByLineIds");
|
||||||
|
List<Overlimit> overLimitList= iOverLimitService.list(new LambdaQueryWrapper<Overlimit>().in(Overlimit::getId,lineIds));
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, overLimitList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -73,4 +73,7 @@ public interface DeptLineMapper extends BaseMapper<DeptLine> {
|
|||||||
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type);
|
List<LineDevGetDTO> lineDevGet(@Param("list")List<Integer> devType,@Param("type")Integer type);
|
||||||
|
|
||||||
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
List<TerminalGetBase> orgSubStationGet(@Param("list")List<Integer> devType);
|
||||||
|
|
||||||
|
|
||||||
|
List<String> getLineIdByDeptIds(@Param("deptIds")List<String> deptIds,@Param("runFlag")List<Integer> runFlag);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,4 +84,26 @@
|
|||||||
#{item}
|
#{item}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getLineIdByDeptIds" resultType="string">
|
||||||
|
select
|
||||||
|
DISTINCT
|
||||||
|
pq_dept_line.line_id
|
||||||
|
from pq_dept_line pq_dept_line
|
||||||
|
inner join pq_line point on pq_dept_line.line_id = point.id
|
||||||
|
inner join pq_line_detail lineDetail on point.id = lineDetail.id
|
||||||
|
inner join pq_line voltage on point.pid = voltage.id
|
||||||
|
inner join pq_line dev on voltage.pid = dev.id
|
||||||
|
inner join pq_device device on dev.id = device.id
|
||||||
|
where Dev_Model = 1
|
||||||
|
and device.run_flag in
|
||||||
|
<foreach collection="runFlag" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
and pq_dept_line.id in
|
||||||
|
<foreach collection="deptIds" item="item" open="(" close=")" separator=",">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -498,7 +498,7 @@
|
|||||||
detail.pt1,
|
detail.pt1,
|
||||||
detail.pt2,
|
detail.pt2,
|
||||||
detail.obj_name,
|
detail.obj_name,
|
||||||
detail.Dev_Capacity,
|
detail.Dev_Capacity deviceCapacity,
|
||||||
detail.Short_Capacity,
|
detail.Short_Capacity,
|
||||||
detail.Standard_Capacity,
|
detail.Standard_Capacity,
|
||||||
detail.Deal_Capacity,
|
detail.Deal_Capacity,
|
||||||
|
|||||||
@@ -38,6 +38,14 @@ public interface DeptLineService extends IService<DeptLine> {
|
|||||||
*/
|
*/
|
||||||
List<DeptLine> selectDeptBindLines(List<String> ids);
|
List<DeptLine> selectDeptBindLines(List<String> ids);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据部门ids集合查询所有监测点id
|
||||||
|
* @param ids 部门ids
|
||||||
|
* @return 查询结果
|
||||||
|
*/
|
||||||
|
List<String> getLineByDeptIds(List<String> ids,List<Integer> runFlag);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 部门解除绑定监测点
|
* 部门解除绑定监测点
|
||||||
* @param id 部门id
|
* @param id 部门id
|
||||||
|
|||||||
@@ -1,12 +0,0 @@
|
|||||||
package com.njcn.device.pq.service;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @version 1.0.0
|
|
||||||
* @author: chenchao
|
|
||||||
* @date: 2022/08/15 15:33
|
|
||||||
*/
|
|
||||||
public interface DeviceOnlineService {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.device.pq.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 越限表实体
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @since 2023-03-28
|
||||||
|
*/
|
||||||
|
public interface IOverLimitService extends IService<Overlimit> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -14,4 +14,6 @@ import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
|||||||
*/
|
*/
|
||||||
public interface IRStatIntegrityDService extends IService<RStatIntegrityD> {
|
public interface IRStatIntegrityDService extends IService<RStatIntegrityD> {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -60,6 +60,11 @@ public class DeptLineServiceImpl extends ServiceImpl<DeptLineMapper, DeptLine> i
|
|||||||
return this.lambdaQuery().in(DeptLine::getId, ids).list();
|
return this.lambdaQuery().in(DeptLine::getId, ids).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<String> getLineByDeptIds(List<String> ids,List<Integer> runFlag) {
|
||||||
|
return this.baseMapper.getLineIdByDeptIds(ids,runFlag);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int removeBind(String id) {
|
public int removeBind(String id) {
|
||||||
QueryWrapper<DeptLine> deptLineQueryWrapper = new QueryWrapper<>();
|
QueryWrapper<DeptLine> deptLineQueryWrapper = new QueryWrapper<>();
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ import java.util.stream.Stream;
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 终端信息处理器,根据需求返回笼统的台账信息。
|
* 终端信息处理器,根据需求返回笼统的台账信息。
|
||||||
ii * 包括:类别名称、类别索引、监测点索引集合、终端索引集合、变电站索引集bb合、供电公司索引集合。
|
* ii * 包括:类别名称、类别索引、监测点索引集合、终端索引集合、变电站索引集bb合、供电公司索引集合。
|
||||||
* PS:若后期需要比如:省会、项目时再动态添加。
|
* PS:若后期需要比如:省会、项目时再动态添加。
|
||||||
*
|
*
|
||||||
* @author hongawen
|
* @author hongawen
|
||||||
@@ -139,7 +139,7 @@ public class GeneralDeviceService {
|
|||||||
return generalDeviceDTO;
|
return generalDeviceDTO;
|
||||||
}
|
}
|
||||||
//获取line详细数据
|
//获取line详细数据
|
||||||
List<Line> lines = terminalBaseService. getLineByCondition(deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList()), deviceInfoParam);
|
List<Line> lines = terminalBaseService.getLineByCondition(deptLines.stream().map(DeptLine::getLineId).collect(Collectors.toList()), deviceInfoParam);
|
||||||
//返回空数据
|
//返回空数据
|
||||||
if (CollectionUtil.isEmpty(lines)) {
|
if (CollectionUtil.isEmpty(lines)) {
|
||||||
return generalDeviceDTO;
|
return generalDeviceDTO;
|
||||||
@@ -200,7 +200,7 @@ public class GeneralDeviceService {
|
|||||||
public List<GeneralDeviceDTO> getDeviceInfoAsSubstation(DeviceInfoParam deviceInfoParam, List<Integer> runFlag, List<Integer> devModel) {
|
public List<GeneralDeviceDTO> getDeviceInfoAsSubstation(DeviceInfoParam deviceInfoParam, List<Integer> runFlag, List<Integer> devModel) {
|
||||||
List<GeneralDeviceDTO> deviceInfoAsSubstation = new ArrayList<>();
|
List<GeneralDeviceDTO> deviceInfoAsSubstation = new ArrayList<>();
|
||||||
List<String> scale = new ArrayList<>();
|
List<String> scale = new ArrayList<>();
|
||||||
if(CollUtil.isNotEmpty(deviceInfoParam.getScale())){
|
if (CollUtil.isNotEmpty(deviceInfoParam.getScale())) {
|
||||||
scale = deviceInfoParam.getScale().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
scale = deviceInfoParam.getScale().stream().map(SimpleDTO::getId).collect(Collectors.toList());
|
||||||
deviceInfoParam.setScale(new ArrayList<>());
|
deviceInfoParam.setScale(new ArrayList<>());
|
||||||
}
|
}
|
||||||
@@ -219,7 +219,7 @@ public class GeneralDeviceService {
|
|||||||
substationIds = substationIds.stream().distinct().collect(Collectors.toList());
|
substationIds = substationIds.stream().distinct().collect(Collectors.toList());
|
||||||
lineIds = lineIds.stream().distinct().collect(Collectors.toList());
|
lineIds = lineIds.stream().distinct().collect(Collectors.toList());
|
||||||
if (!CollectionUtil.isEmpty(substationIds)) {
|
if (!CollectionUtil.isEmpty(substationIds)) {
|
||||||
List<Line> substations = terminalBaseService.getSubstationByIds(substationIds,scale);
|
List<Line> substations = terminalBaseService.getSubstationByIds(substationIds, scale);
|
||||||
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
List<Line> lines = terminalBaseService.getLineById(lineIds);
|
||||||
for (Line substation : substations) {
|
for (Line substation : substations) {
|
||||||
deviceInfoAsSubstation.add(mergeDeviceInfoAsSubstation(substation, lines));
|
deviceInfoAsSubstation.add(mergeDeviceInfoAsSubstation(substation, lines));
|
||||||
@@ -375,9 +375,9 @@ public class GeneralDeviceService {
|
|||||||
/**
|
/**
|
||||||
* 根据部门id集合获取监测点信息
|
* 根据部门id集合获取监测点信息
|
||||||
*
|
*
|
||||||
* @param directDeptDTO 入参deptIndex的直接子部门
|
* @param directDeptDTO 入参deptIndex的直接子部门
|
||||||
* @param deviceType
|
* @param deviceType
|
||||||
* @param ids 直接子部门以及后代部门id集合
|
* @param ids 直接子部门以及后代部门id集合
|
||||||
* @param deviceInfoParam
|
* @param deviceInfoParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -415,8 +415,8 @@ public class GeneralDeviceService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
// 再根据终端条件筛选合法终端信息 联查:pq_line t1,pq_device t2
|
// 再根据终端条件筛选合法终端信息 联查:pq_line t1,pq_device t2
|
||||||
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds,
|
List<Line> devices = terminalBaseService.getDeviceByCondition(devIds,
|
||||||
deviceType,
|
deviceType,
|
||||||
deviceInfoParam.getManufacturer());
|
deviceInfoParam.getManufacturer());
|
||||||
//筛选出母线id,理论上监测点的pids中第六个id为母线id 联查: pq_line t1 ,pq_voltage t2
|
//筛选出母线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(",");
|
||||||
@@ -424,7 +424,7 @@ public class GeneralDeviceService {
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
//再根据电压等级筛选合法母线信息
|
//再根据电压等级筛选合法母线信息
|
||||||
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds,
|
List<Line> voltages = terminalBaseService.getVoltageByCondition(voltageIds,
|
||||||
deviceInfoParam.getScale());
|
deviceInfoParam.getScale());
|
||||||
//筛选最终的数据
|
//筛选最终的数据
|
||||||
dealDeviceData(generalDeviceDTO, lines, devices, voltages);
|
dealDeviceData(generalDeviceDTO, lines, devices, voltages);
|
||||||
return generalDeviceDTO;
|
return generalDeviceDTO;
|
||||||
@@ -474,7 +474,7 @@ public class GeneralDeviceService {
|
|||||||
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_VOLTAGE_STAND.getName()).getData();
|
||||||
scales = scaleDictData.stream().map(dictData -> {
|
scales = scaleDictData.stream().map(dictData -> {
|
||||||
SimpleDTO simpleDTO = new SimpleDTO();
|
SimpleDTO simpleDTO = new SimpleDTO();
|
||||||
BeanUtil.copyProperties(dictData,simpleDTO);
|
BeanUtil.copyProperties(dictData, simpleDTO);
|
||||||
return simpleDTO;
|
return simpleDTO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -502,7 +502,7 @@ public class GeneralDeviceService {
|
|||||||
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.INTERFERENCE_SOURCE_TYPE.getName()).getData();
|
||||||
loadType = scaleDictData.stream().map(dictData -> {
|
loadType = scaleDictData.stream().map(dictData -> {
|
||||||
SimpleDTO simpleDTO = new SimpleDTO();
|
SimpleDTO simpleDTO = new SimpleDTO();
|
||||||
BeanUtil.copyProperties(dictData,simpleDTO);
|
BeanUtil.copyProperties(dictData, simpleDTO);
|
||||||
return simpleDTO;
|
return simpleDTO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -530,7 +530,7 @@ public class GeneralDeviceService {
|
|||||||
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
List<DictData> scaleDictData = dicDataFeignClient.getDicDataByTypeName(DicDataTypeEnum.DEV_MANUFACTURER.getName()).getData();
|
||||||
manufacturer = scaleDictData.stream().map(dictData -> {
|
manufacturer = scaleDictData.stream().map(dictData -> {
|
||||||
SimpleDTO simpleDTO = new SimpleDTO();
|
SimpleDTO simpleDTO = new SimpleDTO();
|
||||||
BeanUtil.copyProperties(dictData,simpleDTO);
|
BeanUtil.copyProperties(dictData, simpleDTO);
|
||||||
return simpleDTO;
|
return simpleDTO;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
@@ -609,117 +609,117 @@ public class GeneralDeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: 按部门分类获取通讯异常设备警告
|
* @Description: 按部门分类获取通讯异常设备警告
|
||||||
* @Param: [deviceInfoParam]
|
* @Param: [deviceInfoParam]
|
||||||
* @return: java.util.List<com.njcn.device.pq.pojo.vo.ExceptionDeviceInfoVO>
|
* @return: java.util.List<com.njcn.device.pq.pojo.vo.ExceptionDeviceInfoVO>
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2022/10/14
|
* @Date: 2022/10/14
|
||||||
*/
|
*/
|
||||||
public List<ExceptionDeviceInfoVO> getExceptionDeviceInfoAsDept(DeviceInfoParam deviceInfoParam) {
|
public List<ExceptionDeviceInfoVO> getExceptionDeviceInfoAsDept(DeviceInfoParam deviceInfoParam) {
|
||||||
|
|
||||||
List<ExceptionDeviceInfoVO> exceptionDeviceInfoVOS = new ArrayList<> ();
|
List<ExceptionDeviceInfoVO> exceptionDeviceInfoVOS = new ArrayList<>();
|
||||||
List<GeneralDeviceDTO> deviceInfoAsSubstation = getDeviceInfoAsDept (deviceInfoParam,null, Stream.of (1).collect (Collectors.toList ( )));
|
List<GeneralDeviceDTO> deviceInfoAsSubstation = getDeviceInfoAsDept(deviceInfoParam, null, Stream.of(1).collect(Collectors.toList()));
|
||||||
/*获取所有设备*/
|
/*获取所有设备*/
|
||||||
final List<String> deviceIndexes = deviceInfoAsSubstation.stream ( ).map (GeneralDeviceDTO::getDeviceIndexes).flatMap (Collection::stream).distinct ( ).collect (Collectors.toList ( ));
|
final List<String> deviceIndexes = deviceInfoAsSubstation.stream().map(GeneralDeviceDTO::getDeviceIndexes).flatMap(Collection::stream).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
QueryWrapper<Device> wrapper = new QueryWrapper<> ();
|
QueryWrapper<Device> wrapper = new QueryWrapper<>();
|
||||||
|
|
||||||
|
|
||||||
|
wrapper.in("Id", deviceIndexes).
|
||||||
|
eq("Com_Flag", 0).
|
||||||
|
eq("Dev_Model", 1).
|
||||||
|
eq("Dev_Data_Type", 2).
|
||||||
|
eq("Run_Flag", 0);
|
||||||
|
|
||||||
wrapper.in ("Id",deviceIndexes).
|
List<Device> deviceList = deviceMapper.selectList(wrapper);
|
||||||
eq ("Com_Flag", 0).
|
|
||||||
eq ("Dev_Model", 1).
|
|
||||||
eq ("Dev_Data_Type", 2).
|
|
||||||
eq ("Run_Flag", 0);
|
|
||||||
|
|
||||||
List<Device> deviceList = deviceMapper.selectList (wrapper);
|
List<String> filterDevIndexs = deviceList.stream().map(Device::getId).collect(Collectors.toList());
|
||||||
|
|
||||||
List<String> filterDevIndexs = deviceList.stream ( ).map (Device::getId).collect (Collectors.toList ( ));
|
QueryWrapper<Line> lineQueryWrapper = new QueryWrapper<>();
|
||||||
|
lineQueryWrapper.in("Id", filterDevIndexs).
|
||||||
QueryWrapper<Line> lineQueryWrapper = new QueryWrapper<> ();
|
eq("Level", 4);
|
||||||
lineQueryWrapper.in ("Id",filterDevIndexs).
|
|
||||||
eq ("Level", 4);
|
|
||||||
/*终端*/
|
/*终端*/
|
||||||
List<Line> tempDevices = lineMapper.selectList (lineQueryWrapper);
|
List<Line> tempDevices = lineMapper.selectList(lineQueryWrapper);
|
||||||
|
|
||||||
|
|
||||||
List<String> subIndexList = tempDevices.stream ( ).map (Line::getPid).distinct ().collect (Collectors.toList ( ));
|
List<String> subIndexList = tempDevices.stream().map(Line::getPid).distinct().collect(Collectors.toList());
|
||||||
/*变电站*/
|
/*变电站*/
|
||||||
QueryWrapper<Line> substationQueryWrapper = new QueryWrapper<> ();
|
QueryWrapper<Line> substationQueryWrapper = new QueryWrapper<>();
|
||||||
substationQueryWrapper.in ("Id", subIndexList).
|
substationQueryWrapper.in("Id", subIndexList).
|
||||||
eq ("Level", 3);
|
eq("Level", 3);
|
||||||
List<Line> tempSubstations = lineMapper.selectList (substationQueryWrapper);
|
List<Line> tempSubstations = lineMapper.selectList(substationQueryWrapper);
|
||||||
/* todo 设置警告类型*/
|
/* todo 设置警告类型*/
|
||||||
DictData data = dicDataFeignClient.getDicDataByCode (DicDataEnum.COMM_ERR.getCode ( )).getData ( );
|
DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.COMM_ERR.getCode()).getData();
|
||||||
deviceList.forEach (device -> {
|
deviceList.forEach(device -> {
|
||||||
|
|
||||||
ExceptionDeviceInfoVO exceptionDeviceInfoVO = new ExceptionDeviceInfoVO();
|
ExceptionDeviceInfoVO exceptionDeviceInfoVO = new ExceptionDeviceInfoVO();
|
||||||
|
|
||||||
exceptionDeviceInfoVO.setIp (device.getIp ());
|
exceptionDeviceInfoVO.setIp(device.getIp());
|
||||||
exceptionDeviceInfoVO.setUpdateTime (device.getUpdateTime ());
|
exceptionDeviceInfoVO.setUpdateTime(device.getUpdateTime());
|
||||||
exceptionDeviceInfoVO.setDevIndex (device.getId ());
|
exceptionDeviceInfoVO.setDevIndex(device.getId());
|
||||||
|
|
||||||
Line tempdevice = tempDevices.stream ( ).filter (temp -> Objects.equals (temp.getId ( ), device.getId ( ))).collect (Collectors.toList ( )).get (0);
|
Line tempdevice = tempDevices.stream().filter(temp -> Objects.equals(temp.getId(), device.getId())).collect(Collectors.toList()).get(0);
|
||||||
|
|
||||||
exceptionDeviceInfoVO.setDevName (tempdevice.getName ());
|
exceptionDeviceInfoVO.setDevName(tempdevice.getName());
|
||||||
exceptionDeviceInfoVO.setSubIndex (tempdevice.getPid ());
|
exceptionDeviceInfoVO.setSubIndex(tempdevice.getPid());
|
||||||
Line substation = tempSubstations.stream ( ).filter (temp -> Objects.equals (temp.getId ( ), tempdevice.getPid ( ))).collect (Collectors.toList ( )).get (0);
|
Line substation = tempSubstations.stream().filter(temp -> Objects.equals(temp.getId(), tempdevice.getPid())).collect(Collectors.toList()).get(0);
|
||||||
exceptionDeviceInfoVO.setSubName (substation.getName () );
|
exceptionDeviceInfoVO.setSubName(substation.getName());
|
||||||
|
|
||||||
|
|
||||||
exceptionDeviceInfoVO.setWarningId (data.getId ());
|
exceptionDeviceInfoVO.setWarningId(data.getId());
|
||||||
exceptionDeviceInfoVO.setWarningType (data.getName ());
|
exceptionDeviceInfoVO.setWarningType(data.getName());
|
||||||
String exceptionDescription = String.format("%s变电站,%s终端于%s通讯中断",substation.getName (),tempdevice.getName (),device.getUpdateTime ());
|
String exceptionDescription = String.format("%s变电站,%s终端于%s通讯中断", substation.getName(), tempdevice.getName(), device.getUpdateTime());
|
||||||
exceptionDeviceInfoVO.setExceptionDescription (exceptionDescription);
|
exceptionDeviceInfoVO.setExceptionDescription(exceptionDescription);
|
||||||
exceptionDeviceInfoVOS.add (exceptionDeviceInfoVO);
|
exceptionDeviceInfoVOS.add(exceptionDeviceInfoVO);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
return exceptionDeviceInfoVOS;
|
return exceptionDeviceInfoVOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: getDeptDeviceDetail
|
* @Description: getDeptDeviceDetail
|
||||||
* @Param: [deviceInfoParam]
|
* @Param: [deviceInfoParam]
|
||||||
* @return: com.njcn.device.pq.pojo.vo.DeptDeviceDetailVO
|
* @return: com.njcn.device.pq.pojo.vo.DeptDeviceDetailVO
|
||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2022/11/4
|
* @Date: 2022/11/4
|
||||||
*/
|
*/
|
||||||
public DeptDeviceDetailVO getDeptDeviceDetail(DeviceInfoParam deviceInfoParam) {
|
public DeptDeviceDetailVO getDeptDeviceDetail(DeviceInfoParam deviceInfoParam) {
|
||||||
|
|
||||||
|
|
||||||
DeptDeviceDetailVO deptDeviceDetailVO =new DeptDeviceDetailVO();
|
DeptDeviceDetailVO deptDeviceDetailVO = new DeptDeviceDetailVO();
|
||||||
/*总数*/
|
/*总数*/
|
||||||
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0, 1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||||
List<String> DeviceIds = deptDeviceInfos.stream ( ).map (GeneralDeviceDTO::getDeviceIndexes).flatMap (Collection::stream).collect (Collectors.toList ( ));
|
List<String> DeviceIds = deptDeviceInfos.stream().map(GeneralDeviceDTO::getDeviceIndexes).flatMap(Collection::stream).collect(Collectors.toList());
|
||||||
Integer deviceCount = DeviceIds.size ();
|
Integer deviceCount = DeviceIds.size();
|
||||||
|
|
||||||
/*实际运行*/
|
/*实际运行*/
|
||||||
QueryWrapper<Device> query = new QueryWrapper<> ();
|
QueryWrapper<Device> query = new QueryWrapper<>();
|
||||||
query.in ("Id",DeviceIds).
|
query.in("Id", DeviceIds).
|
||||||
eq ("Run_Flag",0);
|
eq("Run_Flag", 0);
|
||||||
Integer runDeviceCount = deviceMapper.selectCount (query);
|
Integer runDeviceCount = deviceMapper.selectCount(query);
|
||||||
BigDecimal rate = BigDecimal.valueOf (runDeviceCount).divide ( BigDecimal.valueOf (deviceCount),4,BigDecimal.ROUND_HALF_UP);
|
BigDecimal rate = BigDecimal.valueOf(runDeviceCount).divide(BigDecimal.valueOf(deviceCount), 4, BigDecimal.ROUND_HALF_UP);
|
||||||
deptDeviceDetailVO.setDeviceCount (deviceCount);
|
deptDeviceDetailVO.setDeviceCount(deviceCount);
|
||||||
deptDeviceDetailVO.setRunDeviceCount (runDeviceCount);
|
deptDeviceDetailVO.setRunDeviceCount(runDeviceCount);
|
||||||
deptDeviceDetailVO.setOnLineRate (rate);
|
deptDeviceDetailVO.setOnLineRate(rate);
|
||||||
return deptDeviceDetailVO;
|
return deptDeviceDetailVO;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public DeptSubstationDetailVO getDeptSubstationDetail(DeviceInfoParam deviceInfoParam) {
|
public DeptSubstationDetailVO getDeptSubstationDetail(DeviceInfoParam deviceInfoParam) {
|
||||||
|
|
||||||
DeptSubstationDetailVO deptSubstationDetailVO = new DeptSubstationDetailVO ();
|
DeptSubstationDetailVO deptSubstationDetailVO = new DeptSubstationDetailVO();
|
||||||
|
|
||||||
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0,1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
List<GeneralDeviceDTO> deptDeviceInfos = this.getDeviceInfoAsDept(deviceInfoParam, Stream.of(0, 1).collect(Collectors.toList()), Stream.of(1).collect(Collectors.toList()));
|
||||||
|
|
||||||
List<String> DeviceIds = deptDeviceInfos.stream ( ).map (GeneralDeviceDTO::getSubIndexes).flatMap (Collection::stream).collect (Collectors.toList ( ));
|
List<String> DeviceIds = deptDeviceInfos.stream().map(GeneralDeviceDTO::getSubIndexes).flatMap(Collection::stream).collect(Collectors.toList());
|
||||||
Integer substationCount = DeviceIds.size ();
|
Integer substationCount = DeviceIds.size();
|
||||||
|
|
||||||
Integer count =lineMapper.queryOnlineSubstaion(DeviceIds);
|
Integer count = lineMapper.queryOnlineSubstaion(DeviceIds);
|
||||||
deptSubstationDetailVO.setSubstationCount (substationCount);
|
deptSubstationDetailVO.setSubstationCount(substationCount);
|
||||||
deptSubstationDetailVO.setRunsubstationCount (count);
|
deptSubstationDetailVO.setRunsubstationCount(count);
|
||||||
BigDecimal rate = BigDecimal.valueOf (count).divide ( BigDecimal.valueOf (substationCount),4,BigDecimal.ROUND_HALF_UP);
|
BigDecimal rate = BigDecimal.valueOf(count).divide(BigDecimal.valueOf(substationCount), 4, BigDecimal.ROUND_HALF_UP);
|
||||||
deptSubstationDetailVO.setOnLineRate (rate);
|
deptSubstationDetailVO.setOnLineRate(rate);
|
||||||
|
|
||||||
return deptSubstationDetailVO;
|
return deptSubstationDetailVO;
|
||||||
|
|
||||||
@@ -727,10 +727,13 @@ public class GeneralDeviceService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<String> deptGetRunLine(String deptId){
|
public List<String> deptGetRunLine(String deptId,List<Integer> runFlag) {
|
||||||
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptId, Stream.of(0, 1).collect(Collectors.toList())).getData();
|
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(deptId, Stream.of(0, 1).collect(Collectors.toList())).getData();
|
||||||
|
if (CollUtil.isNotEmpty(deptDTOList)) {
|
||||||
|
List<String> deptIds = deptDTOList.stream().map(DeptDTO::getId).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
return null;
|
return deptLineService.getLineByDeptIds(deptIds,runFlag);
|
||||||
|
}
|
||||||
|
return new ArrayList<>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.device.pq.service.impl;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.device.pq.mapper.OverlimitMapper;
|
||||||
|
import com.njcn.device.pq.service.IOverLimitService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class OverLimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements IOverLimitService {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.njcn.harmonic.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class FpyTagContent {
|
||||||
|
|
||||||
|
private String passFlag;
|
||||||
|
|
||||||
|
private String content;
|
||||||
|
}
|
||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.harmonic.controller.report;
|
package com.njcn.harmonic.controller.report;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.TimeInterval;
|
||||||
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;
|
||||||
@@ -16,12 +17,15 @@ import io.swagger.annotations.ApiImplicitParam;
|
|||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.formula.functions.T;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
* 合格率报告
|
* 合格率报告
|
||||||
@@ -40,16 +44,19 @@ public class QualifiedReport extends BaseController {
|
|||||||
/**
|
/**
|
||||||
* 合格率报告
|
* 合格率报告
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date \
|
* @date 2023/6/7
|
||||||
*/
|
*/
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/page")
|
@PostMapping("/pageTable")
|
||||||
@ApiOperation("合格率报告")
|
@ApiOperation("合格率报告_列表")
|
||||||
@ApiImplicitParam(name = "qualifiedReportParam", value = "合格率报告参数", required = true)
|
@ApiImplicitParam(name = "qualifiedReportParam", value = "合格率报告参数", required = true)
|
||||||
public HttpResult<FpyReportDTO> page(@RequestBody @Validated QualifiedReportParam qualifiedReportParam) {
|
public HttpResult<List<FpyReportDTO>> pageTable(@RequestBody @Validated QualifiedReportParam qualifiedReportParam) {
|
||||||
String methodDescribe = getMethodDescribe("page");
|
TimeInterval timeInterval = new TimeInterval();
|
||||||
//AssesVO list = assesService.getQualityAssessData(pulicTimeStatisParam);
|
String methodDescribe = getMethodDescribe("pageTable");
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
List<FpyReportDTO> result = qualifiedReportService.pageTable(qualifiedReportParam);
|
||||||
|
log.info("合格率报告执行时长:"+timeInterval.interval());
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package com.njcn.harmonic.mapper.report;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* pqs
|
||||||
|
* 合格率报告
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/7
|
||||||
|
*/
|
||||||
|
public interface QualifiedReportMapper {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取合格率详情
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/8
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> getLimitRateData(@Param("page") Page<List<Map<String,Object>>> page, @Param("lineIds")List<String> lineIds, @Param("startTime")LocalDateTime startTime, @Param("endTime")LocalDateTime endTime);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author cdf
|
||||||
|
* @date 2023/6/8
|
||||||
|
*/
|
||||||
|
List<Map<String,Object>> getLimitRateDataIHarm(@Param("lineIds")List<String> lineIds, @Param("startTime")String startTime, @Param("endTime")String endTime);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,110 @@
|
|||||||
|
<?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.harmonic.mapper.report.QualifiedReportMapper">
|
||||||
|
|
||||||
|
<select id="getLimitRateData" resultType="map">
|
||||||
|
select my_index,
|
||||||
|
SUM( UHARM_2_OVERTIME ) UHARM_2_OVERTIME,
|
||||||
|
SUM( IHARM_2_OVERTIME ) IHARM_2_OVERTIME,
|
||||||
|
SUM( UHARM_3_OVERTIME ) UHARM_3_OVERTIME,
|
||||||
|
SUM( IHARM_3_OVERTIME ) IHARM_3_OVERTIME,
|
||||||
|
SUM( UHARM_4_OVERTIME ) UHARM_4_OVERTIME,
|
||||||
|
SUM( IHARM_4_OVERTIME ) IHARM_4_OVERTIME,
|
||||||
|
SUM( UHARM_5_OVERTIME ) UHARM_5_OVERTIME,
|
||||||
|
SUM( IHARM_5_OVERTIME ) IHARM_5_OVERTIME,
|
||||||
|
SUM( UHARM_6_OVERTIME ) UHARM_6_OVERTIME,
|
||||||
|
SUM( IHARM_6_OVERTIME ) IHARM_6_OVERTIME,
|
||||||
|
SUM( UHARM_7_OVERTIME ) UHARM_7_OVERTIME,
|
||||||
|
SUM( IHARM_7_OVERTIME ) IHARM_7_OVERTIME,
|
||||||
|
SUM( UHARM_8_OVERTIME ) UHARM_8_OVERTIME,
|
||||||
|
SUM( IHARM_8_OVERTIME ) IHARM_8_OVERTIME,
|
||||||
|
SUM( UHARM_9_OVERTIME ) UHARM_9_OVERTIME,
|
||||||
|
SUM( IHARM_9_OVERTIME ) IHARM_9_OVERTIME,
|
||||||
|
SUM( UHARM_10_OVERTIME ) UHARM_10_OVERTIME,
|
||||||
|
SUM( IHARM_10_OVERTIME ) IHARM_10_OVERTIME,
|
||||||
|
SUM( UHARM_11_OVERTIME ) UHARM_11_OVERTIME,
|
||||||
|
SUM( IHARM_11_OVERTIME ) IHARM_11_OVERTIME,
|
||||||
|
SUM( UHARM_12_OVERTIME ) UHARM_12_OVERTIME,
|
||||||
|
SUM( IHARM_12_OVERTIME ) IHARM_12_OVERTIME,
|
||||||
|
SUM( UHARM_13_OVERTIME ) UHARM_13_OVERTIME,
|
||||||
|
SUM( IHARM_13_OVERTIME ) IHARM_13_OVERTIME,
|
||||||
|
SUM( UHARM_14_OVERTIME ) UHARM_14_OVERTIME,
|
||||||
|
SUM( IHARM_14_OVERTIME ) IHARM_14_OVERTIME,
|
||||||
|
SUM( UHARM_15_OVERTIME ) UHARM_15_OVERTIME,
|
||||||
|
SUM( IHARM_15_OVERTIME ) IHARM_15_OVERTIME,
|
||||||
|
SUM( UHARM_16_OVERTIME ) UHARM_16_OVERTIME,
|
||||||
|
SUM( IHARM_16_OVERTIME ) IHARM_16_OVERTIME,
|
||||||
|
SUM( UHARM_17_OVERTIME ) UHARM_17_OVERTIME,
|
||||||
|
SUM( IHARM_17_OVERTIME ) IHARM_17_OVERTIME,
|
||||||
|
SUM( UHARM_18_OVERTIME ) UHARM_18_OVERTIME,
|
||||||
|
SUM( IHARM_18_OVERTIME ) IHARM_18_OVERTIME,
|
||||||
|
SUM( UHARM_19_OVERTIME ) UHARM_19_OVERTIME,
|
||||||
|
SUM( IHARM_19_OVERTIME ) IHARM_19_OVERTIME,
|
||||||
|
SUM( UHARM_20_OVERTIME ) UHARM_20_OVERTIME,
|
||||||
|
SUM( IHARM_20_OVERTIME ) IHARM_20_OVERTIME,
|
||||||
|
SUM( UHARM_21_OVERTIME ) UHARM_21_OVERTIME,
|
||||||
|
SUM( IHARM_21_OVERTIME ) IHARM_21_OVERTIME,
|
||||||
|
SUM( UHARM_22_OVERTIME ) UHARM_22_OVERTIME,
|
||||||
|
SUM( IHARM_22_OVERTIME ) IHARM_22_OVERTIME,
|
||||||
|
SUM( UHARM_23_OVERTIME ) UHARM_23_OVERTIME,
|
||||||
|
SUM( IHARM_23_OVERTIME ) IHARM_23_OVERTIME,
|
||||||
|
SUM( UHARM_24_OVERTIME ) UHARM_24_OVERTIME,
|
||||||
|
SUM( IHARM_24_OVERTIME ) IHARM_24_OVERTIME,
|
||||||
|
SUM( UHARM_25_OVERTIME ) UHARM_25_OVERTIME,
|
||||||
|
SUM( IHARM_25_OVERTIME ) IHARM_25_OVERTIME,
|
||||||
|
SUM( VOLTAGE_DEV_OVERTIME ) VOLTAGE_DEV_OVERTIME,
|
||||||
|
SUM( UABERRANCE_OVERTIME ) UABERRANCE_OVERTIME,
|
||||||
|
SUM( UBALANCE_OVERTIME ) UBALANCE_OVERTIME,
|
||||||
|
SUM( FLICKER_OVERTIME ) FLICKER_OVERTIME,
|
||||||
|
SUM( flicker_all_time ) FLICKET_ALL_TIME,
|
||||||
|
sum( Freq_Dev_OverTime ) FREQ_DEV_OVERTIME,
|
||||||
|
SUM( ALL_TIME ) ALLTIME
|
||||||
|
FROM
|
||||||
|
r_stat_limit_target_d
|
||||||
|
WHERE
|
||||||
|
my_index in
|
||||||
|
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
and time_id BETWEEN #{startTime} AND #{endTime}
|
||||||
|
AND Phasic_Type = 'T'
|
||||||
|
group by MY_INDEX
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="getLimitRateDataIHarm" resultType="map">
|
||||||
|
select line_id MYINDEX,
|
||||||
|
max( I_2 ) IHARM_2_OVERTIME,
|
||||||
|
max( I_3 ) IHARM_3_OVERTIME,
|
||||||
|
max( I_4 ) IHARM_4_OVERTIME,
|
||||||
|
max( I_5 ) IHARM_5_OVERTIME,
|
||||||
|
max( I_6 ) IHARM_6_OVERTIME,
|
||||||
|
max( I_7 ) IHARM_7_OVERTIME,
|
||||||
|
max( I_8 ) IHARM_8_OVERTIME,
|
||||||
|
max( I_9 ) IHARM_9_OVERTIME,
|
||||||
|
max( I_10 ) IHARM_10_OVERTIME,
|
||||||
|
max( I_11 ) IHARM_11_OVERTIME,
|
||||||
|
max( I_12 ) IHARM_12_OVERTIME,
|
||||||
|
max( I_13 ) IHARM_13_OVERTIME,
|
||||||
|
max( I_14 ) IHARM_14_OVERTIME,
|
||||||
|
max( I_15 ) IHARM_15_OVERTIME,
|
||||||
|
max( I_16 ) IHARM_16_OVERTIME,
|
||||||
|
max( I_17 ) IHARM_17_OVERTIME,
|
||||||
|
max( I_18 ) IHARM_18_OVERTIME,
|
||||||
|
max( I_19 ) IHARM_19_OVERTIME,
|
||||||
|
max( I_20 ) IHARM_20_OVERTIME,
|
||||||
|
max( I_21 ) IHARM_21_OVERTIME,
|
||||||
|
max( I_22 ) IHARM_22_OVERTIME,
|
||||||
|
max( I_23 ) IHARM_23_OVERTIME,
|
||||||
|
max( I_24 ) IHARM_24_OVERTIME,
|
||||||
|
max( I_25 ) IHARM_25_OVERTIME
|
||||||
|
FROM r_stat_data_i_d
|
||||||
|
WHERE line_id in
|
||||||
|
<foreach collection="lineIds" item="item" open="(" separator="," close=")">
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
and time BETWEEN #{startTime} AND #{endTime}
|
||||||
|
group by line_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -6,6 +6,8 @@ import com.njcn.harmonic.pojo.param.QualifiedReportParam;
|
|||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
*
|
*
|
||||||
@@ -15,9 +17,9 @@ import org.springframework.web.bind.annotation.RequestBody;
|
|||||||
public interface QualifiedReportService {
|
public interface QualifiedReportService {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合格率报告
|
* 合格率报告_列表
|
||||||
* @author cdf
|
* @author cdf
|
||||||
* @date \
|
* @date 2023/6/7
|
||||||
*/
|
*/
|
||||||
HttpResult<FpyReportDTO> page(@RequestBody @Validated QualifiedReportParam qualifiedReportParam);
|
List<FpyReportDTO> pageTable(QualifiedReportParam qualifiedReportParam);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,11 +1,40 @@
|
|||||||
package com.njcn.harmonic.service.majornetwork.impl;
|
package com.njcn.harmonic.service.majornetwork.impl;
|
||||||
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.text.StrBuilder;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.common.utils.PubUtils;
|
||||||
|
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||||
|
import com.njcn.device.pq.api.GeneralDeviceInfoClient;
|
||||||
|
import com.njcn.device.pq.api.LineFeignClient;
|
||||||
|
import com.njcn.device.pq.api.LineIntegrityClient;
|
||||||
|
import com.njcn.device.pq.api.OverLimitClient;
|
||||||
|
import com.njcn.device.pq.pojo.param.LineBaseQueryParam;
|
||||||
|
import com.njcn.device.pq.pojo.po.RStatIntegrityD;
|
||||||
|
import com.njcn.device.pq.pojo.vo.AreaLineInfoVO;
|
||||||
|
import com.njcn.harmonic.mapper.report.QualifiedReportMapper;
|
||||||
import com.njcn.harmonic.pojo.dto.FpyReportDTO;
|
import com.njcn.harmonic.pojo.dto.FpyReportDTO;
|
||||||
|
import com.njcn.harmonic.pojo.dto.FpyTagContent;
|
||||||
import com.njcn.harmonic.pojo.param.QualifiedReportParam;
|
import com.njcn.harmonic.pojo.param.QualifiedReportParam;
|
||||||
|
import com.njcn.harmonic.pojo.po.report.EnumPass;
|
||||||
import com.njcn.harmonic.service.majornetwork.QualifiedReportService;
|
import com.njcn.harmonic.service.majornetwork.QualifiedReportService;
|
||||||
|
import com.njcn.web.factory.PageFactory;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.commons.beanutils.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.lang.reflect.InvocationTargetException;
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* pqs
|
* pqs
|
||||||
*
|
*
|
||||||
@@ -13,16 +42,177 @@ import org.springframework.stereotype.Service;
|
|||||||
* @date 2023/5/31
|
* @date 2023/5/31
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
public class QualifiedReportServiceImpl implements QualifiedReportService {
|
public class QualifiedReportServiceImpl implements QualifiedReportService {
|
||||||
|
|
||||||
|
private final QualifiedReportMapper qualifiedReportMapper;
|
||||||
|
|
||||||
|
private final GeneralDeviceInfoClient generalDeviceInfoClient;
|
||||||
|
|
||||||
|
private final LineFeignClient lineFeignClient;
|
||||||
|
|
||||||
|
private final LineIntegrityClient lineIntegrityClient;
|
||||||
|
|
||||||
|
private final OverLimitClient overLimitClient;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FpyReportDTO> pageTable(QualifiedReportParam qualifiedReportParam) {
|
||||||
|
List<FpyReportDTO> fpyReportDTOList = new ArrayList<>();
|
||||||
|
List<String> lineIds = generalDeviceInfoClient.deptGetRunLine(qualifiedReportParam.getDeptId()).getData();
|
||||||
|
if(CollUtil.isEmpty(lineIds)){
|
||||||
|
return fpyReportDTOList;
|
||||||
|
}
|
||||||
|
|
||||||
|
LineBaseQueryParam lineBaseQueryParam = new LineBaseQueryParam();
|
||||||
|
lineBaseQueryParam.setLineIds(lineIds);
|
||||||
|
lineBaseQueryParam.setSearchValue(qualifiedReportParam.getSearchValue());
|
||||||
|
List<AreaLineInfoVO> areaLineInfoVOList = lineFeignClient.getRichLineInfo(lineBaseQueryParam).getData();
|
||||||
|
List<String> lineNewIds = areaLineInfoVOList.stream().map(AreaLineInfoVO::getLineId).distinct().collect(Collectors.toList());
|
||||||
|
Map<String, AreaLineInfoVO> lineMap = areaLineInfoVOList.stream().collect(Collectors.toMap(AreaLineInfoVO::getLineId,Function.identity()));
|
||||||
|
|
||||||
|
List<Map<String,Object>> limitMap = qualifiedReportMapper.getLimitRateData(new Page<>(PageFactory.getPageNum(qualifiedReportParam),PageFactory.getPageSize(qualifiedReportParam)),lineNewIds, PubUtils.beginTimeToLocalDateTime(qualifiedReportParam.getBeginTime()),PubUtils.endTimeToLocalDateTime(qualifiedReportParam.getEndTime()));
|
||||||
|
List<String> realLineIds = limitMap.stream().map(item->item.get("my_index").toString()).distinct().collect(Collectors.toList());
|
||||||
|
|
||||||
|
List<Map<String, Object>> dayIhMapList = qualifiedReportMapper.getLimitRateDataIHarm(lineIds,qualifiedReportParam.getBeginTime(),qualifiedReportParam.getEndTime());
|
||||||
|
Map<String, Map<String, Object>> mapMap = dayIhMapList.stream().collect(Collectors.toMap(it->it.get("MYINDEX").toString(),Function.identity()));
|
||||||
|
|
||||||
|
|
||||||
|
if(CollUtil.isNotEmpty(limitMap)){
|
||||||
|
|
||||||
|
}
|
||||||
|
List<RStatIntegrityD> rStatIntegrityList = lineIntegrityClient.getIntegrityByLineIds(realLineIds,qualifiedReportParam.getBeginTime(),qualifiedReportParam.getEndTime()).getData();
|
||||||
|
Map<String, RStatIntegrityD> rStatIntegrityMap = rStatIntegrityList.stream().collect(Collectors.toMap(RStatIntegrityD::getLineIndex, Function.identity()));
|
||||||
|
|
||||||
|
|
||||||
|
List<Overlimit> overLimitList = overLimitClient.getOverLimitByLineIds(realLineIds).getData();
|
||||||
|
Map<String, Overlimit> overLimitMap = overLimitList.stream().collect(Collectors.toMap(Overlimit::getId, Function.identity()));
|
||||||
|
|
||||||
|
for(Map<String, Object> map:limitMap){
|
||||||
|
String lineId = map.get("my_index").toString();
|
||||||
|
Map<String, Object> mapOverLimit = new HashMap<>();
|
||||||
|
try {
|
||||||
|
BeanUtils.describe(overLimitMap.get(lineId)).forEach((key, value) -> mapOverLimit.put((String) key, value));
|
||||||
|
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
//获取平均值的最大值
|
||||||
|
Map<String, Object> iM = mapMap.get(lineId);
|
||||||
|
|
||||||
|
FpyTagContent fpyTagContent = calAllTag(map, mapOverLimit,iM);
|
||||||
|
|
||||||
|
FpyReportDTO fpyReportData = new FpyReportDTO();
|
||||||
|
if (lineMap.containsKey(lineId)) {
|
||||||
|
AreaLineInfoVO areaLineInfoVO = lineMap.get(lineId);
|
||||||
|
|
||||||
|
BeanUtil.copyProperties(areaLineInfoVO, fpyReportData);
|
||||||
|
fpyReportData.setHarmDes(fpyTagContent.getPassFlag());
|
||||||
|
fpyReportData.setPowerDes(fpyTagContent.getContent());
|
||||||
|
fpyReportDTOList.add(fpyReportData);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(rStatIntegrityMap.containsKey(lineId)) {
|
||||||
|
RStatIntegrityD rStatIntegrityD = rStatIntegrityMap.get(lineId);
|
||||||
|
fpyReportData.setIntegrityValue(rStatIntegrityD.getIntegrityData());
|
||||||
|
}else {
|
||||||
|
fpyReportData.setIntegrityValue(3.14159f);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return fpyReportDTOList;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合格率报告
|
* 其他指标计算
|
||||||
* @author cdf
|
|
||||||
* @date
|
|
||||||
*/
|
*/
|
||||||
@Override
|
private FpyTagContent calAllTag(Map<String, Object> map, Map<String, Object> mapOverLimit,Map<String, Object> iMap) {
|
||||||
public HttpResult<FpyReportDTO> page(QualifiedReportParam qualifiedReportParam) {
|
StrBuilder content = new StrBuilder();
|
||||||
return null;
|
BigDecimal alltime = (BigDecimal) map.get("ALLTIME");
|
||||||
|
BigDecimal flicketAllTime = (BigDecimal)map.get("FLICKET_ALL_TIME");
|
||||||
|
|
||||||
|
FpyTagContent fpyTagContent = new FpyTagContent();
|
||||||
|
if(alltime.intValue() > 0) {
|
||||||
|
//频率偏差
|
||||||
|
BigDecimal freq = (BigDecimal) map.get("FREQ_DEV_OVERTIME");
|
||||||
|
if (freq.intValue() > 0) {
|
||||||
|
BigDecimal freqRate = alltime.subtract(freq).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
content.append("频率偏差合格率").append(String.valueOf(freqRate.floatValue())).append("%;");
|
||||||
|
}
|
||||||
|
|
||||||
|
//电压偏差
|
||||||
|
BigDecimal voltageDev = (BigDecimal) map.get("VOLTAGE_DEV_OVERTIME");
|
||||||
|
if (voltageDev.intValue() > 0) {
|
||||||
|
BigDecimal voltageDevRate = alltime.subtract(voltageDev).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
content.append("电压偏差合格率").append(String.valueOf(voltageDevRate.floatValue())).append("%;");
|
||||||
|
}
|
||||||
|
|
||||||
|
//三项不平衡
|
||||||
|
BigDecimal ubalance = (BigDecimal) map.get("UBALANCE_OVERTIME");
|
||||||
|
if (ubalance.intValue() > 0) {
|
||||||
|
BigDecimal ubalanceRate = alltime.subtract(ubalance).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
content.append("三相电压不平衡合格率").append(String.valueOf(ubalanceRate.floatValue())).append("%;");
|
||||||
|
}
|
||||||
|
|
||||||
|
//闪变
|
||||||
|
BigDecimal flickOver = (BigDecimal) map.get("FLICKER_OVERTIME");
|
||||||
|
if (flickOver.intValue() > 0) {
|
||||||
|
BigDecimal flickOverRate = flicketAllTime.subtract(flickOver).divide(flicketAllTime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
content.append("闪变合格率").append(String.valueOf(flickOverRate.floatValue())).append("%;");
|
||||||
|
}
|
||||||
|
|
||||||
|
//电压畸变
|
||||||
|
BigDecimal uab = (BigDecimal) map.get("UABERRANCE_OVERTIME");
|
||||||
|
BigDecimal uabRate = alltime.subtract(uab).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
if (uabRate.floatValue() < 95) {
|
||||||
|
content.append("电压总畸变率").append(String.valueOf(uabRate.floatValue())).append("%;");
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算组装谐波含电压有率
|
||||||
|
int flagV = 0;
|
||||||
|
for (int i = 2; i < 26; i++) {
|
||||||
|
BigDecimal v = (BigDecimal) map.get("UHARM_" + i + "_OVERTIME");
|
||||||
|
BigDecimal hegeRate = alltime.subtract(v).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
if (hegeRate.floatValue() < 95) {
|
||||||
|
content.append(String.valueOf(i)).append("次谐波电压含有率合格率").append(String.valueOf(hegeRate.floatValue())).append("%;");
|
||||||
|
flagV++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//计算组装谐波电流幅值
|
||||||
|
int flagI = 0;
|
||||||
|
for (int i = 2; i < 26; i++) {
|
||||||
|
String key = "IHARM_" + i + "_OVERTIME";
|
||||||
|
BigDecimal ih = (BigDecimal) map.get(key);
|
||||||
|
BigDecimal hegeRate = alltime.subtract(ih).divide(alltime, 4, RoundingMode.HALF_UP).multiply(new BigDecimal(100));
|
||||||
|
if (hegeRate.floatValue() < 95) {
|
||||||
|
BigDecimal maxI = (BigDecimal)iMap.get(key);
|
||||||
|
BigDecimal overLimit = new BigDecimal(mapOverLimit.get("iharm" + i).toString());
|
||||||
|
content.append(String.valueOf(i)).append("次谐波电流合格率").append(String.valueOf(hegeRate.floatValue())).append("%,限值为").append(String.valueOf(overLimit.floatValue())).append("A," + "最大值为").append(String.valueOf(maxI.setScale(2,RoundingMode.HALF_UP))).append("A;");
|
||||||
|
flagI++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(flagV==0 && flagI==0){
|
||||||
|
fpyTagContent.setPassFlag(EnumPass.PASS.getDescribe());
|
||||||
|
}else if(flagV>0 && flagI==0){
|
||||||
|
fpyTagContent.setPassFlag("谐波电压");
|
||||||
|
}else if(flagV==0 && flagI>0){
|
||||||
|
fpyTagContent.setPassFlag("谐波电流");
|
||||||
|
}else {
|
||||||
|
fpyTagContent.setPassFlag("谐波电压;谐波电流");
|
||||||
|
}
|
||||||
|
if(StrUtil.isBlank(content)){
|
||||||
|
fpyTagContent.setContent("合格;");
|
||||||
|
}else {
|
||||||
|
fpyTagContent.setContent(content.toString());
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
fpyTagContent.setPassFlag("暂无数据");
|
||||||
|
fpyTagContent.setContent("暂无数据;");
|
||||||
|
}
|
||||||
|
|
||||||
|
return fpyTagContent;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user