Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e4adc58d4 | |||
| 98e880b68d | |||
| 327923ba44 | |||
| e37ace2fd7 | |||
| ea3cff888b | |||
| 1f451f9d0e | |||
| b6c2675311 | |||
|
|
d0c7edff8a | ||
| 59a2bb5e62 | |||
|
|
9c2b2dbd3e | ||
|
|
be4f50fbc5 | ||
| 625ed864c7 | |||
| 10910e36e0 | |||
|
|
49d42328ff | ||
| 53debdf2ef | |||
| be6b29cbb7 | |||
| c72882d023 | |||
| 5022aff834 | |||
|
|
b2511aaaf5 | ||
| 75f07ac86f | |||
|
|
00b16325d6 | ||
|
|
e09232dc55 | ||
|
|
b8157f94c9 | ||
| 5c50e18fc9 | |||
|
|
4b8e2488d2 | ||
|
|
a4acc4775a | ||
|
|
c4803846a4 | ||
| 66c54ac3eb |
@@ -42,4 +42,7 @@ public interface CsLineFeignClient {
|
||||
|
||||
@PostMapping("/getById")
|
||||
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;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
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.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.WlRecordClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -47,4 +48,10 @@ public interface WlRecordFeignClient {
|
||||
|
||||
@GetMapping("/dayDealNoEndTimeEvent")
|
||||
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
||||
|
||||
@GetMapping("/getWlAssByWlId")
|
||||
HttpResult<List<WlRecord>> getWlAssByWlId(@RequestParam("wlId")String wlId);
|
||||
|
||||
@PostMapping("/findDevBaseDataByLineId")
|
||||
HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getLinesByDevList(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置id集合获取监测点id集合",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -57,6 +58,18 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
|
||||
log.error("{}异常,降级处理,异常为:{}","每日处理没有结束时间的测试基础数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<WlRecord>> getWlAssByWlId(String wlId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据测试项id获取测试项详细条目",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(WlRecordParam.lineRecord param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置基础数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -125,4 +125,7 @@ public class CsEquipmentDeliveryAddParm{
|
||||
@ApiModelProperty(value="模块个数")
|
||||
private Integer modelNumber;
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -60,51 +58,12 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
@ApiModelProperty(value="装置接入方式")
|
||||
private String devAccessMethod;
|
||||
|
||||
// /**
|
||||
// * 装置程序版本
|
||||
// */
|
||||
// @ApiModelProperty(value="装置程序版本")
|
||||
// private String programVersion;
|
||||
|
||||
// /**
|
||||
// * 调试人员
|
||||
// */
|
||||
// @ApiModelProperty(value="调试人员")
|
||||
// private String debugPerson;
|
||||
//
|
||||
// /**
|
||||
// * 出厂日期
|
||||
// */
|
||||
// @ApiModelProperty(value="出厂日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
// private Date producteTime;
|
||||
//
|
||||
// /**
|
||||
// * 检修日期
|
||||
// */
|
||||
// @ApiModelProperty(value="检修日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
// private Date checkTime;
|
||||
//
|
||||
// /**
|
||||
// * 调试日期
|
||||
// */
|
||||
// @ApiModelProperty(value="调试日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
// private Date debugTime;
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
*/
|
||||
@ApiModelProperty(value="合同号")
|
||||
private String cntractNo;
|
||||
|
||||
// /**
|
||||
// * 营销经理
|
||||
// */
|
||||
// @ApiModelProperty(value="营销经理")
|
||||
// private String salesManager;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@@ -128,4 +87,10 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
*/
|
||||
@ApiModelProperty(value="模块个数")
|
||||
private Integer modelNumber;
|
||||
|
||||
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||
private Integer usageStatus;
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -24,4 +24,7 @@ public class DataArrayParam {
|
||||
|
||||
@ApiModelProperty("数据类型")
|
||||
private String statMethod;
|
||||
|
||||
@ApiModelProperty("数据集编号")
|
||||
private Integer idx;
|
||||
}
|
||||
|
||||
@@ -99,4 +99,19 @@ public class WlRecordParam {
|
||||
private String id;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class lineRecord extends WlRecordParam {
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("测试项起始时间")
|
||||
private String itemStartTime;
|
||||
|
||||
@ApiModelProperty("测试项结束时间")
|
||||
private String itemEndTime;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -80,4 +80,8 @@ public class CsDataSet extends BaseEntity {
|
||||
*/
|
||||
private String dataLevel;
|
||||
|
||||
/**
|
||||
* 接线方式
|
||||
*/
|
||||
private Integer conType;
|
||||
}
|
||||
|
||||
@@ -108,4 +108,16 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
||||
@TableField(value = "process")
|
||||
private Integer process;
|
||||
|
||||
/**
|
||||
* 装置使用状态(0:停用 1:启用)
|
||||
*/
|
||||
@TableField(value = "usage_status")
|
||||
private Integer usageStatus;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField(value = "sort")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -95,4 +95,10 @@ public class CsLinePO extends BaseEntity {
|
||||
|
||||
@TableField(value = "device_id")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 监测点统计间隔
|
||||
*/
|
||||
@TableField(value = "line_interval")
|
||||
private Integer lineInterval;
|
||||
}
|
||||
@@ -83,4 +83,7 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
||||
@ApiModelProperty(value="设备当前流程状态")
|
||||
private Integer process ;
|
||||
|
||||
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||
private Integer usageStatus ;
|
||||
|
||||
}
|
||||
@@ -48,6 +48,12 @@ public class CsLedgerVO implements Serializable {
|
||||
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(name = "lineType",value = "监测点类型 0:治理监测点 1:电能质量监测点")
|
||||
private Integer lineType;
|
||||
|
||||
@ApiModelProperty(name = "conType",value = "接线方式 0-星型 1-角型 2-V型")
|
||||
private Integer conType;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子节点")
|
||||
private List<CsLedgerVO> children = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -76,8 +76,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
@@ -92,8 +91,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-warn-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- zxing生成二维码 -->
|
||||
@@ -107,9 +105,6 @@
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
@@ -139,8 +134,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-harmonic-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.njcn</groupId>
|
||||
@@ -151,20 +145,14 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>access-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
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.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.service.DeviceFtpService;
|
||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
@@ -63,9 +60,6 @@ public class DeviceFtpController extends BaseController {
|
||||
public HttpResult<List<MakeUpVo>> askDeviceFileOrDir(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("type") String type){
|
||||
String methodDescribe = getMethodDescribe("askDeviceFileOrDir");
|
||||
List<MakeUpVo> list = deviceFtpService.askDeviceFileOrDir(nDid,name,type);
|
||||
if (CollectionUtil.isEmpty(list) && Objects.equals(type,"file")) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ERROR);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -79,7 +73,7 @@ public class DeviceFtpController extends BaseController {
|
||||
@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){
|
||||
String methodDescribe = getMethodDescribe("downloadFile");
|
||||
redisUtil.saveByKeyWithExpire("fileDownUserId"+nDid+name,RequestUtil.getUserIndex(),600L);
|
||||
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -66,10 +67,10 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiOperation("新增出厂设备")
|
||||
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||
public HttpResult<Boolean> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
||||
Boolean flag = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||
if (flag){
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||
if (Objects.nonNull(po)){
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||
if (result){
|
||||
@@ -77,7 +78,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||
}
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -158,4 +158,14 @@ public class CslineController extends BaseController {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -168,6 +168,20 @@ public class WlRecordController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除装置测试项
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/deleteItem")
|
||||
@ApiOperation("删除装置测试项")
|
||||
@ApiImplicitParam(name = "id", value = "装置测试项Id", required = true)
|
||||
public HttpResult<Boolean> deleteItem(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("deleteItem");
|
||||
LogUtil.njcnDebug(log, "{},装置测试项Id为:{}", methodDescribe, id);
|
||||
wlRecordService.deleteItem(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询测试项时间段实时数据
|
||||
*/
|
||||
@@ -195,6 +209,19 @@ public class WlRecordController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点id查询装置基础数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@PostMapping("/findDevBaseDataByLineId")
|
||||
@ApiOperation("根据监测点id查询装置基础数据")
|
||||
@ApiImplicitParam(name = "param", value = "查询条件", required = true)
|
||||
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param) {
|
||||
String methodDescribe = getMethodDescribe("findDevBaseDataByLineId");
|
||||
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, param);
|
||||
List<RecordVo> record = wlRecordService.findDevBaseDataByLineId(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
@@ -207,5 +234,18 @@ public class WlRecordController extends BaseController {
|
||||
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
||||
wlRecordService.dayDealNoEndTimeEvent(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据测试项获取测试项绑定测点数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getWlAssByWlId")
|
||||
@ApiOperation("根据测试项获取测试项绑定测点数据")
|
||||
public HttpResult<List<WlRecord>> getWlAssByWlId(@RequestParam("wlId") String wlId) {
|
||||
String methodDescribe = getMethodDescribe("getWlAssByWlId");
|
||||
List<WlRecord> result = wlRecordService.getWlAssByWlId(wlId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -48,4 +48,6 @@ public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
||||
List<CsLedgerVO> getAll();
|
||||
|
||||
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
||||
|
||||
List<WlRecord> getWlAssByWlId(String wlId);
|
||||
}
|
||||
|
||||
@@ -106,6 +106,7 @@
|
||||
and t1.did = #{param.did}
|
||||
and t3.cl_dev = #{param.cldId}
|
||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
||||
and t3.idx = #{param.idx}
|
||||
and t4.stat_method = #{param.statMethod}
|
||||
order by t4.sort
|
||||
</select>
|
||||
|
||||
@@ -19,7 +19,8 @@
|
||||
<!--@mbg.generated-->
|
||||
id, dev_type, version_no, version_date, file_path, create_by, create_time, update_by,
|
||||
update_time, `status`
|
||||
</sql><select id="getPage" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
</sql>
|
||||
<select id="getPage" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
SELECT a.*
|
||||
FROM cs_dev_model a
|
||||
WHERE
|
||||
@@ -34,13 +35,15 @@
|
||||
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
||||
</if>
|
||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
||||
<!-- </if>-->
|
||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
||||
<!-- </if>-->
|
||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||
AND a.name = #{csDevModelQueryParm.name}
|
||||
</if>
|
||||
</select><select id="queryOne" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
order by a.version_date desc
|
||||
</select>
|
||||
<select id="queryOne" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
SELECT a.*
|
||||
FROM cs_dev_model a
|
||||
WHERE
|
||||
|
||||
@@ -93,4 +93,8 @@
|
||||
)
|
||||
order by start_time
|
||||
</select>
|
||||
|
||||
<select id="getWlAssByWlId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -39,7 +39,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/31
|
||||
*/
|
||||
Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
||||
CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
||||
/**
|
||||
* @Description: AuditEquipmentDelivery
|
||||
* @Param: [id]
|
||||
|
||||
@@ -45,4 +45,6 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
* @param csLineParam
|
||||
*/
|
||||
void updateIds(CsLineParam csLineParam);
|
||||
|
||||
List<CsLinePO> getLinesByDevList(List<String> list);
|
||||
}
|
||||
|
||||
@@ -102,10 +102,14 @@ public interface IWlRecordService extends IService<WlRecord> {
|
||||
*/
|
||||
WlRecord findDevBaseData(WlRecordParam.Record param);
|
||||
|
||||
List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param);
|
||||
|
||||
/**
|
||||
* 每日处理没有结束时间的测试基础数据
|
||||
*/
|
||||
void dayDealNoEndTimeEvent(String date);
|
||||
|
||||
List<WlRecord> getWlAssByWlId(String wlId);
|
||||
|
||||
void deleteItem(String id);
|
||||
}
|
||||
|
||||
@@ -77,11 +77,11 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType));
|
||||
//谐波电压含有率
|
||||
if (target == 0) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$01");
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$0".concat(clDev.toString()));
|
||||
} else if (target == 1) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$01");
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$0".concat(clDev.toString()));
|
||||
} else if (target == 2) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$01");
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$0".concat(clDev.toString()));
|
||||
}
|
||||
return this.baseMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -101,7 +102,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
@@ -111,6 +112,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus (1);
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||
String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(4);
|
||||
@@ -135,7 +137,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return result;
|
||||
return csEquipmentDeliveryPo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -369,14 +371,24 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private void setDataSetValues(CsEquipmentDeliveryPO csEquipmentDeliveryPo, List<CsDataSet> dataSet, List<DeviceManagerVO.DataSetVO> dataSetList, String type, DeviceManagerVO deviceManagerVo) {
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPo, deviceManagerVo);
|
||||
if (CollUtil.isNotEmpty(dataSet)) {
|
||||
if (Objects.equals(type, "rt")) {
|
||||
for (CsDataSet item : dataSet) {
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName("history".equals(type) ? "准实时数据":item.getAnotherName());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
}
|
||||
} else {
|
||||
CsDataSet item = dataSet.get(0);
|
||||
//准实时数据
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName("准实时数据");
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
if (Objects.equals(type, "history")) {
|
||||
//历史数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
@@ -384,14 +396,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
||||
//趋势数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo3.setId(item.getId());
|
||||
dataSetVo3.setName("历史趋势");
|
||||
dataSetVo3.setType("trenddata");
|
||||
dataSetList.add(dataSetVo3);
|
||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
||||
//实时数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo4.setId(item.getId());
|
||||
@@ -404,7 +416,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
dataSetVo5.setName("暂态事件");
|
||||
dataSetVo5.setType("event");
|
||||
dataSetList.add(dataSetVo5);
|
||||
}
|
||||
//测试项tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo6 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo6.setId(item.getId());
|
||||
dataSetVo6.setName("测试项记录");
|
||||
dataSetVo6.setType("items");
|
||||
dataSetList.add(dataSetVo6);
|
||||
}
|
||||
}
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
|
||||
@@ -323,6 +323,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}).collect(Collectors.toList());
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
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",csDataSet.getDataLevel())) {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
vo.setUnit("k" + epdPqd.getUnit());
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -354,16 +355,29 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
}
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
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.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
@@ -90,7 +91,21 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<CsLedgerVO> finalLineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.peek(item -> item.setType("line"))
|
||||
.peek(
|
||||
item -> {
|
||||
item.setType("line");
|
||||
String index = item.getId().substring(item.getId().length()-1);
|
||||
if (Objects.equals(index,"0")) {
|
||||
item.setLineType(0);
|
||||
} else {
|
||||
item.setLineType(1);
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
item.setConType(po.getConType());
|
||||
}
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(deviceList);
|
||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
@@ -109,7 +124,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
c.setName(po.getName());
|
||||
c.setSort(po.getSort());
|
||||
}
|
||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
checkDevSetData(portables);
|
||||
portable.setChildren(portables);
|
||||
@@ -196,7 +214,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
c.setName(po.getName());
|
||||
c.setSort(po.getSort());
|
||||
}
|
||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
portable.setChildren(portables);
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -81,6 +82,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
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)
|
||||
// *
|
||||
|
||||
@@ -45,7 +45,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
public MakeUpVo askDeviceRootPath(String nDid) {
|
||||
MakeUpVo makeUpVo = new MakeUpVo();
|
||||
try {
|
||||
judgeClientOnline(nDid);
|
||||
boolean mqttClient = judgeClientOnline(nDid);
|
||||
if (!mqttClient){
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
||||
Thread.sleep(3000);
|
||||
@@ -55,7 +58,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
makeUpVo.setType("dir");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ROOT_ERROR);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
return makeUpVo;
|
||||
}
|
||||
@@ -64,7 +67,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
public List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type) {
|
||||
List<MakeUpVo> result = new ArrayList<>();
|
||||
try {
|
||||
judgeClientOnline(nDid);
|
||||
boolean mqttClient = judgeClientOnline(nDid);
|
||||
if (!mqttClient){
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
// 删除旧的缓存信息
|
||||
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
||||
// 请求设备文件或目录信息
|
||||
@@ -78,7 +84,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 捕获特定异常并抛出运行时异常
|
||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ERROR);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
result.stream().sorted(Comparator.comparing(MakeUpVo::getType)).collect(Collectors.toList());
|
||||
@@ -89,7 +95,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
@Override
|
||||
@Async
|
||||
public void downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
||||
judgeClientOnline(nDid);
|
||||
boolean mqttClient = judgeClientOnline(nDid);
|
||||
if (!mqttClient) {
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
|
||||
if (Objects.nonNull(task)) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||
@@ -104,7 +113,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
} catch (Exception e) {
|
||||
redisUtil.delete("fileDowning:"+nDid);
|
||||
redisUtil.delete("fileCheck"+nDid+name);
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -119,6 +128,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
redisUtil.delete("fileCheck"+nDid+name);
|
||||
redisUtil.delete("fileDowning:"+nDid);
|
||||
redisUtil.delete(AppRedisKey.FILE_PART.concat(name));
|
||||
redisUtil.delete("fileDownUserId"+nDid+name);
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -134,7 +144,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
result = true;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -151,7 +161,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
result = true;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -198,13 +208,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
return vo;
|
||||
}
|
||||
|
||||
public void judgeClientOnline(String nDid) {
|
||||
public boolean judgeClientOnline(String nDid) {
|
||||
//判断客户端是否在线
|
||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (!mqttClient){
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
return mqttUtil.judgeClientOnline(clientName);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
@@ -13,9 +14,11 @@ import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
@@ -52,7 +55,9 @@ import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -93,6 +98,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
private final PortableOffMainLogService portableOffMainLogService;
|
||||
private final IWlRecordService wlRecordService;
|
||||
|
||||
@Override
|
||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||
@@ -261,7 +267,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
int successcCount = 0;
|
||||
portableOffMainLog.setStatus("1");
|
||||
|
||||
|
||||
List<PortableOfflLog> portableOfflLogs = new ArrayList<>();
|
||||
for(MultipartFile file : uploadDataParam.getFiles()){
|
||||
|
||||
//初始上传日志基本信息
|
||||
@@ -275,11 +281,16 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
//默认总条数及入库数为0(防止解析的数据重复插入及上传的文件目录路径错误)
|
||||
portableOfflLog.setAllCount(0);
|
||||
portableOfflLog.setRealCount(0);
|
||||
if(file.getOriginalFilename().contains("record.bin")){
|
||||
portableOfflLog.setAllCount(1);
|
||||
portableOfflLog.setState(1);
|
||||
}
|
||||
|
||||
//开始匹配解析的文件结果入库
|
||||
for(Response response : responses){
|
||||
//min解析结果较为特殊所有的文件解析后只有一条结果
|
||||
if(OfflineConstant.MIN.equals(response.getFilename()) && checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.MIN)!=null){
|
||||
if(OfflineConstant.MIN.equals(response.getFilename()) && checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.MIN)!=null&&minFlag){
|
||||
|
||||
List<PqdData> pqdData = (List<PqdData>) response.getObj();
|
||||
pqdData.forEach(temp->{
|
||||
temp.setClDid(cdid);
|
||||
@@ -287,6 +298,40 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
temp.setProcess(data1.get(0).getProcess()+"");
|
||||
temp.setLineId(uploadDataParam.getLineId());
|
||||
});
|
||||
|
||||
Instant instantMax = pqdData.stream().map(PqdData::getTime).max(Instant::compareTo).get();
|
||||
Instant instantMin = pqdData.stream().map(PqdData::getTime).min(Instant::compareTo).get();
|
||||
//插入测试项
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
wlRecord.setId(IdUtil.fastSimpleUUID());
|
||||
wlRecord.setItemName("基础数据");
|
||||
wlRecord.setGcName("补召数据");
|
||||
wlRecord.setDevId(csEquipmentDeliveryDTO.getId());
|
||||
wlRecord.setLineId(lineId);
|
||||
// wlRecord.setStatisticalInterval();
|
||||
// wlRecord.setPt();
|
||||
// wlRecord.setCt();
|
||||
// wlRecord.setPt1();
|
||||
// wlRecord.setCt1();
|
||||
// wlRecord.setVoltageLevel();
|
||||
// wlRecord.setCapacitySscb();
|
||||
// wlRecord.setCapacitySscmin();
|
||||
// wlRecord.setCapacitySt();
|
||||
// wlRecord.setCapacitySi();
|
||||
// wlRecord.setVolConType();
|
||||
// wlRecord.setCurConSel();
|
||||
wlRecord.setStartTime(instantMin.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
wlRecord.setEndTime(instantMax.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
// wlRecord.setLocation();
|
||||
wlRecord.setType(1);
|
||||
wlRecord.setState(DataStateEnum.ENABLE.getCode());
|
||||
wlRecordService.lambdaUpdate().set(WlRecord::getState,DataStateEnum.DELETED.getCode())
|
||||
.eq(WlRecord::getLineId,lineId)
|
||||
.eq(WlRecord::getStartTime,wlRecord.getStartTime())
|
||||
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
||||
wlRecordService.save(wlRecord);
|
||||
|
||||
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
@@ -294,6 +339,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
if(pqdData != null && !pqdData.isEmpty()){
|
||||
//否则正常标记为成功解析
|
||||
portableOfflLog.setState(1);
|
||||
portableOfflLog.setName("min文件夹");
|
||||
portableOfflLog.setAllCount(pqdData.size());
|
||||
portableOfflLog.setRealCount(pqdData.size());
|
||||
if(minFlag){
|
||||
@@ -311,17 +357,16 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
//判断当前解析的数据属于哪种结果(目前来说三种:comtrade、log、min(除外))
|
||||
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.COMTRADE)!=null){ //cfg
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
}
|
||||
//由于dat文件不解析但是日志需要记载所以都设为1
|
||||
|
||||
TagComtradeCfg tagComtradeCfg = (TagComtradeCfg) response.getObj();
|
||||
if(tagComtradeCfg != null){
|
||||
|
||||
//否则正常标记为成功解析
|
||||
portableOfflLog.setState(1);
|
||||
portableOfflLog.setAllCount(1);
|
||||
portableOfflLog.setRealCount(1);
|
||||
//cfg入库
|
||||
}
|
||||
|
||||
}
|
||||
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.LOG)!=null){ //事件
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
@@ -378,7 +423,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
for (Response res : cfgResponse) {
|
||||
String cfg = res.getFilename();
|
||||
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.DAT;
|
||||
String sharPath = OfflineConstant.COMTRADE+"/"+csEquipmentDeliveryDTO.getMac()+"/";
|
||||
String sharPath = OfflineConstant.COMTRADE+"/"+csEquipmentDeliveryDTO.getMac().replace(":", "-")+"/";
|
||||
TagComtradeCfg sing = (TagComtradeCfg) res.getObj();
|
||||
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
|
||||
if (sing!= null && sing.getTimeStart()!= null && sing.getTimeTrigger().compareTo(csEventPO.getStartTime())<=0
|
||||
@@ -471,7 +516,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
this.baseMapper.insert(portableOfflLog);
|
||||
successcCount++;
|
||||
}
|
||||
|
||||
portableOfflLogs.add(portableOfflLog);
|
||||
}
|
||||
portableOffMainLog.setEndTime(LocalDateTime.now());
|
||||
portableOffMainLog.setSuccessCount(successcCount);
|
||||
|
||||
@@ -443,6 +443,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
||||
}
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
String unit;
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
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",csDataSet.getDataLevel())) {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
vo.setUnit("k" + epdPqd.getUnit());
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@@ -473,16 +474,29 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
}
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
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.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
@@ -508,6 +522,25 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
return this.getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param) {
|
||||
List<RecordVo> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(WlRecord::getLineId,param.getLineId())
|
||||
.between(WlRecord::getStartTime,param.getItemStartTime(),param.getItemEndTime())
|
||||
.eq(WlRecord::getType,1)
|
||||
.eq(WlRecord::getState,1).orderByDesc(WlRecord::getStartTime);
|
||||
List<WlRecord> list = this.list(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item->{
|
||||
RecordVo vo = new RecordVo();
|
||||
BeanUtils.copyProperties(item,vo);
|
||||
result.add(vo);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void dayDealNoEndTimeEvent(String date) {
|
||||
@@ -601,6 +634,18 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WlRecord> getWlAssByWlId(String wlId) {
|
||||
return this.baseMapper.getDataRecordByTestId(wlId,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteItem(String id) {
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(WlRecord::getId,id).set(WlRecord::getState,0);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
||||
* @param data 数据项
|
||||
|
||||
@@ -120,9 +120,9 @@ public class AnalyseComtradeCfg {
|
||||
hashMapA.put("pq_RmsI",rms[3]);
|
||||
hashMapB.put("pq_RmsI",rms[4]);
|
||||
hashMapC.put("pq_RmsI",rms[5]);
|
||||
hashMapA.put("pq_RmsLU",rms[6]);
|
||||
hashMapB.put("pq_RmsLU",rms[7]);
|
||||
hashMapC.put("pq_RmsLU",rms[8]);
|
||||
hashMapAB.put("pq_RmsLU",rms[6]);
|
||||
hashMapBC.put("pq_RmsLU",rms[7]);
|
||||
hashMapCA.put("pq_RmsLU",rms[8]);
|
||||
|
||||
|
||||
// pqdDataA.setpq_RmsU(rms[0]);
|
||||
@@ -239,6 +239,9 @@ public class AnalyseComtradeCfg {
|
||||
|
||||
for (int i = 0; i < 50; i++) {
|
||||
//间谐波幅值
|
||||
hashMapA.put("pq_InHarmUR_"+(i+1),inHarm[0][i]);
|
||||
hashMapB.put("pq_InHarmUR_"+(i+1),inHarm[1][i]);
|
||||
hashMapC.put("pq_InHarmUR_"+(i+1),inHarm[2][i]);
|
||||
hashMapA.put("pq_InHarmIAmp_"+(i+1),inHarm[3][i]);
|
||||
hashMapB.put("pq_InHarmIAmp_"+(i+1),inHarm[4][i]);
|
||||
hashMapC.put("pq_InHarmIAmp_"+(i+1),inHarm[5][i]);
|
||||
@@ -260,9 +263,9 @@ public class AnalyseComtradeCfg {
|
||||
hashMapB.put("pq_S",totalPower[1][2]);
|
||||
hashMapC.put("pq_S",totalPower[2][2]);
|
||||
|
||||
hashMapM.put("pq_TotHarmP",totalPower[3][0]);
|
||||
hashMapM.put("pq_TotHarmQ",totalPower[3][1]);
|
||||
hashMapM.put("pq_TotHarmS",totalPower[3][2]);
|
||||
hashMapM.put("pq_TotP",totalPower[3][0]);
|
||||
hashMapM.put("pq_TotQ",totalPower[3][1]);
|
||||
hashMapM.put("pq_TotS",totalPower[3][2]);
|
||||
|
||||
/*todo 谐波畸变率,电压波动,电压闪变,电压长闪变会根据监测点接线方式是星型存A,B,C相,角型或者V型存AB,BC,CA相,目前全存在A,B,C相*/
|
||||
//谐波畸变率
|
||||
@@ -294,9 +297,9 @@ public class AnalyseComtradeCfg {
|
||||
hashMapC.put("pq_Fluct",uFluctuation[2]);
|
||||
//电压闪变
|
||||
Float[] uFlicker = min.getU_Flicker();
|
||||
hashMapA.put("pq_Plt",uFlicker[0]);
|
||||
hashMapB.put("pq_Plt",uFlicker[1]);
|
||||
hashMapC.put("pq_Plt",uFlicker[2]);
|
||||
hashMapA.put("pq_Pst",uFlicker[0]);
|
||||
hashMapB.put("pq_Pst",uFlicker[1]);
|
||||
hashMapC.put("pq_Pst",uFlicker[2]);
|
||||
//电压长闪变
|
||||
Float[] ulFlicker = min.getUL_Flicker();
|
||||
hashMapA.put("pq_Plt",ulFlicker[0]);
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
package com.njcn.csharmonic.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class DataParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("起始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty("结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("指标统计类型")
|
||||
private String targetType;
|
||||
|
||||
@ApiModelProperty("数据标志")
|
||||
private String dataLevel;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.csharmonic.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||
import com.njcn.influx.utils.InstantDateSerializer;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.Instant;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class RealTimeDataVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("数据时间")
|
||||
@JsonSerialize(using = InstantDateSerializer.class)
|
||||
private Instant time;
|
||||
|
||||
@ApiModelProperty("指标id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("指标名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("指标别名")
|
||||
private String otherName;
|
||||
|
||||
@ApiModelProperty("相别")
|
||||
private String phase;
|
||||
|
||||
@ApiModelProperty("单位")
|
||||
private String unit;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty("平均值")
|
||||
private Double avgValue;
|
||||
|
||||
@ApiModelProperty("A相值")
|
||||
private Double valueA;
|
||||
|
||||
@ApiModelProperty("B相值")
|
||||
private Double valueB;
|
||||
|
||||
@ApiModelProperty("C相值")
|
||||
private Double valueC;
|
||||
|
||||
@ApiModelProperty("无相值")
|
||||
private Double valueM;
|
||||
}
|
||||
@@ -107,7 +107,12 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<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>
|
||||
<groupId>com.baomidou</groupId>
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
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.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
import com.njcn.csharmonic.service.IDataService;
|
||||
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("/data")
|
||||
@Api(tags = "装置数据")
|
||||
@AllArgsConstructor
|
||||
public class DataController extends BaseController {
|
||||
|
||||
private final IDataService dataService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/realTimeData")
|
||||
@ApiOperation("设备监控-》准实时数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<RealTimeDataVo>> realTimeData(@RequestBody DataParam param) {
|
||||
String methodDescribe = getMethodDescribe("realTimeData");
|
||||
List<RealTimeDataVo> list = dataService.getRealTimeData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getTestData")
|
||||
@ApiOperation("设备监控-》测试项数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<RecordVo>> getTestData(@RequestBody DataParam param) {
|
||||
String methodDescribe = getMethodDescribe("getTestData");
|
||||
List<RecordVo> list = dataService.getTestData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
}
|
||||
@@ -74,12 +74,16 @@ public class OfflineDataUploadController extends BaseController {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping(value = "/makeUp")
|
||||
@ApiOperation("设备补招")
|
||||
@ApiOperation("设备补召")
|
||||
@ApiImplicitParam(name = "param", value = "补招参数", required = true)
|
||||
public HttpResult<String> makeUp(@RequestBody MakeUpParam param) {
|
||||
String methodDescribe = getMethodDescribe("makeUp");
|
||||
offlineDataUploadService.startMakeUpData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
boolean result = offlineDataUploadService.startMakeUpData(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "文件补召中,请稍后", methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "文件补召失败", methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ 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.service.RealDataService;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -33,6 +35,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
public class RealDataController extends BaseController {
|
||||
|
||||
private final RealDataService realDataService;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBaseRealData")
|
||||
@@ -41,6 +44,7 @@ public class RealDataController extends BaseController {
|
||||
public HttpResult<Boolean> getRealData(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("getRealData");
|
||||
boolean result = realDataService.getBaseRealData(lineId);
|
||||
redisUtil.saveByKeyWithExpire("rtDataUserId:"+lineId, RequestUtil.getUserIndex(),600L);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
@@ -57,6 +61,7 @@ public class RealDataController extends BaseController {
|
||||
})
|
||||
public HttpResult<Boolean> getHarmRealData(@RequestParam("lineId") String lineId, @RequestParam("target") Integer target) {
|
||||
String methodDescribe = getMethodDescribe("getHarmRealData");
|
||||
redisUtil.saveByKeyWithExpire("rtDataUserId:"+lineId, RequestUtil.getUserIndex(),600L);
|
||||
boolean result = realDataService.getHarmRealData(lineId,target);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, 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 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.NamedValue;
|
||||
import com.github.tocrhz.mqtt.annotation.Payload;
|
||||
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.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.FrequencyStatisticalQueryParam;
|
||||
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.TemperatureService;
|
||||
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.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.zlevent.api.FileFeignClient;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
@@ -44,7 +54,7 @@ import java.util.stream.Stream;
|
||||
public class MqttMessageHandler {
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
|
||||
private final FileCommonUtils fileCommonUtils;
|
||||
private final ILineTargetService lineTargetService;
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
private final StableDataService stableDataService;
|
||||
@@ -55,6 +65,13 @@ public class MqttMessageHandler {
|
||||
|
||||
private final DevCapacityFeignClient devCapacityFeignClient;
|
||||
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;
|
||||
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@@ -78,15 +95,118 @@ public class MqttMessageHandler {
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askDevData/{devId}",qos = 1)
|
||||
public void responseTopoData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
||||
String topoDataJson =redisUtil.getStringByKey (devId);
|
||||
// @MqttSubscribe(value = "/zl/askDevData/{devId}",qos = 1)
|
||||
// public void responseTopoData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
||||
// String topoDataJson =redisUtil.getStringByKey (devId);
|
||||
// if(StringUtils.isEmpty(topoDataJson)){
|
||||
// List<ThdDataVO> result = new ArrayList<>();
|
||||
// List<ThdDataVO> tempList = new ArrayList<>();
|
||||
//
|
||||
// //1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||
// List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("b934664f9592d1c5e92caa90695b7103").getData();
|
||||
// data.forEach(temp->{
|
||||
// if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
// FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||
// frequencyStatisticalQueryParam.setDevId(devId);
|
||||
// frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
// frequencyStatisticalQueryParam.setValueType("avg");
|
||||
// frequencyStatisticalQueryParam.setFrequencyStart(temp.getHarmStart());
|
||||
// frequencyStatisticalQueryParam.setFrequencyEnd(temp.getHarmEnd());
|
||||
// List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
|
||||
// tempList.addAll(thdDataVOList);
|
||||
//
|
||||
// }else {
|
||||
// CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
// commonStatisticalQueryParam.setDevId(devId);
|
||||
// commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
// commonStatisticalQueryParam.setValueType("avg");
|
||||
// List<ThdDataVO> listFuture= stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
// tempList.addAll(listFuture);
|
||||
// }
|
||||
//
|
||||
// });
|
||||
// //过滤M相
|
||||
// List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
// m.stream().forEach(temp->{
|
||||
// Stream.of("A","B","C").forEach(phase->{
|
||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
// BeanUtils.copyProperties(temp,thdDataVO);
|
||||
// thdDataVO.setPhase(phase);
|
||||
// result.add(thdDataVO);
|
||||
// });
|
||||
// });
|
||||
// List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||
// Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
// collect3.forEach((k,v)->{
|
||||
// if(!CollectionUtil.isEmpty(v)){
|
||||
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
// thdDataVO.setPhase("avg");
|
||||
// result.add(thdDataVO);
|
||||
// }
|
||||
// });
|
||||
// List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
||||
// Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
// collect2.forEach((k,v)->{
|
||||
// if(!CollectionUtil.isEmpty(v)){
|
||||
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
// thdDataVO.setPhase("avg");
|
||||
// result.add(thdDataVO);
|
||||
// }
|
||||
// });
|
||||
// List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
||||
// Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
// collect4.forEach((k,v)->{
|
||||
// if(!CollectionUtil.isEmpty(v)){
|
||||
// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
// thdDataVO.setPhase("avg");
|
||||
// result.add(thdDataVO);
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// Double capacity = devCapacityFeignClient.getDevCapacity(devId).getData();
|
||||
// apfRmsI.forEach(temp->{
|
||||
// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
// BeanUtils.copyProperties(temp,thdDataVO);
|
||||
// thdDataVO.setUnit("%");
|
||||
// thdDataVO.setStatisticalName("load_Rate");
|
||||
// thdDataVO.setAnotherName("负载率");
|
||||
// if (capacity<=0){
|
||||
// thdDataVO.setStatisticalData(3.1415926);
|
||||
// }else {
|
||||
// double v = temp.getStatisticalData()*100 / capacity;
|
||||
// thdDataVO.setStatisticalData(Double.valueOf(df.format(v)));
|
||||
// }
|
||||
// result.add(thdDataVO);
|
||||
// });
|
||||
// List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
// result.addAll(notM);
|
||||
// Gson gson = new Gson();
|
||||
// topoDataJson = gson.toJson(result);
|
||||
// redisUtil.saveByKeyWithExpire(devId, (Object) topoDataJson, 30L);
|
||||
// }
|
||||
// publisher.send("/zl/devData/"+devId,topoDataJson,1,false);
|
||||
// }
|
||||
/**
|
||||
* 实时数据应答
|
||||
*/
|
||||
@MqttSubscribe(value = "/zl/askDevData/{devId}/{typeId}",qos = 1)
|
||||
public void responseTopoDataByType(String topic, @NamedValue("devId") String devId,@NamedValue("typeId") String typeId, MqttMessage message, @Payload String payload) {
|
||||
String topoDataJson =redisUtil.getStringByKey (devId+"#"+typeId);
|
||||
if(StringUtils.isEmpty(topoDataJson)){
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
List<ThdDataVO> tempList = new ArrayList<>();
|
||||
|
||||
//1.查询拓扑图配置的指标:拓扑图扑图配置:7677f94c749dedaff30f911949cbd724
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("b934664f9592d1c5e92caa90695b7103").getData();
|
||||
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(typeId).getData();
|
||||
data.forEach(temp->{
|
||||
if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||
@@ -108,6 +228,7 @@ public class MqttMessageHandler {
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//过滤M相
|
||||
List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
m.stream().forEach(temp->{
|
||||
@@ -118,6 +239,8 @@ public class MqttMessageHandler {
|
||||
result.add(thdDataVO);
|
||||
});
|
||||
});
|
||||
//如果是基础数据则添加拓扑图的数据
|
||||
if(Objects.equals("fc8c86dbc3f2d9810f5cd8f53c295415",typeId)){
|
||||
List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||
Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
collect3.forEach((k,v)->{
|
||||
@@ -170,141 +293,18 @@ public class MqttMessageHandler {
|
||||
}
|
||||
result.add(thdDataVO);
|
||||
});
|
||||
}
|
||||
|
||||
List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
result.addAll(notM);
|
||||
Gson gson = new Gson();
|
||||
topoDataJson = gson.toJson(result);
|
||||
redisUtil.saveByKeyWithExpire(devId, (Object) topoDataJson, 30L);
|
||||
redisUtil.saveByKeyWithExpire(devId+"#"+typeId, (Object) topoDataJson, 30L);
|
||||
}
|
||||
publisher.send("/zl/devData/"+devId,topoDataJson,1,false);
|
||||
publisher.send("/zl/devData/"+devId+"/"+typeId,topoDataJson,1,false);
|
||||
}
|
||||
|
||||
|
||||
// @MqttSubscribe(value = "/zl/askDvrData/{devId}",qos = 1)
|
||||
// public void responseDvrData(String topic, @NamedValue("devId") String devId, MqttMessage message, @Payload String payload) {
|
||||
// String topoDataJson =redisUtil.getStringByKey (devId+"DVR");
|
||||
// if(StringUtils.isEmpty(topoDataJson)){
|
||||
// List<ThdDataVO> result = new ArrayList<>();
|
||||
// List<ThdDataVO> tempList = new ArrayList<>();
|
||||
//
|
||||
//
|
||||
// //1.查询DVR配置的指标:DVR配置:9fc1de386b623a1339977e168a23ad97
|
||||
// List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect("9fc1de386b623a1339977e168a23ad97").getData();
|
||||
// data.forEach(temp->{
|
||||
// if(Objects.nonNull(temp.getHarmStart())&&Objects.nonNull(temp.getHarmEnd())){
|
||||
//
|
||||
// FrequencyStatisticalQueryParam frequencyStatisticalQueryParam = new FrequencyStatisticalQueryParam();
|
||||
// frequencyStatisticalQueryParam.setDevId(devId);
|
||||
// frequencyStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
// frequencyStatisticalQueryParam.setValueType("avg");
|
||||
// frequencyStatisticalQueryParam.setFrequencyStart(temp.getHarmStart());
|
||||
// frequencyStatisticalQueryParam.setFrequencyEnd(temp.getHarmEnd());
|
||||
// List<ThdDataVO> thdDataVOList = stableDataService.QuerySqlData(frequencyStatisticalQueryParam);
|
||||
// tempList.addAll(thdDataVOList);
|
||||
//
|
||||
// }else {
|
||||
// CommonStatisticalQueryParam commonStatisticalQueryParam = new CommonStatisticalQueryParam();
|
||||
// commonStatisticalQueryParam.setDevId(devId);
|
||||
// commonStatisticalQueryParam.setStatisticalId(temp.getId());
|
||||
// commonStatisticalQueryParam.setValueType("avg");
|
||||
// List<ThdDataVO> listFuture= stableDataService.queryFisrtCommonStatistical(commonStatisticalQueryParam);
|
||||
// tempList.addAll(listFuture);
|
||||
// }
|
||||
//
|
||||
// });
|
||||
//
|
||||
// //过滤M相
|
||||
//// List<ThdDataVO> m = tempList.stream().filter(temp -> Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
//// m.stream().forEach(temp->{
|
||||
//// Stream.of("A","B","C").forEach(phase->{
|
||||
//// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
//// BeanUtils.copyProperties(temp,thdDataVO);
|
||||
//// thdDataVO.setPhase(phase);
|
||||
//// result.add(thdDataVO);
|
||||
//// });
|
||||
//// });
|
||||
//// //过滤谐波电流,谐波电压畸变率求平均值
|
||||
//// List<ThdDataVO> thdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdU(%)")).collect(Collectors.toList());
|
||||
//// Map<String, List<ThdDataVO>> collect = thdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
//// collect.forEach((k,v)->{
|
||||
//// if(!CollectionUtil.isEmpty(v)){
|
||||
//// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
//// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
//// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
//// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
//// thdDataVO.setPhase("avg");
|
||||
//// result.add(thdDataVO);
|
||||
////
|
||||
//// }
|
||||
//// });
|
||||
////
|
||||
//// List<ThdDataVO> thdV = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Pq_ThdI(%)")).collect(Collectors.toList());
|
||||
//// Map<String, List<ThdDataVO>> collect1 = thdV.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
//// collect1.forEach((k,v)->{
|
||||
//// if(!CollectionUtil.isEmpty(v)){
|
||||
//// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
//// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
//// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
//// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
//// thdDataVO.setPhase("avg");
|
||||
//// result.add(thdDataVO);
|
||||
////
|
||||
//// }
|
||||
//// });
|
||||
//// List<ThdDataVO> apfThdI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Load(%)")).collect(Collectors.toList());
|
||||
//// Map<String, List<ThdDataVO>> collect3 = apfThdI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
//// collect3.forEach((k,v)->{
|
||||
//// if(!CollectionUtil.isEmpty(v)){
|
||||
//// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
//// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
//// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
//// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
//// thdDataVO.setPhase("avg");
|
||||
//// result.add(thdDataVO);
|
||||
////
|
||||
//// }
|
||||
//// });
|
||||
//// List<ThdDataVO> apfRmsI = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_RmsI_TolOut(A)")).collect(Collectors.toList());
|
||||
//// Map<String, List<ThdDataVO>> collect2 = apfRmsI.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
//// collect2.forEach((k,v)->{
|
||||
//// if(!CollectionUtil.isEmpty(v)){
|
||||
//// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
//// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
//// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
//// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
//// thdDataVO.setPhase("avg");
|
||||
//// result.add(thdDataVO);
|
||||
////
|
||||
//// }
|
||||
//// });
|
||||
//// List<ThdDataVO> apfThdISys = tempList.stream().filter(temp -> Objects.equals(temp.getStatisticalName(), "Apf_ThdA_Sys(%)")).collect(Collectors.toList());
|
||||
//// Map<String, List<ThdDataVO>> collect4 = apfThdISys.stream().collect(Collectors.groupingBy(ThdDataVO::getLineId));
|
||||
//// collect4.forEach((k,v)->{
|
||||
//// if(!CollectionUtil.isEmpty(v)){
|
||||
//// double asDouble = v.stream().mapToDouble(ThdDataVO::getStatisticalData).average().getAsDouble();
|
||||
//// ThdDataVO thdDataVO = new ThdDataVO();
|
||||
//// BeanUtils.copyProperties(v.get(0),thdDataVO);
|
||||
//// thdDataVO.setStatisticalData(Double.valueOf(df.format(asDouble)));
|
||||
//// thdDataVO.setPhase("avg");
|
||||
//// result.add(thdDataVO);
|
||||
////
|
||||
//// }
|
||||
//// });
|
||||
////
|
||||
//// List<ThdDataVO> notM = tempList.stream().filter(temp -> !Objects.equals(temp.getPhase(), "M")).collect(Collectors.toList());
|
||||
//
|
||||
// result.addAll(tempList);
|
||||
//
|
||||
//
|
||||
//
|
||||
// Gson gson = new Gson();
|
||||
// topoDataJson = gson.toJson(result);
|
||||
// redisUtil.saveByKeyWithExpire(devId+"DVR", (Object) topoDataJson,Long.valueOf(10*60));
|
||||
// }
|
||||
//
|
||||
//
|
||||
// publisher.send("/zl/DvrData/"+devId,topoDataJson,1,false);
|
||||
// }
|
||||
|
||||
public String getCldidName( String cldid) {
|
||||
|
||||
@@ -357,4 +357,14 @@ public class MqttMessageHandler {
|
||||
// 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,16 @@
|
||||
package com.njcn.csharmonic.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 数据集表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-31
|
||||
*/
|
||||
public interface CsDataSetMapper extends BaseMapper<CsDataSet> {
|
||||
|
||||
}
|
||||
@@ -121,9 +121,18 @@
|
||||
<select id="queryEventPageWeb" resultType="com.njcn.csharmonic.pojo.vo.EventDetailVO">
|
||||
select DISTINCT b.id id,
|
||||
b.device_id deviceId,b.line_id lineId,b.code code,
|
||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location,d.name lineName
|
||||
from cs_event b inner join cs_equipment_delivery c on b.device_id=c.id inner join cs_line d on d.device_id=b.device_id and d.clDid=b.cl_did where 1=1
|
||||
b.start_time startTime,b.tag tag ,b.wave_path wavePath,b.instant_pics,b.rms_pics , b.type type,b.level level,b.location location
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
||||
,d.name lineName
|
||||
</if>
|
||||
from cs_event b
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
||||
inner join cs_equipment_delivery c on b.device_id=c.id inner join cs_line d on d.device_id=b.device_id and d.clDid=b.cl_did
|
||||
</if>
|
||||
where 1=1
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
||||
and b.process=c.process
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.endTime != null and csEventUserQueryPage.endTime !=''">
|
||||
AND DATE(b.start_time) <= DATE(#{csEventUserQueryPage.endTime})
|
||||
</if>
|
||||
@@ -142,8 +151,14 @@
|
||||
#{item}
|
||||
</foreach>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != null and csEventUserQueryPage.type !=''">
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type == 3 ">
|
||||
AND b.type in(2,3)
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.type != 3 ">
|
||||
AND b.type =#{ csEventUserQueryPage.type}
|
||||
</if>
|
||||
|
||||
</if>
|
||||
<if test="csEventUserQueryPage!=null and csEventUserQueryPage.level != null and csEventUserQueryPage.level !=''">
|
||||
AND b.level =#{ csEventUserQueryPage.level}
|
||||
</if>
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.csharmonic.service;
|
||||
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xuyang
|
||||
*/
|
||||
public interface IDataService {
|
||||
|
||||
/**
|
||||
* 获取设备准实时数据
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
List<RealTimeDataVo> getRealTimeData(DataParam param);
|
||||
|
||||
/**
|
||||
* 获取监测点测试项信息
|
||||
*/
|
||||
List<RecordVo> getTestData(DataParam param);
|
||||
|
||||
}
|
||||
@@ -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文件,区分暂态、稳态,存储离线文件的方式,调用黄正剑的离线数据补招功能
|
||||
* @return
|
||||
*/
|
||||
void startMakeUpData(MakeUpParam param);
|
||||
boolean startMakeUpData(MakeUpParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,238 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.mapper.CsDataSetMapper;
|
||||
import com.njcn.csharmonic.param.DataParam;
|
||||
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||
import com.njcn.csharmonic.service.IDataService;
|
||||
import com.njcn.csharmonic.util.InfluxDbParamUtil;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/6/1 10:11
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class DataServiceImpl implements IDataService {
|
||||
|
||||
private final CommonService commonService;
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
private final WlRecordFeignClient wlRecordFeignClient;
|
||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||
|
||||
@Override
|
||||
public List<RealTimeDataVo> getRealTimeData(DataParam param) {
|
||||
List<RealTimeDataVo> result = new ArrayList<>();
|
||||
//获取监测点使用的数据集
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(param.getLineId())).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
||||
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
||||
//根据类型id获取指标分组
|
||||
List<DictTreeVO> dictTreeVOList = dictTreeFeignClient.query(param.getTargetType()).getData();
|
||||
if (CollUtil.isNotEmpty(dictTreeVOList)) {
|
||||
dictTreeVOList = dictTreeVOList.stream().sorted(Comparator.comparing(DictTreeVO::getSort)).collect(Collectors.toList());
|
||||
//根据分组获取对应指标
|
||||
List<RealTimeDataVo> finalResult = result;
|
||||
dictTreeVOList.forEach(item->{
|
||||
List<EleEpdPqd> epdPqdList = csStatisticalSetFeignClient.queryStatisticalSelect(item.getId()).getData();
|
||||
epdPqdList.forEach(item2->{
|
||||
if (Objects.isNull(item2.getHarmStart())) {
|
||||
RealTimeDataVo vo = getBaseData(item2,param.getLineId(),param.getDataLevel(),csDataSet.getDataLevel(),pt,ct);
|
||||
if (Objects.nonNull(vo)) {
|
||||
finalResult.add(vo);
|
||||
}
|
||||
} else if (Objects.equals(item2.getHarmStart(),2)) {
|
||||
List<RealTimeDataVo> harmList = getHarmData(item2,param.getLineId());
|
||||
finalResult.addAll(harmList);
|
||||
} else if (Objects.equals(item2.getHarmStart(),1)) {
|
||||
List<RealTimeDataVo> inuharmList = getInuHarmData(item2,param.getLineId());
|
||||
finalResult.addAll(inuharmList);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
result = channelData(result);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<RecordVo> getTestData(DataParam param) {
|
||||
WlRecordParam.lineRecord record = new WlRecordParam.lineRecord();
|
||||
record.setLineId(param.getLineId());
|
||||
String beginDay = LocalDateTimeUtil.format(LocalDateTimeUtil.beginOfDay(LocalDateTimeUtil.parse(param.getStartTime(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
String endDay = LocalDateTimeUtil.format(LocalDateTimeUtil.endOfDay(LocalDateTimeUtil.parse(param.getEndTime(), DatePattern.NORM_DATE_PATTERN)),DatePattern.NORM_DATETIME_PATTERN);
|
||||
record.setItemStartTime(beginDay);
|
||||
record.setItemEndTime(endDay);
|
||||
return wlRecordFeignClient.findDevBaseDataByLineId(record).getData();
|
||||
}
|
||||
|
||||
//基础数据
|
||||
public RealTimeDataVo getBaseData(EleEpdPqd item2, String lineId, String dataLevel, String csDataSetLevel,Double pt, Double ct) {
|
||||
RealTimeDataVo vo = new RealTimeDataVo();
|
||||
String unit;
|
||||
double re;
|
||||
vo.setId(item2.getId());
|
||||
vo.setName(item2.getName());
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(item2.getClassId()),item2.getName(),item2.getPhase(),"avg",influxDbParamUtil.getClDidByLineId(lineId));
|
||||
if (Objects.nonNull(statisticalDataDTO)) {
|
||||
vo.setTime(statisticalDataDTO.getTime());
|
||||
vo.setAvgValue(statisticalDataDTO.getValue());
|
||||
}
|
||||
vo.setPhase(item2.getPhase());
|
||||
vo.setOtherName(item2.getShowName());
|
||||
vo.setSort(item2.getSort());
|
||||
if (Objects.equals("Primary",dataLevel)) {
|
||||
if (Objects.equals("Primary",csDataSetLevel)) {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
unit = item2.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
||||
if (Objects.isNull(statisticalDataDTO)) {
|
||||
vo.setAvgValue(3.14159);
|
||||
} else {
|
||||
re = DataChangeUtil.secondaryToPrimary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct) / 1000;
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
}
|
||||
unit = "k" + item2.getUnit();
|
||||
} else {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
unit = item2.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Objects.equals("Primary",csDataSetLevel)) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
||||
if (Objects.isNull(statisticalDataDTO)) {
|
||||
vo.setAvgValue(3.14159);
|
||||
} else {
|
||||
re = DataChangeUtil.primaryToSecondary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct);
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
}
|
||||
} else {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
}
|
||||
} else {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
}
|
||||
unit = item2.getUnit();
|
||||
}
|
||||
vo.setUnit(unit);
|
||||
if (Objects.nonNull(unit)) {
|
||||
vo.setOtherName(item2.getShowName() + "(" + unit + ")");
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
//谐波数据
|
||||
public List<RealTimeDataVo> getHarmData(EleEpdPqd item2, String lineId) {
|
||||
List<RealTimeDataVo> list = new ArrayList<>();
|
||||
for (int i = item2.getHarmStart(); i <= item2.getHarmEnd(); i++) {
|
||||
RealTimeDataVo vo = new RealTimeDataVo();
|
||||
vo.setId(item2.getId());
|
||||
vo.setName(item2.getName().concat("_").concat(Integer.toString(i)));
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(item2.getClassId()),item2.getName().concat("_").concat(Integer.toString(i)),item2.getPhase(),"avg",influxDbParamUtil.getClDidByLineId(lineId));
|
||||
if (Objects.isNull(statisticalDataDTO)) {
|
||||
vo.setAvgValue(3.14159);
|
||||
} else {
|
||||
vo.setTime(statisticalDataDTO.getTime());
|
||||
vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue())));
|
||||
}
|
||||
vo.setPhase(item2.getPhase());
|
||||
vo.setOtherName(i + "次" + "(" + item2.getUnit() + ")");
|
||||
vo.setSort(item2.getSort());
|
||||
vo.setUnit(item2.getUnit());
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//间谐波数据
|
||||
public List<RealTimeDataVo> getInuHarmData(EleEpdPqd item2, String lineId) {
|
||||
List<RealTimeDataVo> list = new ArrayList<>();
|
||||
for (int i = item2.getHarmStart(); i <= item2.getHarmEnd(); i++) {
|
||||
RealTimeDataVo vo = new RealTimeDataVo();
|
||||
vo.setId(item2.getId());
|
||||
vo.setName(item2.getName().concat("_").concat(Integer.toString(i)));
|
||||
StatisticalDataDTO statisticalDataDTO = commonService.getLineRtData(lineId,influxDbParamUtil.getTableNameByClassId(item2.getClassId()),item2.getName().concat("_").concat(Integer.toString(i)),item2.getPhase(),"avg",influxDbParamUtil.getClDidByLineId(lineId));
|
||||
if (Objects.isNull(statisticalDataDTO)) {
|
||||
vo.setAvgValue(3.14159);
|
||||
} else {
|
||||
vo.setTime(statisticalDataDTO.getTime());
|
||||
vo.setAvgValue(Double.valueOf(df.format(statisticalDataDTO.getValue())));
|
||||
}
|
||||
vo.setPhase(item2.getPhase());
|
||||
vo.setOtherName((i-0.5) + "次" + "(" + item2.getUnit() + ")");
|
||||
vo.setSort(item2.getSort());
|
||||
vo.setUnit(item2.getUnit());
|
||||
list.add(vo);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
//数据格式处理
|
||||
public List<RealTimeDataVo> channelData(List<RealTimeDataVo> list) {
|
||||
List<RealTimeDataVo> result = new ArrayList<>();
|
||||
//将list 排序,并按照排序后的结果进行有序分组
|
||||
LinkedHashMap<String, List<RealTimeDataVo>> map = list.stream().sorted(Comparator.comparing(RealTimeDataVo::getSort)).collect(Collectors.groupingBy(RealTimeDataVo::getName, LinkedHashMap::new, Collectors.toList()));
|
||||
map.forEach((k,v)->{
|
||||
RealTimeDataVo vo = new RealTimeDataVo();
|
||||
RealTimeDataVo vo1 = v.get(0);
|
||||
BeanUtils.copyProperties(vo1,vo);
|
||||
RealTimeDataVo phaseA = v.stream().filter(s->Objects.equals(s.getPhase(),"A") || Objects.equals(s.getPhase(),"AB")).findFirst().orElse(null);
|
||||
if (Objects.nonNull(phaseA)) {
|
||||
vo.setValueA(phaseA.getAvgValue());
|
||||
}
|
||||
RealTimeDataVo phaseB = v.stream().filter(s->Objects.equals(s.getPhase(),"B") || Objects.equals(s.getPhase(),"BC")).findFirst().orElse(null);
|
||||
if (Objects.nonNull(phaseB)) {
|
||||
vo.setValueB(phaseB.getAvgValue());
|
||||
}
|
||||
RealTimeDataVo phaseC = v.stream().filter(s->Objects.equals(s.getPhase(),"C") || Objects.equals(s.getPhase(),"CA")).findFirst().orElse(null);
|
||||
if (Objects.nonNull(phaseC)) {
|
||||
vo.setValueC(phaseC.getAvgValue());
|
||||
}
|
||||
RealTimeDataVo phaseM = v.stream().filter(s->Objects.equals(s.getPhase(),"M")).findFirst().orElse(null);
|
||||
if (Objects.nonNull(phaseM)) {
|
||||
vo.setValueM(phaseM.getAvgValue());
|
||||
}
|
||||
vo.setPhase("/");
|
||||
vo.setAvgValue(null);
|
||||
result.add(vo);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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.mincfg.AnalyseComtradeCfg;
|
||||
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.param.MakeUpParam;
|
||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||
@@ -49,7 +50,9 @@ import java.time.LocalDate;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
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 static com.njcn.access.enums.TypeEnum.DATA_48;
|
||||
@@ -216,11 +219,11 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startMakeUpData(MakeUpParam param) {
|
||||
public boolean startMakeUpData(MakeUpParam param) {
|
||||
boolean result = false;
|
||||
List<String> fileList = new ArrayList<>();
|
||||
Map<String,List<String>> map = new HashMap<>();
|
||||
//组装文件路径
|
||||
for (String s : param.getProList()) {
|
||||
//fixme 这边补召暂不支持多工程补召,防止下载文件时间过长,会出问题。
|
||||
String s = param.getProList().get(0);
|
||||
//稳态补招
|
||||
if (param.getDataTypeList().contains(0)) {
|
||||
String minPath = s + "/min";
|
||||
@@ -263,51 +266,134 @@ public class OfflineDataUploadServiceImpl implements OfflineDataUploadService {
|
||||
if (CollectionUtil.isNotEmpty(fileList)) {
|
||||
//添加record.bin文件
|
||||
fileList.add(s + "/record.bin");
|
||||
map.put(s,fileList);
|
||||
}
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(map)) {
|
||||
List<String> keyList = new ArrayList<>();
|
||||
//获取装置信息
|
||||
redisUtil.delete(AppRedisKey.MAKE_UP_FILES + param.getNDid());
|
||||
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);
|
||||
});
|
||||
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);
|
||||
result = true;
|
||||
} else {
|
||||
throw new BusinessException("装置内未找到原始文件!");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
// @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 +462,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);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取文件数据
|
||||
*/
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.njcn.csharmonic.service.impl;
|
||||
|
||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||
import com.njcn.access.utils.MqttUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.DataSetFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
@@ -23,12 +25,18 @@ public class RealDataServiceImpl implements RealDataService {
|
||||
private final DataSetFeignClient dataSetFeignClient;
|
||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||
private final RedisUtil redisUtil;
|
||||
private final MqttUtil mqttUtil;
|
||||
|
||||
@Override
|
||||
public boolean getBaseRealData(String lineId) {
|
||||
boolean result = true;
|
||||
try {
|
||||
String nDid = lineId.substring(0, lineId.length() - 1);
|
||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (!mqttClient) {
|
||||
throw new BusinessException("装置离线");
|
||||
}
|
||||
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
|
||||
//获取装置所用模板
|
||||
CsLinePO po = csLineFeignClient.getById(lineId).getData();
|
||||
@@ -46,8 +54,8 @@ public class RealDataServiceImpl implements RealDataService {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@@ -57,6 +65,11 @@ public class RealDataServiceImpl implements RealDataService {
|
||||
boolean result = true;
|
||||
try {
|
||||
String nDid = lineId.substring(0, lineId.length() - 1);
|
||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (!mqttClient) {
|
||||
throw new BusinessException("装置离线");
|
||||
}
|
||||
Integer clDid = Integer.parseInt(lineId.substring(lineId.length() - 1));
|
||||
//获取装置所用模板
|
||||
CsLinePO po = csLineFeignClient.getById(lineId).getData();
|
||||
@@ -75,8 +88,8 @@ public class RealDataServiceImpl implements RealDataService {
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,9 @@ package com.njcn.csreport.job;
|
||||
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import com.github.jeffreyning.mybatisplus.service.IMppService;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.utils.HarmonicTimesUtil;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
@@ -73,7 +75,11 @@ public class ReportCovertJob {
|
||||
*/
|
||||
@Scheduled(cron = "0 0 1 * * ? ")
|
||||
public void executeEvent() throws ClassNotFoundException {
|
||||
LocalDate today = LocalDate.now().minusDays(3);
|
||||
DateTimeFormatter formatter1 = DateTimeFormatter.ISO_DATE;
|
||||
// 获取当前日期
|
||||
LocalDate today = LocalDate.now();
|
||||
|
||||
|
||||
// 计算前一天的日期
|
||||
LocalDate yesterday = today.minusDays(1);
|
||||
// 获取前一天的开始时间(00:00:00)
|
||||
@@ -121,7 +127,9 @@ public class ReportCovertJob {
|
||||
collect.forEach((tempPhase,byNameMap)->{
|
||||
//最小值
|
||||
InfluxQueryWrapper influxQueryWrapperMin = new InfluxQueryWrapper(PqdData.class, clazz);
|
||||
influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
influxQueryWrapperMin.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "min")
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
|
||||
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
|
||||
|
||||
byNameMap.forEach((name, eleEpdPqdList) -> {
|
||||
@@ -150,7 +158,9 @@ public class ReportCovertJob {
|
||||
|
||||
//最大值
|
||||
InfluxQueryWrapper influxQueryWrapperMax = new InfluxQueryWrapper(PqdData.class, clazz);
|
||||
influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
influxQueryWrapperMax.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "max")
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
|
||||
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
|
||||
|
||||
byNameMap.forEach((name, eleEpdPqdList) -> {
|
||||
@@ -178,7 +188,9 @@ public class ReportCovertJob {
|
||||
|
||||
//平均值
|
||||
InfluxQueryWrapper influxQueryWrapperAvg = new InfluxQueryWrapper(PqdData.class, clazz);
|
||||
influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
influxQueryWrapperAvg.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg")
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
|
||||
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
|
||||
byNameMap.forEach((name, eleEpdPqdList) -> {
|
||||
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
|
||||
@@ -206,7 +218,9 @@ public class ReportCovertJob {
|
||||
|
||||
//CP95
|
||||
InfluxQueryWrapper influxQueryWrapperCp95 = new InfluxQueryWrapper(PqdData.class, clazz);
|
||||
influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg").eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase).eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
influxQueryWrapperCp95.regular(PqdData::getLineId, lineIndex).eq(InfluxDBTableConstant.VALUE_TYPE, "avg")
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,tempPhase);
|
||||
// .eq(InfluxDBTableConstant.IS_ABNORMAL, 0);
|
||||
|
||||
byNameMap.forEach((name, eleEpdPqdList) -> {
|
||||
EleEpdPqd tempEleEpdPqd = eleEpdPqdList.get(0);
|
||||
@@ -304,6 +318,7 @@ public class ReportCovertJob {
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
public String getPhase( String phase) {
|
||||
@@ -329,4 +344,5 @@ public class ReportCovertJob {
|
||||
return "";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.cssystem.pojo.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class AppVersionParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("app版本信息")
|
||||
@NotBlank(message = "app版本信息不能为空")
|
||||
private String appVersion;
|
||||
|
||||
@ApiModelProperty("严重度(0:优化 1:bug调整)")
|
||||
@NotNull(message = "更新严重度不能为空")
|
||||
private Integer sev;
|
||||
|
||||
@ApiModelProperty("整改内容")
|
||||
private String content;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.njcn.cssystem.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
*
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("app_version")
|
||||
public class AppVersion extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* id
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* app版本名称
|
||||
*/
|
||||
private String versionName;
|
||||
|
||||
/**
|
||||
* 版本发布时间
|
||||
*/
|
||||
private LocalDateTime publishTime;
|
||||
|
||||
/**
|
||||
* 严重度(0:优化 1:bug调整)
|
||||
*/
|
||||
private Integer sev;
|
||||
|
||||
/**
|
||||
* 修改内容
|
||||
*/
|
||||
private String content;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package com.njcn.cssystem.pojo.vo;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class AppVersionVo implements Serializable {
|
||||
|
||||
@ApiModelProperty("app版本名称")
|
||||
private String versionName;
|
||||
|
||||
@ApiModelProperty("版本发布时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
private LocalDateTime publishTime;
|
||||
|
||||
@ApiModelProperty("严重度(0:优化 1:bug调整)")
|
||||
private Integer sev;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.njcn.cssystem.controller.baseinfo;
|
||||
|
||||
|
||||
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.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
import com.njcn.cssystem.service.IAppVersionService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@RequestMapping("/appVersion")
|
||||
@Api(tags = "app版本信息")
|
||||
@AllArgsConstructor
|
||||
public class AppVersionController extends BaseController {
|
||||
|
||||
private final IAppVersionService appVersionService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增app版本信息")
|
||||
@ApiImplicitParam(name = "param", value = "app版本信息", required = true)
|
||||
public HttpResult<String> add(@RequestBody @Validated AppVersionParam param){
|
||||
String methodDescribe = getMethodDescribe("add");
|
||||
boolean result = appVersionService.add(param);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "新增成功", methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "新增失败", methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLastData")
|
||||
@ApiOperation("查询app最新版本信息")
|
||||
public HttpResult<AppVersionVo> getLastData(){
|
||||
String methodDescribe = getMethodDescribe("getLastData");
|
||||
AppVersionVo vo = appVersionService.getLastData();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.cssystem.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
public interface AppVersionMapper extends BaseMapper<AppVersion> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.cssystem.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
public interface IAppVersionService extends IService<AppVersion> {
|
||||
|
||||
boolean add(AppVersionParam param);
|
||||
|
||||
AppVersionVo getLastData();
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.cssystem.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.cssystem.mapper.AppVersionMapper;
|
||||
import com.njcn.cssystem.pojo.param.AppVersionParam;
|
||||
import com.njcn.cssystem.pojo.po.AppVersion;
|
||||
import com.njcn.cssystem.pojo.vo.AppVersionVo;
|
||||
import com.njcn.cssystem.service.IAppVersionService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2024-11-21
|
||||
*/
|
||||
@Service
|
||||
public class AppVersionServiceImpl extends ServiceImpl<AppVersionMapper, AppVersion> implements IAppVersionService {
|
||||
|
||||
@Override
|
||||
public boolean add(AppVersionParam param) {
|
||||
AppVersion appVersion = new AppVersion();
|
||||
appVersion.setVersionName(param.getAppVersion());
|
||||
appVersion.setPublishTime(LocalDateTime.now());
|
||||
appVersion.setSev(param.getSev());
|
||||
appVersion.setContent(param.getContent());
|
||||
return this.save(appVersion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppVersionVo getLastData() {
|
||||
AppVersionVo vo = new AppVersionVo();
|
||||
LambdaQueryWrapper<AppVersion> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.orderByDesc(AppVersion::getPublishTime).last("limit 1");
|
||||
AppVersion appVersion = this.getOne(queryWrapper);
|
||||
if (Objects.nonNull(appVersion)) {
|
||||
BeanUtils.copyProperties(appVersion, vo);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user