Compare commits
113 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8e4adc58d4 | |||
| 98e880b68d | |||
| 327923ba44 | |||
| e37ace2fd7 | |||
| ea3cff888b | |||
| 1f451f9d0e | |||
| b6c2675311 | |||
|
|
d0c7edff8a | ||
| 59a2bb5e62 | |||
|
|
9c2b2dbd3e | ||
|
|
be4f50fbc5 | ||
| 625ed864c7 | |||
| 10910e36e0 | |||
|
|
49d42328ff | ||
| 53debdf2ef | |||
| be6b29cbb7 | |||
| c72882d023 | |||
| 5022aff834 | |||
|
|
b2511aaaf5 | ||
| 75f07ac86f | |||
|
|
00b16325d6 | ||
|
|
e09232dc55 | ||
|
|
b8157f94c9 | ||
| 5c50e18fc9 | |||
|
|
4b8e2488d2 | ||
|
|
a4acc4775a | ||
|
|
c4803846a4 | ||
| 66c54ac3eb | |||
|
|
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,13 @@ 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);
|
||||
|
||||
@PostMapping("/getLinesByDevList")
|
||||
HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids);
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -50,4 +50,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,57 @@
|
||||
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 com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
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);
|
||||
|
||||
@GetMapping("/getWlAssByWlId")
|
||||
HttpResult<List<WlRecord>> getWlAssByWlId(@RequestParam("wlId")String wlId);
|
||||
|
||||
@PostMapping("/findDevBaseDataByLineId")
|
||||
HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param);
|
||||
}
|
||||
@@ -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,24 @@ 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLinePO>> getLinesByDevList(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置id集合获取监测点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,75 @@
|
||||
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 com.njcn.csdevice.pojo.vo.RecordVo;
|
||||
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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<WlRecord>> getWlAssByWlId(String wlId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据测试项id获取测试项详细条目",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(WlRecordParam.lineRecord param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置基础数据",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
* 装置模板文件路径
|
||||
|
||||
@@ -125,4 +125,7 @@ public class CsEquipmentDeliveryAddParm{
|
||||
@ApiModelProperty(value="模块个数")
|
||||
private Integer modelNumber;
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.njcn.csdevice.pojo.param;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -60,51 +58,12 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
@ApiModelProperty(value="装置接入方式")
|
||||
private String devAccessMethod;
|
||||
|
||||
// /**
|
||||
// * 装置程序版本
|
||||
// */
|
||||
// @ApiModelProperty(value="装置程序版本")
|
||||
// private String programVersion;
|
||||
|
||||
// /**
|
||||
// * 调试人员
|
||||
// */
|
||||
// @ApiModelProperty(value="调试人员")
|
||||
// private String debugPerson;
|
||||
//
|
||||
// /**
|
||||
// * 出厂日期
|
||||
// */
|
||||
// @ApiModelProperty(value="出厂日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
// private Date producteTime;
|
||||
//
|
||||
// /**
|
||||
// * 检修日期
|
||||
// */
|
||||
// @ApiModelProperty(value="检修日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
// private Date checkTime;
|
||||
//
|
||||
// /**
|
||||
// * 调试日期
|
||||
// */
|
||||
// @ApiModelProperty(value="调试日期")
|
||||
// @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
|
||||
// private Date debugTime;
|
||||
|
||||
/**
|
||||
* 合同号
|
||||
*/
|
||||
@ApiModelProperty(value="合同号")
|
||||
private String cntractNo;
|
||||
|
||||
// /**
|
||||
// * 营销经理
|
||||
// */
|
||||
// @ApiModelProperty(value="营销经理")
|
||||
// private String salesManager;
|
||||
|
||||
/**
|
||||
* 状态
|
||||
*/
|
||||
@@ -128,4 +87,10 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
*/
|
||||
@ApiModelProperty(value="模块个数")
|
||||
private Integer modelNumber;
|
||||
|
||||
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||
private Integer usageStatus;
|
||||
|
||||
@ApiModelProperty(value="排序")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -38,4 +38,14 @@ public class CsLineParam extends BaseEntity {
|
||||
*/
|
||||
private Integer conType;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String modelId;
|
||||
|
||||
/**
|
||||
* 数据集id
|
||||
*/
|
||||
private String dataSetId;
|
||||
|
||||
}
|
||||
@@ -24,4 +24,7 @@ public class DataArrayParam {
|
||||
|
||||
@ApiModelProperty("数据类型")
|
||||
private String statMethod;
|
||||
|
||||
@ApiModelProperty("数据集编号")
|
||||
private Integer idx;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -85,4 +99,19 @@ public class WlRecordParam {
|
||||
private String id;
|
||||
}
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
public static class lineRecord extends WlRecordParam {
|
||||
|
||||
@ApiModelProperty("监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty("测试项起始时间")
|
||||
private String itemStartTime;
|
||||
|
||||
@ApiModelProperty("测试项结束时间")
|
||||
private String itemEndTime;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -80,4 +80,8 @@ public class CsDataSet extends BaseEntity {
|
||||
*/
|
||||
private String dataLevel;
|
||||
|
||||
/**
|
||||
* 接线方式
|
||||
*/
|
||||
private Integer conType;
|
||||
}
|
||||
|
||||
@@ -108,4 +108,16 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
||||
@TableField(value = "process")
|
||||
private Integer process;
|
||||
|
||||
/**
|
||||
* 装置使用状态(0:停用 1:启用)
|
||||
*/
|
||||
@TableField(value = "usage_status")
|
||||
private Integer usageStatus;
|
||||
|
||||
/**
|
||||
* 排序
|
||||
*/
|
||||
@TableField(value = "sort")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -44,6 +44,16 @@ public class CsLinePO extends BaseEntity {
|
||||
@TableField(value = "`position`")
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 数据集id
|
||||
*/
|
||||
private String dataSetId;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String dataModelId;
|
||||
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
@@ -85,4 +95,10 @@ public class CsLinePO extends BaseEntity {
|
||||
|
||||
@TableField(value = "device_id")
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 监测点统计间隔
|
||||
*/
|
||||
@TableField(value = "line_interval")
|
||||
private Integer lineInterval;
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,4 +83,7 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
||||
@ApiModelProperty(value="设备当前流程状态")
|
||||
private Integer process ;
|
||||
|
||||
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||
private Integer usageStatus ;
|
||||
|
||||
}
|
||||
@@ -42,6 +42,18 @@ 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 = "lineType",value = "监测点类型 0:治理监测点 1:电能质量监测点")
|
||||
private Integer lineType;
|
||||
|
||||
@ApiModelProperty(name = "conType",value = "接线方式 0-星型 1-角型 2-V型")
|
||||
private Integer conType;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子节点")
|
||||
private List<CsLedgerVO> children = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -76,8 +76,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>user-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
@@ -92,8 +91,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-warn-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<!-- zxing生成二维码 -->
|
||||
@@ -107,9 +105,6 @@
|
||||
<groupId>com.njcn</groupId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>org.apache.poi</groupId>
|
||||
<artifactId>poi</artifactId>
|
||||
@@ -139,8 +134,7 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-harmonic-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>com.njcn</groupId>
|
||||
@@ -151,16 +145,14 @@
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>cs-system-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
<artifactId>access-api</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</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,127 @@
|
||||
package com.njcn.csdevice.controller.equipment;
|
||||
|
||||
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.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.service.DeviceFtpService;
|
||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
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;
|
||||
|
||||
/**
|
||||
* @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);
|
||||
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){
|
||||
redisUtil.saveByKeyWithExpire("fileDownUserId"+nDid+name,RequestUtil.getUserIndex(),600L);
|
||||
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.*;
|
||||
@@ -39,6 +38,7 @@ import springfox.documentation.annotations.ApiIgnore;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@@ -67,10 +67,10 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiOperation("新增出厂设备")
|
||||
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||
public HttpResult<Boolean> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
||||
Boolean flag = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||
if (flag){
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||
if (Objects.nonNull(po)){
|
||||
//查询mqtt用户名和密码是否存在
|
||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||
if (result){
|
||||
@@ -78,7 +78,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||
}
|
||||
}
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -284,4 +284,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,48 @@ 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);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getLinesByDevList")
|
||||
@ApiOperation("根据装置id集合获取监测点id集合")
|
||||
@ApiImplicitParam(name = "ids", value = "装置id集合", required = true)
|
||||
public HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids) {
|
||||
String methodDescribe = getMethodDescribe("getLinesByDevList");
|
||||
List<CsLinePO> list = csLinePOService.getLinesByDevList(ids);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改测试项
|
||||
*/
|
||||
@@ -138,6 +168,20 @@ public class WlRecordController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除装置测试项
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||
@PostMapping("/deleteItem")
|
||||
@ApiOperation("删除装置测试项")
|
||||
@ApiImplicitParam(name = "id", value = "装置测试项Id", required = true)
|
||||
public HttpResult<Boolean> deleteItem(@RequestParam @Validated String id) {
|
||||
String methodDescribe = getMethodDescribe("deleteItem");
|
||||
LogUtil.njcnDebug(log, "{},装置测试项Id为:{}", methodDescribe, id);
|
||||
wlRecordService.deleteItem(id);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询测试项时间段实时数据
|
||||
*/
|
||||
@@ -151,5 +195,57 @@ 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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据监测点id查询装置基础数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||
@PostMapping("/findDevBaseDataByLineId")
|
||||
@ApiOperation("根据监测点id查询装置基础数据")
|
||||
@ApiImplicitParam(name = "param", value = "查询条件", required = true)
|
||||
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param) {
|
||||
String methodDescribe = getMethodDescribe("findDevBaseDataByLineId");
|
||||
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, param);
|
||||
List<RecordVo> record = wlRecordService.findDevBaseDataByLineId(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 每日处理没有结束时间的测试基础数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@PostMapping("/dayDealNoEndTimeEvent")
|
||||
@ApiOperation("每日处理没有结束时间的测试基础数据")
|
||||
public void dayDealNoEndTimeEvent(@RequestParam("date") String date) {
|
||||
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
||||
wlRecordService.dayDealNoEndTimeEvent(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据测试项获取测试项绑定测点数据
|
||||
*/
|
||||
@OperateInfo(info = LogEnum.SYSTEM_COMMON)
|
||||
@GetMapping("/getWlAssByWlId")
|
||||
@ApiOperation("根据测试项获取测试项绑定测点数据")
|
||||
public HttpResult<List<WlRecord>> getWlAssByWlId(@RequestParam("wlId") String wlId) {
|
||||
String methodDescribe = getMethodDescribe("getWlAssByWlId");
|
||||
List<WlRecord> result = wlRecordService.getWlAssByWlId(wlId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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> {
|
||||
}
|
||||
@@ -48,4 +48,6 @@ public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
||||
List<CsLedgerVO> getAll();
|
||||
|
||||
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
||||
|
||||
List<WlRecord> getWlAssByWlId(String wlId);
|
||||
}
|
||||
|
||||
@@ -105,6 +105,8 @@
|
||||
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 t3.idx = #{param.idx}
|
||||
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>
|
||||
|
||||
|
||||
@@ -19,28 +19,31 @@
|
||||
<!--@mbg.generated-->
|
||||
id, dev_type, version_no, version_date, file_path, create_by, create_time, update_by,
|
||||
update_time, `status`
|
||||
</sql><select id="getPage" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
SELECT a.*
|
||||
FROM cs_dev_model a
|
||||
WHERE
|
||||
1 = 1 And a.`status`='1'
|
||||
<if test="csDevModelQueryParm.versionStartDate != null and csDevModelQueryParm.versionStartDate != ''">
|
||||
AND a.version_date >= #{csDevModelQueryParm.versionStartDate }
|
||||
</if>
|
||||
<if test="csDevModelQueryParm.versionEndDate != null and csDevModelQueryParm.versionEndDate != ''">
|
||||
AND a.version_date <= #{csDevModelQueryParm.versionEndDate }
|
||||
</if>
|
||||
</sql>
|
||||
<select id="getPage" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
SELECT a.*
|
||||
FROM cs_dev_model a
|
||||
WHERE
|
||||
1 = 1 And a.`status`='1'
|
||||
<if test="csDevModelQueryParm.versionStartDate != null and csDevModelQueryParm.versionStartDate != ''">
|
||||
AND a.version_date >= #{csDevModelQueryParm.versionStartDate }
|
||||
</if>
|
||||
<if test="csDevModelQueryParm.versionEndDate != null and csDevModelQueryParm.versionEndDate != ''">
|
||||
AND a.version_date <= #{csDevModelQueryParm.versionEndDate }
|
||||
</if>
|
||||
|
||||
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
||||
</if>
|
||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
||||
<!-- </if>-->
|
||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||
AND a.name = #{csDevModelQueryParm.name}
|
||||
</if>
|
||||
</select><select id="queryOne" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
||||
</if>
|
||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
||||
<!-- </if>-->
|
||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||
AND a.name = #{csDevModelQueryParm.name}
|
||||
</if>
|
||||
order by a.version_date desc
|
||||
</select>
|
||||
<select id="queryOne" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||
SELECT a.*
|
||||
FROM cs_dev_model a
|
||||
WHERE
|
||||
|
||||
@@ -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
|
||||
@@ -90,4 +93,8 @@
|
||||
)
|
||||
order by start_time
|
||||
</select>
|
||||
|
||||
<select id="getWlAssByWlId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
||||
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -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]
|
||||
@@ -33,7 +39,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* @Author: clam
|
||||
* @Date: 2023/3/31
|
||||
*/
|
||||
Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
||||
CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
||||
/**
|
||||
* @Description: AuditEquipmentDelivery
|
||||
* @Param: [id]
|
||||
@@ -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,11 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
*/
|
||||
void updateLine(CsLineParam csLineParam);
|
||||
|
||||
/**
|
||||
* 修改监测点的数据集id和模板id
|
||||
* @param csLineParam
|
||||
*/
|
||||
void updateIds(CsLineParam csLineParam);
|
||||
|
||||
List<CsLinePO> getLinesByDevList(List<String> list);
|
||||
}
|
||||
|
||||
@@ -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,20 @@ public interface IWlRecordService extends IService<WlRecord> {
|
||||
*/
|
||||
List<ThdDataVO> queryCommonStatisticalByTest(CommonStatisticalQueryParam commonStatisticalQueryParam);
|
||||
|
||||
/**
|
||||
* 获取装置基础数据
|
||||
* @return
|
||||
*/
|
||||
WlRecord findDevBaseData(WlRecordParam.Record param);
|
||||
|
||||
List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param);
|
||||
|
||||
/**
|
||||
* 每日处理没有结束时间的测试基础数据
|
||||
*/
|
||||
void dayDealNoEndTimeEvent(String date);
|
||||
|
||||
List<WlRecord> getWlAssByWlId(String wlId);
|
||||
|
||||
void deleteItem(String id);
|
||||
}
|
||||
|
||||
@@ -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$0".concat(clDev.toString()));
|
||||
} else if (target == 1) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$0".concat(clDev.toString()));
|
||||
} else if (target == 2) {
|
||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$0".concat(clDev.toString()));
|
||||
}
|
||||
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,10 +35,12 @@ 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;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
@@ -75,32 +77,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) {
|
||||
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||
@@ -109,6 +112,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||
csEquipmentDeliveryPo.setStatus (1);
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||
String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(4);
|
||||
@@ -129,7 +133,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 csEquipmentDeliveryPo;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -169,6 +177,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 +218,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 +230,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 +268,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 +301,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 = ?
|
||||
@@ -343,42 +371,57 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private void setDataSetValues(CsEquipmentDeliveryPO csEquipmentDeliveryPo, List<CsDataSet> dataSet, List<DeviceManagerVO.DataSetVO> dataSetList, String type, DeviceManagerVO deviceManagerVo) {
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPo, deviceManagerVo);
|
||||
if (CollUtil.isNotEmpty(dataSet)) {
|
||||
for (CsDataSet item : dataSet) {
|
||||
if (Objects.equals(type, "rt")) {
|
||||
for (CsDataSet item : dataSet) {
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
}
|
||||
} else {
|
||||
CsDataSet item = dataSet.get(0);
|
||||
//准实时数据
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setName("准实时数据");
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
if (Objects.equals(type, "history")) {
|
||||
//历史数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
dataSetVo2.setName("历史" + item.getAnotherName());
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
||||
//趋势数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo3.setId(item.getId());
|
||||
dataSetVo3.setName(item.getAnotherName() + "趋势数据");
|
||||
dataSetVo3.setType("trenddata");
|
||||
dataSetList.add(dataSetVo3);
|
||||
//实时数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo4.setId(item.getId());
|
||||
dataSetVo4.setName(item.getAnotherName() + "实时数据");
|
||||
dataSetVo4.setType("realtimedata");
|
||||
dataSetList.add(dataSetVo4);
|
||||
//暂态事件tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo5.setId(item.getId());
|
||||
dataSetVo5.setName(item.getAnotherName() + "暂态事件");
|
||||
dataSetVo5.setType("event");
|
||||
dataSetList.add(dataSetVo5);
|
||||
}
|
||||
//历史数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
dataSetVo2.setName("历史统计数据");
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
//趋势数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo3.setId(item.getId());
|
||||
dataSetVo3.setName("历史趋势");
|
||||
dataSetVo3.setType("trenddata");
|
||||
dataSetList.add(dataSetVo3);
|
||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
||||
//实时数据tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo4.setId(item.getId());
|
||||
dataSetVo4.setName("实时数据");
|
||||
dataSetVo4.setType("realtimedata");
|
||||
dataSetList.add(dataSetVo4);
|
||||
//暂态事件tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo5.setId(item.getId());
|
||||
dataSetVo5.setName("暂态事件");
|
||||
dataSetVo5.setType("event");
|
||||
dataSetList.add(dataSetVo5);
|
||||
//测试项tab
|
||||
DeviceManagerVO.DataSetVO dataSetVo6 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo6.setId(item.getId());
|
||||
dataSetVo6.setName("测试项记录");
|
||||
dataSetVo6.setType("items");
|
||||
dataSetList.add(dataSetVo6);
|
||||
}
|
||||
}
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
@@ -391,9 +434,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 +588,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
appLineTopologyDiagramPOQueryWrapper.in("line_id",collect);
|
||||
appLineTopologyDiagramService.remove(appLineTopologyDiagramPOQueryWrapper);
|
||||
}
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -585,20 +633,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(Double.valueOf(df.format(BigDecimal.valueOf(re).setScale(2, RoundingMode.HALF_UP).doubleValue())));
|
||||
}
|
||||
} else {
|
||||
vo.setDataValue(BigDecimal.valueOf(statisticalDataDTO.getValue()).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
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(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 {
|
||||
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());
|
||||
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,99 @@ 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){
|
||||
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()){
|
||||
if(param.getStatisticalId() == null){
|
||||
continue;
|
||||
}
|
||||
|
||||
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 -> {
|
||||
String unit;
|
||||
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())));
|
||||
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())));
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
unit = 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())));
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
}
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(null);
|
||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
vo.setUnit(unit);
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
@@ -339,7 +420,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 +437,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 +476,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 +524,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 +562,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 +662,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 +793,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 +818,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) {
|
||||
dataGroupTemplate.setName(dataGroupTemplate.getName() + "(" + energyTemplate.getUnit() + ")");
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
@@ -19,7 +20,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 +50,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 +71,65 @@ 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");
|
||||
String index = item.getId().substring(item.getId().length()-1);
|
||||
if (Objects.equals(index,"0")) {
|
||||
item.setLineType(0);
|
||||
} else {
|
||||
item.setLineType(1);
|
||||
}
|
||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1);
|
||||
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||
item.setConType(po.getConType());
|
||||
}
|
||||
)
|
||||
.collect(Collectors.toList());
|
||||
checkDevSetData(deviceList);
|
||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
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");
|
||||
c.setName(po.getName());
|
||||
c.setSort(po.getSort());
|
||||
}
|
||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
checkDevSetData(portables);
|
||||
portable.setChildren(portables);
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
@@ -125,32 +139,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
tree.add(portable);
|
||||
tree.add(government);
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
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();
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
||||
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||
@@ -182,45 +178,46 @@ 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");
|
||||
c.setName(po.getName());
|
||||
c.setSort(po.getSort());
|
||||
}
|
||||
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
portable.setChildren(portables);
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
@@ -230,10 +227,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
tree.add(portable);
|
||||
tree.add(government);
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
return tree;
|
||||
//return engineeringList;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -285,12 +285,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,41 +307,123 @@ 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);
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
device.setProjectId(project.getId());
|
||||
device.setProjectName(project.getName());
|
||||
CsLedger engineer = this.findDataById(project.getPid());
|
||||
device.setEngineeringid(engineer.getId());
|
||||
device.setEngineeringName(engineer.getName());
|
||||
//如果是便携式设备,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());
|
||||
device.setProjectId(project.getId());
|
||||
device.setProjectName(project.getName());
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取子节点
|
||||
*/
|
||||
|
||||
@@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -71,6 +72,21 @@ 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getLinesByDevList(List<String> list) {
|
||||
return this.lambdaQuery().in(CsLinePO::getDevId,list).eq(CsLinePO::getStatus,1).list();
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||
// *
|
||||
|
||||
@@ -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,218 @@
|
||||
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 {
|
||||
boolean mqttClient = judgeClientOnline(nDid);
|
||||
if (!mqttClient){
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
||||
Thread.sleep(3000);
|
||||
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(e.getMessage());
|
||||
}
|
||||
return makeUpVo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type) {
|
||||
List<MakeUpVo> result = new ArrayList<>();
|
||||
try {
|
||||
boolean mqttClient = judgeClientOnline(nDid);
|
||||
if (!mqttClient){
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
// 删除旧的缓存信息
|
||||
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(e.getMessage());
|
||||
}
|
||||
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) {
|
||||
boolean mqttClient = judgeClientOnline(nDid);
|
||||
if (!mqttClient) {
|
||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||
}
|
||||
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
|
||||
if (Objects.nonNull(task)) {
|
||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||
}
|
||||
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(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@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));
|
||||
redisUtil.delete("fileDownUserId"+nDid+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.getMessage());
|
||||
}
|
||||
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.getMessage());
|
||||
}
|
||||
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 boolean judgeClientOnline(String nDid) {
|
||||
//判断客户端是否在线
|
||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||
return mqttUtil.judgeClientOnline(clientName);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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,36 @@
|
||||
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.enums.common.DataStateEnum;
|
||||
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.pojo.po.WlRecord;
|
||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.param.UploadDataParam;
|
||||
import com.njcn.csdevice.service.IWlRecordService;
|
||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
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 +40,24 @@ 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.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZoneOffset;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
@@ -62,6 +75,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 +90,116 @@ 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;
|
||||
private final IWlRecordService wlRecordService;
|
||||
|
||||
@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 +210,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 +250,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");
|
||||
|
||||
List<PortableOfflLog> portableOfflLogs = new ArrayList<>();
|
||||
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 +281,57 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
//默认总条数及入库数为0(防止解析的数据重复插入及上传的文件目录路径错误)
|
||||
portableOfflLog.setAllCount(0);
|
||||
portableOfflLog.setRealCount(0);
|
||||
if(file.getOriginalFilename().contains("record.bin")){
|
||||
portableOfflLog.setAllCount(1);
|
||||
portableOfflLog.setState(1);
|
||||
}
|
||||
|
||||
//开始匹配解析的文件结果入库
|
||||
for(Response response : responses){
|
||||
//min解析结果较为特殊所有的文件解析后只有一条结果
|
||||
if(OfflineConstant.MIN.equals(response.getFilename()) && checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.MIN)!=null){
|
||||
if(OfflineConstant.MIN.equals(response.getFilename()) && checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.MIN)!=null&&minFlag){
|
||||
|
||||
List<PqdData> pqdData = (List<PqdData>) response.getObj();
|
||||
pqdData.forEach(temp->{
|
||||
temp.setClDid(cdid);
|
||||
temp.setIsAbnormal(0);
|
||||
temp.setProcess(data1.get(0).getProcess()+"");
|
||||
temp.setLineId(uploadDataParam.getLineId());
|
||||
});
|
||||
|
||||
Instant instantMax = pqdData.stream().map(PqdData::getTime).max(Instant::compareTo).get();
|
||||
Instant instantMin = pqdData.stream().map(PqdData::getTime).min(Instant::compareTo).get();
|
||||
//插入测试项
|
||||
WlRecord wlRecord = new WlRecord();
|
||||
wlRecord.setId(IdUtil.fastSimpleUUID());
|
||||
wlRecord.setItemName("基础数据");
|
||||
wlRecord.setGcName("补召数据");
|
||||
wlRecord.setDevId(csEquipmentDeliveryDTO.getId());
|
||||
wlRecord.setLineId(lineId);
|
||||
// wlRecord.setStatisticalInterval();
|
||||
// wlRecord.setPt();
|
||||
// wlRecord.setCt();
|
||||
// wlRecord.setPt1();
|
||||
// wlRecord.setCt1();
|
||||
// wlRecord.setVoltageLevel();
|
||||
// wlRecord.setCapacitySscb();
|
||||
// wlRecord.setCapacitySscmin();
|
||||
// wlRecord.setCapacitySt();
|
||||
// wlRecord.setCapacitySi();
|
||||
// wlRecord.setVolConType();
|
||||
// wlRecord.setCurConSel();
|
||||
wlRecord.setStartTime(instantMin.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
wlRecord.setEndTime(instantMax.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||
// wlRecord.setLocation();
|
||||
wlRecord.setType(1);
|
||||
wlRecord.setState(DataStateEnum.ENABLE.getCode());
|
||||
wlRecordService.lambdaUpdate().set(WlRecord::getState,DataStateEnum.DELETED.getCode())
|
||||
.eq(WlRecord::getLineId,lineId)
|
||||
.eq(WlRecord::getStartTime,wlRecord.getStartTime())
|
||||
.eq(WlRecord::getEndTime,wlRecord.getEndTime()).update();
|
||||
wlRecordService.save(wlRecord);
|
||||
|
||||
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
@@ -165,11 +339,16 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
if(pqdData != null && !pqdData.isEmpty()){
|
||||
//否则正常标记为成功解析
|
||||
portableOfflLog.setState(1);
|
||||
portableOfflLog.setName("min文件夹");
|
||||
portableOfflLog.setAllCount(pqdData.size());
|
||||
portableOfflLog.setRealCount(pqdData.size());
|
||||
if(minFlag){
|
||||
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;
|
||||
}
|
||||
@@ -178,17 +357,16 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
||||
//判断当前解析的数据属于哪种结果(目前来说三种:comtrade、log、min(除外))
|
||||
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.COMTRADE)!=null){ //cfg
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
if(response.getState() != null){
|
||||
portableOfflLog.setState(response.getState());
|
||||
}
|
||||
tagComtradeCfg tagComtradeCfg = (tagComtradeCfg) response.getObj();
|
||||
if(tagComtradeCfg != null){
|
||||
//否则正常标记为成功解析
|
||||
portableOfflLog.setState(1);
|
||||
portableOfflLog.setAllCount(1);
|
||||
portableOfflLog.setRealCount(1);
|
||||
//由于dat文件不解析但是日志需要记载所以都设为1
|
||||
|
||||
TagComtradeCfg tagComtradeCfg = (TagComtradeCfg) response.getObj();
|
||||
|
||||
//否则正常标记为成功解析
|
||||
portableOfflLog.setState(1);
|
||||
portableOfflLog.setAllCount(1);
|
||||
portableOfflLog.setRealCount(1);
|
||||
//cfg入库
|
||||
}
|
||||
|
||||
}
|
||||
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.LOG)!=null){ //事件
|
||||
//如果明确返回了state 那么当前文件解析出错
|
||||
@@ -208,6 +386,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 +402,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().replace(":", "-")+"/";
|
||||
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 +449,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 +495,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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
this.baseMapper.insert(portableOfflLog);
|
||||
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++;
|
||||
}
|
||||
portableOfflLogs.add(portableOfflLog);
|
||||
}
|
||||
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 +553,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,66 @@ 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 -> {
|
||||
String unit;
|
||||
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())));
|
||||
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())));
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
unit = 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())));
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
}
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(null);
|
||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
}
|
||||
vo.setUnit(unit);
|
||||
vo.setStatisticalIndex(epdPqd.getId());
|
||||
vo.setUnit(epdPqd.getUnit());
|
||||
vo.setStatisticalName(epdPqd.getName());
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
@@ -334,6 +510,142 @@ 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
|
||||
public List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param) {
|
||||
List<RecordVo> result = new ArrayList<>();
|
||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(WlRecord::getLineId,param.getLineId())
|
||||
.between(WlRecord::getStartTime,param.getItemStartTime(),param.getItemEndTime())
|
||||
.eq(WlRecord::getType,1)
|
||||
.eq(WlRecord::getState,1).orderByDesc(WlRecord::getStartTime);
|
||||
List<WlRecord> list = this.list(lambdaQueryWrapper);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
list.forEach(item->{
|
||||
RecordVo vo = new RecordVo();
|
||||
BeanUtils.copyProperties(item,vo);
|
||||
result.add(vo);
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void dayDealNoEndTimeEvent(String date) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<WlRecord> getWlAssByWlId(String wlId) {
|
||||
return this.baseMapper.getDataRecordByTestId(wlId,0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteItem(String id) {
|
||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(WlRecord::getId,id).set(WlRecord::getState,0);
|
||||
this.update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
||||
* @param data 数据项
|
||||
@@ -454,7 +766,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
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user