1.优化数据单位显示
2.优化补召功能 3.监测点数据完整性及装置在线率(未开发完)
This commit is contained in:
@@ -42,4 +42,7 @@ public interface CsLineFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getById")
|
@PostMapping("/getById")
|
||||||
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
@PostMapping("/getLinesByDevList")
|
||||||
|
HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,16 +1,11 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
|
||||||
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
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.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|||||||
@@ -74,6 +74,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsLinePO>> getLinesByDevList(List<String> ids) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据装置id集合获取监测点id集合",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -95,4 +95,10 @@ public class CsLinePO extends BaseEntity {
|
|||||||
|
|
||||||
@TableField(value = "device_id")
|
@TableField(value = "device_id")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点统计间隔
|
||||||
|
*/
|
||||||
|
@TableField(value = "line_interval")
|
||||||
|
private Integer lineInterval;
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,6 @@ public class DeviceFtpController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "fileCheck", value = "文件校验码", required = true)
|
@ApiImplicitParam(name = "fileCheck", value = "文件校验码", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
|
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
|
||||||
String methodDescribe = getMethodDescribe("downloadFile");
|
|
||||||
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -158,4 +158,14 @@ public class CslineController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLinesByDevList")
|
||||||
|
@ApiOperation("根据装置id集合获取监测点id集合")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "装置id集合", required = true)
|
||||||
|
public HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLinesByDevList");
|
||||||
|
List<CsLinePO> list = csLinePOService.getLinesByDevList(ids);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,4 +45,6 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
|||||||
* @param csLineParam
|
* @param csLineParam
|
||||||
*/
|
*/
|
||||||
void updateIds(CsLineParam csLineParam);
|
void updateIds(CsLineParam csLineParam);
|
||||||
|
|
||||||
|
List<CsLinePO> getLinesByDevList(List<String> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
@@ -336,15 +337,15 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
vo.setUnit("k" + epdPqd.getUnit());
|
unit = "k" + epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -354,16 +355,29 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
}
|
}
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(null);
|
vo.setStatisticalData(null);
|
||||||
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
vo.setStatisticalIndex(epdPqd.getId());
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
vo.setStatisticalName(epdPqd.getName());
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -81,6 +82,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLinePO> getLinesByDevList(List<String> list) {
|
||||||
|
return this.lambdaQuery().in(CsLinePO::getDevId,list).eq(CsLinePO::getStatus,1).list();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||||
// *
|
// *
|
||||||
|
|||||||
@@ -443,6 +443,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
||||||
}
|
}
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
@@ -455,15 +456,15 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
vo.setUnit("k" + epdPqd.getUnit());
|
unit = "k" + epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -473,16 +474,29 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
}
|
}
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(null);
|
vo.setStatisticalData(null);
|
||||||
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
vo.setStatisticalIndex(epdPqd.getId());
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
vo.setStatisticalName(epdPqd.getName());
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DownloadMakeUpDto implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全文件大小
|
||||||
|
*/
|
||||||
|
private Integer allStep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置id
|
||||||
|
*/
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件工程名称
|
||||||
|
*/
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要补召的文件集合
|
||||||
|
*/
|
||||||
|
private List<String> fileList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsDataParam implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("起始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束时间")
|
||||||
|
private String endTime;
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class LineIntegrityVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("装置id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点名称")
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点数据完整性")
|
||||||
|
private Double lineIntegrity;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端在线率")
|
||||||
|
private Double devOnlineRate;
|
||||||
|
}
|
||||||
@@ -107,7 +107,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>access-api</artifactId>
|
<artifactId>access-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>zl-event-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
|
|||||||
@@ -74,12 +74,16 @@ public class OfflineDataUploadController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping(value = "/makeUp")
|
@PostMapping(value = "/makeUp")
|
||||||
@ApiOperation("设备补招")
|
@ApiOperation("设备补召")
|
||||||
@ApiImplicitParam(name = "param", value = "补招参数", required = true)
|
@ApiImplicitParam(name = "param", value = "补招参数", required = true)
|
||||||
public HttpResult<String> makeUp(@RequestBody MakeUpParam param) {
|
public HttpResult<String> makeUp(@RequestBody MakeUpParam param) {
|
||||||
String methodDescribe = getMethodDescribe("makeUp");
|
String methodDescribe = getMethodDescribe("makeUp");
|
||||||
offlineDataUploadService.startMakeUpData(param);
|
boolean result = offlineDataUploadService.startMakeUpData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "文件补召中,请稍后", methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "文件补召中失败", methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
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.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.LineIntegrityVo;
|
||||||
|
import com.njcn.csharmonic.service.IStatisticsDataDataService;
|
||||||
|
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.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/statisticsData")
|
||||||
|
@Api(tags = "统计数据")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class StatisticsDataDataController extends BaseController {
|
||||||
|
|
||||||
|
private final IStatisticsDataDataService statisticsDataDataService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/devData")
|
||||||
|
@ApiOperation("装置数据统计(监测点完整性、装置在线率)")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<LineIntegrityVo>> getDevData(@RequestBody StatisticsDataParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getDevData");
|
||||||
|
List<LineIntegrityVo> list = statisticsDataDataService.getDevData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,11 +2,18 @@ package com.njcn.csharmonic.handler;
|
|||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||||
|
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||||
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
import com.github.tocrhz.mqtt.annotation.MqttSubscribe;
|
||||||
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
import com.github.tocrhz.mqtt.annotation.NamedValue;
|
||||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
|
import com.njcn.access.api.CsTopicFeignClient;
|
||||||
|
import com.njcn.access.utils.ChannelObjectUtil;
|
||||||
|
import com.njcn.access.utils.FileCommonUtils;
|
||||||
import com.njcn.csdevice.api.DevCapacityFeignClient;
|
import com.njcn.csdevice.api.DevCapacityFeignClient;
|
||||||
|
import com.njcn.csdevice.api.DeviceFtpFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
import com.njcn.csharmonic.param.FrequencyStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsRtDataVO;
|
import com.njcn.csharmonic.pojo.vo.CsRtDataVO;
|
||||||
@@ -15,9 +22,12 @@ import com.njcn.csharmonic.service.ILineTargetService;
|
|||||||
import com.njcn.csharmonic.service.StableDataService;
|
import com.njcn.csharmonic.service.StableDataService;
|
||||||
import com.njcn.csharmonic.service.TemperatureService;
|
import com.njcn.csharmonic.service.TemperatureService;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
|
import com.njcn.zlevent.api.FileFeignClient;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -44,7 +54,7 @@ import java.util.stream.Stream;
|
|||||||
public class MqttMessageHandler {
|
public class MqttMessageHandler {
|
||||||
|
|
||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
|
private final FileCommonUtils fileCommonUtils;
|
||||||
private final ILineTargetService lineTargetService;
|
private final ILineTargetService lineTargetService;
|
||||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||||
private final StableDataService stableDataService;
|
private final StableDataService stableDataService;
|
||||||
@@ -55,6 +65,13 @@ public class MqttMessageHandler {
|
|||||||
|
|
||||||
private final DevCapacityFeignClient devCapacityFeignClient;
|
private final DevCapacityFeignClient devCapacityFeignClient;
|
||||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||||
|
private final ChannelObjectUtil channelObjectUtil;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final CsTopicFeignClient csTopicFeignClient;
|
||||||
|
private final DeviceFtpFeignClient deviceFtpFeignClient;
|
||||||
|
private static Integer mid = 1;
|
||||||
|
private final FileFeignClient fileFeignClient;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实时数据应答
|
* 实时数据应答
|
||||||
*/
|
*/
|
||||||
@@ -357,4 +374,14 @@ public class MqttMessageHandler {
|
|||||||
// return thdDataVOList;
|
// return thdDataVOList;
|
||||||
// }
|
// }
|
||||||
// }
|
// }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理补召数据
|
||||||
|
*/
|
||||||
|
@MqttSubscribe(value = "/makeUpData/{nDid}/{lineId}",qos = 1)
|
||||||
|
public void responseRtData(String topic, @NamedValue("nDid") String nDid, @NamedValue("lineId") String lineId, MqttMessage message, @Payload String payload) {
|
||||||
|
//下载文件
|
||||||
|
fileFeignClient.downloadMakeUpFile(nDid);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.csharmonic.service;
|
||||||
|
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.LineIntegrityVo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
public interface IStatisticsDataDataService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据完整性、终端在线率
|
||||||
|
* @param param
|
||||||
|
*/
|
||||||
|
List<LineIntegrityVo> getDevData(StatisticsDataParam param);
|
||||||
|
}
|
||||||
@@ -38,6 +38,6 @@ public interface OfflineDataUploadService {
|
|||||||
* 根据项目递归获取文件夹下的bin文件,区分暂态、稳态,存储离线文件的方式,调用黄正剑的离线数据补招功能
|
* 根据项目递归获取文件夹下的bin文件,区分暂态、稳态,存储离线文件的方式,调用黄正剑的离线数据补招功能
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
void startMakeUpData(MakeUpParam param);
|
boolean startMakeUpData(MakeUpParam param);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -25,6 +25,7 @@ import com.njcn.csharmonic.offline.log.vo.NewTaglogbuffer;
|
|||||||
import com.njcn.csharmonic.offline.log.vo.TagComtradeCfg;
|
import com.njcn.csharmonic.offline.log.vo.TagComtradeCfg;
|
||||||
import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
|
import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
|
||||||
import com.njcn.csharmonic.offline.vo.Response;
|
import com.njcn.csharmonic.offline.vo.Response;
|
||||||
|
import com.njcn.csharmonic.pojo.dto.DownloadMakeUpDto;
|
||||||
import com.njcn.csharmonic.pojo.dto.MakeUpDto;
|
import com.njcn.csharmonic.pojo.dto.MakeUpDto;
|
||||||
import com.njcn.csharmonic.pojo.param.MakeUpParam;
|
import com.njcn.csharmonic.pojo.param.MakeUpParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||||
@@ -49,7 +50,9 @@ import java.time.LocalDate;
|
|||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.njcn.access.enums.TypeEnum.DATA_48;
|
import static com.njcn.access.enums.TypeEnum.DATA_48;
|
||||||
@@ -216,11 +219,12 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void startMakeUpData(MakeUpParam param) {
|
public boolean startMakeUpData(MakeUpParam param) {
|
||||||
List<String> fileList = new ArrayList<>();
|
boolean result = true;
|
||||||
Map<String,List<String>> map = new HashMap<>();
|
try {
|
||||||
//组装文件路径
|
List<String> fileList = new ArrayList<>();
|
||||||
for (String s : param.getProList()) {
|
//fixme 这边补召暂不支持多工程补召,防止下载文件时间过长,会出问题。
|
||||||
|
String s = param.getProList().get(0);
|
||||||
//稳态补招
|
//稳态补招
|
||||||
if (param.getDataTypeList().contains(0)) {
|
if (param.getDataTypeList().contains(0)) {
|
||||||
String minPath = s + "/min";
|
String minPath = s + "/min";
|
||||||
@@ -263,51 +267,134 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
|||||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||||
//添加record.bin文件
|
//添加record.bin文件
|
||||||
fileList.add(s + "/record.bin");
|
fileList.add(s + "/record.bin");
|
||||||
map.put(s,fileList);
|
redisUtil.delete(AppRedisKey.MAKE_UP_FILES + param.getNDid());
|
||||||
|
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
|
||||||
|
DownloadMakeUpDto downloadMakeUpDto = new DownloadMakeUpDto();
|
||||||
|
downloadMakeUpDto.setFileList(fileList);
|
||||||
|
downloadMakeUpDto.setLineId(param.getLineId());
|
||||||
|
downloadMakeUpDto.setDevId(vo.getId());
|
||||||
|
downloadMakeUpDto.setAllStep(fileList.size());
|
||||||
|
String proName = s.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
|
||||||
|
downloadMakeUpDto.setEngineeringName(proName);
|
||||||
|
redisUtil.saveByKey(AppRedisKey.MAKE_UP_FILES + param.getNDid(),downloadMakeUpDto);
|
||||||
|
publisher.send("/makeUpData/" + param.getNDid() +"/" + param.getLineId(), "makeUpData", 1, false);
|
||||||
|
log.info("下载的文件列表,{}",fileList);
|
||||||
}
|
}
|
||||||
|
} catch (Exception e) {
|
||||||
|
result = false;
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isNotEmpty(map)) {
|
return result;
|
||||||
List<String> keyList = new ArrayList<>();
|
|
||||||
//获取装置信息
|
|
||||||
CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
|
|
||||||
map.forEach((k,v)->{
|
|
||||||
String proName = k.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
|
|
||||||
String key = AppRedisKey.PROJECT_INFO + param.getNDid();
|
|
||||||
v.forEach(item->{
|
|
||||||
redisUtil.delete(key);
|
|
||||||
Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_MID + param.getNDid());
|
|
||||||
if (!Objects.isNull(object)) {
|
|
||||||
mid = (Integer) object;
|
|
||||||
}
|
|
||||||
askFileInfo(param.getNDid(),mid,item);
|
|
||||||
try {
|
|
||||||
Thread.sleep(10000);
|
|
||||||
FileDto.FileInfo info = channelObjectUtil.objectToSingleObject(redisUtil.getObjectByKey(key),FileDto.FileInfo.class);
|
|
||||||
String path = deviceFtpFeignClient.downloadFile(param.getNDid(),item,info.getFileSize(),info.getFileCheck()).getData();
|
|
||||||
String lsFile = generalInfo.getBusinessTempPath() + File.separator + item.split(StrUtil.SLASH)[item.split(StrUtil.SLASH).length - 1];
|
|
||||||
moveFile(path,getFilePath(item,param.getNDid()),lsFile);
|
|
||||||
//删除临时文件
|
|
||||||
File file = new File(lsFile);
|
|
||||||
if (file.exists()) {
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
//删除下载文件
|
|
||||||
fileStorageUtil.deleteFile(path);
|
|
||||||
//存储下载
|
|
||||||
keyList.add(item);
|
|
||||||
//推送下载进度
|
|
||||||
String json = "{allStep:" + fileList.size() * 2 + ",nowStep:" + keyList.size() + "}";
|
|
||||||
publisher.send("/dataOnlineRecruitment/Progress/" + param.getLineId(), new Gson().toJson(json), 1, false);
|
|
||||||
} catch (Exception e) {
|
|
||||||
throw new BusinessException(CsHarmonicResponseEnum.MAKE_UP_ERROR);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
//下载完成,调用解析接口
|
|
||||||
portableOffLogFeignClient.dataOnlineRecruitment(vo.getId(),param.getLineId(),proName);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public boolean startMakeUpData(MakeUpParam param) {
|
||||||
|
// boolean result = true;
|
||||||
|
// try {
|
||||||
|
// List<String> fileList = new ArrayList<>();
|
||||||
|
// Map<String,List<String>> map = new HashMap<>();
|
||||||
|
// String s = param.getProList().get(0);
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
//
|
||||||
|
// //组装文件路径
|
||||||
|
// for (String s : param.getProList()) {
|
||||||
|
// //稳态补招
|
||||||
|
// if (param.getDataTypeList().contains(0)) {
|
||||||
|
// String minPath = s + "/min";
|
||||||
|
// List<FileDto.DirInfo> projectInfoList = getFileList(param.getLineId(),param.getNDid(),minPath);
|
||||||
|
// if (CollectionUtil.isNotEmpty(projectInfoList)) {
|
||||||
|
// projectInfoList.forEach(item->{
|
||||||
|
// String linePath = item.getName();
|
||||||
|
// if (timeRange(param.getStartTime(),param.getEndTime(),linePath,"min")) {
|
||||||
|
// List<FileDto.DirInfo> lineDataList = getFileList(param.getLineId(),param.getNDid(),linePath);
|
||||||
|
// if (CollectionUtil.isNotEmpty(lineDataList)) {
|
||||||
|
// fileList.addAll(lineDataList.stream().map(FileDto.DirInfo::getName).collect(Collectors.toList()));
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// //暂态补招
|
||||||
|
// if (param.getDataTypeList().contains(1)) {
|
||||||
|
// //事件
|
||||||
|
// String logPath = s + "/log";
|
||||||
|
// List<FileDto.DirInfo> logList = getFileList(param.getLineId(),param.getNDid(),logPath);
|
||||||
|
// if (CollectionUtil.isNotEmpty(logList)) {
|
||||||
|
// logList.forEach(item->{
|
||||||
|
// if (timeRange(param.getStartTime(),param.getEndTime(),item.getName(),"log")) {
|
||||||
|
// fileList.add(item.getName());
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// //录波文件
|
||||||
|
// String comtradePath = s + "/comtrade";
|
||||||
|
// List<FileDto.DirInfo> comtradeList = getFileList(param.getLineId(),param.getNDid(),comtradePath);
|
||||||
|
// if (CollectionUtil.isNotEmpty(comtradeList)) {
|
||||||
|
// comtradeList.forEach(item->{
|
||||||
|
// if (timeRange(param.getStartTime(),param.getEndTime(),item.getName(),"comtrade")) {
|
||||||
|
// fileList.add(item.getName());
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// if (CollectionUtil.isNotEmpty(fileList)) {
|
||||||
|
// redisUtil.deleteKeysByString(AppRedisKey.MAKE_UP_FILES);
|
||||||
|
// //添加record.bin文件
|
||||||
|
// fileList.add(s + "/record.bin");
|
||||||
|
// map.put(s,fileList);
|
||||||
|
// }
|
||||||
|
// redisUtil.saveByKey(AppRedisKey.MAKE_UP_FILES + param.getNDid(),map);
|
||||||
|
// publisher.send("/makeUpData/" + param.getNDid() +"/" + param.getLineId(), "makeUpData", 1, false);
|
||||||
|
// log.info("下载的文件列表,{}",fileList);
|
||||||
|
// }
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// result = false;
|
||||||
|
// }
|
||||||
|
// return result;
|
||||||
|
//
|
||||||
|
// if (CollectionUtil.isNotEmpty(map)) {
|
||||||
|
// List<String> keyList = new ArrayList<>();
|
||||||
|
// //获取装置信息
|
||||||
|
// CsEquipmentDeliveryVO vo = equipmentFeignClient.queryEquipmentByndid(param.getNDid()).getData();
|
||||||
|
// map.forEach((k,v)->{
|
||||||
|
// String proName = k.replace("/bd0/cmn/",OssPath.DEV_MAKE_UP_PATH + param.getNDid() + "/");
|
||||||
|
// String key = AppRedisKey.PROJECT_INFO + param.getNDid();
|
||||||
|
// v.forEach(item->{
|
||||||
|
// redisUtil.delete(key);
|
||||||
|
// Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_MID + param.getNDid());
|
||||||
|
// if (!Objects.isNull(object)) {
|
||||||
|
// mid = (Integer) object;
|
||||||
|
// }
|
||||||
|
// askFileInfo(param.getNDid(),mid,item);
|
||||||
|
// try {
|
||||||
|
// Thread.sleep(10000);
|
||||||
|
// FileDto.FileInfo info = channelObjectUtil.objectToSingleObject(redisUtil.getObjectByKey(key),FileDto.FileInfo.class);
|
||||||
|
// String path = deviceFtpFeignClient.downloadFile(param.getNDid(),item,info.getFileSize(),info.getFileCheck()).getData();
|
||||||
|
// String lsFile = generalInfo.getBusinessTempPath() + File.separator + item.split(StrUtil.SLASH)[item.split(StrUtil.SLASH).length - 1];
|
||||||
|
// moveFile(path,getFilePath(item,param.getNDid()),lsFile);
|
||||||
|
// //删除临时文件
|
||||||
|
// File file = new File(lsFile);
|
||||||
|
// if (file.exists()) {
|
||||||
|
// file.delete();
|
||||||
|
// }
|
||||||
|
// //删除下载文件
|
||||||
|
// fileStorageUtil.deleteFile(path);
|
||||||
|
// //存储下载
|
||||||
|
// keyList.add(item);
|
||||||
|
// //推送下载进度
|
||||||
|
// String json = "{allStep:" + fileList.size() * 2 + ",nowStep:" + keyList.size() + "}";
|
||||||
|
// publisher.send("/dataOnlineRecruitment/Progress/" + param.getLineId(), new Gson().toJson(json), 1, false);
|
||||||
|
// } catch (Exception e) {
|
||||||
|
// throw new BusinessException(CsHarmonicResponseEnum.MAKE_UP_ERROR);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// //下载完成,调用解析接口
|
||||||
|
// portableOffLogFeignClient.dataOnlineRecruitment(vo.getId(),param.getLineId(),proName);
|
||||||
|
// });
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 时间处理
|
* 时间处理
|
||||||
@@ -376,25 +463,6 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 询问文件信息
|
|
||||||
*/
|
|
||||||
public void askFileInfo(String nDid, Integer mid, String fileName) {
|
|
||||||
String version = csTopicFeignClient.find(nDid).getData();
|
|
||||||
ReqAndResDto.Req reqAndResParam = new ReqAndResDto.Req();
|
|
||||||
reqAndResParam.setMid(mid);
|
|
||||||
reqAndResParam.setDid(0);
|
|
||||||
reqAndResParam.setPri(AccessEnum.FIRST_CHANNEL.getCode());
|
|
||||||
reqAndResParam.setType(Integer.parseInt(TypeEnum.TYPE_8.getCode()));
|
|
||||||
reqAndResParam.setExpire(-1);
|
|
||||||
String json = "{Name:\""+fileName+"\"}";
|
|
||||||
JSONObject jsonObject = JSONObject.fromObject(json);
|
|
||||||
reqAndResParam.setMsg(jsonObject);
|
|
||||||
log.info("请求文件信息报文:" + new Gson().toJson(reqAndResParam));
|
|
||||||
publisher.send("/Pfm/DevFileCmd/"+version+"/"+nDid,new Gson().toJson(reqAndResParam),1,false);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取文件数据
|
* 获取文件数据
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.njcn.csharmonic.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.LineIntegrityVo;
|
||||||
|
import com.njcn.csharmonic.service.IStatisticsDataDataService;
|
||||||
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
|
import com.njcn.influx.service.CommonService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class StatisticsDataDataServiceImpl implements IStatisticsDataDataService {
|
||||||
|
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
private final CommonService commonService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LineIntegrityVo> getDevData(StatisticsDataParam param) {
|
||||||
|
List<LineIntegrityVo> result = new ArrayList<>();
|
||||||
|
//获取库中正常的所有装置
|
||||||
|
List<CsEquipmentDeliveryPO> devList = equipmentFeignClient.getAll().getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
|
Map<String, CsEquipmentDeliveryPO> devMap = devList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||||
|
//获取所有监测点
|
||||||
|
List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(devIdList)) {
|
||||||
|
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
||||||
|
csLinePOList.forEach(item->{
|
||||||
|
//应收数据
|
||||||
|
int dueCount = 1440 / item.getLineInterval();
|
||||||
|
LineIntegrityVo vo = new LineIntegrityVo();
|
||||||
|
StatisticalDataDTO statisticalDataDTO;
|
||||||
|
Integer process = devMap.get(item.getDevId()).getProcess();
|
||||||
|
//治理监测点
|
||||||
|
if (item.getClDid() == 0) {
|
||||||
|
statisticalDataDTO = commonService.getCounts(item.getLineId(),"apf_data","Apf_Freq","frequency","M","avg",item.getClDid().toString(),process.toString(),param.getStartTime(),param.getEndTime());
|
||||||
|
}
|
||||||
|
//电能质量监测点
|
||||||
|
else {
|
||||||
|
statisticalDataDTO = commonService.getCounts(item.getLineId(),"pqd_data","Pq_Freq","frequency","M","avg",item.getClDid().toString(),process.toString(),param.getStartTime(),param.getEndTime());
|
||||||
|
}
|
||||||
|
vo.setDevId(item.getDevId());
|
||||||
|
vo.setDevName(devMap.get(item.getDevId()).getName());
|
||||||
|
vo.setLineId(item.getLineId());
|
||||||
|
vo.setLineName(item.getName());
|
||||||
|
if (Objects.isNull(statisticalDataDTO.getFrequency())) {
|
||||||
|
vo.setLineIntegrity(null);
|
||||||
|
} else {
|
||||||
|
vo.setLineIntegrity(Integer.parseInt(statisticalDataDTO.getFrequency()) / dueCount * 100.0);
|
||||||
|
}
|
||||||
|
result.add(vo);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user