Compare commits
85 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce861e1804 | ||
| 35d44dcc08 | |||
| c3d87eca34 | |||
| 86c6c95777 | |||
| f9d696faad | |||
| c325301a8f | |||
|
|
014370062a | ||
|
|
ada65fd40d | ||
|
|
a940d3961a | ||
|
|
4b7a60190c | ||
| c0be7629dd | |||
|
|
5f82f65b8f | ||
| 4e0b4b6b90 | |||
|
|
ca9193b861 | ||
|
|
469a4ba63e | ||
|
|
4316e72521 | ||
|
|
f942be74f1 | ||
| b750064b16 | |||
| b7c9cd2ee0 | |||
|
|
6cca1cc74d | ||
|
|
a83ab8b141 | ||
|
|
edc2453da2 | ||
| cbc301da5f | |||
| 4142de1fcf | |||
| 78b9a98ab8 | |||
|
|
5169669b2b | ||
|
|
10e0e96b65 | ||
| cd35e67007 | |||
| eb7a1d9beb | |||
|
|
3059f5ac75 | ||
|
|
346afef6d0 | ||
|
|
2cf47ec3b3 | ||
| 83199f07b6 | |||
|
|
8295801f16 | ||
| 306b426573 | |||
|
|
3a60a05ea2 | ||
| 86108004d5 | |||
| 5ef232a485 | |||
| 05112b5262 | |||
|
|
2ca4ee702b | ||
| c95c1271c2 | |||
|
|
105a5314cb | ||
| 867176d8a0 | |||
|
|
e6e6790ee2 | ||
| 6811d02f6b | |||
|
|
4745b86085 | ||
| d1574e43be | |||
| f13c8670cb | |||
| 162f39543e | |||
|
|
0cf9a45436 | ||
|
|
f9aa1d4f69 | ||
| 196de3a1d8 | |||
| 16551b2451 | |||
| d3f32fd396 | |||
| 35e521365d | |||
| e836d9bd07 | |||
| 509712b5b5 | |||
|
|
65afb4eddc | ||
| 86ad89d06c | |||
|
|
a6465911c4 | ||
|
|
aaa1f69ec2 | ||
| f86f18817d | |||
| 46a9922313 | |||
|
|
72807b6d13 | ||
|
|
87e67a4f23 | ||
| e0d5c3e52c | |||
|
|
73374c6b8d | ||
| 0a45b1303d | |||
| facaba6606 | |||
| d2bff5bb81 | |||
|
|
f5bc7e3c2c | ||
|
|
9821b30d94 | ||
| 5a6677ce3d | |||
| d54ec83d1c | |||
| d0aac0886a | |||
|
|
1402287fd5 | ||
| 2bc0f6f563 | |||
| e5067abdfb | |||
| 2d134809a0 | |||
| 7205d8a324 | |||
| 74a83d6f44 | |||
| 3d9acfe95b | |||
| 26e45ddbc5 | |||
| 67cbff33ef | |||
| ad0f7bc3fc |
@@ -112,7 +112,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>common-device-biz</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsCommTerminalFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/commTerminal", fallbackFactory = CsCommTerminalFeignClientFallbackFactory.class,contextId = "deviceUser")
|
||||
public interface CsCommTerminalFeignClient {
|
||||
|
||||
@GetMapping("lineUnitDetail")
|
||||
HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId);
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
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.RequestParam;
|
||||
@@ -18,7 +19,6 @@ import java.util.List;
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csline", fallbackFactory = CsLineClientFallbackFactory.class,contextId = "csline")
|
||||
public interface CsLineFeignClient {
|
||||
|
||||
|
||||
@PostMapping("/queryLineById")
|
||||
HttpResult<List<CsLinePO>> queryLineById(@RequestParam("ids") List<String> ids );
|
||||
|
||||
@@ -36,4 +36,10 @@ public interface CsLineFeignClient {
|
||||
|
||||
@PostMapping("/updateLine")
|
||||
HttpResult<String> updateLine(@RequestBody CsLineParam csLineParam);
|
||||
|
||||
@PostMapping("/updateIds")
|
||||
HttpResult<Boolean> updateIds(@RequestBody @Validated CsLineParam csLineParam);
|
||||
|
||||
@PostMapping("/getById")
|
||||
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsSoftInfoClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsSoftInfoPO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csSoftInfo", fallbackFactory = CsSoftInfoClientFallbackFactory.class,contextId = "csSoftInfo")
|
||||
public interface CsSoftInfoFeignClient {
|
||||
|
||||
@PostMapping("/findSoftInfo")
|
||||
HttpResult<CsSoftInfoPO> findSoftInfo(@RequestParam("id") String id);
|
||||
|
||||
@PostMapping("/saveSoftInfo")
|
||||
HttpResult<String> saveSoftInfo(@RequestBody CsSoftInfoPO po);
|
||||
|
||||
@PostMapping("/removeSoftInfo")
|
||||
HttpResult<String> removeSoftInfo(@RequestParam("id") String id);
|
||||
|
||||
}
|
||||
@@ -5,7 +5,6 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.DataArrayFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -22,13 +21,14 @@ import java.util.List;
|
||||
public interface DataArrayFeignClient {
|
||||
|
||||
@PostMapping("/getArrayBySet")
|
||||
HttpResult<List<CsDataArray>> getArrayBySet(@RequestBody List<CsDataSet> setList);
|
||||
HttpResult<List<CsDataArray>> getArrayBySet(@RequestParam("dataSet") String dataSet);
|
||||
|
||||
@PostMapping("/getDataArray")
|
||||
HttpResult<List<DataArrayTreeVO>> getDataArray(@RequestBody List<String> dataSetList);
|
||||
|
||||
@PostMapping("/getDataArrayById")
|
||||
HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name);
|
||||
|
||||
@PostMapping("/getDataArrayByIds")
|
||||
HttpResult<List<CsDataArray>> getDataArrayByIds(@RequestParam("ids") List<String> ids);
|
||||
|
||||
|
||||
@@ -1,12 +1,20 @@
|
||||
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.DataSetFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@@ -27,4 +35,16 @@ public interface DataSetFeignClient {
|
||||
@PostMapping("/getModuleDataSet")
|
||||
HttpResult<List<CsDataSet>> getModuleDataSet(@RequestParam("modelId") String modelId);
|
||||
|
||||
@PostMapping("/getDataSetBySetIds")
|
||||
HttpResult<List<CsDataSet>> getDataSetBySetIds(@RequestBody List<String> lineIds);
|
||||
|
||||
@PostMapping("/getBaseDataSet")
|
||||
HttpResult<CsDataSet> getBaseDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev);
|
||||
|
||||
@PostMapping("/getHarmonicDataSet")
|
||||
HttpResult<CsDataSet> getHarmonicDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev,@RequestParam("target") Integer target);
|
||||
|
||||
@PostMapping("/getDataSetByIdx")
|
||||
HttpResult<CsDataSet> getDataSetByIdx(@RequestParam("modelId") String modelId,@RequestParam("idx") Integer idx);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.DeviceFtpClientFallbackFactory;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/deviceFile", fallbackFactory = DeviceFtpClientFallbackFactory.class,contextId = "deviceFile")
|
||||
|
||||
public interface DeviceFtpFeignClient {
|
||||
|
||||
@PostMapping("/downloadFile")
|
||||
HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck);
|
||||
}
|
||||
@@ -1,11 +1,16 @@
|
||||
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;
|
||||
@@ -50,4 +55,10 @@ public interface EquipmentFeignClient {
|
||||
*/
|
||||
@PostMapping("/updateModuleNumber")
|
||||
HttpResult<String> updateModuleNumber(@RequestParam("nDid") String nDid,@RequestParam("number") Integer number);
|
||||
|
||||
@PostMapping("/getAll")
|
||||
HttpResult<List<CsEquipmentDeliveryPO>> getAll();
|
||||
|
||||
@PostMapping("/judgeDevModel")
|
||||
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.PortableOffLogFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.api.fallback.ProcessFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
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.RequestParam;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/portableOfflLog", fallbackFactory = PortableOffLogFeignClientFallbackFactory.class,contextId = "PortableOffLog")
|
||||
|
||||
public interface PortableOffLogFeignClient {
|
||||
|
||||
|
||||
|
||||
@PostMapping(value = "dataOnlineRecruitment")
|
||||
HttpResult<String> dataOnlineRecruitment(@RequestParam("devId") String devId
|
||||
, @RequestParam("lineId") String lineId, @RequestParam("path") String path);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
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 org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/wlRecord", fallbackFactory = WlRecordClientFallbackFactory.class,contextId = "wlRecord")
|
||||
|
||||
public interface WlRecordFeignClient {
|
||||
|
||||
/**
|
||||
* 新增原始数据
|
||||
*/
|
||||
@PostMapping("/addBaseData")
|
||||
HttpResult<Boolean> addBaseData(@RequestBody @Validated WlRecord wlRecord);
|
||||
|
||||
/**
|
||||
* 批量新增原始数据
|
||||
*/
|
||||
@PostMapping("/addBaseDataList")
|
||||
HttpResult<Boolean> addBaseDataList(@RequestBody @Validated List<WlRecord> wlRecord);
|
||||
|
||||
/**
|
||||
* 按条件查询设备基础数据
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/findDevBaseData")
|
||||
HttpResult<WlRecord> findDevBaseData(@RequestBody @Validated WlRecordParam.Record param);
|
||||
|
||||
@PostMapping("/updateTestRecord")
|
||||
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
||||
|
||||
|
||||
@GetMapping("/dayDealNoEndTimeEvent")
|
||||
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsCommTerminalFeignClientFallbackFactory implements FallbackFactory<CsCommTerminalFeignClient> {
|
||||
@Override
|
||||
public CsCommTerminalFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsCommTerminalFeignClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<PqsDeviceUnit> lineUnitDetail(String lineId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询分组",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,6 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsLineFeignClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> queryLineById(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询监测点详情异常",cause.toString());
|
||||
@@ -63,6 +62,18 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
log.error("{}异常,降级处理,异常为:{}","更新监测点信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> updateIds(CsLineParam csLineParam) {
|
||||
log.error("{}异常,降级处理,异常为:{}","修改监测点模板id和数据集id",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsLinePO> getById(String lineId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsSoftInfoFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsSoftInfoPO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsSoftInfoClientFallbackFactory implements FallbackFactory<CsSoftInfoFeignClient> {
|
||||
@Override
|
||||
public CsSoftInfoFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsSoftInfoFeignClient() {
|
||||
@Override
|
||||
public HttpResult<CsSoftInfoPO> findSoftInfo(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取装置软件信息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> saveSoftInfo(CsSoftInfoPO po) {
|
||||
log.error("{}异常,降级处理,异常为:{}","保存软件程序",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> removeSoftInfo(String id) {
|
||||
log.error("{}异常,降级处理,异常为:{}","删除软件程序",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.DataArrayFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
@@ -36,7 +35,7 @@ public class DataArrayFeignClientFallbackFactory implements FallbackFactory<Data
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DataArrayFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<CsDataArray>> getArrayBySet(List<CsDataSet> setList) {
|
||||
public HttpResult<List<CsDataArray>> getArrayBySet(String dataSet) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据数据集获取详细数据失败",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,30 @@ public class DataSetFeignClientFallbackFactory implements FallbackFactory<DataSe
|
||||
log.error("{}异常,降级处理,异常为:{}","获取子模块数据集",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsDataSet>> getDataSetBySetIds(List<String> lineIds) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据数据集ids获取数据集",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsDataSet> getBaseDataSet(String modelId, Integer clDev) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取实时数据-基础数据集",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsDataSet> getHarmonicDataSet(String modelId, Integer clDev, Integer target) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取实时数据-谐波数据集",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsDataSet> getDataSetByIdx(String modelId, Integer idx) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据idx获取数据集数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.DeviceFtpFeignClient;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class DeviceFtpClientFallbackFactory implements FallbackFactory<DeviceFtpFeignClient> {
|
||||
@Override
|
||||
public DeviceFtpFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> DeviceFtpFeignClient = exceptionEnum;
|
||||
return new DeviceFtpFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<String> downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
||||
log.error("{}异常,降级处理,异常为:{}","文件下载处理",cause.toString());
|
||||
throw new BusinessException(DeviceFtpFeignClient);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -71,6 +71,18 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
||||
log.error("{}异常,降级处理,异常为:{}","更新设备模块个数",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有装置",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> judgeDevModel(String nDid) {
|
||||
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.PortableOffLogFeignClient;
|
||||
import com.njcn.csdevice.api.ProcessFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentProcessPO;
|
||||
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 20:09
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class PortableOffLogFeignClientFallbackFactory implements FallbackFactory<PortableOffLogFeignClient> {
|
||||
@Override
|
||||
public PortableOffLogFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
exceptionEnum = CsDeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new PortableOffLogFeignClient() {
|
||||
|
||||
|
||||
@Override
|
||||
public HttpResult<String> dataOnlineRecruitment(String devId, String lineId, String path) {
|
||||
log.error("{}异常,降级处理,异常为:{}","线上补招",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFeignClient> {
|
||||
@Override
|
||||
public WlRecordFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new WlRecordFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> addBaseData(WlRecord wlRecord) {
|
||||
log.error("{}异常,降级处理,异常为:{}","新增原始数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> addBaseDataList(List<WlRecord> wlRecord) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量新增原始数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<WlRecord> findDevBaseData(WlRecordParam.Record param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询装置基础数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||
log.error("{}异常,降级处理,异常为:{}","修改测试项",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dayDealNoEndTimeEvent(String date) {
|
||||
log.error("{}异常,降级处理,异常为:{}","每日处理没有结束时间的测试基础数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -48,10 +48,21 @@ public interface DataParam {
|
||||
|
||||
String portableDev = "便携式设备";
|
||||
|
||||
String PORTABLE_SYSTEM = "便携式系统";
|
||||
|
||||
String WIRELESS_PROJECT = "无线项目";
|
||||
|
||||
String WIRELESS_PROJECT_ID = "WIRELESS_PROJECT_ID";
|
||||
|
||||
String governmentDev = "治理设备";
|
||||
|
||||
String GOVERNANCE_SYSTEM = "治理系统";
|
||||
|
||||
String EvtParamPhase = "Evt_Param_Phase";
|
||||
|
||||
String EvtParamDepth = "Evt_Param_VVaDepth";
|
||||
String EVTPARAMTM ="Evt_Param_Tm";
|
||||
|
||||
String evtData = "evt_data";
|
||||
|
||||
String wlRecordPath = "test/";
|
||||
|
||||
@@ -38,7 +38,16 @@ public enum AlgorithmResponseEnum {
|
||||
|
||||
DATA_ARRAY_MISSING("A00515","详细数据为空"),
|
||||
UNKNOW_ROLE("A00515","角色无权限操作"),
|
||||
DATA_MISSING("A00516","数据缺失")
|
||||
DATA_MISSING("A00516","数据缺失"),
|
||||
ASK_DEVICE_DIR_ROOT_ERROR("A00516","读取装置根目录异常"),
|
||||
ASK_DEVICE_DIR_ERROR("A00516","读取装置文件异常,请重试"),
|
||||
FILE_DOWNLOAD_ERROR("A00516","下载失败"),
|
||||
FILE_DOWNLOADING("A00516","下载失败,系统正在响应其他下载任务,请稍后重试"),
|
||||
FILE_UPLOADING("A00516","上传失败,系统正在响应其他上传任务,请稍后重试"),
|
||||
FILE_BUSY("A00516","正在进行其他文件操作,请稍后重试"),
|
||||
RECORD_FILE_LOST("A00516","record.bin文件缺失,请检查上传文件夹"),
|
||||
LINE_NUM_MISMATCH("A00516","上传文件的监测点序号和选择的监测点不匹配,请检查"),
|
||||
DEV_OFFLINE("A00516","装置未连接MQTT服务器"),
|
||||
;
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,118 @@
|
||||
package com.njcn.csdevice.pojo.dto;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 初始化模板实体
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class CsDevModelDto implements Serializable {
|
||||
|
||||
@ApiModelProperty("模板id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("版本号")
|
||||
private String versionNo;
|
||||
|
||||
@TableField("版本日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date versionDate;
|
||||
|
||||
@ApiModelProperty("模板名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("设备类型名称")
|
||||
private String devTypeName;
|
||||
|
||||
@ApiModelProperty("模板存储路径")
|
||||
private String filePath;
|
||||
|
||||
@ApiModelProperty("模板类型(0:治理类型 1:电能质量类型)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("数据集")
|
||||
private List<CsDataSet> dataSets;
|
||||
|
||||
@Data
|
||||
public static class CsDataSet implements Serializable {
|
||||
|
||||
@ApiModelProperty("数据集id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("模板id")
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty("数据集名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数据集别名")
|
||||
private String anotherName;
|
||||
|
||||
@ApiModelProperty("数据集编号")
|
||||
private Integer idx;
|
||||
|
||||
@ApiModelProperty("数据集类型")
|
||||
private String dataType;
|
||||
|
||||
@ApiModelProperty("统计周期")
|
||||
private Integer period;
|
||||
|
||||
@ApiModelProperty("是否存储 0:不存储 1:存储")
|
||||
private Integer storeFlag;
|
||||
|
||||
@ApiModelProperty("逻辑子设备")
|
||||
private Integer clDev;
|
||||
|
||||
@ApiModelProperty("数据集类型(0:主设备 1:子模块 2:监测设备)")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("数据类型(Primary:一次值 Secondary:二次值)")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty("数据类型")
|
||||
private List<CsDataArray> dataArrays;
|
||||
}
|
||||
|
||||
@Data
|
||||
public static class CsDataArray implements Serializable {
|
||||
|
||||
@ApiModelProperty("指标id")
|
||||
private String id;
|
||||
|
||||
@ApiModelProperty("数据集id")
|
||||
private String pid;
|
||||
|
||||
@ApiModelProperty("字典表id")
|
||||
private String dataId;
|
||||
|
||||
@ApiModelProperty("数据集名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty("数据集别名")
|
||||
private String anotherName;
|
||||
|
||||
@ApiModelProperty("数据集编号")
|
||||
private Integer idx;
|
||||
|
||||
@ApiModelProperty("数据统计方法(max、min、avg、cp95)")
|
||||
private String statMethod;
|
||||
|
||||
@ApiModelProperty("数据类型")
|
||||
private String dataType;
|
||||
|
||||
@ApiModelProperty("相别")
|
||||
private String phase;
|
||||
|
||||
@ApiModelProperty("排序")
|
||||
private Integer sort;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,9 +1,12 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -36,8 +39,9 @@ public class CsDevModelAddParm {
|
||||
/**
|
||||
* 版本日期
|
||||
*/
|
||||
@ApiModelProperty(value = "版本日期")
|
||||
private String time;
|
||||
@TableField(value = "version_date")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date versionDate;
|
||||
|
||||
/**
|
||||
* 装置模板文件路径
|
||||
|
||||
@@ -38,4 +38,14 @@ public class CsLineParam extends BaseEntity {
|
||||
*/
|
||||
private Integer conType;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String modelId;
|
||||
|
||||
/**
|
||||
* 数据集id
|
||||
*/
|
||||
private String dataSetId;
|
||||
|
||||
}
|
||||
@@ -3,6 +3,8 @@ package com.njcn.csdevice.pojo.param;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -16,7 +18,7 @@ import java.util.List;
|
||||
public class WlRecordParam {
|
||||
|
||||
@ApiModelProperty("方案名称")
|
||||
private String itemName;
|
||||
private String proName;
|
||||
|
||||
@ApiModelProperty("描述")
|
||||
private String describe;
|
||||
@@ -25,6 +27,18 @@ public class WlRecordParam {
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class Record extends WlRecordParam {
|
||||
|
||||
@ApiModelProperty("装置id")
|
||||
private String devId;
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("项目起始时间")
|
||||
private LocalDateTime proStartTime;
|
||||
|
||||
@ApiModelProperty("项目结束时间")
|
||||
private LocalDateTime proEndTime;
|
||||
|
||||
@ApiModelProperty("测试项名称")
|
||||
private String itemName;
|
||||
|
||||
|
||||
@@ -44,6 +44,16 @@ public class CsLinePO extends BaseEntity {
|
||||
@TableField(value = "`position`")
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 数据集id
|
||||
*/
|
||||
private String dataSetId;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String dataModelId;
|
||||
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统软件表
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-05-17
|
||||
*/
|
||||
@Data
|
||||
@TableName("cs_soft_info")
|
||||
public class CsSoftInfoPO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 读写操作属性:“r”
|
||||
*/
|
||||
private String opAttr;
|
||||
|
||||
/**
|
||||
* 操作系统名称,裸机系统填Null
|
||||
*/
|
||||
private String osName;
|
||||
|
||||
/**
|
||||
* 操作系统版本,裸机系统填Null
|
||||
*/
|
||||
private String osVersion;
|
||||
|
||||
/**
|
||||
* 应用程序版本号
|
||||
*/
|
||||
private String appVersion;
|
||||
|
||||
/**
|
||||
* 应用程序发布日期
|
||||
*/
|
||||
private LocalDateTime appDate;
|
||||
|
||||
/**
|
||||
* 应用程序校验码
|
||||
*/
|
||||
private String appCheck;
|
||||
|
||||
/**
|
||||
* 是否支持远程升级程序
|
||||
*/
|
||||
private String softUpdate;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/10/15 10:43【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@TableName(value = "portable_off_main_log")
|
||||
public class PortableOffMainLog extends BaseEntity {
|
||||
/**
|
||||
* 批次id
|
||||
*/
|
||||
@TableId(value = "id", type = IdType.INPUT)
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 导入开始时间
|
||||
*/
|
||||
@TableField(value = "start_time")
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
private LocalDateTime startTime;
|
||||
|
||||
/**
|
||||
* 工程名称
|
||||
*/
|
||||
@TableField(value = "project_name")
|
||||
private String projectName;
|
||||
|
||||
/**
|
||||
* 导入结束时间
|
||||
*/
|
||||
@JsonFormat(
|
||||
pattern = "yyyy-MM-dd HH:mm:ss"
|
||||
)
|
||||
@TableField(value = "end_time")
|
||||
private LocalDateTime endTime;
|
||||
|
||||
/**
|
||||
* 成功解析数
|
||||
*/
|
||||
@TableField(value = "success_count")
|
||||
private Integer successCount;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
@TableField(value = "status")
|
||||
private String status;
|
||||
|
||||
@TableField(exist = false)
|
||||
private List<PortableOfflLog> portableOfflLogList;
|
||||
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
@@ -21,6 +22,8 @@ public class PortableOfflLog extends BaseEntity {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String logsIndex;
|
||||
@TableField( value = "log_main_id")
|
||||
private String logMainId;
|
||||
|
||||
/**
|
||||
* 文件名称
|
||||
@@ -38,7 +41,7 @@ public class PortableOfflLog extends BaseEntity {
|
||||
private String dataPath;
|
||||
|
||||
/**
|
||||
* 0-未解析 1-解析成功 2-解析失败 3-文件不存在
|
||||
* 0-无需解析解析 1-解析成功 2-解析失败 3-文件不存在
|
||||
*/
|
||||
private Integer state;
|
||||
|
||||
|
||||
@@ -145,4 +145,9 @@ public class WlRecord extends BaseEntity {
|
||||
@TableField(value = "`describe`")
|
||||
private String describe;
|
||||
|
||||
/**
|
||||
* 工程路径
|
||||
*/
|
||||
private String gcDataPath;
|
||||
|
||||
}
|
||||
|
||||
@@ -48,8 +48,8 @@ public class CsDevModelPageVO extends BaseEntity {
|
||||
* 版本日期
|
||||
*/
|
||||
@ApiModelProperty(value = "版本日期")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private Date versionDate;
|
||||
|
||||
/**
|
||||
|
||||
@@ -42,6 +42,12 @@ public class CsLedgerVO implements Serializable {
|
||||
@ApiModelProperty(name = "comFlag",value = "设备状态")
|
||||
private Integer comFlag;
|
||||
|
||||
@ApiModelProperty(name = "nDid",value = "nDid")
|
||||
private String nDId;
|
||||
|
||||
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子节点")
|
||||
private List<CsLedgerVO> children = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -20,9 +20,6 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("事件ID")
|
||||
private String eventId;
|
||||
|
||||
@ApiModelProperty("变电站名称")
|
||||
private String subName;
|
||||
|
||||
@ApiModelProperty("监测点ID")
|
||||
private String lineId;
|
||||
|
||||
@@ -39,7 +36,7 @@ public class DataGroupEventVO {
|
||||
private String itemName;
|
||||
|
||||
@ApiModelProperty("持续时间")
|
||||
private Double duration;
|
||||
private Double persistTime;
|
||||
|
||||
@ApiModelProperty("发生时刻")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss.SSS")
|
||||
@@ -56,4 +53,7 @@ public class DataGroupEventVO {
|
||||
@ApiModelProperty("暂降幅值")
|
||||
private Float featureAmplitude;
|
||||
|
||||
@ApiModelProperty("波形路径")
|
||||
private String wavePath;
|
||||
|
||||
}
|
||||
|
||||
@@ -42,6 +42,16 @@ public class DeviceManagerVO {
|
||||
@ApiModelProperty(value = "装置数据标识")
|
||||
private String dataLevel;
|
||||
|
||||
@ApiModelProperty(value = "应用程序版本号")
|
||||
private String appVersion;
|
||||
|
||||
@ApiModelProperty(value = "应用程序发布日期")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
private LocalDateTime appDate;
|
||||
|
||||
@ApiModelProperty(value = "应用程序校验码")
|
||||
private String appCheck;
|
||||
|
||||
@Data
|
||||
public static class DataSetVO {
|
||||
@ApiModelProperty(value = "数据集Id")
|
||||
|
||||
@@ -66,6 +66,9 @@ public class RecordVo {
|
||||
@ApiModelProperty("电压接线方式")
|
||||
private String volConType;
|
||||
|
||||
@ApiModelProperty("基础数据集合ID")
|
||||
private List<String> list;
|
||||
|
||||
@Data
|
||||
public static class RecordItemVo{
|
||||
|
||||
|
||||
@@ -1,12 +1,15 @@
|
||||
package com.njcn.csdevice.utils;
|
||||
|
||||
/**
|
||||
* 类的介绍:用来将二次值转成一次值
|
||||
* 类的介绍:
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
*/
|
||||
public class DataChangeUtil {
|
||||
|
||||
/**
|
||||
* 用来将二次值转成一次值
|
||||
*/
|
||||
public static double secondaryToPrimary(String formula, Double data,Double pt, Double ct) {
|
||||
switch (formula) {
|
||||
case "*PT":
|
||||
@@ -23,4 +26,24 @@ public class DataChangeUtil {
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用来将一次值转成二次值
|
||||
*/
|
||||
public static double primaryToSecondary(String formula, Double data,Double pt, Double ct) {
|
||||
switch (formula) {
|
||||
case "*PT":
|
||||
data = data / pt;
|
||||
break;
|
||||
case "*CT":
|
||||
data = data / ct;
|
||||
break;
|
||||
case "*PT*CT":
|
||||
data = data / pt / ct;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -154,13 +154,17 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<artifactId>access-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -16,10 +16,7 @@ import io.swagger.annotations.ApiImplicitParams;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -76,5 +73,55 @@ public class CsDataSetController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDataSetBySetIds")
|
||||
@ApiOperation("根据测点获取数据集")
|
||||
@ApiImplicitParam(name = "lineIds", value = "监测点ids", required = true)
|
||||
public HttpResult<List<CsDataSet>> getDataSetBySetIds(@RequestBody List<String> lineIds){
|
||||
String methodDescribe = getMethodDescribe("getDataSetBySetIds");
|
||||
List<CsDataSet> list = csDataSetService.getDataSetBySetIds(lineIds);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getBaseDataSet")
|
||||
@ApiOperation("获取实时数据-基础数据集")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
|
||||
@ApiImplicitParam(name = "clDev", value = "逻辑子设备标识", required = true)
|
||||
})
|
||||
public HttpResult<CsDataSet> getBaseDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev){
|
||||
String methodDescribe = getMethodDescribe("getBaseDataSet");
|
||||
CsDataSet dataSet = csDataSetService.getBaseDataSet(modelId,clDev);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataSet, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getHarmonicDataSet")
|
||||
@ApiOperation("获取实时数据-谐波数据集")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
|
||||
@ApiImplicitParam(name = "clDev", value = "逻辑子设备标识", required = true),
|
||||
@ApiImplicitParam(name = "target", value = "指标序号", required = true),
|
||||
})
|
||||
public HttpResult<CsDataSet> getHarmonicDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev,@RequestParam("target") Integer target){
|
||||
String methodDescribe = getMethodDescribe("getHarmonicDataSet");
|
||||
CsDataSet dataSet = csDataSetService.getHarmonicDataSet(modelId,clDev,target);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, dataSet, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDataSetByIdx")
|
||||
@ApiOperation("根据idx获取数据集数据")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
|
||||
@ApiImplicitParam(name = "idx", value = "数据集序号", required = true)
|
||||
})
|
||||
public HttpResult<CsDataSet> getDataSetByIdx(@RequestParam("modelId") String modelId,@RequestParam("idx") Integer idx){
|
||||
String methodDescribe = getMethodDescribe("getDataSetByIdx");
|
||||
CsDataSet csDataSet = csDataSetService.getDataSetByIdx(modelId,idx);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDataSet, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -56,9 +56,10 @@ public class CsLogController extends BaseController {
|
||||
@ApiOperation("查询日志")
|
||||
@ApiImplicitParam(name = "baseParam", value = "查询日志参数", required = true)
|
||||
public HttpResult<IPage<CsLogsPO>> queryLog(@RequestBody BaseParam baseParam){
|
||||
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
|
||||
String methodDescribe = getMethodDescribe("queryLog");
|
||||
|
||||
IPage<CsLogsPO> list = csLogsPOService.queryPage(baseParam);
|
||||
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
|
||||
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.mapper.CsSoftInfoMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsSoftInfoPO;
|
||||
import com.njcn.csdevice.service.ICsSoftInfoService;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统软件表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csSoftInfo")
|
||||
@Api(tags = "装置程序信息")
|
||||
@AllArgsConstructor
|
||||
@Validated
|
||||
public class CsSoftInfoController extends BaseController {
|
||||
|
||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||
private final ICsSoftInfoService csSoftInfoService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/findSoftInfo")
|
||||
@ApiOperation("获取程序软件信息")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<CsSoftInfoPO> findSoftInfo(@RequestParam String id){
|
||||
String methodDescribe = getMethodDescribe("findSoftInfo");
|
||||
CsSoftInfoPO po = csSoftInfoMapper.selectById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/saveSoftInfo")
|
||||
@ApiOperation("保存程序软件信息")
|
||||
@ApiImplicitParam(name = "po", value = "po", required = true)
|
||||
public HttpResult<String> saveSoftInfo(@RequestBody CsSoftInfoPO po){
|
||||
String methodDescribe = getMethodDescribe("saveSoftInfo");
|
||||
csSoftInfoService.save(po);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/removeSoftInfo")
|
||||
@ApiOperation("删除程序软件信息")
|
||||
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||
public HttpResult<String> removeSoftInfo(@RequestParam String id){
|
||||
String methodDescribe = getMethodDescribe("removeSoftInfo");
|
||||
csSoftInfoService.removeById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
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 io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
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.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@RestController
|
||||
@Slf4j
|
||||
@Api(tags = "装置文件管理")
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/deviceFile")
|
||||
public class DeviceFtpController extends BaseController {
|
||||
|
||||
private final DeviceFtpService deviceFtpService;
|
||||
private final RedisUtil redisUtil;
|
||||
private final MqttPublisher publisher;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/askDeviceRootPath")
|
||||
@ApiOperation("设备根目录询问")
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true)
|
||||
public HttpResult<MakeUpVo> askDeviceRootPath(@RequestParam("nDid") String nDid){
|
||||
String methodDescribe = getMethodDescribe("askDeviceRootPath");
|
||||
MakeUpVo vo = deviceFtpService.askDeviceRootPath(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/askDeviceFileOrDir")
|
||||
@ApiOperation("设备文件/目录信息询问")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||
@ApiImplicitParam(name = "name", value = "文件路径名", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "文件类型", required = true)
|
||||
})
|
||||
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);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/downloadFile")
|
||||
@ApiOperation("设备文件下载")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||
@ApiImplicitParam(name = "name", value = "文件路径名", required = true),
|
||||
@ApiImplicitParam(name = "size", value = "文件大小(单位byte)", required = true),
|
||||
@ApiImplicitParam(name = "fileCheck", value = "文件校验码", required = true)
|
||||
})
|
||||
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
|
||||
String methodDescribe = getMethodDescribe("downloadFile");
|
||||
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getDownloadFilePath")
|
||||
@ApiOperation("获取文件下载路径")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||
@ApiImplicitParam(name = "name", value = "文件路径名", required = true)
|
||||
})
|
||||
public HttpResult<String> getDownloadFilePath(@RequestParam("nDid") String nDid, @RequestParam("name") String name){
|
||||
String methodDescribe = getMethodDescribe("getDownloadFilePath");
|
||||
String result = deviceFtpService.getDownloadFilePath(nDid,name);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/createFolder")
|
||||
@ApiOperation("创建文件")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||
@ApiImplicitParam(name = "path", value = "文件路径", required = true)
|
||||
})
|
||||
public HttpResult<String> createFolder(@RequestParam("nDid") String nDid, @RequestParam("path") String path){
|
||||
String methodDescribe = getMethodDescribe("createFolder");
|
||||
boolean result = deviceFtpService.createFile(nDid,path);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deleteFolder")
|
||||
@ApiOperation("删除文件")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true),
|
||||
@ApiImplicitParam(name = "path", value = "文件路径", required = true)
|
||||
})
|
||||
public HttpResult<String> deleteFolder(@RequestParam("nDid") String nDid, @RequestParam("path") String path){
|
||||
String methodDescribe = getMethodDescribe("deleteFolder");
|
||||
boolean result = deviceFtpService.deleteFile(nDid,path);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -23,7 +23,6 @@ import com.njcn.csdevice.service.IMqttUserService;
|
||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.web.advice.DeviceLog;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.*;
|
||||
@@ -284,4 +283,36 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
}
|
||||
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rebootDevice")
|
||||
@ApiOperation("重启设备")
|
||||
@ApiImplicitParam(name = "nDid", value = "nDid", required = true)
|
||||
public HttpResult<String> rebootDevice(@RequestParam("nDid") String nDid){
|
||||
String methodDescribe = getMethodDescribe("rebootDevice");
|
||||
boolean result = csEquipmentDeliveryService.rebootDevice(nDid);
|
||||
if (result) {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
} else {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, null, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAll")
|
||||
@ApiOperation("获取所有装置")
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll(){
|
||||
String methodDescribe = getMethodDescribe("getAll");
|
||||
List<CsEquipmentDeliveryPO> result = csEquipmentDeliveryService.getAll();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/judgeDevModel")
|
||||
@ApiOperation("判断设备型号")
|
||||
public HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid){
|
||||
String methodDescribe = getMethodDescribe("judgeDevModel");
|
||||
boolean result = csEquipmentDeliveryService.judgeDevModel(nDid);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,10 +9,13 @@ 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.param.WlRecordTemplete;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.minioss.config.MinIossProperties;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.poi.excel.ExcelUtil;
|
||||
import com.njcn.poi.util.PoiUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -53,6 +56,8 @@ public class PortableOfflLogController extends BaseController {
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final MinIossProperties minIossProperties;
|
||||
@ResponseBody
|
||||
@ApiOperation("导出设备基础数据模板")
|
||||
@GetMapping(value = "getExcelTemplate")
|
||||
@@ -77,6 +82,15 @@ public class PortableOfflLogController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryMainLogPage")
|
||||
@ApiOperation("便携式设备解析日志")
|
||||
public HttpResult<Page<PortableOffMainLog>> queryMainLogPage(@RequestBody BaseParam baseParam){
|
||||
String methodDescribe = getMethodDescribe("queryMainLogPage");
|
||||
Page<PortableOffMainLog> list = iPortableOfflLogService.queryMainLogPage(baseParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("离线数据导入")
|
||||
@PostMapping(value = "importEquipment")
|
||||
@@ -98,5 +112,27 @@ public class PortableOfflLogController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@ApiOperation("数据在线补招")
|
||||
@PostMapping(value = "dataOnlineRecruitment")
|
||||
public HttpResult<String> dataOnlineRecruitment(@RequestParam("devId") String devId
|
||||
, @RequestParam("lineId") String lineId, @RequestParam("path") String path) {
|
||||
String methodDescribe = getMethodDescribe("dataOnlineRecruitment");
|
||||
|
||||
List<MultipartFile> excelreport = null;
|
||||
try {
|
||||
excelreport = fileStorageUtil.getAllFile(minIossProperties.getBucket(), path);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
UploadDataParam uploadDataParam = new UploadDataParam();
|
||||
uploadDataParam.setDevId(devId);
|
||||
uploadDataParam.setLineId(lineId);
|
||||
|
||||
uploadDataParam.setFiles(excelreport);
|
||||
iPortableOfflLogService.importEquipment(uploadDataParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.njcn.csdevice.controller.ledger;
|
||||
|
||||
|
||||
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.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
|
||||
/**
|
||||
* @author wr
|
||||
* @description
|
||||
* @date 2023/4/26 10:00
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/commTerminal")
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
@Api(tags = "通用台账查询")
|
||||
public class CsCommTerminalController extends BaseController {
|
||||
|
||||
private final PqsDeviceUnitMapper pqsDeviceUnitMapper;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过监测点获取监测点数据单位
|
||||
* @author cdf
|
||||
* @date 2023/9/21
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/lineUnitDetail")
|
||||
@ApiOperation("根据监测点id获取数据单位")
|
||||
@ApiImplicitParam(name = "lineId", value = "实体", required = true)
|
||||
public HttpResult<PqsDeviceUnit> lineUnitDetail(@RequestParam("lineId") String lineId) {
|
||||
String methodDescribe = getMethodDescribe("lineUnitDetail");
|
||||
|
||||
PqsDeviceUnit pqsDeviceUnit = pqsDeviceUnitMapper.selectById(lineId);
|
||||
if(Objects.isNull(pqsDeviceUnit)){
|
||||
pqsDeviceUnit = new PqsDeviceUnit();
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, pqsDeviceUnit, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -67,6 +67,15 @@ public class CsLedgerController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getztProjectTree")
|
||||
@ApiOperation("三层设备树(项目层根节点为治理系统和便携式系统组态)")
|
||||
public HttpResult<List<CsLedgerVO>> getztProjectTree(){
|
||||
String methodDescribe = getMethodDescribe("getProjectTree");
|
||||
List<CsLedgerVO> list = csLedgerService.getztProjectTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/add")
|
||||
@ApiOperation("新增台账信息")
|
||||
|
||||
@@ -1,19 +1,25 @@
|
||||
package com.njcn.csdevice.controller.line;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
@@ -36,6 +42,9 @@ public class CslineController extends BaseController {
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryLineById")
|
||||
@ApiOperation("监测点查询通过id获取")
|
||||
@@ -70,9 +79,16 @@ public class CslineController extends BaseController {
|
||||
@PostMapping("/addList")
|
||||
@ApiOperation("批量新增监测点")
|
||||
@ApiImplicitParam(name = "list", value = "监测点数据集", required = true)
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public HttpResult<String> addLineList(@RequestBody List<CsLinePO> list){
|
||||
String methodDescribe = getMethodDescribe("addLineList");
|
||||
csLinePOService.saveBatch(list);
|
||||
for(CsLinePO csLinePO: list){
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(csLinePO.getVolGrade().floatValue(),10f,10f,10f,0,1);
|
||||
overlimit.setId(csLinePO.getLineId());
|
||||
overlimitMapper.deleteById(csLinePO.getLineId());
|
||||
overlimitMapper.insert(overlimit);
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -108,4 +124,38 @@ public class CslineController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateIds")
|
||||
@ApiOperation("修改监测点模板id和数据集id")
|
||||
@ApiImplicitParam(name = "csLineParam", value = "监测点信息", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<Boolean> updateIds(@RequestBody @Validated CsLineParam csLineParam) {
|
||||
String methodDescribe = getMethodDescribe("updateIds");
|
||||
csLinePOService.updateIds(csLineParam);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getById")
|
||||
@ApiOperation("根据监测点id获取监测点详情")
|
||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
||||
@ApiIgnore
|
||||
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
|
||||
String methodDescribe = getMethodDescribe("getById");
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getOverLimitData")
|
||||
@ApiOperation("根据监测点id获取国标限值")
|
||||
@ApiImplicitParam(name = "id", value = "监测点id", required = true)
|
||||
public HttpResult<Overlimit> getOverLimitData(@RequestParam("id") String id) {
|
||||
String methodDescribe = getMethodDescribe("getOverLimitData");
|
||||
Overlimit result = overlimitMapper.selectById(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.common.utils.LogUtil;
|
||||
import com.njcn.csdevice.param.WlRecordPageParam;
|
||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
@@ -22,6 +23,7 @@ import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -83,6 +85,34 @@ public class WlRecordController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增原始数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/addBaseData")
|
||||
@ApiOperation("新增原始数据")
|
||||
@ApiImplicitParam(name = "wlRecord", value = "装置原始数据", required = true)
|
||||
public HttpResult<Boolean> addBaseData(@RequestBody @Validated WlRecord wlRecord) {
|
||||
String methodDescribe = getMethodDescribe("addBaseData");
|
||||
LogUtil.njcnDebug(log, "{},装置原始数据为:{}", methodDescribe, wlRecord);
|
||||
wlRecordService.addBaseData(wlRecord);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量新增原始数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.ADD)
|
||||
@PostMapping("/addBaseDataList")
|
||||
@ApiOperation("批量新增原始数据")
|
||||
@ApiImplicitParam(name = "wlRecord", value = "装置原始数据", required = true)
|
||||
public HttpResult<Boolean> addBaseDataList(@RequestBody @Validated List<WlRecord> wlRecord) {
|
||||
String methodDescribe = getMethodDescribe("addBaseDataList");
|
||||
LogUtil.njcnDebug(log, "{},装置原始数据为:{}", methodDescribe, wlRecord);
|
||||
wlRecordService.addBaseDataList(wlRecord);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改测试项
|
||||
*/
|
||||
@@ -151,5 +181,31 @@ public class WlRecordController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询装置基础数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@PostMapping("/findDevBaseData")
|
||||
@ApiOperation("查询装置基础数据")
|
||||
@ApiImplicitParam(name = "param", value = "查询条件", required = true)
|
||||
public HttpResult<WlRecord> findDevBaseData(@RequestBody @Validated WlRecordParam.Record param) {
|
||||
String methodDescribe = getMethodDescribe("findDevBaseData");
|
||||
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, param);
|
||||
WlRecord record = wlRecordService.findDevBaseData(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 每日处理没有结束时间的测试基础数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/dayDealNoEndTimeEvent")
|
||||
@ApiOperation("每日处理没有结束时间的测试基础数据")
|
||||
public void dayDealNoEndTimeEvent(@RequestParam("date") String date) {
|
||||
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
||||
wlRecordService.dayDealNoEndTimeEvent(date);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csdevice.init;
|
||||
|
||||
import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.CommandLineRunner;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 项目初始化缓存设备池,后续从缓存中获取设备数据
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class InitData implements CommandLineRunner {
|
||||
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
private final CsDevModelService csDevModelService;
|
||||
|
||||
@Override
|
||||
public void run(String... args) {
|
||||
csEquipmentDeliveryService.refreshDeviceDataCache();
|
||||
csDevModelService.refreshDevModelCache();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsSoftInfoPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统软件表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
public interface CsSoftInfoMapper extends BaseMapper<CsSoftInfoPO> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author cdf
|
||||
* @since 2022-01-04
|
||||
*/
|
||||
@DS("sjzx")
|
||||
@Mapper
|
||||
public interface OverlimitMapper extends BaseMapper<Overlimit> {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/10/15 10:43【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PortableOffMainLogMapper extends BaseMapper<PortableOffMainLog> {
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
|
||||
/**
|
||||
* pqs
|
||||
*
|
||||
* @author cdf
|
||||
* @date 2024/8/21
|
||||
*/
|
||||
public interface PqsDeviceUnitMapper extends BaseMapper<PqsDeviceUnit> {
|
||||
}
|
||||
@@ -105,6 +105,7 @@
|
||||
t0.ndid = #{param.id}
|
||||
and t1.did = #{param.did}
|
||||
and t3.cl_dev = #{param.cldId}
|
||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
||||
and t4.stat_method = #{param.statMethod}
|
||||
order by t4.sort
|
||||
</select>
|
||||
|
||||
@@ -12,7 +12,9 @@
|
||||
from
|
||||
cs_data_set
|
||||
where
|
||||
pid = #{modelId} and cl_dev = #{clDev}
|
||||
pid = #{modelId}
|
||||
and cl_dev = #{clDev}
|
||||
and data_type in ('Stat',NULL)
|
||||
order by type,cl_dev
|
||||
</select>
|
||||
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.njcn.csdevice.mapper.PortableOffMainLogMapper">
|
||||
<sql id="Base_Column_List">
|
||||
<!--@mbg.generated-->
|
||||
id, start_time, project_name, end_time, success_count, create_by, create_time, update_by,
|
||||
update_time
|
||||
</sql>
|
||||
</mapper>
|
||||
@@ -23,7 +23,8 @@
|
||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
||||
select a.dev_id as id,b.name as name from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1 and
|
||||
where a.type=1 and a.state =1 and a.end_time is not null
|
||||
and
|
||||
(select count(1) from wl_record wl where wl.dev_id = a.dev_id) >
|
||||
(select count(1) from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id}
|
||||
and data_id in (select w.id from wl_record w where w.dev_id = a.dev_id))
|
||||
@@ -32,7 +33,8 @@
|
||||
<if test="wlRecordPageParam.isTrueFlag == 1">
|
||||
select a.dev_id as id,b.name as name from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1 and exists
|
||||
where a.type=1 and a.state =1 and a.end_time is not null
|
||||
and exists
|
||||
(select 1 from wl_record wl where wl.dev_id = a.dev_id and wl.type=1 and wl.state =1
|
||||
and exists (select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = wl.id))
|
||||
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||
@@ -55,17 +57,18 @@
|
||||
<select id="getRecordAllTime" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo$RecordAllTimeTreeVo">
|
||||
select a.id as id,concat(a.start_time,'-',a.end_time) as name, concat(#{wlRecordPageParam.lineId},'-',#{wlRecordPageParam.devId}) as pid from wl_record a
|
||||
left join cs_line c on a.line_id = c.line_id
|
||||
where a.type=1 and a.state =1 and a.dev_id=#{wlRecordPageParam.devId} and a.line_id=#{wlRecordPageParam.lineId}
|
||||
where a.type=1 and a.state =1 and a.end_time is not null and a.dev_id=#{wlRecordPageParam.devId} and a.line_id=#{wlRecordPageParam.lineId}
|
||||
and
|
||||
<if test="wlRecordPageParam.isTrueFlag == 0">
|
||||
not
|
||||
</if>
|
||||
exists
|
||||
(select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id)
|
||||
order by a.start_time asc
|
||||
</select>
|
||||
|
||||
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
||||
select a.dev_id as id,b.name as name ,2 as level from wl_record a
|
||||
select a.dev_id as id,b.name as name ,2 as level,b.ndid nDid from wl_record a
|
||||
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||
where a.type=1 and a.state =1
|
||||
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||
|
||||
@@ -20,6 +20,12 @@ import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||
*/
|
||||
public interface CsDevModelService extends IService<CsDevModelPO>{
|
||||
|
||||
/**
|
||||
* 初始化缓存模板信息
|
||||
* 想缓存模板,发现数据量太大,先按照之前的逻辑处理
|
||||
*/
|
||||
void refreshDevModelCache();
|
||||
|
||||
/**
|
||||
* @Description: addDevModel
|
||||
* @Param: [csDevModelAddParm]
|
||||
|
||||
@@ -14,6 +14,7 @@ import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -26,6 +27,11 @@ import javax.servlet.http.HttpServletResponse;
|
||||
*/
|
||||
public interface CsEquipmentDeliveryService extends IService<CsEquipmentDeliveryPO>{
|
||||
|
||||
/**
|
||||
* 初始化缓存设备池
|
||||
*/
|
||||
void refreshDeviceDataCache();
|
||||
|
||||
/**
|
||||
* @Description: save
|
||||
* @Param: [csEquipmentDeliveryAddParm]
|
||||
@@ -114,4 +120,17 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* @param number
|
||||
*/
|
||||
void updateModuleNumber(String nDid, Integer number);
|
||||
|
||||
boolean rebootDevice(String nDid);
|
||||
|
||||
/**
|
||||
* 获取所有装置信息
|
||||
* @return
|
||||
*/
|
||||
List<CsEquipmentDeliveryPO> getAll();
|
||||
|
||||
/**
|
||||
* 判断设备型号
|
||||
*/
|
||||
boolean judgeDevModel(String nDid);
|
||||
}
|
||||
|
||||
@@ -40,4 +40,9 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
*/
|
||||
void updateLine(CsLineParam csLineParam);
|
||||
|
||||
/**
|
||||
* 修改监测点的数据集id和模板id
|
||||
* @param csLineParam
|
||||
*/
|
||||
void updateIds(CsLineParam csLineParam);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface DeviceFtpService {
|
||||
|
||||
MakeUpVo askDeviceRootPath(String nDid);
|
||||
|
||||
List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type);
|
||||
|
||||
void downloadFile(String nDid, String name, Integer size, String fileCheck);
|
||||
|
||||
String getDownloadFilePath(String nDid, String name);
|
||||
|
||||
boolean createFile(String nDid, String path);
|
||||
|
||||
boolean deleteFile(String nDid, String path);
|
||||
|
||||
}
|
||||
@@ -50,4 +50,9 @@ public interface ICsDataArrayService extends IService<CsDataArray> {
|
||||
* @return
|
||||
*/
|
||||
List<CsDataArray> findListByParam(DataArrayParam param);
|
||||
|
||||
/**
|
||||
* 根据数据集id获取指标数据
|
||||
*/
|
||||
List<CsDataArray> getDataArrayByDataSetIds(List<String> dataSetIds);
|
||||
}
|
||||
|
||||
@@ -45,4 +45,28 @@ public interface ICsDataSetService extends IService<CsDataSet> {
|
||||
* @return
|
||||
*/
|
||||
List<CsDataSet> getModuleDataSet(String modelId);
|
||||
|
||||
/**
|
||||
* 根据测点id获取数据集
|
||||
* @param setIds 监测点id
|
||||
* @return
|
||||
*/
|
||||
List<CsDataSet> getDataSetBySetIds(List<String> setIds);
|
||||
|
||||
CsDataSet getBaseDataSet(String modelId,Integer clDev);
|
||||
|
||||
CsDataSet getHarmonicDataSet(String modelId,Integer clDev,Integer target);
|
||||
|
||||
/**
|
||||
* 根据模板和idx获取数据集数据
|
||||
* @param modelId
|
||||
* @param idx
|
||||
* @return
|
||||
*/
|
||||
CsDataSet getDataSetByIdx(String modelId, Integer idx);
|
||||
|
||||
/**
|
||||
* 根据模板id获取所有数据集
|
||||
*/
|
||||
List<CsDataSet> getDataSetByModelId(List<String> modelList);
|
||||
}
|
||||
|
||||
@@ -74,4 +74,6 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
List<CsLedger> queryLine(LineParamDTO lineParamdto);
|
||||
|
||||
DevDetailDTO queryDevDetail(String devId);
|
||||
|
||||
List<CsLedgerVO> getztProjectTree();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.CsSoftInfoPO;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统软件表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
public interface ICsSoftInfoService extends IService<CsSoftInfoPO> {
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
@@ -19,4 +20,6 @@ public interface IPortableOfflLogService extends IService<PortableOfflLog> {
|
||||
Page<PortableOfflLog> queryPage(BaseParam baseParam);
|
||||
|
||||
void importEquipment(UploadDataParam uploadDataParam);
|
||||
|
||||
Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam);
|
||||
}
|
||||
|
||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -41,6 +42,20 @@ public interface IWlRecordService extends IService<WlRecord> {
|
||||
*/
|
||||
void addRecord(WlRecordParam.AddRecord records);
|
||||
|
||||
/**
|
||||
* 新增原始数据
|
||||
* @param wlRecord
|
||||
* @return
|
||||
*/
|
||||
void addBaseData(WlRecord wlRecord);
|
||||
|
||||
/**
|
||||
* 批量新增原始数据
|
||||
* @param wlRecord
|
||||
* @return
|
||||
*/
|
||||
void addBaseDataList(List<WlRecord> wlRecord);
|
||||
|
||||
/**
|
||||
* 修改测试项
|
||||
* @param record
|
||||
@@ -81,4 +96,16 @@ public interface IWlRecordService extends IService<WlRecord> {
|
||||
*/
|
||||
List<ThdDataVO> queryCommonStatisticalByTest(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
||||
|
||||
/**
|
||||
* 获取装置基础数据
|
||||
* @return
|
||||
*/
|
||||
WlRecord findDevBaseData(WlRecordParam.Record param);
|
||||
|
||||
|
||||
/**
|
||||
* 每日处理没有结束时间的测试基础数据
|
||||
*/
|
||||
void dayDealNoEndTimeEvent(String date);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.OverlimitMapper;
|
||||
import com.njcn.csdevice.service.impl.OverlimitService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/10/22 14:14【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@DS("sjzx")
|
||||
public class OverlimitServiceImpl extends ServiceImpl<OverlimitMapper, Overlimit> implements OverlimitService{
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/10/15 10:43【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface PortableOffMainLogService extends IService<PortableOffMainLog>{
|
||||
|
||||
|
||||
}
|
||||
@@ -6,6 +6,7 @@ import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||
import com.njcn.csdevice.pojo.param.DataArrayParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerDetailVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
@@ -174,4 +175,11 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
public List<CsDataArray> findListByParam(DataArrayParam param) {
|
||||
return this.baseMapper.findListByParam(param);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDataArray> getDataArrayByDataSetIds(List<String> dataSetIds) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsDataArray::getPid,dataSetIds)
|
||||
.list();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
@@ -8,6 +9,8 @@ import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,12 +26,22 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
|
||||
@Override
|
||||
public List<CsDataSet> findDataSetByModelId(String modelId, Integer clDev) {
|
||||
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).eq(CsDataSet::getClDev,clDev).list();
|
||||
return this.lambdaQuery()
|
||||
.eq(CsDataSet::getPid,modelId)
|
||||
.eq(CsDataSet::getClDev,clDev)
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
||||
.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDataSet> findDataSetByModelId(String modelId) {
|
||||
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).in(CsDataSet::getType, Arrays.asList(0,2)).orderByAsc(CsDataSet::getType,CsDataSet::getClDev).list();
|
||||
return this.lambdaQuery()
|
||||
.eq(CsDataSet::getPid,modelId)
|
||||
.in(CsDataSet::getType, Arrays.asList(0,2))
|
||||
.eq(CsDataSet::getStoreFlag,1)
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
||||
.orderByAsc(CsDataSet::getType,CsDataSet::getClDev)
|
||||
.list();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -41,4 +54,51 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
||||
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).ne(CsDataSet::getClDev,0).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDataSet> getDataSetBySetIds(List<String> setIds) {
|
||||
return this.lambdaQuery().in(CsDataSet::getId,setIds).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsDataSet getBaseDataSet(String modelId, Integer clDev) {
|
||||
List<CsDataSet> list = this.lambdaQuery()
|
||||
.eq(CsDataSet::getPid,modelId)
|
||||
.eq(CsDataSet::getClDev,clDev)
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType))
|
||||
.list();
|
||||
return list.stream().min(Comparator.comparingInt(CsDataSet::getIdx)).get();
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsDataSet getHarmonicDataSet(String modelId, Integer clDev,Integer target) {
|
||||
LambdaQueryWrapper<CsDataSet> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(CsDataSet::getPid,modelId)
|
||||
.eq(CsDataSet::getClDev,clDev)
|
||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType));
|
||||
//谐波电压含有率
|
||||
if (target == 0) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$01");
|
||||
} else if (target == 1) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$01");
|
||||
} else if (target == 2) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$01");
|
||||
}
|
||||
return this.baseMapper.selectOne(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsDataSet getDataSetByIdx(String modelId, Integer idx) {
|
||||
return this.lambdaQuery()
|
||||
.eq(CsDataSet::getPid,modelId)
|
||||
.in(CsDataSet::getIdx, idx)
|
||||
.one();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDataSet> getDataSetByModelId(List<String> modelList) {
|
||||
return this.lambdaQuery()
|
||||
.in(CsDataSet::getPid,modelList)
|
||||
.list();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -61,6 +61,6 @@ public class CsDevCapacityPOServiceImpl extends ServiceImpl<CsDevCapacityPOMappe
|
||||
if(Objects.isNull(one)){
|
||||
return 0.0;
|
||||
}
|
||||
return Double.valueOf(df.format(one.getCapacity()*0.1));
|
||||
return Double.valueOf(df.format(one.getCapacity()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,37 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsDevModelDto;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||
import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.sql.Date;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -27,16 +42,77 @@ import java.sql.Date;
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevModelPO> implements CsDevModelService{
|
||||
|
||||
private final ICsDataSetService csDataSetService;
|
||||
private final ICsDataArrayService csDataArrayService;
|
||||
private final RedisUtil redisUtil;
|
||||
|
||||
@Override
|
||||
public void refreshDevModelCache() {
|
||||
// List<CsDevModelDto> csDevModelDtoList = new ArrayList<>();
|
||||
// List<CsDevModelDto.CsDataSet> csDataSetList = new ArrayList<>();
|
||||
// List<CsDevModelDto.CsDataArray> csDataArrayList = new ArrayList<>();
|
||||
// //获取系统所有模板
|
||||
// LambdaQueryWrapper<CsDevModelPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
// queryWrapper.eq(CsDevModelPO::getStatus,1);
|
||||
// List<CsDevModelPO> list = this.list(queryWrapper);
|
||||
// //根据模板ids获取数据集
|
||||
// if (CollUtil.isNotEmpty(list)) {
|
||||
// List<String> modelIds = list.stream().map(CsDevModelPO::getId).collect(Collectors.toList());
|
||||
// List<CsDataSet> csDataSets = csDataSetService.getDataSetByModelId(modelIds);
|
||||
// //根据数据集获取具体指标
|
||||
// List<String> dataSetList = csDataSets.stream().map(CsDataSet::getId).collect(Collectors.toList());
|
||||
// List<CsDataArray> csDataArrays = csDataArrayService.getDataArrayByDataSetIds(dataSetList);
|
||||
//
|
||||
// list.forEach(item->{
|
||||
// CsDevModelDto dto = new CsDevModelDto();
|
||||
// BeanUtils.copyProperties(item,dto);
|
||||
// csDevModelDtoList.add(dto);
|
||||
// });
|
||||
// csDataSets.forEach(item->{
|
||||
// CsDevModelDto.CsDataSet dto = new CsDevModelDto.CsDataSet();
|
||||
// BeanUtils.copyProperties(item,dto);
|
||||
// csDataSetList.add(dto);
|
||||
// });
|
||||
// csDataArrays.forEach(item->{
|
||||
// CsDevModelDto.CsDataArray dto = new CsDevModelDto.CsDataArray();
|
||||
// BeanUtils.copyProperties(item,dto);
|
||||
// csDataArrayList.add(dto);
|
||||
// });
|
||||
//
|
||||
// for (CsDevModelDto.CsDataSet item1 : csDataSetList) {
|
||||
// List<CsDevModelDto.CsDataArray> list1 = new ArrayList<>();
|
||||
// for (CsDevModelDto.CsDataArray item2 : csDataArrayList) {
|
||||
// if (Objects.equals(item1.getId(),item2.getPid())) {
|
||||
// list1.add(item2);
|
||||
// }
|
||||
// }
|
||||
// item1.setDataArrays(list1);
|
||||
// }
|
||||
//
|
||||
// for (CsDevModelDto item1 : csDevModelDtoList) {
|
||||
// List<CsDevModelDto.CsDataSet> list1 = new ArrayList<>();
|
||||
// for (CsDevModelDto.CsDataSet item2 : csDataSetList) {
|
||||
// if (Objects.equals(item1.getId(),item2.getPid())) {
|
||||
// list1.add(item2);
|
||||
// }
|
||||
// }
|
||||
// item1.setDataSets(list1);
|
||||
// redisUtil.saveByKey(AppRedisKey.DEV_MODEL.concat(item1.getId()),item1);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CsDevModelPO addDevModel(CsDevModelAddParm csDevModelAddParm) {
|
||||
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||
BeanUtils.copyProperties (csDevModelAddParm, csDevModelPO);
|
||||
csDevModelPO.setStatus ("1");
|
||||
csDevModelPO.setVersionDate(Date.valueOf(csDevModelAddParm.getTime()));
|
||||
this.save (csDevModelPO);
|
||||
return csDevModelPO;
|
||||
}
|
||||
@@ -46,8 +122,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
||||
public Boolean AuditDevModel(CsDevModelAuditParm csDevModelAuditParm) {
|
||||
CsDevModelPO csDevModelPO = new CsDevModelPO ();
|
||||
BeanUtils.copyProperties (csDevModelAuditParm, csDevModelPO);
|
||||
boolean b = this.updateById (csDevModelPO);
|
||||
return b;
|
||||
return this.updateById (csDevModelPO);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -61,8 +136,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
||||
@Override
|
||||
public CsDevModelPageVO queryDevModelOne(CsDevModelQueryListParm csDevModelQueryListParm) {
|
||||
|
||||
CsDevModelPageVO result = this.getBaseMapper ().queryOne(csDevModelQueryListParm);
|
||||
return result;
|
||||
return this.getBaseMapper ().queryOne(csDevModelQueryListParm);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -11,18 +11,18 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
@@ -35,6 +35,7 @@ import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
@@ -75,32 +76,33 @@ import java.util.stream.Collectors;
|
||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
||||
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
|
||||
private final ICsDataSetService csDataSetService;
|
||||
|
||||
private final ICsLedgerService csLedgerService;
|
||||
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
|
||||
private final AppLineTopologyDiagramService appLineTopologyDiagramService;
|
||||
|
||||
private final CsTouristDataPOService csTouristDataPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
|
||||
private final CsEquipmentProcessPOService csEquipmentProcessPOService;
|
||||
private final IMqttUserService mqttUserService;
|
||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||
private final RedisUtil redisUtil;
|
||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||
|
||||
@Override
|
||||
public void refreshDeviceDataCache() {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.ne(CsEquipmentDeliveryPO::getRunStatus,0);
|
||||
List<CsEquipmentDeliveryPO> deliveryPOS = this.list(queryWrapper);
|
||||
redisUtil.saveByKey(AppRedisKey.DEVICE_LIST,deliveryPOS);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||
@@ -129,7 +131,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csEquipmentProcess.setStatus (1);
|
||||
|
||||
csEquipmentProcessPOService.save(csEquipmentProcess);
|
||||
return this.save (csEquipmentDeliveryPo);
|
||||
result = this.save (csEquipmentDeliveryPo);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,6 +175,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
|
||||
csDevModelRelationService.lambdaUpdate().eq(CsDevModelRelationPO::getDevId,id).set(CsDevModelRelationPO::getStatus,0).update();
|
||||
if (update) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
@@ -207,6 +216,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||
boolean result;
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
||||
.in(CsEquipmentDeliveryPO::getStatus,Arrays.asList(1,2,3))
|
||||
@@ -218,14 +228,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||
return this.updateById (csEquipmentDeliveryPo);
|
||||
result = this.updateById(csEquipmentDeliveryPo);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStatusBynDid(String nDId,Integer status) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getStatus,status).eq(CsEquipmentDeliveryPO::getNdid,nDId);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -248,13 +266,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
queryWrapper.orderBy(true, false, "create_time");
|
||||
}
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryParam.getDevType()) || !Objects.isNull(queryParam.getDevType())){
|
||||
if (StrUtil.isNotBlank(queryParam.getDevType()) && !Objects.isNull(queryParam.getDevType())){
|
||||
queryWrapper.eq("cs_equipment_delivery.dev_type", queryParam.getDevType());
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryParam.getDevModel()) || !Objects.isNull(queryParam.getDevModel())){
|
||||
if (StrUtil.isNotBlank(queryParam.getDevModel()) && !Objects.isNull(queryParam.getDevModel())){
|
||||
queryWrapper.eq("cs_equipment_delivery.dev_model", queryParam.getDevModel());
|
||||
}
|
||||
if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) || !Objects.isNull(queryParam.getDevAccessMethod())){
|
||||
if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) && !Objects.isNull(queryParam.getDevAccessMethod())){
|
||||
queryWrapper.eq("cs_equipment_delivery.dev_access_method", queryParam.getDevAccessMethod());
|
||||
}
|
||||
if (!Objects.isNull(queryParam.getStatus())){
|
||||
@@ -281,6 +299,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||
List<DeviceManagerVO.DataSetVO> dataSetList = new ArrayList<>();
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||
//获取装置版本信息
|
||||
String softInfoId = csEquipmentDeliveryPo.getSoftinfoId();
|
||||
if (StringUtils.isNotBlank(softInfoId) && ObjectUtil.isNotNull(softInfoId)) {
|
||||
CsSoftInfoPO po = csSoftInfoMapper.selectById(softInfoId);
|
||||
deviceManagerVo.setAppVersion(po.getAppVersion());
|
||||
deviceManagerVo.setAppDate(po.getAppDate());
|
||||
deviceManagerVo.setAppCheck(po.getAppCheck());
|
||||
}
|
||||
if (lineId == null || lineId.isEmpty()) {
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
//如果没有传lineId(测点ID) 则根据设备ID获取对应的模板 select modelId from cs_dev_model_relation where dev_id = ?
|
||||
@@ -346,7 +372,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
for (CsDataSet item : dataSet) {
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setName("history".equals(type) ? "准实时数据":item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
@@ -354,7 +380,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//历史数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
dataSetVo2.setName("历史" + item.getAnotherName());
|
||||
dataSetVo2.setName("历史统计数据");
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
@@ -363,19 +389,19 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
//趋势数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo3.setId(item.getId());
|
||||
dataSetVo3.setName(item.getAnotherName() + "趋势数据");
|
||||
dataSetVo3.setName("历史趋势");
|
||||
dataSetVo3.setType("trenddata");
|
||||
dataSetList.add(dataSetVo3);
|
||||
//实时数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo4.setId(item.getId());
|
||||
dataSetVo4.setName(item.getAnotherName() + "实时数据");
|
||||
dataSetVo4.setName("实时数据");
|
||||
dataSetVo4.setType("realtimedata");
|
||||
dataSetList.add(dataSetVo4);
|
||||
//暂态事件tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo5.setId(item.getId());
|
||||
dataSetVo5.setName(item.getAnotherName() + "暂态事件");
|
||||
dataSetVo5.setName("暂态事件");
|
||||
dataSetVo5.setType("event");
|
||||
dataSetList.add(dataSetVo5);
|
||||
}
|
||||
@@ -391,9 +417,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.set(CsEquipmentDeliveryPO::getSoftinfoId,id).set(CsEquipmentDeliveryPO::getModuleNumber,module).eq(CsEquipmentDeliveryPO::getNdid,nDid);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -541,6 +571,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
appLineTopologyDiagramPOQueryWrapper.in("line_id",collect);
|
||||
appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper);
|
||||
}
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -585,20 +616,66 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
|
||||
@Override
|
||||
public void updateSoftInfo(String nDid, String id) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.set(CsEquipmentDeliveryPO::getSoftinfoId,id);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateModuleNumber(String nDid, Integer number) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.set(CsEquipmentDeliveryPO::getModuleNumber,number);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rebootDevice(String nDid) {
|
||||
boolean result = false;
|
||||
try {
|
||||
askDeviceDataFeignClient.rebootDevice(nDid);
|
||||
Thread.sleep(3000);
|
||||
String key = AppRedisKey.CONTROL + nDid;
|
||||
Object object = redisUtil.getObjectByKey(key);
|
||||
if (Objects.nonNull(object)) {
|
||||
String value = object.toString();
|
||||
if (Objects.equals(value,"success")) {
|
||||
result = true;
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> getAll() {
|
||||
return this.lambdaQuery().ne(CsEquipmentDeliveryPO::getRunStatus,0).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean judgeDevModel(String nDid) {
|
||||
boolean result = false;
|
||||
//获取装置id
|
||||
CsEquipmentDeliveryPO po = findDevByNDid(nDid);
|
||||
//设备型号
|
||||
String code = dictTreeFeignClient.queryById(po.getDevModel()).getData().getCode();
|
||||
if (Objects.equals(DicTreeEnum.PQ_COM.getCode(),code)) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,45 +1,41 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
||||
import com.njcn.csdevice.mapper.CsGroupMapper;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||
import com.njcn.csdevice.pojo.po.CsGroArr;
|
||||
import com.njcn.csdevice.pojo.po.CsGroup;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsGroupService;
|
||||
import com.njcn.csdevice.service.ICsLedgerService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataTdVO;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.pq.api.LineFeignClient;
|
||||
import com.njcn.device.pq.api.OverLimitClient;
|
||||
import com.njcn.device.pq.pojo.vo.LineDetailVO;
|
||||
import com.njcn.event.api.EventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
@@ -54,6 +50,7 @@ import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.system.pojo.vo.CsStatisticalSetVO;
|
||||
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@@ -81,40 +78,24 @@ import java.util.stream.Stream;
|
||||
public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> implements ICsGroupService {
|
||||
|
||||
private final ICsDataArrayService csDataArrayService;
|
||||
|
||||
private final CsGroArrMapper csGroArrMapper;
|
||||
|
||||
private final CsGroupMapper csGroupMapper;
|
||||
|
||||
private final CsDataArrayMapper csDataArrayMapper;
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
private final EpdFeignClient epdFeignClient;
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
private final ICsLedgerService iCsLedgerService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
|
||||
private final EvtDataService evtDataService;
|
||||
|
||||
private final EventDetailFeignClient eventDetailFeignClient;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("#0.0000");
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("#0.00");
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
private final OverLimitClient overLimitClient;
|
||||
|
||||
private final LineFeignClient lineFeignClient;
|
||||
|
||||
private final OverlimitMapper overlimitMapper;
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
private final EventFeignClient eventFeignClient;
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CsGroupVO> getGroupData(String dataSet) {
|
||||
@@ -144,15 +125,17 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
//获取所有字典指标
|
||||
List<EleEpdPqd> epdPqdList = epdFeignClient.selectByIds(list.stream().map(EnergyTemplateVO::getDataId).distinct().collect(Collectors.toList())).getData();
|
||||
Map<String, EleEpdPqd> eventTypeMap = epdPqdList.stream().collect(Collectors.toMap(EleEpdPqd::getId, Function.identity()));
|
||||
getUnit(list,epdPqdList,groupList);
|
||||
getUnit(list,epdPqdList,groupList,dataLevel);
|
||||
//根据lineId获取监测点pt、ct变比
|
||||
CsLinePO csLinePO = csLineFeignClient.queryLineById(Collections.singletonList(lineId)).getData().get(0);
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,csLinePO.getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
//获取测点模板
|
||||
for (EnergyTemplateVO item : list) {
|
||||
EnergyTemplateVO vo = new EnergyTemplateVO();
|
||||
BeanUtils.copyProperties(item,vo);
|
||||
if (vo.getAnotherName().contains("A相") || vo.getAnotherName().contains("B相") || vo.getAnotherName().contains("C相")) {
|
||||
vo.setAnotherName(vo.getAnotherName().substring(0,2));
|
||||
}
|
||||
EleEpdPqd eleEpdPqd = eventTypeMap.get(item.getDataId());
|
||||
vo.setClassId(eleEpdPqd.getClassId());
|
||||
vo.setUnit(eleEpdPqd.getUnit());
|
||||
@@ -160,15 +143,33 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if (Objects.nonNull(statisticalDataDTO)) {
|
||||
vo.setTime(statisticalDataDTO.getTime());
|
||||
//判断监测点类型 针对治理设备 模块数据是一次值、电能质量设备是二次值
|
||||
if (csLinePO.getClDid() != 0 && Objects.equals("Primary",dataLevel) && ObjectUtil.isNotNull(eleEpdPqd.getPrimaryFormula())) {
|
||||
double secondaryData = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio());
|
||||
vo.setDataValue(BigDecimal.valueOf(secondaryData).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
if (ObjectUtil.isNotNull(eleEpdPqd.getPrimaryFormula()) && !Objects.equals(csDataSet.getDataLevel(),dataLevel)) {
|
||||
double re;
|
||||
if("Primary".equals(csDataSet.getDataLevel())){
|
||||
re = DataChangeUtil.primaryToSecondary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio());
|
||||
}else {
|
||||
re = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getValue(), csLinePO.getPtRatio(), csLinePO.getCtRatio());
|
||||
}
|
||||
if (changePower(vo.getAnotherName()) && Objects.equals(dataLevel,"Primary")) {
|
||||
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re / 1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
} else {
|
||||
vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(re).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
}
|
||||
} else {
|
||||
if (changePower(vo.getAnotherName()) && Objects.equals(dataLevel,"Primary")) {
|
||||
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getValue()/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
} else {
|
||||
vo.setDataValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vo.setDataValue(3.1415926);
|
||||
}
|
||||
if (vo.getAnotherName().contains("A相") || vo.getAnotherName().contains("B相") || vo.getAnotherName().contains("C相")) {
|
||||
vo.setAnotherName(vo.getAnotherName().substring(0,2));
|
||||
} else if (vo.getAnotherName().contains("AB") || vo.getAnotherName().contains("BC") || vo.getAnotherName().contains("CA")) {
|
||||
vo.setAnotherName(vo.getAnotherName().substring(0,2).concat("相"));
|
||||
}
|
||||
arrayList.add(vo);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(arrayList)){
|
||||
@@ -202,9 +203,14 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
//获取所有字典指标
|
||||
List<EleEpdPqd> epdPqdList = epdFeignClient.selectByIds(list.stream().map(EnergyTemplateVO::getDataId).distinct().collect(Collectors.toList())).getData();
|
||||
Map<String, EleEpdPqd> eventTypeMap = epdPqdList.stream().collect(Collectors.toMap(EleEpdPqd::getId, Function.identity()));
|
||||
getUnit(list,epdPqdList,groupList);
|
||||
getUnit(list,epdPqdList,groupList,energyBaseParam.getDataLevel());
|
||||
//根据lineId获取监测点pt、ct变比
|
||||
CsLinePO po = csLineFeignClient.queryLineById(Collections.singletonList(energyBaseParam.getLineId())).getData().get(0);
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,po.getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
|
||||
for (EnergyTemplateVO item : list) {
|
||||
EnergyTemplateVO vo = new EnergyTemplateVO();
|
||||
BeanUtils.copyProperties(item,vo);
|
||||
@@ -218,17 +224,39 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if (Objects.nonNull(statisticalDataDTO)) {
|
||||
vo.setTime(statisticalDataDTO.getTime());
|
||||
//判断监测点类型 针对治理设备 模块数据是一次值、电能质量设备是二次值
|
||||
if (po.getClDid() != 0 && Objects.equals("Primary",energyBaseParam.getDataLevel()) && ObjectUtil.isNotNull(eleEpdPqd.getPrimaryFormula())) {
|
||||
double secondaryData1 = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getMaxValue(), po.getPtRatio(), po.getCtRatio());
|
||||
double secondaryData2 = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getMinValue(), po.getPtRatio(), po.getCtRatio());
|
||||
double secondaryData3 = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getAvgValue(), po.getPtRatio(), po.getCtRatio());
|
||||
vo.setMaxValue(BigDecimal.valueOf(secondaryData1).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
vo.setMinValue(BigDecimal.valueOf(secondaryData2).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
vo.setAvgValue(BigDecimal.valueOf(secondaryData3).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
if (ObjectUtil.isNotNull(eleEpdPqd.getPrimaryFormula()) && !Objects.equals(csDataSet.getDataLevel(),energyBaseParam.getDataLevel()) ) {
|
||||
double secondaryData1;
|
||||
double secondaryData2;
|
||||
double secondaryData3;
|
||||
if("Primary".equals(csDataSet.getDataLevel())){
|
||||
secondaryData1 = DataChangeUtil.primaryToSecondary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getMaxValue(), po.getPtRatio(), po.getCtRatio());
|
||||
secondaryData2 = DataChangeUtil.primaryToSecondary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getMinValue(), po.getPtRatio(), po.getCtRatio());
|
||||
secondaryData3 = DataChangeUtil.primaryToSecondary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getAvgValue(), po.getPtRatio(), po.getCtRatio());
|
||||
}else {
|
||||
secondaryData1 = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getMaxValue(), po.getPtRatio(), po.getCtRatio());
|
||||
secondaryData2 = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getMinValue(), po.getPtRatio(), po.getCtRatio());
|
||||
secondaryData3 = DataChangeUtil.secondaryToPrimary(eleEpdPqd.getPrimaryFormula(), statisticalDataDTO.getAvgValue(), po.getPtRatio(), po.getCtRatio());
|
||||
}
|
||||
|
||||
if (changePower(vo.getAnotherName())) {
|
||||
vo.setMaxValue(Double.valueOf(df.format(BigDecimal.valueOf(secondaryData1/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setMinValue(Double.valueOf(df.format(BigDecimal.valueOf(secondaryData2/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setAvgValue(Double.valueOf(df.format(BigDecimal.valueOf(secondaryData3/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
} else {
|
||||
vo.setMaxValue(BigDecimal.valueOf(statisticalDataDTO.getMaxValue()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
vo.setMinValue(BigDecimal.valueOf(statisticalDataDTO.getMinValue()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
vo.setAvgValue(BigDecimal.valueOf(statisticalDataDTO.getAvgValue()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
vo.setMaxValue(Double.valueOf(df.format(BigDecimal.valueOf(secondaryData1).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setMinValue(Double.valueOf(df.format(BigDecimal.valueOf(secondaryData2).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setAvgValue(Double.valueOf(df.format(BigDecimal.valueOf(secondaryData3).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
}
|
||||
} else {
|
||||
if (changePower(vo.getAnotherName())) {
|
||||
vo.setMaxValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getMaxValue()/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setMinValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getMinValue()/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setAvgValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getAvgValue()/1000).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
} else {
|
||||
vo.setMaxValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getMaxValue()).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setMinValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getMinValue()).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
vo.setAvgValue(Double.valueOf(df.format(BigDecimal.valueOf(statisticalDataDTO.getAvgValue()).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
vo.setMaxValue(3.1415956);
|
||||
@@ -258,46 +286,85 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
@Override
|
||||
public Object deviceDataByType(CommonStatisticalQueryParam commonStatisticalQueryParam) {
|
||||
String type = commonStatisticalQueryParam.getType();
|
||||
if (type == null) throw new BusinessException(LineBaseEnum.NOTYPE_FAIL.getMessage());
|
||||
if (type == null){
|
||||
throw new BusinessException(LineBaseEnum.NOTYPE_FAIL.getMessage());
|
||||
}
|
||||
//传1 则是趋势数据tab页面
|
||||
if("1".equals(type)){
|
||||
formatQueryParamList(commonStatisticalQueryParam);
|
||||
List<ThdDataVO> result = new ArrayList();
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||
if(param.getStatisticalId() == null){
|
||||
continue;
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = finalCsLinePOList.get(0).getCtRatio();
|
||||
Double pt = finalCsLinePOList.get(0).getPtRatio();
|
||||
if(CollectionUtil.isNotEmpty(commonStatisticalQueryParam.getList())){
|
||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||
eleEpdPqds.forEach(epdPqd->{
|
||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(temp.getLineId());
|
||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName()+ (StringUtils.isEmpty(param.getFrequency()) ? "":"_"+param.getFrequency()));
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
//commonQueryParam.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||
//commonQueryParam.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||
|
||||
commonQueryParam.setStartTime(DateUtil.format(DateUtil.parse(commonStatisticalQueryParam.getStartTime(),DatePattern.NORM_DATE_PATTERN), DatePattern.NORM_DATETIME_PATTERN));
|
||||
commonQueryParam.setEndTime(DateUtil.format(DateUtil.endOfDay(DateUtil.parse(commonStatisticalQueryParam.getEndTime(),DatePattern.NORM_DATE_PATTERN)), DatePattern.NORM_DATETIME_PATTERN));
|
||||
|
||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||
return commonQueryParam;
|
||||
}).collect(Collectors.toList());
|
||||
//List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtData(commonQueryParams);
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(temp.getPhaseType());
|
||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
if(temp.getValue()!=null) {
|
||||
double re;
|
||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(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());
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
||||
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());
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(null);
|
||||
}
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
@@ -339,7 +406,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(temp.getPhaseType());
|
||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -356,14 +423,23 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
return result;
|
||||
}else if("3".equals(type)){
|
||||
//传3 则是暂态事件tab页面
|
||||
Page<DataGroupEventVO> returnpage = new Page<> (commonStatisticalQueryParam.getPageNum(),commonStatisticalQueryParam.getPageSize());
|
||||
returnpage = this.getBaseMapper().getGroupEventList(returnpage,commonStatisticalQueryParam.getDevId(),commonStatisticalQueryParam.getLineId());
|
||||
returnpage.getRecords().forEach(temp->{
|
||||
CsEventUserQueryPage csEventUserQueryPage = new CsEventUserQueryPage();
|
||||
csEventUserQueryPage.setPageNum(commonStatisticalQueryParam.getPageNum());
|
||||
csEventUserQueryPage.setPageSize(commonStatisticalQueryParam.getPageSize());
|
||||
csEventUserQueryPage.setLineId(commonStatisticalQueryParam.getLineId());
|
||||
csEventUserQueryPage.setStartTime(commonStatisticalQueryParam.getStartTime());
|
||||
csEventUserQueryPage.setEndTime(commonStatisticalQueryParam.getEndTime());
|
||||
Page<DataGroupEventVO> csEventVOPage = eventFeignClient.pageQueryByLineId(csEventUserQueryPage).getData();
|
||||
|
||||
csEventVOPage.getRecords().forEach(temp->{
|
||||
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
||||
//事件描述
|
||||
CsLedger dataById = iCsLedgerService.findDataById(temp.getLineId());
|
||||
temp.setLineName(dataById.getName());
|
||||
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
if(ele!=null){
|
||||
temp.setShowName(ele.getShowName());
|
||||
|
||||
//相别
|
||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||
@@ -386,18 +462,26 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}else {
|
||||
temp.setPhaseType(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
|
||||
}
|
||||
}
|
||||
//变电站名称
|
||||
List<LineDetailVO.Detail> lineDetailVOS = lineFeignClient.getLineDetailByIds(Arrays.asList(temp.getLineId())).getData();
|
||||
if(!lineDetailVOS.isEmpty()){
|
||||
temp.setSubName(lineDetailVOS.get(0).getSubName());
|
||||
}
|
||||
//暂降幅值
|
||||
List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(temp.getEventId())).getData();
|
||||
if(eventDetails !=null && !eventDetails.isEmpty()) temp.setFeatureAmplitude(PubUtils.floatRound(2, eventDetails.get(0).getFeatureAmplitude().floatValue()));
|
||||
|
||||
List<EventDataSetDTO> evtParamDepth = eventDataSetDTOS.stream().
|
||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), DataParam.EvtParamDepth)).
|
||||
collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(evtParamDepth)){
|
||||
temp.setFeatureAmplitude(null);
|
||||
}else {
|
||||
temp.setFeatureAmplitude(evtParamDepth.get(0).getValue().equals("-")?null:Float.parseFloat(evtParamDepth.get(0).getValue()));
|
||||
}
|
||||
List<EventDataSetDTO> evtParmTm = eventDataSetDTOS.stream().
|
||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), DataParam.EVTPARAMTM)).
|
||||
collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(evtParamDepth)){
|
||||
temp.setPersistTime(null);
|
||||
}else {
|
||||
temp.setPersistTime(evtParmTm.get(0).getValue().equals("-")?null:Double.parseDouble(evtParmTm.get(0).getValue()));
|
||||
}
|
||||
}
|
||||
});
|
||||
return returnpage;
|
||||
return csEventVOPage;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -426,7 +510,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
@Override
|
||||
public List<ThdDataTdVO> getDeviceTrendData(String devId, String lineId,String groupId) {
|
||||
List<ThdDataTdVO> data = new ArrayList();
|
||||
List<Overlimit> overlimits = overLimitClient.getOverLimitByLineIds(Arrays.asList(lineId)).getData();
|
||||
List<Overlimit> overlimits = overlimitMapper.selectBatchIds(Arrays.asList(lineId));
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(lineId)).getData();
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(devId).collect(Collectors.toList())).getData();
|
||||
//便携式设备-稳态指标-实时数据-指标
|
||||
@@ -464,7 +548,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(temp.getPhaseType());
|
||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -564,7 +648,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(temp.getPhaseType());
|
||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
@@ -695,7 +779,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
}
|
||||
|
||||
//单位处理
|
||||
public void getUnit(List<EnergyTemplateVO> energyTemplates, List<EleEpdPqd> eleEpdPqds, List<DataGroupTemplateVO> dataGroupTemplates) {
|
||||
public void getUnit(List<EnergyTemplateVO> energyTemplates, List<EleEpdPqd> eleEpdPqds, List<DataGroupTemplateVO> dataGroupTemplates, String type) {
|
||||
// 使用Map来存储EleEpdPqd的ID和Unit,以便快速查找
|
||||
Map<String, String> unitMap = new HashMap<>();
|
||||
for (EleEpdPqd item : eleEpdPqds) {
|
||||
@@ -720,10 +804,23 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
for (DataGroupTemplateVO dataGroupTemplate : dataGroupTemplates) {
|
||||
EnergyTemplateVO energyTemplate = energyTemplateMap.get(dataGroupTemplate.getId());
|
||||
if (energyTemplate != null && energyTemplate.getUnit() != null) {
|
||||
if (changePower(dataGroupTemplate.getName()) && Objects.equals("Primary",type)) {
|
||||
dataGroupTemplate.setName(dataGroupTemplate.getName() + "(k" + energyTemplate.getUnit() + ")");
|
||||
} else {
|
||||
dataGroupTemplate.setName(dataGroupTemplate.getName() + "(" + energyTemplate.getUnit() + ")");
|
||||
}
|
||||
}
|
||||
dataGroupTemplate.setName(dataGroupTemplate.getName().replace("序列",""));;
|
||||
}
|
||||
}
|
||||
|
||||
//判断指标是否需要转换
|
||||
public boolean changePower(String name) {
|
||||
if(name.contains("相角")) {
|
||||
return false;
|
||||
}
|
||||
return HarmonicConstant.POWER_LIST.stream()
|
||||
.anyMatch(name::contains);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,7 +19,6 @@ import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -50,14 +49,10 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
private final WlRecordMapper wlRecordMapper;
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final ICsDataSetService csDataSetService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLedgerTree() {
|
||||
List<CsLedgerVO> list = new ArrayList<>();
|
||||
@@ -75,47 +70,48 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLineTree() {
|
||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||
List<CsLedgerVO> engineeringList;
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
String areaId = dicDataFeignClient.getDicDataByCode(DicDataEnum.OUTPUT_SIDE.getCode()).getData().getId();
|
||||
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId())).
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
peek(
|
||||
temp->{
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
||||
temp.setType("device");
|
||||
}
|
||||
).
|
||||
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
List<CsLedgerVO> finalLineList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
List<CsLedgerVO> finalLineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.peek(item -> item.setType("line"))
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(deviceList);
|
||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
//整理整个树并新增便携式设备树
|
||||
//获取便携式设备树
|
||||
CsLedgerVO portable = new CsLedgerVO();
|
||||
portable.setLevel(0);
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
List<CsLedgerVO> portables = wlRecordMapper.getAll();
|
||||
checkDevSetData(portables);
|
||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
||||
for(CsLedgerVO c : portables){
|
||||
c.setPid(portable.getId());
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
||||
c.setChildren(wlRecordMapper.getAllLine(c.getId()));
|
||||
for(CsLedgerVO cs : c.getChildren()){
|
||||
cs.setPid(c.getId());
|
||||
cs.setLevel(3);
|
||||
}
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
}
|
||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
checkDevSetData(portables);
|
||||
portable.setChildren(portables);
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
@@ -125,32 +121,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
tree.add(government);
|
||||
return tree;
|
||||
//return engineeringList;
|
||||
}
|
||||
|
||||
// //剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
// private void checkDevSetData(List<CsLedgerVO> ledgerVOS){
|
||||
// Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||
// while (iterator.hasNext()){
|
||||
// CsLedgerVO csLedgerVO = iterator.next();
|
||||
// //只针对设备
|
||||
// if(csLedgerVO.getLevel() == 2){
|
||||
// List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(csLedgerVO.getId());
|
||||
// if (CollUtil.isEmpty(modelId)){
|
||||
// iterator.remove();
|
||||
// }else{
|
||||
// for (CsDevModelRelationPO item : modelId) {
|
||||
// if (CollUtil.isEmpty(csDataSetService.findDataSetByModelId(item.getModelId()))){
|
||||
// iterator.remove();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
||||
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||
@@ -182,44 +160,42 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getDeviceTree() {
|
||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||
List<CsLedgerVO> engineeringList;
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
// if (Objects.equals(RequestUtil.getUsername(),"root")){
|
||||
// engineeringList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
// } else {
|
||||
// List<CsEngineeringPO> engineering = csEngineeringUserService.getEngineeringByUser();
|
||||
// engineeringList = allList.stream().filter(item->engineering.stream().map(CsEngineeringPO::getId).collect(Collectors.toList()).contains(item.getId())).collect(Collectors.toList());
|
||||
// }
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
// List<CsLedgerVO> deviceList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId())).
|
||||
map(
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
peek(
|
||||
temp->{
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
||||
return temp;
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(po.getRunStatus());
|
||||
temp.setNDId(po.getNdid());
|
||||
temp.setType("device");
|
||||
}
|
||||
).
|
||||
sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(deviceList);
|
||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
//整理整个树并新增便携式设备树
|
||||
|
||||
//获取便携式设备树
|
||||
CsLedgerVO portable = new CsLedgerVO();
|
||||
portable.setLevel(0);
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
List<CsLedgerVO> portables = wlRecordMapper.getAll();
|
||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
||||
checkDevSetData(portables);
|
||||
for(CsLedgerVO c : portables){
|
||||
c.setPid(portable.getId());
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
}
|
||||
portable.setChildren(portables);
|
||||
|
||||
@@ -230,10 +206,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
return tree;
|
||||
//return engineeringList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,12 +264,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
public List<CsLedgerVO> getProjectTree() {
|
||||
List<CsLedgerVO> engineeringList = new ArrayList<>();
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
// if (Objects.equals(RequestUtil.getUsername(),"root") || Objects.equals(RequestUtil.getUsername(),"njcnser")){
|
||||
// engineeringList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
// } else {
|
||||
// List<CsEngineeringPO> engineering = csEngineeringUserService.getEngineeringByUser();
|
||||
// engineeringList = allList.stream().filter(item->engineering.stream().map(CsEngineeringPO::getId).collect(Collectors.toList()).contains(item.getId())).collect(Collectors.toList());
|
||||
// }
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
@@ -313,29 +286,33 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
temp.setChildren(collect);
|
||||
});
|
||||
engineeringList.forEach(eng -> {
|
||||
|
||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
||||
eng.setRemark(csEngineeringPO.getDescription());
|
||||
eng.setChildren(getChildren(eng, projectList));
|
||||
|
||||
}
|
||||
);
|
||||
|
||||
|
||||
return engineeringList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedger> queryLine(LineParamDTO lineParamdto) {
|
||||
List<CsLedger> lineIds = this.getBaseMapper().queryLine(lineParamdto);
|
||||
return lineIds;
|
||||
return this.getBaseMapper().queryLine(lineParamdto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevDetailDTO queryDevDetail(String devId) {
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
CsLedger dev = this.findDataById(devId);
|
||||
//如果是便携式设备,pid为0,项目,工程都设置为/
|
||||
if(Objects.equals(dev.getPid(),"0")){
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
device.setEngineeringName("/");
|
||||
}else {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
@@ -344,10 +321,88 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
CsLedger engineer = this.findDataById(project.getPid());
|
||||
device.setEngineeringid(engineer.getId());
|
||||
device.setEngineeringName(engineer.getName());
|
||||
}
|
||||
|
||||
|
||||
return device;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getztProjectTree() {
|
||||
List<CsLedgerVO> engineeringList;
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
|
||||
List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(),"0")).
|
||||
peek(
|
||||
temp->{
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
temp.setComFlag(po.getRunStatus());
|
||||
temp.setNDId(po.getNdid());
|
||||
temp.setType("device");
|
||||
}
|
||||
).
|
||||
sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(deviceList);
|
||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
|
||||
//获取便携式项目数
|
||||
CsLedgerVO portable = new CsLedgerVO();
|
||||
portable.setLevel(0);
|
||||
portable.setName(DataParam.PORTABLE_SYSTEM);
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
|
||||
CsLedgerVO project = new CsLedgerVO();
|
||||
project.setLevel(1);
|
||||
project.setName(DataParam.WIRELESS_PROJECT);
|
||||
project.setPid("0");
|
||||
project.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||
|
||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
||||
checkDevSetData(portables);
|
||||
for(CsLedgerVO c : portables){
|
||||
c.setPid(project.getId());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
}
|
||||
project.setChildren(portables);
|
||||
|
||||
List<CsLedgerVO> wxProjectList = new ArrayList<>();
|
||||
wxProjectList.add(project);
|
||||
|
||||
portable.setChildren(wxProjectList);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(0);
|
||||
government.setName(DataParam.GOVERNANCE_SYSTEM);
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
|
||||
return tree;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -71,6 +71,16 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateIds(CsLineParam csLineParam) {
|
||||
LambdaUpdateWrapper<CsLinePO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CsLinePO::getLineId,csLineParam.getLineId())
|
||||
.eq(CsLinePO::getStatus,1)
|
||||
.set(CsLinePO::getDataSetId,csLineParam.getDataSetId())
|
||||
.set(CsLinePO::getDataModelId,csLineParam.getModelId());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||
// *
|
||||
|
||||
@@ -46,8 +46,9 @@ public class CsLogsPOServiceImpl extends ServiceImpl<CsLogsPOMapper, CsLogsPO> i
|
||||
String userRole = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(userRole, String.class);
|
||||
QueryWrapper<CsLogsPO> csLogsPOQueryWrapper = new QueryWrapper<>();
|
||||
csLogsPOQueryWrapper.lambda().eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username).
|
||||
ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
|
||||
csLogsPOQueryWrapper.lambda()
|
||||
// .eq(!strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode()),CsLogsPO::getUserName, username)
|
||||
.ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()),CsLogsPO::getCreateTime,baseParam.getSearchBeginTime()).
|
||||
le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),CsLogsPO::getCreateTime,baseParam.getSearchEndTime()).orderByDesc(CsLogsPO::getCreateTime);
|
||||
IPage<CsLogsPO> list = this.getBaseMapper().selectPage(returnpage,csLogsPOQueryWrapper);
|
||||
return list;
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsSoftInfoPO;
|
||||
import com.njcn.csdevice.service.ICsSoftInfoService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 系统软件表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xuyang
|
||||
* @since 2023-08-09
|
||||
*/
|
||||
@Service
|
||||
public class CsSoftInfoServiceImpl extends ServiceImpl<CsSoftInfoMapper, CsSoftInfoPO> implements ICsSoftInfoService {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||
import com.njcn.access.enums.AccessResponseEnum;
|
||||
import com.njcn.access.pojo.dto.file.FileDto;
|
||||
import com.njcn.access.utils.ChannelObjectUtil;
|
||||
import com.njcn.access.utils.MqttUtil;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.service.DeviceFtpService;
|
||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class DeviceFtpServiceImpl implements DeviceFtpService {
|
||||
|
||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||
private final RedisUtil redisUtil;
|
||||
private final ChannelObjectUtil channelObjectUtil;
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
private final MqttUtil mqttUtil;
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss");
|
||||
|
||||
@Override
|
||||
public MakeUpVo askDeviceRootPath(String nDid) {
|
||||
MakeUpVo makeUpVo = new MakeUpVo();
|
||||
try {
|
||||
judgeClientOnline(nDid);
|
||||
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
||||
Thread.sleep(3000);
|
||||
Object object = redisUtil.getObjectByKey(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
if (Objects.nonNull(object)) {
|
||||
makeUpVo.setPrjDataPath(object.toString());
|
||||
makeUpVo.setType("dir");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ROOT_ERROR);
|
||||
}
|
||||
return makeUpVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type) {
|
||||
List<MakeUpVo> result = new ArrayList<>();
|
||||
try {
|
||||
judgeClientOnline(nDid);
|
||||
// 删除旧的缓存信息
|
||||
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
||||
// 请求设备文件或目录信息
|
||||
askDeviceDataFeignClient.askDeviceFileOrDir(nDid, name);
|
||||
Thread.sleep(10000);
|
||||
// 从 Redis 获取对象
|
||||
Object object = redisUtil.getObjectByKey(AppRedisKey.PROJECT_INFO + nDid);
|
||||
if (object != null) {
|
||||
// 根据类型处理不同的数据
|
||||
processObject(result, object, type);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
// 捕获特定异常并抛出运行时异常
|
||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ERROR);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(result)) {
|
||||
result.stream().sorted(Comparator.comparing(MakeUpVo::getType)).collect(Collectors.toList());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Async
|
||||
public void downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
||||
judgeClientOnline(nDid);
|
||||
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
|
||||
if (Objects.nonNull(task)) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||
}
|
||||
Object task2 = redisUtil.getObjectByKey("uploading");
|
||||
if (Objects.nonNull(task2)) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_BUSY);
|
||||
}
|
||||
try {
|
||||
redisUtil.delete("downloadFilePath:"+ nDid + name);
|
||||
askDeviceDataFeignClient.downloadFile(nDid,name,size,fileCheck).getData();
|
||||
} catch (Exception e) {
|
||||
redisUtil.delete("fileDowning:"+nDid);
|
||||
redisUtil.delete("fileCheck"+nDid+name);
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDownloadFilePath(String nDid, String name) {
|
||||
String result = null;
|
||||
Object object = redisUtil.getObjectByKey("downloadFilePath:" + nDid + name);
|
||||
if (Objects.nonNull(object)) {
|
||||
result = (String) object;
|
||||
redisUtil.delete("downloadFilePath:" + nDid + name);
|
||||
}
|
||||
redisUtil.delete("fileCheck"+nDid+name);
|
||||
redisUtil.delete("fileDowning:"+nDid);
|
||||
redisUtil.delete(AppRedisKey.FILE_PART.concat(name));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean createFile(String nDid, String path) {
|
||||
boolean result = false;
|
||||
try {
|
||||
askDeviceDataFeignClient.createFolder(nDid,path);
|
||||
Thread.sleep(3000);
|
||||
String key = "createDir"+ nDid;
|
||||
Integer value = Integer.parseInt(redisUtil.getObjectByKey(key).toString());
|
||||
if (Objects.equals(value,200)) {
|
||||
result = true;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteFile(String nDid, String path) {
|
||||
boolean result = false;
|
||||
try {
|
||||
askDeviceDataFeignClient.deleteFolder(nDid,path);
|
||||
Thread.sleep(3000);
|
||||
String key = "deleteDir"+ nDid;
|
||||
Integer value = Integer.parseInt(redisUtil.getObjectByKey(key).toString());
|
||||
if (Objects.equals(value,200)) {
|
||||
result = true;
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private void processObject(List<MakeUpVo> result, Object object, String type) {
|
||||
if ("dir".equals(type)) {
|
||||
List<FileDto.DirInfo> projectInfoList = channelObjectUtil.objectToList(object, FileDto.DirInfo.class);
|
||||
projectInfoList.forEach(item -> {
|
||||
MakeUpVo vo = createMakeUpVoFromDir(item);
|
||||
result.add(vo);
|
||||
});
|
||||
} else {
|
||||
FileDto.FileInfo fileInfo = channelObjectUtil.objectToSingleObject(object, FileDto.FileInfo.class);
|
||||
MakeUpVo vo = createMakeUpVoFromFile(fileInfo);
|
||||
result.add(vo);
|
||||
}
|
||||
}
|
||||
|
||||
private MakeUpVo createMakeUpVoFromDir(FileDto.DirInfo item) {
|
||||
MakeUpVo vo = new MakeUpVo();
|
||||
vo.setPrjDataPath(item.getName());
|
||||
vo.setType(item.getType());
|
||||
vo.setSize(item.getSize());
|
||||
if (item.getTime() == 0) {
|
||||
vo.setStartTime("/");
|
||||
} else {
|
||||
LocalDateTime dateTime = Instant.ofEpochMilli((item.getTime()-8*3600)*1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
String formattedDate = dateTime.format(formatter);
|
||||
vo.setStartTime(formattedDate);
|
||||
}
|
||||
return vo;
|
||||
}
|
||||
|
||||
private MakeUpVo createMakeUpVoFromFile(FileDto.FileInfo fileInfo) {
|
||||
MakeUpVo vo = new MakeUpVo();
|
||||
vo.setPrjDataPath(fileInfo.getName());
|
||||
if (fileInfo.getFileTime() != 0) {
|
||||
LocalDateTime dateTime = Instant.ofEpochMilli((fileInfo.getFileTime() - 8*3600) * 1000).atZone(ZoneId.systemDefault()).toLocalDateTime();
|
||||
String formattedDate = dateTime.format(formatter);
|
||||
vo.setStartTime(formattedDate);
|
||||
vo.setSize(fileInfo.getFileSize());
|
||||
}
|
||||
vo.setFileCheck(fileInfo.getFileCheck());
|
||||
return vo;
|
||||
}
|
||||
|
||||
public void judgeClientOnline(String nDid) {
|
||||
//判断客户端是否在线
|
||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||
if (!mqttClient){
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/10/22 14:14【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface OverlimitService extends IService<Overlimit>{
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||
import com.njcn.csdevice.mapper.PortableOffMainLogMapper;
|
||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
* Date: 2024/10/15 10:43【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
public class PortableOffMainLogServiceImpl extends ServiceImpl<PortableOffMainLogMapper, PortableOffMainLog> implements PortableOffMainLogService{
|
||||
|
||||
}
|
||||
@@ -1,26 +1,33 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
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.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
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.service.IPortableOfflLogService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.api.OfflineDataUploadFeignClient;
|
||||
import com.njcn.csharmonic.offline.constant.OfflineConstant;
|
||||
import com.njcn.csharmonic.offline.log.Log;
|
||||
import com.njcn.csharmonic.offline.log.vo.NewBodyTaglogbuffer;
|
||||
import com.njcn.csharmonic.offline.log.vo.NewHeadTaglogbuffer;
|
||||
import com.njcn.csharmonic.offline.log.vo.NewTaglogbuffer;
|
||||
import com.njcn.csharmonic.offline.mincfg.tagComtradeCfg;
|
||||
import com.njcn.csharmonic.offline.log.vo.TagComtradeCfg;
|
||||
import com.njcn.csharmonic.offline.mincfg.AnalyseComtradeCfg;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.CmnModeCfg;
|
||||
import com.njcn.csharmonic.offline.vo.Response;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.influx.imapper.EvtDataMapper;
|
||||
@@ -30,21 +37,22 @@ import com.njcn.influx.pojo.po.cs.PqdData;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.EleEvtParm;
|
||||
import com.njcn.web.pojo.param.BaseParam;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.collections4.ListUtils;
|
||||
import org.apache.commons.io.FilenameUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.ObjectInputStream;
|
||||
import java.io.*;
|
||||
import java.text.DecimalFormat;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -62,6 +70,9 @@ import java.util.stream.Stream;
|
||||
@RequiredArgsConstructor
|
||||
public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMapper, PortableOfflLog> implements IPortableOfflLogService {
|
||||
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("#0.000");
|
||||
|
||||
private final FileStorageUtil fileStorageUtil;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
@@ -74,26 +85,115 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
|
||||
private final EquipmentFeignClient equipmentFeignClient;
|
||||
|
||||
private final CsLineFeignClient csLineFeignClient;
|
||||
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
|
||||
private final PqdDataMapper pqdDataMapper;
|
||||
|
||||
private final EvtDataMapper evtDataMapper;
|
||||
|
||||
private final MqttPublisher publisher;
|
||||
private final PortableOffMainLogService portableOffMainLogService;
|
||||
|
||||
@Override
|
||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||
Page<PortableOfflLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||
if(baseParam.getSearchBeginTime()!=null) baseParam.setSearchBeginTime(baseParam.getSearchBeginTime()+DataParam.startTime);
|
||||
if(baseParam.getSearchEndTime()!=null) baseParam.setSearchEndTime(baseParam.getSearchEndTime()+DataParam.endTime);
|
||||
if(baseParam.getSearchBeginTime()!=null) {
|
||||
baseParam.setSearchBeginTime(baseParam.getSearchBeginTime()+DataParam.startTime);
|
||||
}
|
||||
if(baseParam.getSearchEndTime()!=null) {
|
||||
baseParam.setSearchEndTime(baseParam.getSearchEndTime()+DataParam.endTime);
|
||||
}
|
||||
returnpage = this.getBaseMapper().queryPage(returnpage,baseParam);
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
public byte[] uploadAnalysis(List<MultipartFile> files,String type) throws Exception{
|
||||
byte[] bytes = null;
|
||||
ByteArrayOutputStream baos = new ByteArrayOutputStream();
|
||||
ObjectOutputStream oos = new ObjectOutputStream(baos);
|
||||
|
||||
List<Response> responses = new ArrayList<>();
|
||||
//min解析较为特殊需要同时解析所有文件
|
||||
if(!files.isEmpty() && OfflineConstant.MIN.equals(type)){
|
||||
Response response = new Response();
|
||||
response.setFilename(OfflineConstant.MIN);
|
||||
List<PqdData> pqdData = null;
|
||||
try {
|
||||
pqdData = AnalyseComtradeCfg.processDirectory(files);
|
||||
} catch (Exception e) {
|
||||
log.error("min文件夹下的数据文件解析失败");
|
||||
response.setState(2);
|
||||
}
|
||||
response.setObj(pqdData);
|
||||
responses.add(response);
|
||||
}else{
|
||||
for(MultipartFile file : files){
|
||||
Response response = new Response();
|
||||
response.setFilename(file.getOriginalFilename());
|
||||
if(OfflineConstant.COMTRADE.equals(type) && file.getOriginalFilename().indexOf(OfflineConstant.CFG) != -1) {
|
||||
TagComtradeCfg tagComtradeCfg = null;
|
||||
try {
|
||||
tagComtradeCfg = AnalyseComtradeCfg.analyseComtradeCfg(file);
|
||||
} catch (Exception e) {
|
||||
log.error("当前文件:{},解析失败",file.getOriginalFilename());
|
||||
response.setState(2);
|
||||
}
|
||||
response.setObj(tagComtradeCfg);
|
||||
}else if(OfflineConstant.LOG.equals(type) && file.getOriginalFilename().indexOf(OfflineConstant.BIN) != -1){
|
||||
List<NewTaglogbuffer> newTaglogbuffers = null;
|
||||
try {
|
||||
newTaglogbuffers = Log.convertLog(file);
|
||||
} catch (Exception e) {
|
||||
log.error("当前文件:{},解析失败",file.getOriginalFilename());
|
||||
response.setState(2);
|
||||
}
|
||||
response.setObj(newTaglogbuffers);
|
||||
}
|
||||
responses.add(response);
|
||||
}
|
||||
}
|
||||
try {
|
||||
oos.writeObject(responses);
|
||||
bytes = baos.toByteArray();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException(OfflineConstant.DATATOBYTE_FAIL);
|
||||
} finally {
|
||||
oos.close();
|
||||
baos.close();
|
||||
}
|
||||
return bytes;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public void importEquipment(UploadDataParam uploadDataParam) {
|
||||
public void importEquipment(UploadDataParam uploadDataParam){
|
||||
String lineId = uploadDataParam.getLineId();
|
||||
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
||||
//第一步解析redcord.bin文件获取监测点序号做校验
|
||||
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
|
||||
temp -> temp.getOriginalFilename().contains("record.bin"))
|
||||
.collect(Collectors.toList());
|
||||
if(CollectionUtils.isEmpty(record)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.RECORD_FILE_LOST);
|
||||
}else {
|
||||
InputStream inputStream = null;
|
||||
try {
|
||||
inputStream = record.get(0).getInputStream();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
CmnModeCfg cmnModeCfg = AnalyseComtradeCfg.convertRecord(inputStream);
|
||||
//监测点序号
|
||||
int lineIdx = cmnModeCfg.line_idx;
|
||||
|
||||
if(lineIdx!=Integer.valueOf(cdid)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.LINE_NUM_MISMATCH);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
//获取离线上传对应的字典规则(字典用来控制上传的文件夹名称,其中字典的name代表名称,code代表该文件夹下对应的解析规则且code不能更改)
|
||||
List<DictData> dictDatas = dicDataFeignClient.getDicDataByTypeCode(DataParam.wlRecordUpload).getData();
|
||||
List<Response> responses = new ArrayList<>();
|
||||
@@ -104,11 +204,18 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
List<MultipartFile> fileList = new ArrayList<>();
|
||||
for(MultipartFile file : uploadDataParam.getFiles()){
|
||||
//获取每个文件夹下对应的文件信息
|
||||
if(checkPrevsFolder(file.getOriginalFilename(),dictData.getName())!=null) fileList.add(file);
|
||||
if(checkPrevsFolder(file.getOriginalFilename(),dictData.getName())!=null) {
|
||||
fileList.add(file);
|
||||
}
|
||||
}
|
||||
if(!fileList.isEmpty()){
|
||||
//将当前文件夹下的文件统一解析
|
||||
byte[] resp = offlineDataUploadFeignClient.uploadAnalysis(fileList,dictData.getCode()).getData();
|
||||
byte[] resp = new byte[0];
|
||||
try {
|
||||
resp = uploadAnalysis(fileList,dictData.getCode());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
//解析的返回的是复杂对象所以直接转成byte数组
|
||||
ByteArrayInputStream bis = new ByteArrayInputStream(resp);
|
||||
ObjectInputStream ois = null;
|
||||
@@ -137,14 +244,29 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(uploadDataParam.getDevId()).collect(Collectors.toList())).getData();
|
||||
|
||||
CsEquipmentDeliveryDTO csEquipmentDeliveryDTO = data1.get(0);
|
||||
//min文件夹下的文件是否解析过
|
||||
boolean minFlag = true;
|
||||
//开始上传文件、记录上传日志、解析的文件结果入库
|
||||
//最外层便利所有文件确保所有文件都上传及记录上传日志
|
||||
int nowStep = uploadDataParam.getFiles().size();
|
||||
PortableOffMainLog portableOffMainLog = new PortableOffMainLog();
|
||||
portableOffMainLog.setId(IdUtil.fastSimpleUUID());
|
||||
portableOffMainLog.setStartTime(LocalDateTime.now());
|
||||
String paths = uploadDataParam.getFiles().stream().map(MultipartFile::getOriginalFilename)
|
||||
.reduce((s1, s2) -> getCommonPrefix(s1, s2))
|
||||
.orElse(null);
|
||||
String[] split = paths.split("/");
|
||||
portableOffMainLog.setProjectName(split.length>0?split[split.length-1]:"/");
|
||||
int successcCount = 0;
|
||||
portableOffMainLog.setStatus("1");
|
||||
|
||||
|
||||
for(MultipartFile file : uploadDataParam.getFiles()){
|
||||
|
||||
//初始上传日志基本信息
|
||||
PortableOfflLog portableOfflLog = new PortableOfflLog();
|
||||
portableOfflLog.setLogMainId(portableOffMainLog.getId());
|
||||
portableOfflLog.setName(file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf("/")+1));
|
||||
portableOfflLog.setPath(file.getOriginalFilename());
|
||||
portableOfflLog.setDataPath(fileStorageUtil.uploadMultipart(file, DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/"));
|
||||
@@ -153,11 +275,18 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
//默认总条数及入库数为0(防止解析的数据重复插入及上传的文件目录路径错误)
|
||||
portableOfflLog.setAllCount(0);
|
||||
portableOfflLog.setRealCount(0);
|
||||
|
||||
//开始匹配解析的文件结果入库
|
||||
for(Response response : responses){
|
||||
//min解析结果较为特殊所有的文件解析后只有一条结果
|
||||
if(OfflineConstant.MIN.equals(response.getFilename()) && checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.MIN)!=null){
|
||||
List<PqdData> pqdData = (List<PqdData>) response.getObj();
|
||||
pqdData.forEach(temp->{
|
||||
temp.setClDid(cdid);
|
||||
temp.setIsAbnormal(0);
|
||||
temp.setProcess(data1.get(0).getProcess()+"");
|
||||
temp.setLineId(uploadDataParam.getLineId());
|
||||
});
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
@@ -169,7 +298,11 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
portableOfflLog.setRealCount(pqdData.size());
|
||||
if(minFlag){
|
||||
log.info("类型min,插入infulxDb的pqdData");
|
||||
//pqdDataMapper.insertBatch(pqdData);
|
||||
List<List<PqdData>> partition = ListUtils.partition(pqdData, 1500);
|
||||
for (List<PqdData> sliceList : partition) {
|
||||
List<PqdData> sublistAsOriginalListType = new ArrayList<>(sliceList);
|
||||
pqdDataMapper.insertBatch(sublistAsOriginalListType);
|
||||
}
|
||||
//min结果集解析入库后就不需要在解析了
|
||||
minFlag = false;
|
||||
}
|
||||
@@ -181,7 +314,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
}
|
||||
tagComtradeCfg tagComtradeCfg = (tagComtradeCfg) response.getObj();
|
||||
TagComtradeCfg tagComtradeCfg = (TagComtradeCfg) response.getObj();
|
||||
if(tagComtradeCfg != null){
|
||||
//否则正常标记为成功解析
|
||||
portableOfflLog.setState(1);
|
||||
@@ -208,6 +341,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
NewHeadTaglogbuffer newHeadTaglogbuffer = newTaglogbuffer.getNewHeadTaglogbuffer();
|
||||
String strId = "";
|
||||
String strName = newHeadTaglogbuffer.getLogCode()+"";
|
||||
//todo 其他事件做映射
|
||||
//中断标志
|
||||
if(DataParam.intrStr.contains(newHeadTaglogbuffer.getLogCode())){
|
||||
strId = DataParam.intrStrId;
|
||||
@@ -223,28 +357,44 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
strId = DataParam.swlStrId;
|
||||
strName = DataParam.swlStrName;
|
||||
}
|
||||
List<EleEvtParm> eleEvtParms = eleEvtFeignClient.queryByPid(strId).getData();
|
||||
//插入事件表
|
||||
CsEventPO csEventPO = new CsEventPO();
|
||||
csEventPO.setId(IdUtil.simpleUUID());
|
||||
csEventPO.setId(IdUtil.fastSimpleUUID());
|
||||
csEventPO.setLineId(uploadDataParam.getLineId());
|
||||
csEventPO.setDeviceId(uploadDataParam.getDevId());
|
||||
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
||||
//todo 做映射目前置空
|
||||
csEventPO.setCode(null);
|
||||
csEventPO.setStartTime(newTaglogbuffer.getStart());
|
||||
csEventPO.setTag(strName);
|
||||
//更具唯一索引做校验存在该事件则跳过;
|
||||
CsEventPO data = eventFeignClient.queryByIndex(csEventPO).getData();
|
||||
if(Objects.nonNull(data)){
|
||||
continue;
|
||||
}
|
||||
|
||||
String wavePath = null;
|
||||
//设置波形文件(去cfg结果集里面去找)
|
||||
for (Response res : cfgResponse) {
|
||||
String cfg = res.getFilename();
|
||||
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.DAT;
|
||||
String sharPath = OfflineConstant.COMTRADE+"/"+DataParam.wlRecordPath+uploadDataParam.getDevId()+"/"+uploadDataParam.getLineId()+"/"+getFolderName()+"/";
|
||||
tagComtradeCfg sing = (tagComtradeCfg) res.getObj();
|
||||
Date date = Date.from(newTaglogbuffer.getStart().atZone( ZoneId.systemDefault()).toInstant());
|
||||
String sharPath = OfflineConstant.COMTRADE+"/"+csEquipmentDeliveryDTO.getMac()+"/";
|
||||
TagComtradeCfg sing = (TagComtradeCfg) res.getObj();
|
||||
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
|
||||
if ((sing!= null && sing.getTimeStart()!= null && sing.getTimeEnd() !=null && sing.getTimeTrigger().compareTo(date) <= 0 && sing.getTimeEnd().compareTo(date) >= 0)) {
|
||||
if (sing!= null && sing.getTimeStart()!= null && sing.getTimeTrigger().compareTo(csEventPO.getStartTime())<=0
|
||||
&&sing.getTimeEnd().compareTo(csEventPO.getStartTime())>=0) {
|
||||
for(MultipartFile f : uploadDataParam.getFiles()){
|
||||
if(f.getOriginalFilename().equals(cfg) || f.getOriginalFilename().equals(dat)){
|
||||
fileStorageUtil.uploadMultipart(f, sharPath);
|
||||
wavePath = sharPath;
|
||||
int lastIndex = f.getOriginalFilename().lastIndexOf('/');
|
||||
String fileName = f.getOriginalFilename().substring(lastIndex + 1);
|
||||
String baseName = FilenameUtils.getBaseName(fileName);
|
||||
String extension = FilenameUtils.getExtension(fileName);
|
||||
try {
|
||||
fileStorageUtil.uploadStreamSpecifyName(f.getInputStream(), sharPath, baseName + "." + extension.toUpperCase());
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
wavePath = sharPath+fileName.substring(0,fileName.lastIndexOf("."));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -254,17 +404,24 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
csEventPO.setType(0);
|
||||
String clDid = influxDbParamUtil.getClDidByLineId(uploadDataParam.getLineId());
|
||||
csEventPO.setClDid(clDid == null ? null : Integer.parseInt(clDid));
|
||||
//默认告警等级2
|
||||
csEventPO.setLevel(2);
|
||||
//默认事件发生位置:电网侧
|
||||
csEventPO.setLocation("grid");
|
||||
csEventPO.setProcess(data1.get(0).getProcess());
|
||||
|
||||
|
||||
csEventPO.setProcess(csEquipmentDeliveryDTO.getProcess());
|
||||
csEventPOS.add(csEventPO);
|
||||
EntData entData = new EntData();
|
||||
entData.setTime(newTaglogbuffer.getStart().toInstant(ZoneOffset.UTC));
|
||||
entData.setUuid(csEventPO.getId());
|
||||
entData.setTime(new Date().toInstant());
|
||||
|
||||
|
||||
//entData.setTime(newTaglogbuffer.getStart().toInstant(ZoneOffset.UTC));
|
||||
for(NewBodyTaglogbuffer newBodyTaglogbuffer : newTaglogbuffer.getNewBodyTaglogbuffers()){
|
||||
if(newBodyTaglogbuffer.getParaCode() == 0) entData.setEvtParamVVaDepth(newBodyTaglogbuffer.getParaValue()/65536D);
|
||||
if(newBodyTaglogbuffer.getParaCode() == 1) entData.setEvtParamTm(newBodyTaglogbuffer.getParaValue()/65536D);
|
||||
if(newBodyTaglogbuffer.getParaCode() == 0) {
|
||||
entData.setEvtParamVVaDepth(Double.parseDouble(df.format(newBodyTaglogbuffer.getParaValue()/65536D)));
|
||||
}
|
||||
if(newBodyTaglogbuffer.getParaCode() == 1) {
|
||||
entData.setEvtParamTm(Double.parseDouble(df.format(newBodyTaglogbuffer.getParaValue()/65536D)));
|
||||
csEventPO.setPersistTime(Double.parseDouble(df.format(newBodyTaglogbuffer.getParaValue()/65536D)));
|
||||
}
|
||||
if(newBodyTaglogbuffer.getParaCode() == 5) {
|
||||
int code = newBodyTaglogbuffer.getParaValue()/65536;
|
||||
switch (code){
|
||||
@@ -293,16 +450,48 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
}
|
||||
}
|
||||
log.info("类型log,插入infulxDb的evtData");
|
||||
//evtDataMapper.insertOne(entData);
|
||||
try {
|
||||
evtDataMapper.insertOne(entData);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
log.info("类型log,插入mysql事件表cs_event");
|
||||
//eventFeignClient.saveBatchEventList(csEventPOS);
|
||||
eventFeignClient.saveBatchEventList(csEventPOS);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
nowStep++;
|
||||
String json = "{allStep:"+uploadDataParam.getFiles().size()*2+",nowStep:"+nowStep+"}";
|
||||
|
||||
publisher.send("/dataOnlineRecruitment/Progress/" + uploadDataParam.getLineId(), new Gson().toJson(json), 1, false);
|
||||
//无需解析的不需要记录
|
||||
if(portableOfflLog.getState()!=0){
|
||||
this.baseMapper.insert(portableOfflLog);
|
||||
successcCount++;
|
||||
}
|
||||
|
||||
}
|
||||
portableOffMainLog.setEndTime(LocalDateTime.now());
|
||||
portableOffMainLog.setSuccessCount(successcCount);
|
||||
portableOffMainLogService.save(portableOffMainLog);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<PortableOffMainLog> queryMainLogPage(BaseParam baseParam) {
|
||||
Page<PortableOffMainLog> returnpage = new Page<> (baseParam.getPageNum(), baseParam.getPageSize ());
|
||||
QueryWrapper<PortableOffMainLog> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.lambda()
|
||||
.ge(StringUtils.isNotBlank(baseParam.getSearchBeginTime()), PortableOffMainLog::getCreateTime,baseParam.getSearchBeginTime()+" 00:00:00")
|
||||
.le(StringUtils.isNotBlank(baseParam.getSearchEndTime()),PortableOffMainLog::getCreateTime,baseParam.getSearchEndTime()+" 23:59:59").orderByDesc(PortableOffMainLog::getCreateTime);
|
||||
Page<PortableOffMainLog> portableOffMainLogPage = portableOffMainLogService.getBaseMapper().selectPage(returnpage, queryWrapper);
|
||||
portableOffMainLogPage.getRecords().forEach(temp->{
|
||||
List<PortableOfflLog> list = this.lambdaQuery().eq(PortableOfflLog::getLogMainId, temp.getId()).list();
|
||||
temp.setPortableOfflLogList(list);
|
||||
});
|
||||
|
||||
return returnpage;
|
||||
}
|
||||
|
||||
//根据文件全路径(包含文件夹)解析文件的分类
|
||||
@@ -319,4 +508,13 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd_HHmmss");
|
||||
return sdf.format(calendar.getTime());
|
||||
}
|
||||
|
||||
private static String getCommonPrefix(String s1, String s2) {
|
||||
for (int i = 0; i <= s1.length() && i <= s2.length(); i++) {
|
||||
if (i == s1.length() || i == s2.length() || s1.charAt(i) != s2.charAt(i)) {
|
||||
return s1.substring(0, i);
|
||||
}
|
||||
}
|
||||
return s1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.date.LocalDateTimeUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.WlRecordMapper;
|
||||
import com.njcn.csdevice.param.WlRecordPageParam;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
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.po.WlRecord;
|
||||
import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo;
|
||||
@@ -22,21 +32,33 @@ import com.njcn.csdevice.pojo.vo.RecordTreeVo;
|
||||
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.device.biz.pojo.po.Overlimit;
|
||||
import com.njcn.device.biz.utils.COverlimitUtil;
|
||||
import com.njcn.influx.imapper.CommonMapper;
|
||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||
import com.njcn.influx.pojo.constant.InfluxDBTableConstant;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.pojo.po.DictData;
|
||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneOffset;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -63,12 +85,22 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
|
||||
private final CommonService commonService;
|
||||
|
||||
private final CommonMapper commonMapper;
|
||||
|
||||
private final CsDataSetMapper csDataSetMapper;
|
||||
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
private final OverlimitService overlimitService;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat(DataParam.DecimalFormatStr);
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void addRecord(WlRecordParam.AddRecord records) {
|
||||
//整理的方案下测试项集合(可能添加多个测试项)
|
||||
List<WlRecord> insertList = new ArrayList<>();
|
||||
@@ -95,17 +127,51 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
updateRecord.setId(record.getId());
|
||||
updateRecord.setList(item.getList());
|
||||
saveDataRecord(updateRecord);
|
||||
//生成测试项限值,用于报表
|
||||
DictData scaleResult = dicDataFeignClient.getDicDataById(record.getVoltageLevel()).getData();
|
||||
if (Objects.isNull(scaleResult)) {
|
||||
throw new BusinessException(CommonResponseEnum.DIC_DATA);
|
||||
}
|
||||
|
||||
|
||||
float voltageLevel = Float.parseFloat(scaleResult.getValue());
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, record.getCapacitySi(), record.getCapacitySt(), record.getCapacitySscmin(), 1, 0);
|
||||
overlimit.setId(id);
|
||||
overlimitService.saveOrUpdate(overlimit);
|
||||
});
|
||||
this.saveBatch(insertList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void addBaseData(WlRecord wlRecord) {
|
||||
this.save(wlRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addBaseDataList(List<WlRecord> wlRecord) {
|
||||
this.saveBatch(wlRecord);
|
||||
}
|
||||
|
||||
@Override
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
BeanUtils.copyProperties(record, wlRecord);
|
||||
wlRecord.setStartTime(record.getProStartTime());
|
||||
wlRecord.setEndTime(record.getProEndTime());
|
||||
this.updateById(wlRecord);
|
||||
saveDataRecord(record);
|
||||
//修改测试项限值,用于报表
|
||||
DictData scaleResult = dicDataFeignClient.getDicDataById(record.getVoltageLevel()).getData();
|
||||
if (Objects.isNull(scaleResult)) {
|
||||
throw new BusinessException(CommonResponseEnum.DIC_DATA);
|
||||
}
|
||||
|
||||
|
||||
float voltageLevel = Float.parseFloat(scaleResult.getValue());
|
||||
Overlimit overlimit = COverlimitUtil.globalAssemble(voltageLevel, record.getCapacitySi(), record.getCapacitySt(), record.getCapacitySscmin(), 1, 0);
|
||||
overlimit.setId(record.getId());
|
||||
overlimitService.saveOrUpdate(overlimit);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,13 +200,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
||||
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
||||
List<RecordVo> recordVoList = new ArrayList<>();
|
||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper<>();
|
||||
qw.eq(WlRecord::getId,testRecordId).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
||||
List<WlRecord> list = this.baseMapper.selectList(qw);
|
||||
WlRecord wlRecord = list.get(0);
|
||||
//当前ID就是测试项ID直接返回
|
||||
if(wlRecord.getPId()!=null){
|
||||
qw = new LambdaQueryWrapper();
|
||||
qw.clear();
|
||||
qw.eq(WlRecord::getId,wlRecord.getPId()).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
||||
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||
recordItemVo.setDescribe(wlRecordList.get(0).getDescribe());
|
||||
@@ -149,18 +215,21 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
wlRecord.setStartTime(getFirstTimeById(wlRecord.getId()));
|
||||
wlRecord.setEndTime(getLastTimeById(wlRecord.getId()));
|
||||
BeanUtils.copyProperties(wlRecord, recordVo);
|
||||
recordVo.setList(this.baseMapper.getDataRecordBytestId(wlRecord.getId()));
|
||||
recordVoList.add(recordVo);
|
||||
}else{
|
||||
//反之则是方案ID 则返回该方案下所有的测试项信息
|
||||
recordItemVo.setDescribe(wlRecord.getDescribe());
|
||||
recordItemVo.setItemName(wlRecord.getItemName());
|
||||
qw = new LambdaQueryWrapper();
|
||||
qw.clear();
|
||||
qw.eq(WlRecord::getPId,testRecordId).eq(WlRecord::getType,0).eq(WlRecord::getState,1).orderByAsc(WlRecord::getCreateTime);;
|
||||
for (WlRecord wl : this.baseMapper.selectList(qw)){
|
||||
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||
for (WlRecord wl : wlRecordList){
|
||||
RecordVo recordVo = new RecordVo();
|
||||
wl.setStartTime(getFirstTimeById(wl.getId()));
|
||||
wl.setEndTime(getLastTimeById(wl.getId()));
|
||||
BeanUtils.copyProperties(wl, recordVo);
|
||||
recordVo.setList(this.baseMapper.getDataRecordBytestId(wl.getId()));
|
||||
recordVoList.add(recordVo);
|
||||
}
|
||||
}
|
||||
@@ -171,6 +240,55 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
@Override
|
||||
public Object queryPage(WlRecordPageParam wlRecordPageParam) {
|
||||
//组装tree用于测试项绑定数据页面左侧的搜索树
|
||||
/* List<RecordAllDevTreeVo> devList = new ArrayList<>();
|
||||
if(wlRecordPageParam.getIsTrueFlag() == 0){
|
||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(WlRecord::getType,1).eq(WlRecord::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<WlRecord> wlRecordList = this.list(lambdaQueryWrapper);
|
||||
|
||||
|
||||
|
||||
if(CollUtil.isNotEmpty(wlRecordList)){
|
||||
List<String> devIds = wlRecordList.stream().map(WlRecord::getDevId).distinct().collect(Collectors.toList());
|
||||
List<String> lineIds = wlRecordList.stream().map(WlRecord::getLineId).distinct().collect(Collectors.toList());
|
||||
List<CsLinePO> csLinePOList = csLinePOMapper.selectBatchIds(lineIds);
|
||||
Map<String,CsLinePO> csLinePOMap = csLinePOList.stream().collect(Collectors.toMap(CsLinePO::getLineId, Function.identity()));
|
||||
List<CsEquipmentDeliveryPO> csDevPOList = csEquipmentDeliveryMapper.selectList(new LambdaQueryWrapper<CsEquipmentDeliveryPO>().in(CsEquipmentDeliveryPO::getId,devIds));
|
||||
Map<String,CsEquipmentDeliveryPO> csDevPOMap = csDevPOList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
|
||||
Map<String,List<WlRecord>> devMap = wlRecordList.stream().collect(Collectors.groupingBy(WlRecord::getDevId));
|
||||
|
||||
devMap.forEach((devId,list)->{
|
||||
RecordAllDevTreeVo devTree = new RecordAllDevTreeVo();
|
||||
devTree.setId(devId);
|
||||
devTree.setName(csDevPOMap.get(list.get(0).getDevId()).getName());
|
||||
devTree.setPid("0");
|
||||
|
||||
Map<String,List<WlRecord>> lineMap = list.stream().collect(Collectors.groupingBy(WlRecord::getLineId));
|
||||
List<RecordAllDevTreeVo> csLineList = new ArrayList<>();
|
||||
lineMap.forEach((lineId,lineList)->{
|
||||
RecordAllDevTreeVo recordAllDevTreeVo = new RecordAllDevTreeVo();
|
||||
recordAllDevTreeVo.setId(lineId);
|
||||
recordAllDevTreeVo.setName(csLinePOMap.get(lineList.get(0).getLineId()).getName());
|
||||
recordAllDevTreeVo.setPid(devId);
|
||||
List<RecordAllDevTreeVo> iiList = new ArrayList<>();
|
||||
lineList.forEach(it->{
|
||||
RecordAllDevTreeVo ii = new RecordAllDevTreeVo();
|
||||
ii.setId(it.getId());
|
||||
ii.setName(it.getStartTime()+"-"+it.getEndTime());
|
||||
ii.setPid(lineId);
|
||||
iiList.add(ii);
|
||||
});
|
||||
recordAllDevTreeVo.setChildren(iiList);
|
||||
csLineList.add(recordAllDevTreeVo);
|
||||
});
|
||||
devTree.setChildren(csLineList);
|
||||
devList.add(devTree);
|
||||
});
|
||||
}
|
||||
|
||||
}*/
|
||||
|
||||
List<RecordAllDevTreeVo> recordAllDevTreeVos = this.baseMapper.getRecordAll(wlRecordPageParam);
|
||||
for (RecordAllDevTreeVo recordAllDevTreeVo : recordAllDevTreeVos){
|
||||
wlRecordPageParam.setDevId(recordAllDevTreeVo.getId());
|
||||
@@ -218,7 +336,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
// @Transactional(rollbackFor = Exception.class)
|
||||
public void deleteRecord(String id) {
|
||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||
qw.eq(WlRecord::getId,id).eq(WlRecord::getState,"1").eq(WlRecord::getType,"0");
|
||||
@@ -235,6 +353,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
if(wlRecord.getPId() != null){
|
||||
//方案关联的设备基础数据也删除
|
||||
this.baseMapper.deleteDataRecord(id,null);
|
||||
overlimitService.removeById(id);
|
||||
}else{
|
||||
//如果删除的是方案 那么连带方案下的所有测试项也要删除
|
||||
qw = new LambdaQueryWrapper();
|
||||
@@ -276,7 +395,8 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
List<WlRecord> data = new ArrayList<>();
|
||||
if(wlRecord.getPId() == null){
|
||||
//如果查询的是方案 则查询该方案下所有的测试项关联的设备基础数据
|
||||
data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),1);
|
||||
return null;
|
||||
// data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),1);
|
||||
}else{
|
||||
//如果查询的是测试项 则查询该测试项下所有的关联的设备基础数据
|
||||
data = this.baseMapper.getDataRecordByTestId(wlRecord.getId(),0);
|
||||
@@ -287,7 +407,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
}
|
||||
//格式化前端参数
|
||||
formatQueryParamList(commonStatisticalQueryParam);
|
||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||
if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
|
||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||
if(param.getStatisticalId() == null){
|
||||
continue;
|
||||
@@ -295,6 +415,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
||||
for(WlRecord wl : data){
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(wl.getLineId())).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||
if(StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
}
|
||||
Double ct = Double.valueOf(wlRecord.getCt())/wlRecord.getCt1();
|
||||
Double pt =Double.valueOf(wlRecord.getPt())/wlRecord.getPt1();
|
||||
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
||||
eleEpdPqds.forEach(epdPqd->{
|
||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||
@@ -311,17 +438,52 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
return commonQueryParam;
|
||||
}).collect(Collectors.toList());
|
||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||
//此处设空时为了有多段时将线条断开前端显示
|
||||
if(!CollectionUtils.isEmpty(deviceRtData)){
|
||||
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
||||
}
|
||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||
ThdDataVO vo = new ThdDataVO();
|
||||
vo.setLineId(temp.getLineId());
|
||||
vo.setPhase(temp.getPhaseType());
|
||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
vo.setPosition(position);
|
||||
vo.setTime(temp.getTime());
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
if(temp.getValue()!=null) {
|
||||
double re;
|
||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setUnit(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());
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
||||
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());
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(null);
|
||||
}
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
@@ -334,6 +496,111 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(WlRecord::getGcName,param.getProName())
|
||||
.eq(WlRecord::getDevId,param.getDevId())
|
||||
.eq(WlRecord::getLineId,param.getLineId())
|
||||
.eq(WlRecord::getStartTime,param.getProStartTime())
|
||||
.eq(WlRecord::getType,1)
|
||||
.eq(WlRecord::getState,1);
|
||||
return this.getOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void dayDealNoEndTimeEvent(String date) {
|
||||
DateTime dateEnd = DateUtil.parse(date,DatePattern.NORM_DATE_PATTERN);
|
||||
DateTime dateStart = DateUtil.offsetDay(dateEnd,-30);
|
||||
System.out.println("进入定时任务");
|
||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.between(WlRecord::getStartTime,dateStart,dateEnd).eq(WlRecord::getType,1).eq(WlRecord::getState,DataStateEnum.ENABLE.getCode());
|
||||
List<WlRecord> wlRecordList = this.list(lambdaQueryWrapper);
|
||||
if(CollUtil.isNotEmpty(wlRecordList)){
|
||||
|
||||
//需要处理的基础数据
|
||||
List<WlRecord> needDealList = wlRecordList.stream().filter(it->Objects.isNull(it.getEndTime())).collect(Collectors.toList());
|
||||
List<String> needIds = needDealList.stream().map(WlRecord::getLineId).distinct().collect(Collectors.toList());
|
||||
|
||||
Map<String,List<WlRecord>> lineMap = wlRecordList.stream().collect(Collectors.groupingBy(WlRecord::getLineId));
|
||||
|
||||
List<WlRecord> poList = new ArrayList<>();
|
||||
lineMap.forEach((lineId,list)->{
|
||||
if(needIds.contains(lineId)){
|
||||
//选择起始时间进行倒序
|
||||
list = list.stream().sorted(Comparator.comparing(WlRecord::getStartTime)).collect(Collectors.toList());
|
||||
for(int i=0;i<list.size();i++){
|
||||
LocalDateTime start = list.get(i).getStartTime();
|
||||
String startSql = start.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||
if(i==list.size()-1){
|
||||
//判断最迟时间的数据是否没有结束时间
|
||||
if(Objects.isNull(list.get(i).getEndTime())){
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
String sqlNow = now.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||
.select(StatisticalDataDTO::getPhaseType)
|
||||
.select(StatisticalDataDTO::getValueType)
|
||||
.last("Pq_Freq")
|
||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
||||
.between(InfluxDBTableConstant.TIME,startSql,sqlNow);
|
||||
System.out.println(influxQueryWrapper.generateSql());
|
||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||
if(Objects.nonNull(statisticalDataDTO)){
|
||||
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
||||
Duration duration = Duration.between(now, endTime);
|
||||
long hour = duration.toHours();
|
||||
if(hour>6){
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
wlRecord.setId(list.get(i).getId());
|
||||
wlRecord.setEndTime(endTime);
|
||||
poList.add(wlRecord);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}else {
|
||||
//如果不存在结束时间,则取后面一条的起始时间作为结束判断标识
|
||||
if(Objects.isNull(list.get(i).getEndTime())){
|
||||
String end = list.get(i+1).getStartTime().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper("pqd_data",StatisticalDataDTO.class);
|
||||
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||
.select(StatisticalDataDTO::getPhaseType)
|
||||
.select(StatisticalDataDTO::getValueType)
|
||||
.last("Pq_Freq")
|
||||
.eq(InfluxDBTableConstant.LINE_ID,lineId)
|
||||
.eq(InfluxDBTableConstant.PHASIC_TYPE,"M")
|
||||
.between(InfluxDBTableConstant.TIME,startSql,end);
|
||||
System.out.println(influxQueryWrapper.generateSql());
|
||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
wlRecord.setId(list.get(i).getId());
|
||||
|
||||
if(Objects.nonNull(statisticalDataDTO)){
|
||||
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
||||
wlRecord.setEndTime(endTime);
|
||||
}else {
|
||||
//TODO 如果查询时间段内无数据,说明装置可能时间段内掉线,出错,需要标识出来
|
||||
wlRecord.setEndTime(list.get(i+1).getStartTime());
|
||||
}
|
||||
poList.add(wlRecord);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
if(CollUtil.isNotEmpty(poList)){
|
||||
this.updateBatchById(poList);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
||||
* @param data 数据项
|
||||
@@ -454,7 +721,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
if(recordIds.isEmpty()){
|
||||
recordIds.add("-1");
|
||||
}
|
||||
qw.eq(WlRecord::getState,"1").in(WlRecord::getId,recordIds).orderByAsc(WlRecord::getEndTime);
|
||||
qw.eq(WlRecord::getState,"1").in(WlRecord::getId,recordIds).orderByDesc(WlRecord::getEndTime);
|
||||
List<WlRecord> list = this.baseMapper.selectList(qw);
|
||||
if(list.isEmpty()){
|
||||
return null;
|
||||
|
||||
@@ -33,6 +33,10 @@ spring:
|
||||
refresh: true
|
||||
main:
|
||||
allow-bean-definition-overriding: true
|
||||
servlet:
|
||||
multipart:
|
||||
max-file-size: 100MB
|
||||
max-request-size: 100MB
|
||||
|
||||
|
||||
#项目日志的配置
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>pqs-influx</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csharmonic.api.fallback.EventFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -18,4 +25,10 @@ public interface EventFeignClient {
|
||||
@PostMapping("/saveBatchEventList")
|
||||
HttpResult<String> saveBatchEventList(@RequestBody List<CsEventPO> csEventPOS);
|
||||
|
||||
}
|
||||
@PostMapping("/pageQueryByLineId")
|
||||
HttpResult<Page<DataGroupEventVO>> pageQueryByLineId(@RequestBody CsEventUserQueryPage csEventUserQueryPage);
|
||||
@PostMapping("/queryByIndex")
|
||||
HttpResult<CsEventPO> queryByIndex(@RequestBody CsEventPO csEventPO);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,13 +1,20 @@
|
||||
package com.njcn.csharmonic.api.fallback;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
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.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -30,6 +37,18 @@ public class EventFeignClientFallbackFactory implements FallbackFactory<EventFei
|
||||
log.error("{}异常,降级处理,异常为:{}","获取当天事件未读消息未读消息",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Page<DataGroupEventVO>> pageQueryByLineId(CsEventUserQueryPage csEventUserQueryPage) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点分页查询暂降事件",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEventPO> queryByIndex( CsEventPO csEventPO) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据根据表唯一索引查询(用于校验是否存在该事件)s",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,10 @@
|
||||
package com.njcn.csharmonic.constant;
|
||||
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 常量类
|
||||
* @author qijian
|
||||
@@ -68,4 +72,12 @@ public interface HarmonicConstant {
|
||||
String INSET_DATA = "inset_data";
|
||||
|
||||
String CTRL_DATA = "ctrl_data";
|
||||
|
||||
Set<String> POWER_LIST = new HashSet<>(Arrays.asList(
|
||||
"电网有功功率", "电网无功功率", "电网视在功率", "负载有功功率",
|
||||
"负载无功功率", "负载视在功率", "有功功率", "无功功率",
|
||||
"视在功率", "基波有功功率", "基波无功功率",
|
||||
"基波视在功率", "三相总有功功率", "三相总无功功率",
|
||||
"三相总视在功率","相电压总有效值","线电压总有效值","相电压基波有效值","线电压基波有效值","电压正序分量"
|
||||
));
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public enum CsHarmonicResponseEnum {
|
||||
*/
|
||||
CS_DEVICE_COMMON_ERROR("A00600","治理稳态模块异常"),
|
||||
BIND_TARGET_ERROR("A00601","指标参数绑定异常"),
|
||||
MAKE_UP_ERROR("A00602","补招失败"),
|
||||
RECORD_MISSING("A00602","record.bin文件缺失,补召失败")
|
||||
|
||||
;
|
||||
|
||||
|
||||
@@ -14,8 +14,7 @@ import java.util.List;
|
||||
@Slf4j
|
||||
public class Log {
|
||||
private static String logPath = "C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\log";//事件文件路径
|
||||
private static LocalDateTime event_starttime = null;
|
||||
private static LocalDateTime event_endtime = null;
|
||||
|
||||
private static List<TagComtradeCfg> tagComtradeCfgs = new ArrayList();//波形文件cfg信息队列
|
||||
public static void main(String[] args) throws Exception {
|
||||
boolean logbin = false;
|
||||
@@ -55,12 +54,14 @@ public class Log {
|
||||
e.printStackTrace();
|
||||
throw new BusinessException("文件" + file.getName() + " 读取时发生错误");
|
||||
}
|
||||
LocalDateTime event_starttime = null;
|
||||
LocalDateTime event_endtime = null;
|
||||
NewTaglogbuffer newTaglogbuffer = getnewTaglogbuffer(bBuf);
|
||||
newTaglogbuffers.add(newTaglogbuffer);
|
||||
TagMsTime devtime = newTaglogbuffer.getNewHeadTaglogbuffer().getDevtime();
|
||||
LocalDateTime time = LocalDateTime.of(devtime.getYear(), devtime.getMonth(), devtime.getDay(), devtime.getHour(), devtime.getMin(), devtime.getSec(), devtime.getMs());
|
||||
LocalDateTime time = LocalDateTime.of(devtime.getYear(), devtime.getMonth(), devtime.getDay(), devtime.getHour(), devtime.getMin(), devtime.getSec(), devtime.getMs()*1000*1000);
|
||||
//存在启动时间
|
||||
if (event_starttime != LocalDateTime.MIN && event_starttime != null) {
|
||||
if (event_starttime != LocalDateTime.MIN&& event_starttime!=null) {
|
||||
if (time.compareTo(event_starttime) <= 0) {
|
||||
event_starttime = time;
|
||||
}
|
||||
@@ -68,7 +69,7 @@ public class Log {
|
||||
//不存在启动时间 填入当前时间
|
||||
event_starttime = time;
|
||||
}
|
||||
if (event_endtime != LocalDateTime.MIN && event_endtime != null) {
|
||||
if (event_endtime != LocalDateTime.MIN && event_endtime!=null) {
|
||||
if (time.compareTo(event_endtime) >= 0) {
|
||||
event_endtime = time;
|
||||
}
|
||||
@@ -77,6 +78,7 @@ public class Log {
|
||||
event_endtime = time;
|
||||
}
|
||||
|
||||
|
||||
long sec = 0;
|
||||
for (NewBodyTaglogbuffer sing : newTaglogbuffer.getNewBodyTaglogbuffers()) {
|
||||
switch (sing.getParaCode()) {
|
||||
@@ -95,14 +97,19 @@ public class Log {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//当事件时长超过1分钟直接排除
|
||||
if(sec>60){
|
||||
continue;
|
||||
}
|
||||
newTaglogbuffer.setStart(time); //事件开始时间
|
||||
newTaglogbuffer.setEnd(time.plusSeconds(sec)); //事件结束时间
|
||||
for (TagComtradeCfg sing : tagComtradeCfgs) {
|
||||
if (sing.getTimeTrigger().compareTo(newTaglogbuffer.getStart()) <= 0 && sing.getTimeEnd().compareTo(newTaglogbuffer.getStart()) >= 0) {
|
||||
newTaglogbuffer.setPath(sing.getPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//这里tagComtradeCfgs为空无效
|
||||
// for (TagComtradeCfg sing : tagComtradeCfgs) {
|
||||
// if (sing.getTimeTrigger().compareTo(newTaglogbuffer.getStart()) <= 0 && sing.getTimeEnd().compareTo(newTaglogbuffer.getStart()) >= 0) {
|
||||
// newTaglogbuffer.setPath(sing.getPath());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
@@ -137,11 +144,12 @@ public class Log {
|
||||
throw new BusinessException("文件" + file.getOriginalFilename() + " 读取时发生错误");
|
||||
}
|
||||
NewTaglogbuffer newTaglogbuffer = getnewTaglogbuffer(bBuf);
|
||||
newTaglogbuffers.add(newTaglogbuffer);
|
||||
LocalDateTime event_starttime = null;
|
||||
LocalDateTime event_endtime = null;
|
||||
TagMsTime devtime = newTaglogbuffer.getNewHeadTaglogbuffer().getDevtime();
|
||||
LocalDateTime time = LocalDateTime.of(devtime.getYear(), devtime.getMonth(), devtime.getDay(), devtime.getHour(), devtime.getMin(), devtime.getSec(), devtime.getMs());
|
||||
LocalDateTime time = LocalDateTime.of(devtime.getYear(), devtime.getMonth(), devtime.getDay(), devtime.getHour(), devtime.getMin(), devtime.getSec(), devtime.getMs()*1000*1000);
|
||||
//存在启动时间
|
||||
if (event_starttime != LocalDateTime.MIN && event_starttime != null) {
|
||||
if (event_starttime != LocalDateTime.MIN&& event_starttime!=null) {
|
||||
if (time.compareTo(event_starttime) <= 0) {
|
||||
event_starttime = time;
|
||||
}
|
||||
@@ -149,7 +157,7 @@ public class Log {
|
||||
//不存在启动时间 填入当前时间
|
||||
event_starttime = time;
|
||||
}
|
||||
if (event_endtime != LocalDateTime.MIN && event_endtime != null) {
|
||||
if (event_endtime != LocalDateTime.MIN && event_endtime!=null) {
|
||||
if (time.compareTo(event_endtime) >= 0) {
|
||||
event_endtime = time;
|
||||
}
|
||||
@@ -176,14 +184,21 @@ public class Log {
|
||||
break;
|
||||
}
|
||||
}
|
||||
//当事件时长超过1分钟直接排除
|
||||
if(sec>60){
|
||||
continue;
|
||||
}
|
||||
newTaglogbuffer.setStart(time); //事件开始时间
|
||||
newTaglogbuffer.setEnd(time.plusSeconds(sec)); //事件结束时间
|
||||
for (TagComtradeCfg sing : tagComtradeCfgs) {
|
||||
if (sing.getTimeTrigger().compareTo(newTaglogbuffer.getStart()) <= 0 && sing.getTimeEnd().compareTo(newTaglogbuffer.getStart()) >= 0) {
|
||||
newTaglogbuffer.setPath(sing.getPath());
|
||||
break;
|
||||
}
|
||||
}
|
||||
//这里tagComtradeCfgs为空无效
|
||||
// for (TagComtradeCfg sing : tagComtradeCfgs) {
|
||||
// if (sing.getTimeTrigger().compareTo(newTaglogbuffer.getStart()) <= 0 && sing.getTimeEnd().compareTo(newTaglogbuffer.getStart()) >= 0) {
|
||||
// newTaglogbuffer.setPath(sing.getPath());
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
newTaglogbuffers.add(newTaglogbuffer);
|
||||
|
||||
}
|
||||
} catch (BusinessException e) {
|
||||
e.printStackTrace();
|
||||
|
||||
@@ -5,6 +5,7 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
|
||||
@@ -1,11 +1,13 @@
|
||||
package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@Data
|
||||
public class TagComtradeCfg {
|
||||
public class TagComtradeCfg implements Serializable {
|
||||
private int nChannelNum; //通道总个数
|
||||
private int nAnalogNum; //模拟量通道的个数 WW 2013-05-15
|
||||
private int nDigitalNum; //数字量通道的个数 WW 2013-05-15
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TagOneChannleCfg {
|
||||
public class TagOneChannleCfg implements Serializable {
|
||||
//通道序号
|
||||
private int nIndex;
|
||||
//通道名称
|
||||
|
||||
@@ -2,8 +2,10 @@ package com.njcn.csharmonic.offline.log.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class TagOneChannleCfgDigital {
|
||||
public class TagOneChannleCfgDigital implements Serializable {
|
||||
//通道序号
|
||||
private int nIndex;
|
||||
//通道名称
|
||||
|
||||
@@ -2,16 +2,22 @@ package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.datatype.jsr310.JavaTimeModule;
|
||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||
import com.njcn.csharmonic.offline.log.vo.TagComtradeCfg;
|
||||
import com.njcn.csharmonic.offline.log.vo.TagOneChannleCfg;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.*;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.RTC_Timer_MS;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmn;
|
||||
import com.njcn.csharmonic.offline.mincfg.vo.tagPQDataCmnHh;
|
||||
import com.njcn.influx.pojo.po.cs.PqdData;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.*;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.Paths;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
@@ -111,7 +117,7 @@ public class AnalyseComtradeCfg {
|
||||
hashMapA.put("pq_RmsU",rms[0]);
|
||||
hashMapB.put("pq_RmsU",rms[1]);
|
||||
hashMapC.put("pq_RmsU",rms[2]);
|
||||
hashMapA.put("pq_RmsU",rms[3]);
|
||||
hashMapA.put("pq_RmsI",rms[3]);
|
||||
hashMapB.put("pq_RmsI",rms[4]);
|
||||
hashMapC.put("pq_RmsI",rms[5]);
|
||||
hashMapA.put("pq_RmsLU",rms[6]);
|
||||
@@ -134,7 +140,7 @@ public class AnalyseComtradeCfg {
|
||||
//电能质量只有电压偏差,上偏差正,下偏差负,判断上偏差是否为0如果为0取下偏差负数,反正取上偏差
|
||||
hashMapA.put("pq_UDev",AnalyseComtradeCfg.isZero(uuDeviation[0])?(-ulDeviation[0]):uuDeviation[0]);
|
||||
hashMapB.put("pq_UDev",AnalyseComtradeCfg.isZero(uuDeviation[1])?(-ulDeviation[1]):uuDeviation[1]);
|
||||
hashMapC.put("pq_RmsU",AnalyseComtradeCfg.isZero(uuDeviation[2])?(-ulDeviation[2]):uuDeviation[2]);
|
||||
hashMapC.put("pq_UDev",AnalyseComtradeCfg.isZero(uuDeviation[2])?(-ulDeviation[2]):uuDeviation[2]);
|
||||
hashMapAB.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[3])?(-ulDeviation[3]):uuDeviation[3]);
|
||||
hashMapBC.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[4])?(-ulDeviation[4]):uuDeviation[4]);
|
||||
hashMapCA.put("pq_LUDev",AnalyseComtradeCfg.isZero(uuDeviation[5])?(-ulDeviation[5]):uuDeviation[5]);
|
||||
@@ -191,37 +197,37 @@ public class AnalyseComtradeCfg {
|
||||
Float[][][] harmPower = min.getHarm_Power();
|
||||
for (int i = 0; i < 49; i++) {
|
||||
//电压含有率
|
||||
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i]);
|
||||
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i]);
|
||||
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i]);
|
||||
hashMapA.put("pq_HarmU_"+(i+2),harmContain[0][i+1]);
|
||||
hashMapB.put("pq_HarmU_"+(i+2),harmContain[1][i+1]);
|
||||
hashMapC.put("pq_HarmU_"+(i+2),harmContain[2][i+1]);
|
||||
|
||||
//谐波相角
|
||||
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i]);
|
||||
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i]);
|
||||
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i]);
|
||||
hashMapA.put("pq_HarmUAng_"+(i+2),fuHarmPhase[0][i+1]);
|
||||
hashMapB.put("pq_HarmUAng_"+(i+2),fuHarmPhase[1][i+1]);
|
||||
hashMapC.put("pq_HarmUAng_"+(i+2),fuHarmPhase[2][i+1]);
|
||||
|
||||
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i]);
|
||||
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i]);
|
||||
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i]);
|
||||
hashMapA.put("pq_HarmIAng_"+(i+2),fuHarmPhase[3][i+1]);
|
||||
hashMapB.put("pq_HarmIAng_"+(i+2),fuHarmPhase[4][i+1]);
|
||||
hashMapC.put("pq_HarmIAng_"+(i+2),fuHarmPhase[5][i+1]);
|
||||
|
||||
//电流幅值
|
||||
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i]);
|
||||
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i]);
|
||||
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i]);
|
||||
hashMapA.put("pq_HarmI_"+(i+2),fuHarm[3][i+1]);
|
||||
hashMapB.put("pq_HarmI_"+(i+2),fuHarm[4][i+1]);
|
||||
hashMapC.put("pq_HarmI_"+(i+2),fuHarm[5][i+1]);
|
||||
|
||||
|
||||
//谐波功率
|
||||
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i][0]);
|
||||
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i][1]);
|
||||
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i][2]);
|
||||
hashMapA.put("pq_HarmP_"+(i+2),harmPower[0][i+1][0]);
|
||||
hashMapA.put("pq_HarmQ_"+(i+2),harmPower[0][i+1][1]);
|
||||
hashMapA.put("pq_HarmS_"+(i+2),harmPower[0][i+1][2]);
|
||||
|
||||
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i][0]);
|
||||
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i][1]);
|
||||
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i][2]);
|
||||
hashMapB.put("pq_HarmP_"+(i+2),harmPower[1][i+1][0]);
|
||||
hashMapB.put("pq_HarmQ_"+(i+2),harmPower[1][i+1][1]);
|
||||
hashMapB.put("pq_HarmS_"+(i+2),harmPower[1][i+1][2]);
|
||||
|
||||
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i][0]);
|
||||
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i][1]);
|
||||
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i][2]);
|
||||
hashMapC.put("pq_HarmP_"+(i+2),harmPower[2][i+1][0]);
|
||||
hashMapC.put("pq_HarmQ_"+(i+2),harmPower[2][i+1][1]);
|
||||
hashMapC.put("pq_HarmS_"+(i+2),harmPower[2][i+1][2]);
|
||||
//M相目前没有
|
||||
// hashMapT.put("pq_HarmP_"+(i+2),harmPower[3][i][0]);
|
||||
// hashMapT.put("pq_HarmQ_"+(i+2),harmPower[3][i][1]);
|
||||
@@ -522,8 +528,8 @@ public class AnalyseComtradeCfg {
|
||||
}
|
||||
|
||||
}
|
||||
public static List<tagComtradeCfg> convertCfgFile(String strFilePath) { //解析cfg录波文件
|
||||
List<tagComtradeCfg> tagComtradeCfgList = new ArrayList<>();
|
||||
public static List<TagComtradeCfg> convertCfgFile(String strFilePath) { //解析cfg录波文件
|
||||
List<TagComtradeCfg> tagComtradeCfgList = new ArrayList<>();
|
||||
// File folder = new File(strFilePath);
|
||||
// File[] files = folder.listFiles((dir, name) -> name.endsWith(".cfg")); //获取文件夹下所有cfg文件
|
||||
// Arrays.stream(files).forEach(file -> {
|
||||
@@ -539,8 +545,8 @@ public class AnalyseComtradeCfg {
|
||||
* @Author: clam
|
||||
* @Date: 2024/7/15
|
||||
*/
|
||||
public static tagComtradeCfg analyseComtradeCfg(MultipartFile file) {
|
||||
tagComtradeCfg comtradeCfg = new tagComtradeCfg();
|
||||
public static TagComtradeCfg analyseComtradeCfg(MultipartFile file) {
|
||||
TagComtradeCfg comtradeCfg = new TagComtradeCfg();
|
||||
String strFilePath = file.getOriginalFilename();
|
||||
int i = 0; //用于遍历 字符串转换的字段数组
|
||||
String strFileLine;//临时存放 cfg每行读取的字符串
|
||||
@@ -551,7 +557,7 @@ public class AnalyseComtradeCfg {
|
||||
InputStream readFile = file.getInputStream();
|
||||
InputStreamReader isr = new InputStreamReader(readFile, StandardCharsets.UTF_8);
|
||||
BufferedReader sr = new BufferedReader(isr);
|
||||
comtradeCfg = new tagComtradeCfg();//配置文件总类对象初始化
|
||||
comtradeCfg = new TagComtradeCfg();//配置文件总类对象初始化
|
||||
ratesCfg = new tagRates();//多段采样类对象初始化
|
||||
long nFreq = 0; //临时存放 采样频率 例:50Hz
|
||||
//第一行不关心仅仅是一些描述类的信息
|
||||
@@ -562,65 +568,65 @@ public class AnalyseComtradeCfg {
|
||||
for (i = 0; i < strTempArray.length; i++) {
|
||||
switch (i) {
|
||||
case 0: //通道总个数
|
||||
comtradeCfg.nChannelNum = Integer.parseInt(strTempArray[i]);
|
||||
comtradeCfg.setNChannelNum(Integer.parseInt(strTempArray[i]));
|
||||
break;
|
||||
case 1: //模拟量的个数
|
||||
String str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||
comtradeCfg.nAnalogNum = Integer.parseInt(str);
|
||||
comtradeCfg.setNAnalogNum(Integer.parseInt(str));
|
||||
break;
|
||||
case 2://开关量的个数
|
||||
str = strTempArray[i].substring(0, strTempArray[i].length() - 1);
|
||||
comtradeCfg.nDigitalNum = Integer.parseInt(str);
|
||||
comtradeCfg.setNDigitalNum(Integer.parseInt(str));
|
||||
break;
|
||||
}
|
||||
}
|
||||
//从第三行到第ComtradeCfg.nChannelNum+3行是模拟量通道和数字量通道
|
||||
List<tagOneChannleCfg> OneChannleCfgList =new ArrayList<>();
|
||||
for (i = 0; i < comtradeCfg.nChannelNum; i++) {
|
||||
tagOneChannleCfg oneChannlecfg = new tagOneChannleCfg();
|
||||
ArrayList<TagOneChannleCfg> OneChannleCfgList =new ArrayList<>();
|
||||
for (i = 0; i < comtradeCfg.getNChannelNum(); i++) {
|
||||
TagOneChannleCfg oneChannlecfg = new TagOneChannleCfg();
|
||||
|
||||
strFileLine = sr.readLine(); // ③ or ④ or ⑤
|
||||
strTempArray = strFileLine.split(",");
|
||||
for (int j = 0; j < strTempArray.length; j++) {
|
||||
switch (j) {
|
||||
case 0://通道序号
|
||||
oneChannlecfg.nIndex = Integer.parseInt(strTempArray[j]);
|
||||
oneChannlecfg.setNIndex(Integer.parseInt(strTempArray[j]));
|
||||
break;
|
||||
case 1://通道名称
|
||||
oneChannlecfg.szChannleName = strTempArray[j];
|
||||
oneChannlecfg.setSzChannleName(strTempArray[j]);
|
||||
break;
|
||||
case 2://监视的通道名称
|
||||
oneChannlecfg.szPhasicName = strTempArray[j];
|
||||
oneChannlecfg.setSzPhasicName(strTempArray[j]);
|
||||
break;
|
||||
case 3://监视的通道名称
|
||||
oneChannlecfg.szMonitoredChannleName = strTempArray[j];
|
||||
oneChannlecfg.setSzMonitoredChannleName(strTempArray[j]);
|
||||
break;
|
||||
case 4://通道的单位
|
||||
oneChannlecfg.szUnitName = strTempArray[j];
|
||||
oneChannlecfg.setSzUnitName(strTempArray[j]);
|
||||
break;
|
||||
case 5://通道的系数
|
||||
oneChannlecfg.fCoefficent = Float.parseFloat(strTempArray[j]);
|
||||
oneChannlecfg.setFCoefficent(Float.parseFloat(strTempArray[j]));
|
||||
break;
|
||||
case 6://通道的偏移量
|
||||
oneChannlecfg.fOffset = Float.parseFloat(strTempArray[j]);
|
||||
oneChannlecfg.setFOffset(Float.parseFloat(strTempArray[j]));
|
||||
break;
|
||||
case 7://起始采样时间的偏移量
|
||||
oneChannlecfg.fTimeOffset = Float.parseFloat(strTempArray[j]);
|
||||
oneChannlecfg.setFTimeOffset( Float.parseFloat(strTempArray[j]));
|
||||
break;
|
||||
case 8://采样值的最小值
|
||||
oneChannlecfg.nMin = Integer.parseInt(strTempArray[j]);
|
||||
oneChannlecfg.setNMin( Integer.parseInt(strTempArray[j]));
|
||||
break;
|
||||
case 9://采样值的最大值
|
||||
oneChannlecfg.nMax = Integer.parseInt(strTempArray[j]);
|
||||
oneChannlecfg.setNMax(Integer.parseInt(strTempArray[j]));
|
||||
break;
|
||||
case 10://一次变比
|
||||
oneChannlecfg.fPrimary = Float.parseFloat(strTempArray[j]);
|
||||
oneChannlecfg.setFPrimary( Float.parseFloat(strTempArray[j]));
|
||||
break;
|
||||
case 11://二次变比
|
||||
oneChannlecfg.fSecondary = Float.parseFloat(strTempArray[j]);
|
||||
oneChannlecfg.setFSecondary(Float.parseFloat(strTempArray[j]));
|
||||
break;
|
||||
case 12://一次值还是二次值标志
|
||||
oneChannlecfg.szValueType = strTempArray[j];
|
||||
oneChannlecfg.setSzValueType(strTempArray[j]);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -664,21 +670,21 @@ public class AnalyseComtradeCfg {
|
||||
|
||||
sr.close();
|
||||
readFile.close();
|
||||
return comtradeCfg;
|
||||
return new TagComtradeCfg();
|
||||
}
|
||||
//波形起始时间
|
||||
strFileLine = sr.readLine(); // ⑨
|
||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy,HH:mm:ss.SSSSSS");
|
||||
comtradeCfg.setTimeTrigger(sdf.parse(strFileLine));
|
||||
DateTimeFormatter sdf = DateTimeFormatter.ofPattern("dd/MM/yyyy,HH:mm:ss.SSSSSS");
|
||||
comtradeCfg.setTimeTrigger(LocalDateTime.parse(strFileLine, sdf));
|
||||
|
||||
strFileLine = sr.readLine(); // ⑩
|
||||
comtradeCfg.setTimeStart(sdf.parse(strFileLine));
|
||||
comtradeCfg.setTimeEnd(new Date(comtradeCfg.getTimeStart().getTime() + nMSTotal));;
|
||||
comtradeCfg.setTimeStart(LocalDateTime.parse(strFileLine, sdf));
|
||||
comtradeCfg.setTimeEnd(LocalDateTime.parse(strFileLine, sdf).plusNanos(nMSTotal * 1000000));;
|
||||
comtradeCfg.setPath(file.getOriginalFilename());
|
||||
|
||||
sr.close();
|
||||
readFile.close();
|
||||
} catch (IOException | ParseException e) {
|
||||
} catch (IOException e) {
|
||||
System.out.println("Error opening file: " + strFilePath + " " + e.getMessage());
|
||||
return comtradeCfg;
|
||||
}
|
||||
@@ -686,6 +692,81 @@ public class AnalyseComtradeCfg {
|
||||
return comtradeCfg;
|
||||
}
|
||||
|
||||
public static CmnModeCfg convertRecord(String strFile) {
|
||||
File file = new File(strFile);
|
||||
if (file.length() == 0) {
|
||||
System.out.println("文件 " + strFile + " 长度为0字节,程序将跳过本文件的转换");
|
||||
}
|
||||
|
||||
long nBufSize = file.length();
|
||||
int n1BufLen = PrjRecordInfo.GetSize();
|
||||
int n2BufLen = CmnModeCfg.GetSize();
|
||||
|
||||
PrjRecordInfo prjRecordInfo = new PrjRecordInfo();
|
||||
CmnModeCfg cmnModeCfg = new CmnModeCfg();
|
||||
if (nBufSize == n1BufLen) {
|
||||
byte[] bBuf = new byte[0];
|
||||
try {
|
||||
bBuf = Files.readAllBytes(Paths.get(strFile));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
prjRecordInfo.SetStructBuf(bBuf, 0);
|
||||
CmnModeCfg recordInfo = prjRecordInfo.cfg;
|
||||
} else if (nBufSize == n2BufLen) {
|
||||
byte[] bBuf = new byte[0];
|
||||
try {
|
||||
bBuf = Files.readAllBytes(Paths.get(strFile));
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
cmnModeCfg.SetStructBuf(bBuf, 0);
|
||||
CmnModeCfg recordInfo = cmnModeCfg;
|
||||
} else {
|
||||
System.out.println("解析配置参数文件异常");
|
||||
}
|
||||
return cmnModeCfg;
|
||||
}
|
||||
|
||||
|
||||
public static CmnModeCfg convertRecord(InputStream fileStream) {
|
||||
|
||||
PrjRecordInfo prjRecordInfo = new PrjRecordInfo();
|
||||
CmnModeCfg cmnModeCfg = new CmnModeCfg();
|
||||
try {
|
||||
int nBufSize = fileStream.available();//计算需要解析的文件总长
|
||||
int n1BufLen = PrjRecordInfo.GetSize();
|
||||
int n2BufLen = CmnModeCfg.GetSize();
|
||||
|
||||
|
||||
if (nBufSize == n1BufLen) {
|
||||
byte[] bBuf = new byte[nBufSize];
|
||||
|
||||
fileStream.read(bBuf, 0, n1BufLen);
|
||||
|
||||
prjRecordInfo.SetStructBuf(bBuf, 0);
|
||||
cmnModeCfg = prjRecordInfo.cfg;
|
||||
} else if (nBufSize == n2BufLen) {
|
||||
byte[] bBuf = new byte[nBufSize];
|
||||
|
||||
fileStream.read(bBuf, 0, n2BufLen);
|
||||
|
||||
cmnModeCfg.SetStructBuf(bBuf, 0);
|
||||
} else {
|
||||
System.out.println("解析配置参数文件异常");
|
||||
}
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}finally {
|
||||
try {
|
||||
fileStream.close();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
return cmnModeCfg;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws IOException {
|
||||
// tagComtradeCfg tagComtradeCfg = AnalyseComtradeCfg.analyseComtradeCfg("C:\\Users\\Administrator\\Desktop\\浙江无线\\离线数据上传\\09\\comtrade\\line1_20240704_143908_213.cfg");
|
||||
// System.out.println(tagComtradeCfg);
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package com.njcn.csharmonic.offline.mincfg;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2024/7/15 15:40【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Data
|
||||
public class tagComtradeCfg implements Serializable {
|
||||
|
||||
public int nChannelNum; //通道总个数
|
||||
public int nAnalogNum; //模拟量通道的个数 WW 2013-05-15
|
||||
public int nDigitalNum; //数字量通道的个数 WW 2013-05-15
|
||||
public List<tagOneChannleCfg> OneChannleCfg; //模拟量通道记录类链表
|
||||
public List<tagOneChannleCfg_digital> OneChannleCfgDig; //数字量通道记录类链表
|
||||
public Date TimeTrigger; //暂态触发时间
|
||||
public Date TimeStart; //波形起始时间 注:相较于TimeTrigger波形触发时间起始有一段平滑过渡波形时间,约100ms
|
||||
public Date TimeEnd; //波形结束时间
|
||||
public String path;//对应波形cfg文件全路径名称
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,7 @@ package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
装置普测工程配置信息
|
||||
|
||||
*/
|
||||
public class cmn_mode_cfg
|
||||
public class CmnModeCfg
|
||||
{
|
||||
public byte[] prj_name = new byte[128]; //工程名称
|
||||
//C# TO JAVA CONVERTER WARNING: Unsigned integer types have no direct equivalent in Java:
|
||||
@@ -4,10 +4,10 @@ package com.njcn.csharmonic.offline.mincfg.vo;
|
||||
工程数据文件信息
|
||||
|
||||
*/
|
||||
public class prj_record_info
|
||||
public class PrjRecordInfo
|
||||
{
|
||||
public pqv_dev_info_int dev_info; //装置信息
|
||||
public cmn_mode_cfg cfg; //测试记录工程配置
|
||||
public CmnModeCfg cfg; //测试记录工程配置
|
||||
public prj_store_info store_mag; //存储管理缓冲
|
||||
public int tv_sec_s; //开始记录时间
|
||||
public int tv_sec_e; //结束记录时间
|
||||
@@ -15,16 +15,16 @@ public class prj_record_info
|
||||
//ORIGINAL LINE: public uint status;
|
||||
public int status; //测试工程数据是否有效标志
|
||||
|
||||
public prj_record_info()
|
||||
public PrjRecordInfo()
|
||||
{
|
||||
dev_info = new pqv_dev_info_int();
|
||||
cfg = new cmn_mode_cfg();
|
||||
cfg = new CmnModeCfg();
|
||||
store_mag = new prj_store_info();
|
||||
}
|
||||
public static int GetSize() //用于定义Byte数组
|
||||
{
|
||||
//C# TO JAVA CONVERTER TODO TASK: There is no Java equivalent to 'sizeof':
|
||||
int nSize = 2 * Integer.SIZE / Byte.SIZE + 1 * Integer.SIZE / Byte.SIZE + pqv_dev_info_int.GetSize() + cmn_mode_cfg.GetSize() + prj_store_info.GetSize(); //CComtradeDataItem数据结构数据长度
|
||||
int nSize = 2 * Integer.SIZE / Byte.SIZE + 1 * Integer.SIZE / Byte.SIZE + pqv_dev_info_int.GetSize() + CmnModeCfg.GetSize() + prj_store_info.GetSize(); //CComtradeDataItem数据结构数据长度
|
||||
return nSize;
|
||||
}
|
||||
public final boolean SetStructBuf(byte[] bArray, int nHaveRead)
|
||||
@@ -39,7 +39,7 @@ public class prj_record_info
|
||||
dev_info.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + pqv_dev_info_int.GetSize();
|
||||
cfg.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + cmn_mode_cfg.GetSize();
|
||||
iStep = iStep + CmnModeCfg.GetSize();
|
||||
store_mag.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + prj_store_info.GetSize();
|
||||
tv_sec_s = Service.convertInt32_net(bArray, iStep);
|
||||
@@ -66,7 +66,7 @@ public class prj_record_info
|
||||
dev_info.SetStructBuf(bArray, iStep);
|
||||
iStep = iStep + pqv_dev_info_int.GetSize();
|
||||
cfg.SetStructBuf_net(bArray, iStep);
|
||||
iStep = iStep + cmn_mode_cfg.GetSize();
|
||||
iStep = iStep + CmnModeCfg.GetSize();
|
||||
store_mag.SetStructBuf_net(bArray, iStep);
|
||||
iStep = iStep + prj_store_info.GetSize();
|
||||
tv_sec_s = Service.convertInt32(bArray, iStep);
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user