Compare commits
100 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 0d7d1781e3 | |||
| b794842d33 | |||
| 5e0c2d5cbc | |||
| 6c9a33c05d | |||
| a847f541f1 | |||
| 94b5b92991 | |||
| 882d56a2c5 | |||
| 1629e1c4cc | |||
| 45846e1889 | |||
| 030384333e | |||
| dc9958b249 | |||
| a607437225 | |||
| d277eba5fb | |||
| 913c2ef262 | |||
| 0fe80e12b5 | |||
| ffb6ead753 | |||
| 6782b19b7d | |||
| eeb22c749a | |||
| 31c21a43f4 | |||
| a923978f72 | |||
| 40588c6cd4 | |||
| cb76943f0f | |||
| 660925df31 | |||
| 0ce5840d02 | |||
| 9bd6ca43e1 | |||
| d6056e2cac | |||
| 8d8eb4d274 | |||
| b045860a43 | |||
| c0c3ae4e41 | |||
| 443adfaa37 | |||
| a314b3c862 | |||
| 282a592a13 | |||
| 0f839dfd5b | |||
| 45f706475b | |||
| 0a06d2d5eb | |||
| bba6da3c7d | |||
| 71d59528a3 | |||
| 06de2121f6 | |||
| 65d39224ed | |||
| fda83a1bd9 | |||
| 4ee41b833b | |||
|
|
cd07f8bee3 | ||
| 58a559b7b7 | |||
|
|
52342d736d | ||
| 6f5ffb8395 | |||
|
|
ed7c02a116 | ||
|
|
e12d23d4e1 | ||
| 0965eed31b | |||
| f754cf61c4 | |||
| e32e820417 | |||
| 158917f2bc | |||
| 2df06d9597 | |||
| 81da6e54ca | |||
| 1f4e8c7e25 | |||
| f90a3228b9 | |||
| 04cdb50b13 | |||
| b377ad7c95 | |||
|
|
698c0a6eb0 | ||
| ada760eeb2 | |||
| b22bd79750 | |||
|
|
5f14f8fe2f | ||
| b93faee241 | |||
| 2191276185 | |||
| 2206f203e8 | |||
| c28724bb05 | |||
|
|
86d21f984c | ||
|
|
6f38ddf068 | ||
| d1aefa92d8 | |||
| 51a22057a9 | |||
| 8055d08bda | |||
| 8a0e0d8c08 | |||
| 3df2bedaa6 | |||
| 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 |
@@ -0,0 +1,20 @@
|
|||||||
|
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.CsCommunicateFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/pqsCommunicate", fallbackFactory = CsCommunicateFeignClientFallbackFactory.class,contextId = "pqsCommunicate")
|
||||||
|
|
||||||
|
public interface CsCommunicateFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/insertion")
|
||||||
|
HttpResult<String> insertion(@RequestBody PqsCommunicateDto pqsCommunicateDto);
|
||||||
|
}
|
||||||
@@ -1,7 +1,11 @@
|
|||||||
package com.njcn.csdevice.api;
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||||
@@ -39,4 +43,9 @@ public interface CsLedgerFeignClient {
|
|||||||
@PostMapping("/deviceTree")
|
@PostMapping("/deviceTree")
|
||||||
@ApiOperation("三层设备树(装置层)")
|
@ApiOperation("三层设备树(装置层)")
|
||||||
HttpResult<List<CsLedgerVO>> getDeviceTree();
|
HttpResult<List<CsLedgerVO>> getDeviceTree();
|
||||||
}
|
|
||||||
|
@PostMapping("/getAllLedger")
|
||||||
|
HttpResult<List<CsLedgerVO>> getAllLedger();
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|||||||
@@ -42,4 +42,7 @@ public interface CsLineFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/getById")
|
@PostMapping("/getById")
|
||||||
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
HttpResult<CsLinePO> getById(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
@PostMapping("/getLinesByDevList")
|
||||||
|
HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,4 +61,7 @@ public interface EquipmentFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/judgeDevModel")
|
@PostMapping("/judgeDevModel")
|
||||||
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
|
HttpResult<Boolean> judgeDevModel(@RequestParam("nDid") String nDid);
|
||||||
|
|
||||||
|
@PostMapping("/getDevByLineId")
|
||||||
|
HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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.IntegrityClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
|
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.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/rStatIntegrityD", fallbackFactory = IntegrityClientFallbackFactory.class,contextId = "rStatIntegrityD")
|
||||||
|
public interface IntegrityFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
HttpResult<List<RStatIntegrityD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
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.onlineRateClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
|
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.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/rStatOnlineRateD", fallbackFactory = onlineRateClientFallbackFactory.class,contextId = "rStatOnlineRateD")
|
||||||
|
public interface OnlineRateFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/list")
|
||||||
|
HttpResult<List<RStatOnlineRateD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.csdevice.api.fallback.WlRecordClientFallbackFactory;
|
import com.njcn.csdevice.api.fallback.WlRecordClientFallbackFactory;
|
||||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
@@ -45,6 +46,12 @@ public interface WlRecordFeignClient {
|
|||||||
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
HttpResult<Boolean> updateTestRecord(@RequestBody @Validated WlRecordParam.UpdateRecord record);
|
||||||
|
|
||||||
|
|
||||||
@GetMapping("/dayDealNoEndTimeEvent")
|
@PostMapping("/dayDealNoEndTimeEvent")
|
||||||
void dayDealNoEndTimeEvent(@RequestParam("date") String date);
|
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,40 @@
|
|||||||
|
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.CsCommunicateFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
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 CsCommunicateFeignClientFallbackFactory implements FallbackFactory<CsCommunicateFeignClient> {
|
||||||
|
@Override
|
||||||
|
public CsCommunicateFeignClient 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 CsCommunicateFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<String> insertion(PqsCommunicateDto pqsCommunicateDto) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","新增记录",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -62,6 +62,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
|
|||||||
log.error("{}异常,降级处理,异常为:{}","查询设备树",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","查询设备树",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsLedgerVO>> getAllLedger() {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","获取台账树所有数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -74,6 +74,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id获取监测点详情",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsLinePO>> getLinesByDevList(List<String> ids) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据装置id集合获取监测点id集合",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
|||||||
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","判断设备型号",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(String lineId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据监测点id查询装置信息",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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.IntegrityFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class IntegrityClientFallbackFactory implements FallbackFactory<IntegrityFeignClient> {
|
||||||
|
@Override
|
||||||
|
public IntegrityFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new IntegrityFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<RStatIntegrityD>> list(List<String> list, String startTime, String endTime) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.csdevice.api.WlRecordFeignClient;
|
import com.njcn.csdevice.api.WlRecordFeignClient;
|
||||||
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
import com.njcn.csdevice.pojo.param.WlRecordParam;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -57,6 +58,18 @@ public class WlRecordClientFallbackFactory implements FallbackFactory<WlRecordFe
|
|||||||
log.error("{}异常,降级处理,异常为:{}","每日处理没有结束时间的测试基础数据",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","每日处理没有结束时间的测试基础数据",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
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);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
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.OnlineRateFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class onlineRateClientFallbackFactory implements FallbackFactory<OnlineRateFeignClient> {
|
||||||
|
@Override
|
||||||
|
public OnlineRateFeignClient create(Throwable cause) {
|
||||||
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
}
|
||||||
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
|
return new OnlineRateFeignClient() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<RStatOnlineRateD>> list(List<String> list, String startTime, String endTime) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,70 @@
|
|||||||
|
package com.njcn.csdevice.param;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点有效数值统计数据评估入参
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2024/11/6 20:36
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LineCountEvaluateParam implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点编号集合
|
||||||
|
*/
|
||||||
|
private List<String> lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 表名
|
||||||
|
*/
|
||||||
|
private String tableName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 相别集合
|
||||||
|
*/
|
||||||
|
private List<String> phasicType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 值类型
|
||||||
|
*/
|
||||||
|
private List<String> valueType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 异常数据时间集合
|
||||||
|
* Map<String,List<String>> key:监测点id value:异常时间集合
|
||||||
|
*/
|
||||||
|
private Map<String, List<String>> abnormalTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 列名
|
||||||
|
*/
|
||||||
|
private String columnName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最小值 >=
|
||||||
|
*/
|
||||||
|
private String ge;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 最大值 <=
|
||||||
|
*/
|
||||||
|
private String lt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型 判断获取数据是否排除暂态异常数据
|
||||||
|
*/
|
||||||
|
private Boolean dataType = true;
|
||||||
|
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.csdevice.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/3/10 10:01
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class PqsCommunicateDto implements Serializable {
|
||||||
|
|
||||||
|
private String time;
|
||||||
|
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
private String description;
|
||||||
|
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -47,7 +47,8 @@ public class CsDevModelQueryParm {
|
|||||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
|
||||||
private String versionEndDate;
|
private String versionEndDate;
|
||||||
|
@ApiModelProperty(value = "装置型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,12 +1,10 @@
|
|||||||
package com.njcn.csdevice.pojo.param;
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.Pattern;
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -34,6 +32,7 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="网络设备ID")
|
@ApiModelProperty(value="网络设备ID")
|
||||||
@NotBlank(message="网络设备ID不能为空!")
|
@NotBlank(message="网络设备ID不能为空!")
|
||||||
|
@Pattern(regexp = "^[A-Za-z0-9]{6,32}$", message = "网络设备ID只可为数字或字母,长度至少为6位")
|
||||||
private String ndid;
|
private String ndid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -125,4 +124,7 @@ public class CsEquipmentDeliveryAddParm{
|
|||||||
@ApiModelProperty(value="模块个数")
|
@ApiModelProperty(value="模块个数")
|
||||||
private Integer modelNumber;
|
private Integer modelNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -1,12 +1,11 @@
|
|||||||
package com.njcn.csdevice.pojo.param;
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import java.util.Date;
|
import javax.validation.constraints.Pattern;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -34,6 +33,7 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
* 网关识别码
|
* 网关识别码
|
||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="网关识别码")
|
@ApiModelProperty(value="网关识别码")
|
||||||
|
@Pattern(regexp = "^[A-Za-z0-9]{1,32}$", message = "网络设备ID只可为(数字,字母)")
|
||||||
private String ndid;
|
private String ndid;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -60,51 +60,12 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
@ApiModelProperty(value="装置接入方式")
|
@ApiModelProperty(value="装置接入方式")
|
||||||
private String devAccessMethod;
|
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="合同号")
|
@ApiModelProperty(value="合同号")
|
||||||
private String cntractNo;
|
private String cntractNo;
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 营销经理
|
|
||||||
// */
|
|
||||||
// @ApiModelProperty(value="营销经理")
|
|
||||||
// private String salesManager;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 状态
|
* 状态
|
||||||
*/
|
*/
|
||||||
@@ -128,4 +89,10 @@ public class CsEquipmentDeliveryAuditParm {
|
|||||||
*/
|
*/
|
||||||
@ApiModelProperty(value="模块个数")
|
@ApiModelProperty(value="模块个数")
|
||||||
private Integer modelNumber;
|
private Integer modelNumber;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||||
|
private Integer usageStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="排序")
|
||||||
|
private Integer sort;
|
||||||
}
|
}
|
||||||
@@ -34,4 +34,10 @@ public class CsEquipmentDeliveryQueryParm extends BaseParam {
|
|||||||
@ApiModelProperty("运行状态 1:离线 2:在线")
|
@ApiModelProperty("运行状态 1:离线 2:在线")
|
||||||
private Integer runStatus;
|
private Integer runStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("流程步骤")
|
||||||
|
private Integer process;
|
||||||
|
|
||||||
|
@ApiModelProperty("物联通讯状态 0:未连接 1:已连接")
|
||||||
|
private Integer connectStatus;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -48,4 +48,9 @@ public class CsLineParam extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String dataSetId;
|
private String dataSetId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 统计间隔
|
||||||
|
*/
|
||||||
|
private Integer lineInterval;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -24,4 +24,7 @@ public class DataArrayParam {
|
|||||||
|
|
||||||
@ApiModelProperty("数据类型")
|
@ApiModelProperty("数据类型")
|
||||||
private String statMethod;
|
private String statMethod;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据集编号")
|
||||||
|
private Integer idx;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
package com.njcn.csdevice.pojo.param;
|
package com.njcn.csdevice.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.EqualsAndHashCode;
|
import lombok.EqualsAndHashCode;
|
||||||
@@ -34,9 +35,11 @@ public class WlRecordParam {
|
|||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
@ApiModelProperty("项目起始时间")
|
@ApiModelProperty("项目起始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime proStartTime;
|
private LocalDateTime proStartTime;
|
||||||
|
|
||||||
@ApiModelProperty("项目结束时间")
|
@ApiModelProperty("项目结束时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime proEndTime;
|
private LocalDateTime proEndTime;
|
||||||
|
|
||||||
@ApiModelProperty("测试项名称")
|
@ApiModelProperty("测试项名称")
|
||||||
@@ -99,4 +102,23 @@ public class WlRecordParam {
|
|||||||
private String id;
|
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;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据来源 0:补召 1:在线监测 ")
|
||||||
|
private Integer dataSource;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,4 +80,8 @@ public class CsDataSet extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String dataLevel;
|
private String dataLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接线方式
|
||||||
|
*/
|
||||||
|
private Integer conType;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -108,4 +108,16 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
|||||||
@TableField(value = "process")
|
@TableField(value = "process")
|
||||||
private Integer process;
|
private Integer process;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置使用状态(0:停用 1:启用)
|
||||||
|
*/
|
||||||
|
@TableField(value = "usage_status")
|
||||||
|
private Integer usageStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排序
|
||||||
|
*/
|
||||||
|
@TableField(value = "sort")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -95,4 +95,10 @@ public class CsLinePO extends BaseEntity {
|
|||||||
|
|
||||||
@TableField(value = "device_id")
|
@TableField(value = "device_id")
|
||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点统计间隔
|
||||||
|
*/
|
||||||
|
@TableField(value = "line_interval")
|
||||||
|
private Integer lineInterval;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 数据完整性日表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("r_stat_integrity_d")
|
||||||
|
public class RStatIntegrityD implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@MppMultiId
|
||||||
|
private LocalDate timeId;
|
||||||
|
|
||||||
|
@MppMultiId
|
||||||
|
private String lineIndex;
|
||||||
|
|
||||||
|
private Integer dueTime;
|
||||||
|
|
||||||
|
private Integer realTime;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
package com.njcn.csdevice.pojo.po;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 在线率日表
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
@TableName("r_stat_onlinerate_d")
|
||||||
|
public class RStatOnlineRateD implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@MppMultiId
|
||||||
|
private LocalDate timeId;
|
||||||
|
|
||||||
|
@MppMultiId
|
||||||
|
private String devIndex;
|
||||||
|
|
||||||
|
private Integer onlineMin;
|
||||||
|
|
||||||
|
private Integer offlineMin;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -150,4 +150,10 @@ public class WlRecord extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
private String gcDataPath;
|
private String gcDataPath;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据类型(Primary:一次值 Secondary:二次值)
|
||||||
|
*/
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String dataLevel;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -83,4 +83,12 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
|||||||
@ApiModelProperty(value="设备当前流程状态")
|
@ApiModelProperty(value="设备当前流程状态")
|
||||||
private Integer process ;
|
private Integer process ;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置使用状态(0:停用 1:启用)")
|
||||||
|
private Integer usageStatus ;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置与MQTT服务器连接状态")
|
||||||
|
private String connectStatus ;
|
||||||
|
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -28,8 +28,17 @@ public class CsLedgerVO implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty(name = "path",value = "拓扑图路径")
|
@ApiModelProperty(name = "path",value = "拓扑图路径")
|
||||||
private String path;
|
private String path;
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "provinceId",value = "省Id")
|
||||||
|
private String provinceId;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty(name = "cityId",value = "市Id")
|
||||||
|
private String cityId;
|
||||||
|
|
||||||
@ApiModelProperty(name = "area",value = "区域")
|
@ApiModelProperty(name = "area",value = "区域")
|
||||||
private String area;
|
private String area;
|
||||||
|
|
||||||
@ApiModelProperty(name = "remark",value = "备注")
|
@ApiModelProperty(name = "remark",value = "备注")
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
@@ -48,6 +57,15 @@ public class CsLedgerVO implements Serializable {
|
|||||||
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
|
@ApiModelProperty(name = "type",value = "类型 项目 工程 装置 监测点")
|
||||||
private String type;
|
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 = "process",value = "流程状态")
|
||||||
|
private Integer process;
|
||||||
|
|
||||||
@ApiModelProperty(name = "children",value = "子节点")
|
@ApiModelProperty(name = "children",value = "子节点")
|
||||||
private List<CsLedgerVO> children = new ArrayList<>();
|
private List<CsLedgerVO> children = new ArrayList<>();
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.format.annotation.DateTimeFormat;
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -12,7 +13,7 @@ import java.time.LocalDateTime;
|
|||||||
* @date 2023/6/19
|
* @date 2023/6/19
|
||||||
*/
|
*/
|
||||||
@Data
|
@Data
|
||||||
public class DataGroupEventVO {
|
public class DataGroupEventVO {
|
||||||
|
|
||||||
@ApiModelProperty("id")
|
@ApiModelProperty("id")
|
||||||
private String id;
|
private String id;
|
||||||
@@ -26,6 +27,12 @@ public class DataGroupEventVO {
|
|||||||
@ApiModelProperty("监测点名称")
|
@ApiModelProperty("监测点名称")
|
||||||
private String lineName;
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置ID")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
@ApiModelProperty("项目名称")
|
@ApiModelProperty("项目名称")
|
||||||
private String projectName;
|
private String projectName;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EachModuleVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("模块名称")
|
||||||
|
private String moduleName;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块状态")
|
||||||
|
private String moduleState;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块运行状态数据")
|
||||||
|
List<HarmonicVo> dataList;
|
||||||
|
|
||||||
|
@ApiModelProperty("负载电流数据")
|
||||||
|
List<DataVo> loadList;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块输出电流")
|
||||||
|
List<DataVo> modOutList;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块温度")
|
||||||
|
List<DataVo> temperatureList;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class HarmonicVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("稳态数据时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime time;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块状态 0-离线,1-运行,2-停止,3-故障")
|
||||||
|
private String stateDesc;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据类型 0-稳态数据 1-事件数据 2-主动触发")
|
||||||
|
private Integer dataType;
|
||||||
|
|
||||||
|
@ApiModelProperty("事件code")
|
||||||
|
private String eventCode;
|
||||||
|
|
||||||
|
@ApiModelProperty("事件名称")
|
||||||
|
private String eventName;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DataVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("稳态数据时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime time;
|
||||||
|
|
||||||
|
@ApiModelProperty("相别")
|
||||||
|
private String phasicType;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据")
|
||||||
|
private Double data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,6 +22,9 @@ public class RecordVo {
|
|||||||
@ApiModelProperty("名称")
|
@ApiModelProperty("名称")
|
||||||
private String itemName;
|
private String itemName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
@ApiModelProperty("数据起始时间")
|
@ApiModelProperty("数据起始时间")
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
@@ -30,6 +33,9 @@ public class RecordVo {
|
|||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private LocalDateTime endTime;
|
private LocalDateTime endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("持续时间")
|
||||||
|
private String lastTime;
|
||||||
|
|
||||||
@ApiModelProperty("测试位置")
|
@ApiModelProperty("测试位置")
|
||||||
private String location;
|
private String location;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.csdevice.utils;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
|
||||||
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Description:
|
||||||
|
* Date: 2024/12/17 14:29【需求编号】
|
||||||
|
*
|
||||||
|
* @author clam
|
||||||
|
* @version V1.0.0
|
||||||
|
*/
|
||||||
|
public class StringUtil {
|
||||||
|
public static void containsSpecialCharacters(String str) {
|
||||||
|
// 定义包含特殊字符的正则表达式
|
||||||
|
String specialChars = "[<>%'%;()&+/\\\\-\\\\\\\\_|@*?#$!,.]|html";
|
||||||
|
// 创建Pattern对象
|
||||||
|
Pattern pattern = Pattern.compile(specialChars);
|
||||||
|
// 使用Pattern对象的matcher方法检查字符串
|
||||||
|
if(pattern.matcher(str).find()){
|
||||||
|
throw new BusinessException("存在特殊字符[<>\"'%;()&+//\\-———|@*_?#$!,.html]");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
StringUtil.containsSpecialCharacters("*");
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -76,8 +76,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>user-api</artifactId>
|
<artifactId>user-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
@@ -92,8 +91,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>cs-warn-api</artifactId>
|
<artifactId>cs-warn-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- zxing生成二维码 -->
|
<!-- zxing生成二维码 -->
|
||||||
@@ -107,9 +105,6 @@
|
|||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<version>1.0.0</version>
|
<version>1.0.0</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.poi</groupId>
|
<groupId>org.apache.poi</groupId>
|
||||||
<artifactId>poi</artifactId>
|
<artifactId>poi</artifactId>
|
||||||
@@ -139,8 +134,7 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>cs-harmonic-api</artifactId>
|
<artifactId>cs-harmonic-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
<exclusions>
|
<exclusions>
|
||||||
<exclusion>
|
<exclusion>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
@@ -151,20 +145,14 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>cs-system-api</artifactId>
|
<artifactId>cs-system-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>access-api</artifactId>
|
<artifactId>access-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
<scope>compile</scope>
|
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
|
|
||||||
<build>
|
<build>
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.csdevice.controller.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 动态注解类
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2024/11/7 11:00
|
||||||
|
*/
|
||||||
|
@Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface InsertBean {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.csdevice.controller.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* 动态注解类
|
||||||
|
*
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2024/11/7 11:00
|
||||||
|
*/
|
||||||
|
@Target({ElementType.TYPE,ElementType.METHOD,ElementType.FIELD})
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface QueryBean {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.njcn.csdevice.controller.bean;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.controller.annotation.InsertBean;
|
||||||
|
import com.njcn.csdevice.controller.annotation.QueryBean;
|
||||||
|
import org.springframework.beans.BeansException;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||||
|
import org.springframework.context.ApplicationContext;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2024/11/7 11:31
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class DynamicBeanProcessor implements BeanPostProcessor {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ApplicationContext context;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询配置
|
||||||
|
*/
|
||||||
|
@Value("${data.source.query:Influxdb}")
|
||||||
|
private String queryParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入配置
|
||||||
|
*/
|
||||||
|
@Value("${data.source.insert:Relation}")
|
||||||
|
private String insertParam;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException {
|
||||||
|
if (bean.getClass().isAnnotationPresent(Controller.class) || bean.getClass().isAnnotationPresent(RestController.class) || bean.getClass().isAnnotationPresent(Service.class)) {
|
||||||
|
processFields(bean);
|
||||||
|
}
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void processFields(Object bean) {
|
||||||
|
Field[] fields = bean.getClass().getDeclaredFields();
|
||||||
|
for (Field field : fields) {
|
||||||
|
String beanId;
|
||||||
|
Class<?> type = field.getType();
|
||||||
|
// 判断是否是接口类型,并且是否是注解指定类库
|
||||||
|
if (type.isInterface() && (field.isAnnotationPresent(QueryBean.class) || field.isAnnotationPresent(InsertBean.class))) {
|
||||||
|
String name = type.getName();
|
||||||
|
beanId = name.substring(name.lastIndexOf(".") + 2);
|
||||||
|
if (field.isAnnotationPresent(QueryBean.class)) {
|
||||||
|
beanId = queryParam + beanId + "Impl";
|
||||||
|
} else if (field.isAnnotationPresent(InsertBean.class)) {
|
||||||
|
beanId = insertParam + beanId + "Impl";
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
field.setAccessible(true);
|
||||||
|
field.set(bean, context.getBean(beanId));
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new BusinessException("获取动态实现类失败");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException {
|
||||||
|
return bean;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
package com.njcn.csdevice.controller.data;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.constant.OperateType;
|
||||||
|
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.controller.annotation.QueryBean;
|
||||||
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.csdevice.service.ICsCommunicateService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.validation.annotation.Validated;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0
|
||||||
|
* @data 2024/11/6 19:48
|
||||||
|
*/
|
||||||
|
@Validated
|
||||||
|
@Slf4j
|
||||||
|
@Controller
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/pqsCommunicate")
|
||||||
|
@Api(tags = "获取装置上下线记录")
|
||||||
|
public class PqsCommunicateController extends BaseController {
|
||||||
|
|
||||||
|
@QueryBean
|
||||||
|
private ICsCommunicateService pqsCommunicateCvtQuery;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getRawDataLatest")
|
||||||
|
@ApiOperation("获取取出最新装置数据")
|
||||||
|
public HttpResult<List<PqsCommunicateDto>> getRawDataLatest(@RequestBody LineCountEvaluateParam lineParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getRawDataLatest");
|
||||||
|
List<PqsCommunicateDto> rawData = pqsCommunicateCvtQuery.getRawDataLatest(lineParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rawData, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getRawData")
|
||||||
|
@ApiOperation("获取原始数据")
|
||||||
|
public HttpResult<List<PqsCommunicateDto>> getRawData(@RequestBody LineCountEvaluateParam lineParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getRawData");
|
||||||
|
List<PqsCommunicateDto> rawData = pqsCommunicateCvtQuery.getRawData(lineParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rawData, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getRawDataEnd")
|
||||||
|
@ApiOperation("获取是否有当天最后一条数据")
|
||||||
|
public HttpResult<List<PqsCommunicateDto>> getRawDataEnd(@RequestBody LineCountEvaluateParam lineParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("getRawData");
|
||||||
|
List<PqsCommunicateDto> rawData = pqsCommunicateCvtQuery.getRawDataEnd(lineParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, rawData, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON,operateType = OperateType.ADD)
|
||||||
|
@PostMapping("/insertion")
|
||||||
|
@ApiOperation("插入数据")
|
||||||
|
public HttpResult<String> insertion(@RequestBody PqsCommunicateDto pqsCommunicateDto) {
|
||||||
|
String methodDescribe = getMethodDescribe("insertion");
|
||||||
|
pqsCommunicateCvtQuery.insertion(pqsCommunicateDto);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.njcn.csdevice.controller.data;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
|
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 数据完整性日表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rStatIntegrityD")
|
||||||
|
@Api(tags = "数据完整性接口")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RStatIntegrityDController extends BaseController {
|
||||||
|
|
||||||
|
private final IRStatIntegrityDService irStatIntegrityDService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("新增数据完整性(可根据时间段进行补召)")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<String> addData(@RequestBody @Validated StatisticsDataParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("addData");
|
||||||
|
irStatIntegrityDService.addData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ApiOperation("获取数据")
|
||||||
|
public HttpResult<List<RStatIntegrityD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
List<RStatIntegrityD> result = irStatIntegrityDService.getData(list,startTime,endTime);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,60 @@
|
|||||||
|
package com.njcn.csdevice.controller.data;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 在线率日表 前端控制器
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/rStatOnlineRateD")
|
||||||
|
@Api(tags = "终端在线率接口")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class RStatOnlineRateDController extends BaseController {
|
||||||
|
|
||||||
|
private final IRStatOnlineRateDService rStatOnlineRateDService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ApiOperation("新增终端在线率(可根据时间段进行补召)")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<String> addData(@RequestBody @Validated StatisticsDataParam param){
|
||||||
|
String methodDescribe = getMethodDescribe("addData");
|
||||||
|
rStatOnlineRateDService.addData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ApiOperation("获取数据")
|
||||||
|
public HttpResult<List<RStatOnlineRateD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime){
|
||||||
|
String methodDescribe = getMethodDescribe("list");
|
||||||
|
List<RStatOnlineRateD> result = rStatOnlineRateDService.getData(list,startTime,endTime);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -1,18 +1,16 @@
|
|||||||
package com.njcn.csdevice.controller.equipment;
|
package com.njcn.csdevice.controller.equipment;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
||||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
|
||||||
import com.njcn.csdevice.service.DeviceFtpService;
|
import com.njcn.csdevice.service.DeviceFtpService;
|
||||||
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
import com.njcn.csharmonic.pojo.vo.MakeUpVo;
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiImplicitParam;
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
import io.swagger.annotations.ApiImplicitParams;
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
@@ -25,7 +23,6 @@ import org.springframework.web.bind.annotation.RequestParam;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author xy
|
* @author xy
|
||||||
@@ -63,9 +60,6 @@ public class DeviceFtpController extends BaseController {
|
|||||||
public HttpResult<List<MakeUpVo>> askDeviceFileOrDir(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("type") String type){
|
public HttpResult<List<MakeUpVo>> askDeviceFileOrDir(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("type") String type){
|
||||||
String methodDescribe = getMethodDescribe("askDeviceFileOrDir");
|
String methodDescribe = getMethodDescribe("askDeviceFileOrDir");
|
||||||
List<MakeUpVo> list = deviceFtpService.askDeviceFileOrDir(nDid,name,type);
|
List<MakeUpVo> list = deviceFtpService.askDeviceFileOrDir(nDid,name,type);
|
||||||
if (CollectionUtil.isEmpty(list) && Objects.equals(type,"file")) {
|
|
||||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ERROR);
|
|
||||||
}
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -79,7 +73,7 @@ public class DeviceFtpController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "fileCheck", value = "文件校验码", required = true)
|
@ApiImplicitParam(name = "fileCheck", value = "文件校验码", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
|
public HttpResult<String> downloadFile(@RequestParam("nDid") String nDid, @RequestParam("name") String name, @RequestParam("size") Integer size, @RequestParam("fileCheck") String fileCheck){
|
||||||
String methodDescribe = getMethodDescribe("downloadFile");
|
redisUtil.saveByKeyWithExpire("fileDownUserId"+nDid+name,RequestUtil.getUserIndex(),600L);
|
||||||
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, "文件下载中,请稍等");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
|
||||||
import com.njcn.csdevice.enums.DeviceOperate;
|
import com.njcn.csdevice.enums.DeviceOperate;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.param.*;
|
import com.njcn.csdevice.pojo.param.*;
|
||||||
@@ -23,6 +22,9 @@ import com.njcn.csdevice.service.IMqttUserService;
|
|||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||||
import com.njcn.poi.excel.ExcelUtil;
|
import com.njcn.poi.excel.ExcelUtil;
|
||||||
import com.njcn.poi.util.PoiUtil;
|
import com.njcn.poi.util.PoiUtil;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.advice.DeviceLog;
|
import com.njcn.web.advice.DeviceLog;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.*;
|
import io.swagger.annotations.*;
|
||||||
@@ -30,6 +32,7 @@ import lombok.AllArgsConstructor;
|
|||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
@@ -37,7 +40,9 @@ import springfox.documentation.annotations.ApiIgnore;
|
|||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collection;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -57,19 +62,19 @@ import java.util.stream.Stream;
|
|||||||
public class EquipmentDeliveryController extends BaseController {
|
public class EquipmentDeliveryController extends BaseController {
|
||||||
|
|
||||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
|
||||||
private final IMqttUserService mqttUserService;
|
private final IMqttUserService mqttUserService;
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/addEquipmentDelivery")
|
@PostMapping("/addEquipmentDelivery")
|
||||||
@ApiOperation("新增出厂设备")
|
@ApiOperation("新增出厂设备")
|
||||||
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
@ApiImplicitParam(name = "csEquipmentDeliveryAddParm", value = "新增项目参数", required = true)
|
||||||
@DeviceLog(operateType = DeviceOperate.ADD)
|
@DeviceLog(operateType = DeviceOperate.ADD)
|
||||||
public HttpResult<Boolean> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
public HttpResult<CsEquipmentDeliveryPO> addEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm){
|
||||||
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
String methodDescribe = getMethodDescribe("addEquipmentDelivery");
|
||||||
Boolean flag = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.save(csEquipmentDeliveryAddParm);
|
||||||
if (flag){
|
if (Objects.nonNull(po)){
|
||||||
//查询mqtt用户名和密码是否存在
|
//查询mqtt用户名和密码是否存在
|
||||||
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||||
if (result){
|
if (result){
|
||||||
@@ -77,7 +82,7 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
mqttUserService.insertMqttUser(csEquipmentDeliveryAddParm.getNdid());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -99,6 +104,14 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
public HttpResult<Boolean> updateEquipmentDelivery(@RequestBody @Validated CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm ){
|
||||||
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
String methodDescribe = getMethodDescribe("updateEquipmentDelivery");
|
||||||
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
Boolean flag = csEquipmentDeliveryService.updateEquipmentDelivery(csEquipmentDeliveryAuditParm);
|
||||||
|
if (flag){
|
||||||
|
//查询mqtt用户名和密码是否存在
|
||||||
|
boolean result = mqttUserService.findMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
|
if (result){
|
||||||
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
|
mqttUserService.insertMqttUser(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
|
}
|
||||||
|
}
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -162,12 +175,6 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
public HttpResult<Page<CsEquipmentDeliveryVO>> list(@RequestBody CsEquipmentDeliveryQueryParm param){
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("list");
|
||||||
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||||
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
|
||||||
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
|
||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
|
||||||
csEquipmentDeliveryVO.setStatus(5);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, page, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -220,7 +227,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息");
|
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据)", "终端入网检测录入信息");
|
||||||
exportParams.setStyle(ExcelStyleUtil.class);
|
exportParams.setStyle(ExcelStyleUtil.class);
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, DeviceExcelTemplete.class, new ArrayList<DeviceExcelTemplete>());
|
||||||
ExcelUtil.selectList(workbook, 2, 2, Stream.of("直连设备","网关设备").collect(Collectors.toList()).toArray(new String[]{}));
|
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
||||||
|
if(!CollectionUtils.isEmpty(deviceType)){
|
||||||
|
List<String> collect = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||||
|
ExcelUtil.selectList(workbook, 2, 2, collect.toArray(new String[]{}));
|
||||||
|
List<String> collect2 = deviceType.get(0).getChildren().stream().map(SysDicTreePO::getChildren).flatMap(Collection::stream).map(SysDicTreePO::getName).collect(Collectors.toList());
|
||||||
|
ExcelUtil.selectList(workbook, 3, 3, collect2.toArray(new String[]{}));
|
||||||
|
}
|
||||||
ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{}));
|
ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{}));
|
||||||
String fileName = "设备模板.xlsx";
|
String fileName = "设备模板.xlsx";
|
||||||
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
ExportParams exportExcel = new ExportParams("设备模板", "设备模板");
|
||||||
@@ -233,7 +246,18 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
@PostMapping(value = "importEquipment")
|
@PostMapping(value = "importEquipment")
|
||||||
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
public HttpResult<String> importEquipment(@ApiParam(value = "文件", required = true) @RequestPart("file") MultipartFile file, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("importEquipment");
|
String methodDescribe = getMethodDescribe("importEquipment");
|
||||||
csEquipmentDeliveryService.importEquipment(file, response);
|
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.importEquipment(file, response);
|
||||||
|
if (!CollectionUtils.isEmpty(csEquipmentDeliveryPOS)){
|
||||||
|
csEquipmentDeliveryPOS.forEach(temp->{
|
||||||
|
//查询mqtt用户名和密码是否存在
|
||||||
|
boolean result = mqttUserService.findMqttUser(temp.getNdid());
|
||||||
|
if (result){
|
||||||
|
//初始化装置mqtt连接信息(使用sha256加密)
|
||||||
|
mqttUserService.insertMqttUser(temp.getNdid());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
@@ -315,4 +339,13 @@ public class EquipmentDeliveryController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getDevByLineId")
|
||||||
|
@ApiOperation("根据监测点id查询装置信息")
|
||||||
|
public HttpResult<CsEquipmentDeliveryPO> getDevByLineId(@RequestParam("lineId") String lineId){
|
||||||
|
String methodDescribe = getMethodDescribe("getDevByLineId");
|
||||||
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.getDevByLineId(lineId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.common.utils.HttpResultUtil;
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||||
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||||
@@ -39,6 +40,7 @@ import java.util.List;
|
|||||||
public class CsLedgerController extends BaseController {
|
public class CsLedgerController extends BaseController {
|
||||||
|
|
||||||
private final ICsLedgerService csLedgerService;
|
private final ICsLedgerService csLedgerService;
|
||||||
|
private final CsLedgerMapper csLedgerMapper;
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/tree")
|
@PostMapping("/tree")
|
||||||
@@ -145,5 +147,14 @@ public class CsLedgerController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, details, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getAllLedger")
|
||||||
|
@ApiOperation("获取台账树所有数据")
|
||||||
|
public HttpResult<List<CsLedgerVO>> getAllLedger(){
|
||||||
|
String methodDescribe = getMethodDescribe("getAllLedger");
|
||||||
|
List<CsLedgerVO> allList = csLedgerMapper.getAll();
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, allList, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -139,7 +139,6 @@ public class CslineController extends BaseController {
|
|||||||
@PostMapping("/getById")
|
@PostMapping("/getById")
|
||||||
@ApiOperation("根据监测点id获取监测点详情")
|
@ApiOperation("根据监测点id获取监测点详情")
|
||||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
||||||
@ApiIgnore
|
|
||||||
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
|
public HttpResult<CsLinePO> getById(@RequestParam String lineId) {
|
||||||
String methodDescribe = getMethodDescribe("getById");
|
String methodDescribe = getMethodDescribe("getById");
|
||||||
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -158,4 +157,14 @@ public class CslineController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getLinesByDevList")
|
||||||
|
@ApiOperation("根据装置id集合获取监测点id集合")
|
||||||
|
@ApiImplicitParam(name = "ids", value = "装置id集合", required = true)
|
||||||
|
public HttpResult<List<CsLinePO>> getLinesByDevList(@RequestParam("ids") List<String> ids) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLinesByDevList");
|
||||||
|
List<CsLinePO> list = csLinePOService.getLinesByDevList(ids);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,4 +80,14 @@ public class AppProjectController extends BaseController {
|
|||||||
Boolean flag = appProjectService.AuditAppProject(appProjectAuditParm);
|
Boolean flag = appProjectService.AuditAppProject(appProjectAuditParm);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/updateProject")
|
||||||
|
@ApiOperation("web修改项目信息")
|
||||||
|
public HttpResult<Boolean> updateProject(@RequestBody @Validated AppProjectAuditParm appProjectAuditParm){
|
||||||
|
String methodDescribe = getMethodDescribe("updateProject");
|
||||||
|
Boolean flag = appProjectService.updateProject(appProjectAuditParm);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,20 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改测试项日志
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/updateRecordData")
|
||||||
|
@ApiOperation("修改测试项日志")
|
||||||
|
@ApiImplicitParam(name = "record", value = "测试项日志信息", required = true)
|
||||||
|
public HttpResult<Boolean> updateRecordData(@RequestBody @Validated WlRecordParam.UpdateRecord record) {
|
||||||
|
String methodDescribe = getMethodDescribe("updateRecordData");
|
||||||
|
LogUtil.njcnDebug(log, "{},修改的测试项日志信息:{}", methodDescribe, record);
|
||||||
|
wlRecordService.updateRecordData(record);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改方案
|
* 新增或修改方案
|
||||||
*/
|
*/
|
||||||
@@ -168,6 +182,20 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除装置测试项
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.UPDATE)
|
||||||
|
@PostMapping("/deleteItem")
|
||||||
|
@ApiOperation("删除装置测试项")
|
||||||
|
@ApiImplicitParam(name = "id", value = "装置测试项Id", required = true)
|
||||||
|
public HttpResult<Boolean> deleteItem(@RequestParam @Validated String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("deleteItem");
|
||||||
|
LogUtil.njcnDebug(log, "{},装置测试项Id为:{}", methodDescribe, id);
|
||||||
|
wlRecordService.deleteItem(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询测试项时间段实时数据
|
* 查询测试项时间段实时数据
|
||||||
*/
|
*/
|
||||||
@@ -195,6 +223,19 @@ public class WlRecordController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点id查询装置基础数据
|
||||||
|
*/
|
||||||
|
@OperateInfo(info = LogEnum.SYSTEM_COMMON, operateType = OperateType.QUERY)
|
||||||
|
@PostMapping("/findDevBaseDataByLineId")
|
||||||
|
@ApiOperation("根据监测点id查询装置基础数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "查询条件", required = true)
|
||||||
|
public HttpResult<List<RecordVo>> findDevBaseDataByLineId(@RequestBody @Validated WlRecordParam.lineRecord param) {
|
||||||
|
String methodDescribe = getMethodDescribe("findDevBaseDataByLineId");
|
||||||
|
LogUtil.njcnDebug(log, "{},查询对象为:{}", methodDescribe, param);
|
||||||
|
List<RecordVo> record = wlRecordService.findDevBaseDataByLineId(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, record, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -207,5 +248,17 @@ public class WlRecordController extends BaseController {
|
|||||||
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
String methodDescribe = getMethodDescribe("dayDealNoEndTimeEvent");
|
||||||
wlRecordService.dayDealNoEndTimeEvent(date);
|
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,62 @@
|
|||||||
|
package com.njcn.csdevice.job;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||||
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
@EnableScheduling
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
@Slf4j
|
||||||
|
public class DayDataJob {
|
||||||
|
|
||||||
|
private final IRStatIntegrityDService statIntegrityDService;
|
||||||
|
private final IRStatOnlineRateDService statOnlineRateDService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天1点计算治理设备的完整性
|
||||||
|
*
|
||||||
|
* @date 2025/7/1
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 0 1 * * ?")
|
||||||
|
public void lineIntegrityJob() {
|
||||||
|
StatisticsDataParam param = new StatisticsDataParam();
|
||||||
|
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||||
|
LocalDateTime start = yesterday.atStartOfDay();
|
||||||
|
LocalDateTime end = yesterday.atTime(23, 59, 59);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
|
||||||
|
param.setStartTime(start.format(formatter));
|
||||||
|
param.setEndTime(end.format(formatter));
|
||||||
|
statIntegrityDService.addData(param);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 每天2点计算治理设备的在线率
|
||||||
|
*
|
||||||
|
* @date 2025/7/1
|
||||||
|
*/
|
||||||
|
@Scheduled(cron = "0 30 1 * * ?")
|
||||||
|
public void devOnlineRateJob() {
|
||||||
|
StatisticsDataParam param = new StatisticsDataParam();
|
||||||
|
LocalDate yesterday = LocalDate.now().minusDays(1);
|
||||||
|
LocalDateTime start = yesterday.atStartOfDay();
|
||||||
|
LocalDateTime end = yesterday.atTime(23, 59, 59);
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern(DatePattern.NORM_DATE_PATTERN);
|
||||||
|
param.setStartTime(start.format(formatter));
|
||||||
|
param.setEndTime(end.format(formatter));
|
||||||
|
statOnlineRateDService.addData(param);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.mapper;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||||
@@ -25,5 +26,10 @@ public interface CsEquipmentDeliveryMapper extends BaseMapper<CsEquipmentDeliver
|
|||||||
|
|
||||||
Page<CsEquipmentDeliveryVO> page(Page<CsEquipmentDeliveryPO> returnpage, @Param("ew") QueryWrapper<CsEquipmentDeliveryPO> queryWrapper);
|
Page<CsEquipmentDeliveryVO> page(Page<CsEquipmentDeliveryPO> returnpage, @Param("ew") QueryWrapper<CsEquipmentDeliveryPO> queryWrapper);
|
||||||
|
|
||||||
|
//获取符合条件的设备列表
|
||||||
|
List<CsEquipmentDeliveryVO> getList(@Param("queryParam") CsEquipmentDeliveryQueryParm queryParam);
|
||||||
|
|
||||||
|
//获取符合条件的设备数量
|
||||||
|
int getCounts(@Param("queryParam") CsEquipmentDeliveryQueryParm queryParam);
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 数据完整性日表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RStatIntegrityDMapper extends MppBaseMapper<RStatIntegrityD> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.njcn.csdevice.mapper;
|
||||||
|
|
||||||
|
import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 在线率日表 Mapper 接口
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Mapper
|
||||||
|
public interface RStatOnlineRateDMapper extends MppBaseMapper<RStatOnlineRateD> {
|
||||||
|
|
||||||
|
}
|
||||||
@@ -48,4 +48,6 @@ public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
|||||||
List<CsLedgerVO> getAll();
|
List<CsLedgerVO> getAll();
|
||||||
|
|
||||||
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
||||||
|
|
||||||
|
List<WlRecord> getWlAssByWlId(@Param("wlId") String wlId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -106,6 +106,7 @@
|
|||||||
and t1.did = #{param.did}
|
and t1.did = #{param.did}
|
||||||
and t3.cl_dev = #{param.cldId}
|
and t3.cl_dev = #{param.cldId}
|
||||||
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
and (t3.data_type = 'Stat' or t3.data_type is NULL)
|
||||||
|
and t3.idx = #{param.idx}
|
||||||
and t4.stat_method = #{param.statMethod}
|
and t4.stat_method = #{param.statMethod}
|
||||||
order by t4.sort
|
order by t4.sort
|
||||||
</select>
|
</select>
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
where
|
where
|
||||||
pid = #{modelId}
|
pid = #{modelId}
|
||||||
and cl_dev = #{clDev}
|
and cl_dev = #{clDev}
|
||||||
and data_type in ('Stat',NULL)
|
and (data_type = 'Stat' or data_type IS NULL)
|
||||||
order by type,cl_dev
|
order by type,cl_dev
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
@@ -19,28 +19,28 @@
|
|||||||
<!--@mbg.generated-->
|
<!--@mbg.generated-->
|
||||||
id, dev_type, version_no, version_date, file_path, create_by, create_time, update_by,
|
id, dev_type, version_no, version_date, file_path, create_by, create_time, update_by,
|
||||||
update_time, `status`
|
update_time, `status`
|
||||||
</sql><select id="getPage" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
</sql>
|
||||||
SELECT a.*
|
<select id="getPage" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||||
FROM cs_dev_model a
|
SELECT a.*
|
||||||
WHERE
|
FROM cs_dev_model a
|
||||||
1 = 1 And a.`status`='1'
|
WHERE
|
||||||
<if test="csDevModelQueryParm.versionStartDate != null and csDevModelQueryParm.versionStartDate != ''">
|
1 = 1 And a.`status`='1'
|
||||||
AND a.version_date >= #{csDevModelQueryParm.versionStartDate }
|
<if test="csDevModelQueryParm.versionStartDate != null and csDevModelQueryParm.versionStartDate != ''">
|
||||||
</if>
|
AND a.version_date >= #{csDevModelQueryParm.versionStartDate }
|
||||||
<if test="csDevModelQueryParm.versionEndDate != null and csDevModelQueryParm.versionEndDate != ''">
|
</if>
|
||||||
AND a.version_date <= #{csDevModelQueryParm.versionEndDate }
|
<if test="csDevModelQueryParm.versionEndDate != null and csDevModelQueryParm.versionEndDate != ''">
|
||||||
</if>
|
AND a.version_date <= #{csDevModelQueryParm.versionEndDate }
|
||||||
|
</if>
|
||||||
|
|
||||||
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
<if test="csDevModelQueryParm.devName != null and csDevModelQueryParm.devName != ''">
|
||||||
AND a.dev_type_name LIKE concat('%',#{csDevModelQueryParm.devName},'%')
|
AND a.dev_type_name = #{csDevModelQueryParm.devName}
|
||||||
</if>
|
</if>
|
||||||
<!-- <if test="csDevModelQueryParm.devType != null and csDevModelQueryParm.devType != ''">-->
|
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
||||||
<!-- AND a.dev_type = #{csDevModelQueryParm.devType}-->
|
AND a.name LIKE concat('%',#{csDevModelQueryParm.name},'%')
|
||||||
<!-- </if>-->
|
</if>
|
||||||
<if test="csDevModelQueryParm.name != null and csDevModelQueryParm.name != ''">
|
order by a.version_date desc
|
||||||
AND a.name = #{csDevModelQueryParm.name}
|
</select>
|
||||||
</if>
|
<select id="queryOne" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
||||||
</select><select id="queryOne" resultType="com.njcn.csdevice.pojo.vo.CsDevModelPageVO">
|
|
||||||
SELECT a.*
|
SELECT a.*
|
||||||
FROM cs_dev_model a
|
FROM cs_dev_model a
|
||||||
WHERE
|
WHERE
|
||||||
|
|||||||
@@ -87,5 +87,41 @@
|
|||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getList" resultType="CsEquipmentDeliveryVO">
|
||||||
|
select
|
||||||
|
*
|
||||||
|
from
|
||||||
|
cs_equipment_delivery
|
||||||
|
<where>
|
||||||
|
1=1
|
||||||
|
<if test="queryParam.process != null and queryParam.process !=''">
|
||||||
|
and process = #{queryParam.process}
|
||||||
|
</if>
|
||||||
|
<if test="queryParam.runStatus != null and queryParam.runStatus !=''">
|
||||||
|
and run_status = #{queryParam.runStatus}
|
||||||
|
</if>
|
||||||
|
<if test="queryParam.searchValue != null and queryParam.searchValue !=''">
|
||||||
|
and (name like concat('%',#{queryParam.searchValue},'%') or ndid like concat('%',#{queryParam.searchValue},'%'))
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getCounts" resultType="int">
|
||||||
|
select
|
||||||
|
count(1)
|
||||||
|
from
|
||||||
|
cs_equipment_delivery
|
||||||
|
<where>
|
||||||
|
1=1
|
||||||
|
<if test="queryParam.process != null and queryParam.process !=''">
|
||||||
|
and process = #{queryParam.process}
|
||||||
|
</if>
|
||||||
|
<if test="queryParam.runStatus != null and queryParam.runStatus !=''">
|
||||||
|
and run_status = #{queryParam.runStatus}
|
||||||
|
</if>
|
||||||
|
<if test="queryParam.searchValue != null and queryParam.searchValue !=''">
|
||||||
|
and (name like concat('%',#{queryParam.searchValue},'%') or ndid like concat('%',#{queryParam.searchValue},'%'))
|
||||||
|
</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -64,7 +64,7 @@
|
|||||||
</if>
|
</if>
|
||||||
exists
|
exists
|
||||||
(select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and wd.data_id = a.id)
|
(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
|
order by a.start_time desc
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
||||||
@@ -93,4 +93,55 @@
|
|||||||
)
|
)
|
||||||
order by start_time
|
order by start_time
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getWlAssByWlId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.start_time,
|
||||||
|
a.end_time,
|
||||||
|
a.line_id,
|
||||||
|
a.type,
|
||||||
|
c.data_level AS dataLevel,
|
||||||
|
b.ct_ratio AS ct,
|
||||||
|
b.pt_ratio AS pt,
|
||||||
|
NULL AS itemName,
|
||||||
|
NULL AS voltageLevel,
|
||||||
|
NULL AS capacitySscb,
|
||||||
|
NULL AS capacitySscmin,
|
||||||
|
NULL AS capacitySt,
|
||||||
|
NULL AS capacitySi
|
||||||
|
FROM
|
||||||
|
wl_record a
|
||||||
|
INNER JOIN cs_line b ON a.line_id = b.line_id
|
||||||
|
INNER JOIN cs_data_set c ON b.data_set_id = c.id
|
||||||
|
WHERE
|
||||||
|
a.type = 1
|
||||||
|
AND a.id IN (
|
||||||
|
SELECT
|
||||||
|
data_id
|
||||||
|
FROM
|
||||||
|
wl_record_test_data
|
||||||
|
WHERE
|
||||||
|
test_item_id = #{wlId} )
|
||||||
|
UNION
|
||||||
|
SELECT
|
||||||
|
a.id,
|
||||||
|
a.start_time,
|
||||||
|
a.end_time,
|
||||||
|
a.line_id,
|
||||||
|
a.type,
|
||||||
|
NULL AS dataLevel,
|
||||||
|
(a.ct / a.ct1) AS ct,
|
||||||
|
(a.pt / a.pt1) AS pt,
|
||||||
|
a.item_name,
|
||||||
|
a.voltage_level,
|
||||||
|
a.capacity_sscb,
|
||||||
|
a.capacity_sscmin,
|
||||||
|
a.capacity_st,
|
||||||
|
a.capacity_si
|
||||||
|
FROM
|
||||||
|
wl_record a
|
||||||
|
WHERE
|
||||||
|
a.id = #{wlId}
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -37,6 +37,9 @@ public interface AppProjectService extends IService<AppProjectPO> {
|
|||||||
* @Date: 2023/3/27
|
* @Date: 2023/3/27
|
||||||
*/
|
*/
|
||||||
Boolean AuditAppProject(AppProjectAuditParm appProjectAuditParm);
|
Boolean AuditAppProject(AppProjectAuditParm appProjectAuditParm);
|
||||||
|
|
||||||
|
Boolean updateProject(AppProjectAuditParm appProjectAuditParm);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @Description: queryProject
|
* @Description: queryProject
|
||||||
* @Param: [appProjectQueryParm]
|
* @Param: [appProjectQueryParm]
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
* @Author: clam
|
* @Author: clam
|
||||||
* @Date: 2023/3/31
|
* @Date: 2023/3/31
|
||||||
*/
|
*/
|
||||||
Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm);
|
||||||
/**
|
/**
|
||||||
* @Description: AuditEquipmentDelivery
|
* @Description: AuditEquipmentDelivery
|
||||||
* @Param: [id]
|
* @Param: [id]
|
||||||
@@ -99,7 +99,7 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
*/
|
*/
|
||||||
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
CsEquipmentDeliveryPO findDevByNDid(String nDid);
|
||||||
|
|
||||||
void importEquipment(MultipartFile file, HttpServletResponse response);
|
List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response);
|
||||||
|
|
||||||
void delete(String devId);
|
void delete(String devId);
|
||||||
|
|
||||||
@@ -133,4 +133,6 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
|||||||
* 判断设备型号
|
* 判断设备型号
|
||||||
*/
|
*/
|
||||||
boolean judgeDevModel(String nDid);
|
boolean judgeDevModel(String nDid);
|
||||||
|
|
||||||
|
CsEquipmentDeliveryPO getDevByLineId(String lineId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,4 +45,6 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
|||||||
* @param csLineParam
|
* @param csLineParam
|
||||||
*/
|
*/
|
||||||
void updateIds(CsLineParam csLineParam);
|
void updateIds(CsLineParam csLineParam);
|
||||||
|
|
||||||
|
List<CsLinePO> getLinesByDevList(List<String> list);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/3/6 10:22
|
||||||
|
*/
|
||||||
|
public interface ICsCommunicateService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 取出最新装置数据
|
||||||
|
* @param lineParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取时间范围数据
|
||||||
|
* @param lineParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
*是否有当天最后一条数据
|
||||||
|
* @param lineParam
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<PqsCommunicateDto> getRawDataEnd(LineCountEvaluateParam lineParam);
|
||||||
|
|
||||||
|
void insertion(PqsCommunicateDto pqsCommunicateDto);
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 数据完整性日表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
public interface IRStatIntegrityDService extends IService<RStatIntegrityD> {
|
||||||
|
|
||||||
|
void addData(StatisticsDataParam param);
|
||||||
|
|
||||||
|
List<RStatIntegrityD> getData(List<String> list, String startTime, String endTime);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
package com.njcn.csdevice.service;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 在线率日表 服务类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
public interface IRStatOnlineRateDService extends IService<RStatOnlineRateD> {
|
||||||
|
|
||||||
|
void addData(StatisticsDataParam param);
|
||||||
|
|
||||||
|
List<RStatOnlineRateD> getData(List<String> list, String startTime, String endTime);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -63,6 +63,8 @@ public interface IWlRecordService extends IService<WlRecord> {
|
|||||||
*/
|
*/
|
||||||
void updateTestRecord(WlRecordParam.UpdateRecord record);
|
void updateTestRecord(WlRecordParam.UpdateRecord record);
|
||||||
|
|
||||||
|
void updateRecordData(WlRecordParam.UpdateRecord record);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 新增或修改方案
|
* 新增或修改方案
|
||||||
* @param record
|
* @param record
|
||||||
@@ -102,10 +104,14 @@ public interface IWlRecordService extends IService<WlRecord> {
|
|||||||
*/
|
*/
|
||||||
WlRecord findDevBaseData(WlRecordParam.Record param);
|
WlRecord findDevBaseData(WlRecordParam.Record param);
|
||||||
|
|
||||||
|
List<RecordVo> findDevBaseDataByLineId(WlRecordParam.lineRecord param);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 每日处理没有结束时间的测试基础数据
|
* 每日处理没有结束时间的测试基础数据
|
||||||
*/
|
*/
|
||||||
void dayDealNoEndTimeEvent(String date);
|
void dayDealNoEndTimeEvent(String date);
|
||||||
|
|
||||||
|
List<WlRecord> getWlAssByWlId(String wlId);
|
||||||
|
|
||||||
|
void deleteItem(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -132,7 +132,7 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
|||||||
// eq ("user_id", userId).
|
// eq ("user_id", userId).
|
||||||
eq ("name", name);
|
eq ("name", name);
|
||||||
Integer integer = csLedgerMapper.selectCount (queryWrapper);
|
Integer integer = csLedgerMapper.selectCount (queryWrapper);
|
||||||
return integer > 0 ? true : false;
|
return integer > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -249,7 +249,25 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
|||||||
csLedger2.setName(appProjectAuditParm.getName());
|
csLedger2.setName(appProjectAuditParm.getName());
|
||||||
}
|
}
|
||||||
csLedgerMapper.updateById(csLedger2);
|
csLedgerMapper.updateById(csLedger2);
|
||||||
return i == 1 ? true : false;
|
return i == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional(rollbackFor = BusinessException.class)
|
||||||
|
public Boolean updateProject(AppProjectAuditParm appProjectAuditParm) {
|
||||||
|
//修改项目表
|
||||||
|
this.lambdaUpdate().set(AppProjectPO::getName,appProjectAuditParm.getName())
|
||||||
|
.set(AppProjectPO::getArea,appProjectAuditParm.getArea())
|
||||||
|
.set(AppProjectPO::getDescription,appProjectAuditParm.getDescription())
|
||||||
|
.eq(AppProjectPO::getId,appProjectAuditParm.getId())
|
||||||
|
.eq(AppProjectPO::getStatus,"1")
|
||||||
|
.update();
|
||||||
|
//修改台账表
|
||||||
|
CsLedger csLedger = new CsLedger();
|
||||||
|
csLedger.setId(appProjectAuditParm.getId());
|
||||||
|
csLedger.setName(appProjectAuditParm.getName());
|
||||||
|
csLedgerMapper.updateById(csLedger);
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -9,7 +9,6 @@ import com.njcn.csdevice.service.ICsDataSetService;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.Comparator;
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -40,7 +39,7 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
|||||||
.in(CsDataSet::getType, Arrays.asList(0,2))
|
.in(CsDataSet::getType, Arrays.asList(0,2))
|
||||||
.eq(CsDataSet::getStoreFlag,1)
|
.eq(CsDataSet::getStoreFlag,1)
|
||||||
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
.and(i->i.eq(CsDataSet::getDataType,"Stat").or().isNull(CsDataSet::getDataType))
|
||||||
.orderByAsc(CsDataSet::getType,CsDataSet::getClDev)
|
.orderByAsc(CsDataSet::getIdx)
|
||||||
.list();
|
.list();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,11 +76,11 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
|||||||
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType));
|
.and(i->i.eq(CsDataSet::getDataType,"Rt").or().isNull(CsDataSet::getDataType));
|
||||||
//谐波电压含有率
|
//谐波电压含有率
|
||||||
if (target == 0) {
|
if (target == 0) {
|
||||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$01");
|
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmV$0".concat(clDev.toString()));
|
||||||
} else if (target == 1) {
|
} else if (target == 1) {
|
||||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$01");
|
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$HarmI$0".concat(clDev.toString()));
|
||||||
} else if (target == 2) {
|
} else if (target == 2) {
|
||||||
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$01");
|
wrapper.eq(CsDataSet::getName,"Ds$Pqd$Rt$InHarmV$0".concat(clDev.toString()));
|
||||||
}
|
}
|
||||||
return this.baseMapper.selectOne(wrapper);
|
return this.baseMapper.selectOne(wrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,37 +1,32 @@
|
|||||||
package com.njcn.csdevice.service.impl;
|
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.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
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.CsDevModelAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
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.po.CsDevModelPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||||
import com.njcn.csdevice.service.CsDevModelService;
|
import com.njcn.csdevice.service.CsDevModelService;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
import com.njcn.csdevice.service.ICsDataSetService;
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import java.sql.Date;
|
import java.sql.Date;
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -50,6 +45,7 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
private final ICsDataSetService csDataSetService;
|
private final ICsDataSetService csDataSetService;
|
||||||
private final ICsDataArrayService csDataArrayService;
|
private final ICsDataArrayService csDataArrayService;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
|
private final DictTreeFeignClient dictTreeFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDevModelCache() {
|
public void refreshDevModelCache() {
|
||||||
@@ -128,7 +124,14 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
@Override
|
@Override
|
||||||
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
|
public IPage<CsDevModelPageVO> queryPage(CsDevModelQueryParm csDevModelQueryParm) {
|
||||||
Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getPageNum ( ), csDevModelQueryParm.getPageSize ( ));
|
Page<CsDevModelPageVO> returnpage = new Page<> (csDevModelQueryParm.getPageNum ( ), csDevModelQueryParm.getPageSize ( ));
|
||||||
|
if (Objects.nonNull (csDevModelQueryParm.getDevType()) && StringUtils.isNotBlank(csDevModelQueryParm.getDevType())) {
|
||||||
|
SysDicTreePO po = dictTreeFeignClient.queryById(csDevModelQueryParm.getDevType()).getData();
|
||||||
|
if (Objects.isNull (po)) {
|
||||||
|
throw new BusinessException("装置型号字典缺失");
|
||||||
|
} else {
|
||||||
|
csDevModelQueryParm.setDevName(po.getName());
|
||||||
|
}
|
||||||
|
}
|
||||||
returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm);
|
returnpage = this.getBaseMapper ().getPage(returnpage,csDevModelQueryParm);
|
||||||
return returnpage;
|
return returnpage;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,10 @@ import cn.afterturn.easypoi.excel.entity.ExportParams;
|
|||||||
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.text.StrPool;
|
import cn.hutool.core.text.StrPool;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
import cn.hutool.core.util.StrUtil;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
import com.alibaba.nacos.client.naming.utils.CollectionUtils;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
@@ -18,7 +19,10 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.access.api.AskDeviceDataFeignClient;
|
import com.njcn.access.api.AskDeviceDataFeignClient;
|
||||||
|
import com.njcn.access.utils.MqttUtil;
|
||||||
|
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.csdevice.api.CsLogsFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||||
@@ -31,7 +35,7 @@ import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
|||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.csdevice.util.QRCodeUtil;
|
import com.njcn.csdevice.util.QRCodeUtil;
|
||||||
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
import com.njcn.csdevice.utils.ExcelStyleUtil;
|
||||||
import com.njcn.db.constant.DbConstant;
|
import com.njcn.csdevice.utils.StringUtil;
|
||||||
import com.njcn.oss.constant.OssPath;
|
import com.njcn.oss.constant.OssPath;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||||
@@ -39,9 +43,10 @@ import com.njcn.redis.utils.RedisUtil;
|
|||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.DictTreeFeignClient;
|
import com.njcn.system.api.DictTreeFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.enums.DicDataTypeEnum;
|
||||||
import com.njcn.system.enums.DicTreeEnum;
|
import com.njcn.system.enums.DicTreeEnum;
|
||||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||||
import com.njcn.web.factory.PageFactory;
|
import com.njcn.user.enums.AppRoleEnum;
|
||||||
import com.njcn.web.utils.RequestUtil;
|
import com.njcn.web.utils.RequestUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.apache.commons.lang.StringUtils;
|
import org.apache.commons.lang.StringUtils;
|
||||||
@@ -90,6 +95,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
private final AskDeviceDataFeignClient askDeviceDataFeignClient;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final CsSoftInfoMapper csSoftInfoMapper;
|
private final CsSoftInfoMapper csSoftInfoMapper;
|
||||||
|
private final IMqttUserService mqttUserService;
|
||||||
|
private final MqttUtil mqttUtil;
|
||||||
|
private final CsLogsFeignClient csLogsFeignClient;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void refreshDeviceDataCache() {
|
public void refreshDeviceDataCache() {
|
||||||
@@ -101,8 +109,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
public CsEquipmentDeliveryPO save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||||
boolean result;
|
boolean result;
|
||||||
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAddParm.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||||
|
if(Objects.nonNull (one)){
|
||||||
|
throw new BusinessException ("设备名称不能重复");
|
||||||
|
}
|
||||||
|
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAddParm.getNdid());
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (csEquipmentDeliveryAddParm.getNdid());
|
||||||
if(!Objects.isNull (po)){
|
if(!Objects.isNull (po)){
|
||||||
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
throw new BusinessException (AlgorithmResponseEnum.NDID_ERROR);
|
||||||
@@ -111,6 +124,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
BeanUtils.copyProperties (csEquipmentDeliveryAddParm,csEquipmentDeliveryPo);
|
||||||
csEquipmentDeliveryPo.setStatus (1);
|
csEquipmentDeliveryPo.setStatus (1);
|
||||||
csEquipmentDeliveryPo.setRunStatus(1);
|
csEquipmentDeliveryPo.setRunStatus(1);
|
||||||
|
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||||
String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
||||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||||
csEquipmentDeliveryPo.setProcess(4);
|
csEquipmentDeliveryPo.setProcess(4);
|
||||||
@@ -135,7 +149,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
}
|
}
|
||||||
return result;
|
return csEquipmentDeliveryPo;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -215,7 +229,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
public Boolean updateEquipmentDelivery(CsEquipmentDeliveryAuditParm csEquipmentDeliveryAuditParm) {
|
||||||
|
StringUtil.containsSpecialCharacters(csEquipmentDeliveryAuditParm.getNdid());
|
||||||
boolean result;
|
boolean result;
|
||||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,csEquipmentDeliveryAuditParm.getNdid())
|
||||||
@@ -226,11 +242,39 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
if (countByAccount >= 1) {
|
if (countByAccount >= 1) {
|
||||||
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
throw new BusinessException(AlgorithmResponseEnum.NDID_ERROR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper2 = new LambdaQueryWrapper<>();
|
||||||
|
lambdaQueryWrapper2.eq(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId());
|
||||||
|
CsEquipmentDeliveryPO po = this.baseMapper.selectOne(lambdaQueryWrapper2);
|
||||||
|
|
||||||
|
List<CsEquipmentDeliveryPO> list = this.lambdaQuery()
|
||||||
|
.ne(CsEquipmentDeliveryPO::getId, csEquipmentDeliveryAuditParm.getId())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getNdid, csEquipmentDeliveryAuditParm.getNdid())
|
||||||
|
.eq(CsEquipmentDeliveryPO::getName, csEquipmentDeliveryAuditParm.getName())
|
||||||
|
.ne(CsEquipmentDeliveryPO::getRunStatus, 0).list();
|
||||||
|
if(!CollectionUtils.isEmpty (list)){
|
||||||
|
throw new BusinessException ("设备名称不能重复");
|
||||||
|
}
|
||||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = new CsEquipmentDeliveryPO();
|
||||||
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
BeanUtils.copyProperties (csEquipmentDeliveryAuditParm, csEquipmentDeliveryPo);
|
||||||
result = this.updateById(csEquipmentDeliveryPo);
|
result = this.updateById(csEquipmentDeliveryPo);
|
||||||
|
//修改台账树中的设备名称
|
||||||
|
CsLedger csLedger = csLedgerService.findDataById(csEquipmentDeliveryAuditParm.getId());
|
||||||
|
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||||
|
BeanUtils.copyProperties (csLedger, csLedgerParam);
|
||||||
|
csLedgerParam.setName(csEquipmentDeliveryAuditParm.getName());
|
||||||
|
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||||
|
|
||||||
if (result) {
|
if (result) {
|
||||||
refreshDeviceDataCache();
|
refreshDeviceDataCache();
|
||||||
|
if (!Objects.equals(po.getUsageStatus(),csEquipmentDeliveryAuditParm.getUsageStatus())) {
|
||||||
|
DeviceLogDTO dto = new DeviceLogDTO();
|
||||||
|
dto.setUserName(RequestUtil.getUsername());
|
||||||
|
dto.setOperate("设备使用状态被修改");
|
||||||
|
dto.setResult(1);
|
||||||
|
dto.setLoginName(RequestUtil.getLoginName());
|
||||||
|
csLogsFeignClient.addUserLog(dto);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -248,52 +292,109 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
||||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
Page<CsEquipmentDeliveryVO> page = new Page<> ();
|
||||||
if (ObjectUtil.isNotNull(queryParam)) {
|
page.setCurrent(queryParam.getPageNum());
|
||||||
//查询参数不为空,进行条件填充
|
page.setSize(queryParam.getPageSize());
|
||||||
if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
queryParam.setPageNum((queryParam.getPageNum()-1)*queryParam.getPageSize());
|
||||||
//部门根据名称模糊查询
|
int total = this.baseMapper.getCounts(queryParam);
|
||||||
queryWrapper
|
if (total > 0) {
|
||||||
.and(param -> param.like("cs_equipment_delivery.name", queryParam.getSearchValue())
|
List<CsEquipmentDeliveryVO> recordList = this.baseMapper.getList(queryParam);
|
||||||
.or().like("cs_equipment_delivery.ndid", queryParam.getSearchValue())
|
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||||
.or().like("cs_equipment_delivery.mac", queryParam.getSearchValue()));
|
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : recordList){
|
||||||
|
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||||
|
csEquipmentDeliveryVO.setStatus(5);
|
||||||
|
} else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||||
|
csEquipmentDeliveryVO.setStatus(6);
|
||||||
|
}
|
||||||
|
//判断装置是否已经连接上mqtt服务器
|
||||||
|
String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||||
|
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
if (mqttClient) {
|
||||||
|
csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||||
|
} else {
|
||||||
|
csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//排序
|
if (ObjectUtil.isNotNull(queryParam.getConnectStatus())) {
|
||||||
if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
recordList = recordList.stream()
|
||||||
queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
.filter(item -> queryParam.getConnectStatus() == 0
|
||||||
} else {
|
? "未连接".equals(item.getConnectStatus())
|
||||||
//默认根据创建时间排序
|
: "已连接".equals(item.getConnectStatus()))
|
||||||
queryWrapper.orderBy(true, false, "create_time");
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
page.setTotal(CollectionUtil.isEmpty(recordList) ? 0 : recordList.size());
|
||||||
|
page.setRecords(recordList);
|
||||||
}
|
}
|
||||||
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())){
|
|
||||||
queryWrapper.eq("cs_equipment_delivery.dev_model", queryParam.getDevModel());
|
|
||||||
}
|
|
||||||
if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) && !Objects.isNull(queryParam.getDevAccessMethod())){
|
|
||||||
queryWrapper.eq("cs_equipment_delivery.dev_access_method", queryParam.getDevAccessMethod());
|
|
||||||
}
|
|
||||||
if (!Objects.isNull(queryParam.getStatus())){
|
|
||||||
queryWrapper.eq("cs_equipment_delivery.status", queryParam.getStatus());
|
|
||||||
} else {
|
|
||||||
queryWrapper.in("cs_equipment_delivery.status", Arrays.asList(1,2,3));
|
|
||||||
}
|
|
||||||
if (!Objects.isNull(queryParam.getRunStatus())){
|
|
||||||
queryWrapper.eq("cs_equipment_delivery.run_status", queryParam.getRunStatus());
|
|
||||||
} else {
|
|
||||||
queryWrapper.in("cs_equipment_delivery.run_status", Arrays.asList(1,2));
|
|
||||||
}
|
|
||||||
Page<CsEquipmentDeliveryVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
|
||||||
page.getRecords().forEach(item->{
|
|
||||||
if (!Objects.isNull(item.getQrPath())){
|
|
||||||
item.setQrPath(item.getQrPath());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return page;
|
return page;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// public Page<CsEquipmentDeliveryVO> list(CsEquipmentDeliveryQueryParm queryParam) {
|
||||||
|
// QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<CsEquipmentDeliveryPO>();
|
||||||
|
// if (ObjectUtil.isNotNull(queryParam)) {
|
||||||
|
// //查询参数不为空,进行条件填充
|
||||||
|
// if (StrUtil.isNotBlank(queryParam.getSearchValue())) {
|
||||||
|
// //部门根据名称模糊查询
|
||||||
|
// queryWrapper
|
||||||
|
// .and(param -> param.like("cs_equipment_delivery.name", queryParam.getSearchValue())
|
||||||
|
// .or().like("cs_equipment_delivery.ndid", queryParam.getSearchValue())
|
||||||
|
// .or().like("cs_equipment_delivery.mac", queryParam.getSearchValue()));
|
||||||
|
// }
|
||||||
|
// //排序
|
||||||
|
// if (ObjectUtil.isAllNotEmpty(queryParam.getSortBy(), queryParam.getOrderBy())) {
|
||||||
|
// queryWrapper.orderBy(true, queryParam.getOrderBy().equalsIgnoreCase(DbConstant.ASC), StrUtil.toUnderlineCase(queryParam.getSortBy()));
|
||||||
|
// } else {
|
||||||
|
// //默认根据创建时间排序
|
||||||
|
// queryWrapper.orderBy(true, false, "create_time");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// 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())){
|
||||||
|
// queryWrapper.eq("cs_equipment_delivery.dev_model", queryParam.getDevModel());
|
||||||
|
// }
|
||||||
|
// if (StrUtil.isNotBlank(queryParam.getDevAccessMethod()) && !Objects.isNull(queryParam.getDevAccessMethod())){
|
||||||
|
// queryWrapper.eq("cs_equipment_delivery.dev_access_method", queryParam.getDevAccessMethod());
|
||||||
|
// }
|
||||||
|
// if (!Objects.isNull(queryParam.getStatus())){
|
||||||
|
// queryWrapper.eq("cs_equipment_delivery.status", queryParam.getStatus());
|
||||||
|
// } else {
|
||||||
|
// queryWrapper.in("cs_equipment_delivery.status", Arrays.asList(1,2,3));
|
||||||
|
// }
|
||||||
|
// if (!Objects.isNull(queryParam.getRunStatus())){
|
||||||
|
// queryWrapper.eq("cs_equipment_delivery.run_status", queryParam.getRunStatus());
|
||||||
|
// } else {
|
||||||
|
// queryWrapper.in("cs_equipment_delivery.run_status", Arrays.asList(1,2));
|
||||||
|
// }
|
||||||
|
// if (!Objects.isNull(queryParam.getProcess())){
|
||||||
|
// queryWrapper.eq("cs_equipment_delivery.process", queryParam.getProcess());
|
||||||
|
// }
|
||||||
|
// Page<CsEquipmentDeliveryVO> page = this.baseMapper.page(new Page<>(PageFactory.getPageNum(queryParam), PageFactory.getPageSize(queryParam)), queryWrapper);
|
||||||
|
// page.getRecords().forEach(item->{
|
||||||
|
// if (!Objects.isNull(item.getQrPath())){
|
||||||
|
// item.setQrPath(item.getQrPath());
|
||||||
|
// }
|
||||||
|
// });
|
||||||
|
// //新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||||
|
// for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
||||||
|
// if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||||
|
// csEquipmentDeliveryVO.setStatus(5);
|
||||||
|
// } else if (DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 2) {
|
||||||
|
// csEquipmentDeliveryVO.setStatus(6);
|
||||||
|
// }
|
||||||
|
// //判断装置是否已经连接上mqtt服务器
|
||||||
|
// String clientName = "NJCN-" + csEquipmentDeliveryVO.getNdid().substring(csEquipmentDeliveryVO.getNdid().length() - 6);
|
||||||
|
// boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
||||||
|
// if (mqttClient) {
|
||||||
|
// csEquipmentDeliveryVO.setConnectStatus("已连接");
|
||||||
|
// } else {
|
||||||
|
// csEquipmentDeliveryVO.setConnectStatus("未连接");
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
// return page;
|
||||||
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
public DeviceManagerVO getDeviceData(String deviceId, String type, String lineId) {
|
||||||
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||||
@@ -328,17 +429,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
List<CsDataSet> dataSet = new ArrayList<>();
|
List<CsDataSet> dataSet = new ArrayList<>();
|
||||||
//治理监测点
|
//治理监测点
|
||||||
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
|
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
// select
|
|
||||||
// t1.id
|
|
||||||
// from
|
|
||||||
// cs_dev_model_relation t0
|
|
||||||
// left join cs_dev_model t1 on
|
|
||||||
// t0.model_id = t1.id
|
|
||||||
// where
|
|
||||||
// t0.status="1" and
|
|
||||||
// t0.dev_id = #{devId} and t1.`type` = #{type}
|
|
||||||
modelId = csDevModelRelationService.getModelByType(deviceId,0);
|
modelId = csDevModelRelationService.getModelByType(deviceId,0);
|
||||||
//select * from cs_data_set where pid = modelId and clDev = 0
|
|
||||||
dataSet = csDataSetService.findDataSetByModelId(modelId,0);
|
dataSet = csDataSetService.findDataSetByModelId(modelId,0);
|
||||||
}
|
}
|
||||||
//电网侧监测点
|
//电网侧监测点
|
||||||
@@ -369,43 +460,38 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
private void setDataSetValues(CsEquipmentDeliveryPO csEquipmentDeliveryPo, List<CsDataSet> dataSet, List<DeviceManagerVO.DataSetVO> dataSetList, String type, DeviceManagerVO deviceManagerVo) {
|
private void setDataSetValues(CsEquipmentDeliveryPO csEquipmentDeliveryPo, List<CsDataSet> dataSet, List<DeviceManagerVO.DataSetVO> dataSetList, String type, DeviceManagerVO deviceManagerVo) {
|
||||||
BeanUtils.copyProperties(csEquipmentDeliveryPo, deviceManagerVo);
|
BeanUtils.copyProperties(csEquipmentDeliveryPo, deviceManagerVo);
|
||||||
if (CollUtil.isNotEmpty(dataSet)) {
|
if (CollUtil.isNotEmpty(dataSet)) {
|
||||||
for (CsDataSet item : dataSet) {
|
if (Objects.equals(type, "rt")) {
|
||||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
for (CsDataSet item : dataSet) {
|
||||||
dataSetVO.setId(item.getId());
|
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||||
dataSetVO.setName("history".equals(type) ? "准实时数据":item.getAnotherName());
|
dataSetVO.setId(item.getId());
|
||||||
dataSetVO.setType("rt");
|
dataSetVO.setName(item.getAnotherName());
|
||||||
dataSetList.add(dataSetVO);
|
dataSetVO.setType("rt");
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
dataSetList.add(dataSetVO);
|
||||||
if (Objects.equals(type, "history")) {
|
|
||||||
//历史数据tab
|
|
||||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
|
||||||
dataSetVo2.setId(item.getId());
|
|
||||||
dataSetVo2.setName("历史统计数据");
|
|
||||||
dataSetVo2.setType("history");
|
|
||||||
dataSetList.add(dataSetVo2);
|
|
||||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
}
|
||||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
} else {
|
||||||
//趋势数据tab
|
CsDataSet item = dataSet.get(0);
|
||||||
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
boolean isPortableDevice = DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType());
|
||||||
dataSetVo3.setId(item.getId());
|
addDataSet(dataSetList, item, "最新数据", "rt");
|
||||||
dataSetVo3.setName("历史趋势");
|
addDataSet(dataSetList, item, "历史统计数据", "history");
|
||||||
dataSetVo3.setType("trenddata");
|
addDataSet(dataSetList, item, "历史趋势", "trenddata");
|
||||||
dataSetList.add(dataSetVo3);
|
if (item.getClDev() == 0 && item.getType() == 0) {
|
||||||
//实时数据tab
|
//限制角色展示
|
||||||
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
String role = RequestUtil.getUserRole();
|
||||||
dataSetVo4.setId(item.getId());
|
List<String> strings = JSONArray.parseArray(role, String.class);
|
||||||
dataSetVo4.setName("实时数据");
|
if (strings.contains(AppRoleEnum.ENGINEERING_USER.getCode())
|
||||||
dataSetVo4.setType("realtimedata");
|
|| strings.contains(AppRoleEnum.OPERATION_MANAGER.getCode())
|
||||||
dataSetList.add(dataSetVo4);
|
|| strings.contains(AppRoleEnum.ROOT.getCode())) {
|
||||||
//暂态事件tab
|
addDataSet(dataSetList, item, "模块数据", "moduleData");
|
||||||
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
|
|
||||||
dataSetVo5.setId(item.getId());
|
|
||||||
dataSetVo5.setName("暂态事件");
|
|
||||||
dataSetVo5.setType("event");
|
|
||||||
dataSetList.add(dataSetVo5);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (isPortableDevice) {
|
||||||
|
// 便携式设备特有的数据集
|
||||||
|
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||||
|
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||||
|
addDataSet(dataSetList, item, "测试项日志", "items");
|
||||||
|
}
|
||||||
|
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||||
}
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
List<CsLinePO> csLinePOS = csLinePOService.findByNdid(csEquipmentDeliveryPo.getNdid());
|
||||||
@@ -415,6 +501,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void addDataSet(List<DeviceManagerVO.DataSetVO> dataSetList, CsDataSet item, String name, String type) {
|
||||||
|
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||||
|
dataSetVO.setId(item.getId());
|
||||||
|
dataSetVO.setName(name);
|
||||||
|
dataSetVO.setType(type);
|
||||||
|
dataSetList.add(dataSetVO);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
public void updateSoftInfoBynDid(String nDid, String id, Integer module) {
|
||||||
boolean result;
|
boolean result;
|
||||||
@@ -433,13 +527,14 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void importEquipment(MultipartFile file, HttpServletResponse response) {
|
public List<CsEquipmentDeliveryPO> importEquipment(MultipartFile file, HttpServletResponse response) {
|
||||||
ImportParams params = new ImportParams ( );
|
ImportParams params = new ImportParams ( );
|
||||||
params.setHeadRows(1);
|
params.setHeadRows(1);
|
||||||
params.setTitleRows(1);
|
params.setTitleRows(1);
|
||||||
//第一个sheet为台账信息
|
//第一个sheet为台账信息
|
||||||
params.setStartSheetIndex(0);
|
params.setStartSheetIndex(0);
|
||||||
params.setSheetNum(1);
|
params.setSheetNum(1);
|
||||||
|
String regex = "^[A-Za-z0-9]{6,32}$";
|
||||||
try {
|
try {
|
||||||
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
|
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
|
||||||
//如果存在非法数据,将不合格的数据导出
|
//如果存在非法数据,将不合格的数据导出
|
||||||
@@ -448,6 +543,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
|
|
||||||
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
for (int i = 0; i < terminalBaseList.getList ( ).size ( ); i++) {
|
||||||
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
DeviceExcelTemplete deviceExcelTemplete = terminalBaseList.getList ( ).get (i);
|
||||||
|
|
||||||
|
if(!deviceExcelTemplete.getNdid().matches(regex)){
|
||||||
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
|
idlegalityDeviceException.setMsg("网络设备ID只可为数字或字母,长度至少为6位");
|
||||||
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
|
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (deviceExcelTemplete.getNdid ( ));
|
||||||
if(!Objects.isNull (po)){
|
if(!Objects.isNull (po)){
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
@@ -456,39 +560,47 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if(Objects.equals(deviceExcelTemplete.getDevType(),DicDataEnum.GATEWAY_DEV.getName())){
|
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, deviceExcelTemplete.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||||
DictTreeVO data = dictTreeFeignClient.queryByCode(DicDataEnum.GATEWAY_DEV.getCode()).getData();
|
if(Objects.nonNull (one)){
|
||||||
deviceExcelTemplete.setDevType(data.getId());
|
|
||||||
List<DictTreeVO> data1 = dictTreeFeignClient.query(data.getId()).getData();
|
|
||||||
Map<String, DictTreeVO> collect = data1.stream().collect(Collectors.toMap(DictTreeVO::getCode, dictTreeVO -> dictTreeVO));
|
|
||||||
if(collect.containsKey(deviceExcelTemplete.getDevModel())){
|
|
||||||
deviceExcelTemplete.setDevModel(collect.get(deviceExcelTemplete.getDevModel()).getId());
|
|
||||||
trueCollect.add(deviceExcelTemplete);
|
|
||||||
}else {
|
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
|
||||||
idlegalityDeviceException.setMsg("装置型号不正确");
|
|
||||||
falseCollect.add(idlegalityDeviceException);
|
|
||||||
}
|
|
||||||
} else if (Objects.equals(deviceExcelTemplete.getDevType(),DicDataEnum.CONNECT_DEV.getName())) {
|
|
||||||
DictTreeVO data = dictTreeFeignClient.queryByCode(DicDataEnum.CONNECT_DEV.getCode()).getData();
|
|
||||||
deviceExcelTemplete.setDevType(data.getId());
|
|
||||||
List<DictTreeVO> data1 = dictTreeFeignClient.query(data.getId()).getData();
|
|
||||||
Map<String, DictTreeVO> collect = data1.stream().collect(Collectors.toMap(DictTreeVO::getCode, dictTreeVO -> dictTreeVO));
|
|
||||||
if(collect.containsKey(deviceExcelTemplete.getDevModel())){
|
|
||||||
deviceExcelTemplete.setDevModel(collect.get(deviceExcelTemplete.getDevModel()).getId());
|
|
||||||
trueCollect.add(deviceExcelTemplete);
|
|
||||||
}else {
|
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
|
||||||
idlegalityDeviceException.setMsg("装置型号不正确");
|
|
||||||
falseCollect.add(idlegalityDeviceException);
|
|
||||||
}
|
|
||||||
}else {
|
|
||||||
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
idlegalityDeviceException.setMsg("装置类型不正确");
|
idlegalityDeviceException.setMsg("NDID重复");
|
||||||
falseCollect.add(idlegalityDeviceException);
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
List<SysDicTreePO> deviceType = dictTreeFeignClient.queryByCodeList(DicDataTypeEnum.DEVICE_TYPE.getCode()).getData();
|
||||||
|
//设备类型
|
||||||
|
List<SysDicTreePO> children = deviceType.get(0).getChildren();
|
||||||
|
Map<String, SysDicTreePO> map = children.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||||
|
|
||||||
|
List<SysDicTreePO> collect = children.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevType())).collect(Collectors.toList());
|
||||||
|
SysDicTreePO sysDicTreePO = map.get(deviceExcelTemplete.getDevType());
|
||||||
|
if(CollectionUtils.isEmpty(collect)){
|
||||||
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
|
idlegalityDeviceException.setMsg("设备类型不正确");
|
||||||
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
deviceExcelTemplete.setDevType(map.get(deviceExcelTemplete.getDevType()).getId());
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
//设备型号
|
||||||
|
List<SysDicTreePO> children1 = sysDicTreePO.getChildren();
|
||||||
|
Map<String, SysDicTreePO> map2 = children1.stream().collect(Collectors.toMap(SysDicTreePO::getName, dictTreeVO -> dictTreeVO));
|
||||||
|
|
||||||
|
List<SysDicTreePO> collect2 = children1.stream().filter(temp -> Objects.equals(temp.getName(), deviceExcelTemplete.getDevModel())).collect(Collectors.toList());
|
||||||
|
|
||||||
|
if(CollectionUtils.isEmpty(collect2)){
|
||||||
|
DeviceExcelTemplete.IllegalityDeviceExcelTemplete idlegalityDeviceException = new DeviceExcelTemplete.IllegalityDeviceExcelTemplete();
|
||||||
|
BeanUtils.copyProperties(deviceExcelTemplete,idlegalityDeviceException);
|
||||||
|
idlegalityDeviceException.setMsg("设备类型与设备型号不匹配");
|
||||||
|
falseCollect.add(idlegalityDeviceException);
|
||||||
|
continue;
|
||||||
|
}else {
|
||||||
|
deviceExcelTemplete.setDevModel(map2.get(deviceExcelTemplete.getDevModel()).getId());
|
||||||
|
trueCollect.add(deviceExcelTemplete);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -505,6 +617,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
csEquipmentDeliveryPO.setRunStatus(1);
|
csEquipmentDeliveryPO.setRunStatus(1);
|
||||||
csEquipmentDeliveryPO.setStatus(1);
|
csEquipmentDeliveryPO.setStatus(1);
|
||||||
csEquipmentDeliveryPO.setProcess(2);
|
csEquipmentDeliveryPO.setProcess(2);
|
||||||
|
csEquipmentDeliveryPO.setSort(100);
|
||||||
|
|
||||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||||
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
||||||
@@ -517,17 +630,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
}).collect (Collectors.toList ( ));
|
}).collect (Collectors.toList ( ));
|
||||||
csEquipmentProcessPOService.saveBatch(collect1,500);
|
csEquipmentProcessPOService.saveBatch(collect1,500);
|
||||||
this.saveOrUpdateBatch (collect, 500);
|
this.saveOrUpdateBatch (collect, 500);
|
||||||
|
|
||||||
|
return collect;
|
||||||
}
|
}
|
||||||
if (!CollectionUtils.isEmpty (falseCollect)) {
|
if (!CollectionUtils.isEmpty (falseCollect)) {
|
||||||
ExportParams exportExcel = new ExportParams ("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
ExportParams exportExcel = new ExportParams ("批量导入模板(请严格按照模板标准填入数据)", "非法设备信息");
|
||||||
Workbook workbook = ExcelExportUtil.exportExcel (exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
Workbook workbook = ExcelExportUtil.exportExcel (exportExcel, DeviceExcelTemplete.IllegalityDeviceExcelTemplete.class, falseCollect);
|
||||||
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
ExcelStyleUtil.exportFileByWorkbook (workbook, "非法设备信息.xlsx", response);
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace ( );
|
e.printStackTrace ( );
|
||||||
}
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* 物理删除设备相关数据
|
* 物理删除设备相关数据
|
||||||
@@ -678,6 +794,12 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsEquipmentDeliveryPO getDevByLineId(String lineId) {
|
||||||
|
CsLinePO linePO = csLinePOService.getById(lineId);
|
||||||
|
return this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId,linePO.getDeviceId()).ne(CsEquipmentDeliveryPO::getRunStatus,0).one();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据ndid生成二维码
|
* 根据ndid生成二维码
|
||||||
* @param ndid
|
* @param ndid
|
||||||
|
|||||||
@@ -323,6 +323,7 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
|
String unit;
|
||||||
ThdDataVO vo = new ThdDataVO();
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setLineId(temp.getLineId());
|
vo.setLineId(temp.getLineId());
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
@@ -332,38 +333,102 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
vo.setStatMethod(temp.getValueType());
|
vo.setStatMethod(temp.getValueType());
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
if(temp.getValue()!=null) {
|
if(temp.getValue()!=null) {
|
||||||
double re;
|
double re = 0;
|
||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
vo.setUnit(epdPqd.getUnit());
|
|
||||||
} else {
|
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
re = Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue() / 1000));
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(re);
|
||||||
vo.setUnit("k" + epdPqd.getUnit());
|
unit = "k" + epdPqd.getUnit();
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Objects.isNull(temp.getValue()) ? 3.14159 : Double.parseDouble(df.format(temp.getValue())));
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() * pt / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
} else {
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
vo.setUnit(epdPqd.getUnit());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
}
|
}
|
||||||
vo.setUnit(epdPqd.getUnit());
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(null);
|
vo.setStatisticalData(null);
|
||||||
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
} else {
|
||||||
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
vo.setStatisticalIndex(epdPqd.getId());
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
vo.setStatisticalName(epdPqd.getName());
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
vo.setAnotherName(epdPqd.getShowName());
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
import cn.hutool.core.util.IdUtil;
|
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.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
@@ -15,16 +16,15 @@ import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
|||||||
import com.njcn.csdevice.pojo.po.*;
|
import com.njcn.csdevice.pojo.po.*;
|
||||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.service.*;
|
import com.njcn.csdevice.service.*;
|
||||||
import com.njcn.oss.utils.FileStorageUtil;
|
|
||||||
import com.njcn.redis.utils.RedisUtil;
|
import com.njcn.redis.utils.RedisUtil;
|
||||||
import com.njcn.system.api.AreaFeignClient;
|
import com.njcn.system.api.AreaFeignClient;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
|
||||||
import com.njcn.system.pojo.po.Area;
|
import com.njcn.system.pojo.po.Area;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,15 +39,12 @@ import java.util.stream.Collectors;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> implements ICsLedgerService {
|
||||||
|
|
||||||
private final ICsEngineeringUserService csEngineeringUserService;
|
|
||||||
private final AreaFeignClient areaFeignClient;
|
private final AreaFeignClient areaFeignClient;
|
||||||
private final RedisUtil redisUtil;
|
private final RedisUtil redisUtil;
|
||||||
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
|
private final AppTopologyDiagramMapper appTopologyDiagramMapper;
|
||||||
private final AppProjectMapper appProjectMapper;
|
private final AppProjectMapper appProjectMapper;
|
||||||
private final CsEngineeringMapper csEngineeringMapper;
|
private final CsEngineeringMapper csEngineeringMapper;
|
||||||
private final CsLinePOService csLinePOService;
|
private final CsLinePOService csLinePOService;
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
|
||||||
private final FileStorageUtil fileStorageUtil;
|
|
||||||
private final RoleEngineerDevService roleEngineerDevService;
|
private final RoleEngineerDevService roleEngineerDevService;
|
||||||
private final CsDevModelRelationService csDevModelRelationService;
|
private final CsDevModelRelationService csDevModelRelationService;
|
||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
@@ -76,40 +73,83 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
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> 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(
|
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||||
temp->{
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
CsEquipmentDeliveryPO csEquipmentDeliveryPO = csEquipmentDeliveryMapper.selectById(temp.getId());
|
.map(CsLedgerVO::getId)
|
||||||
temp.setComFlag(csEquipmentDeliveryPO.getRunStatus());
|
.distinct()
|
||||||
temp.setType("device");
|
.collect(Collectors.toMap(
|
||||||
}
|
Function.identity(),
|
||||||
).
|
csEquipmentDeliveryMapper::selectById
|
||||||
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(item -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
|
item.setComFlag(po.getRunStatus());
|
||||||
|
item.setNDId(po.getNdid());
|
||||||
|
item.setType("device");
|
||||||
|
item.setProcess(po.getProcess());
|
||||||
|
})
|
||||||
|
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||||
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
List<CsLedgerVO> finalLineList = allList.stream()
|
List<CsLedgerVO> finalLineList = allList.stream()
|
||||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
.peek(item -> item.setType("line"))
|
.peek(
|
||||||
|
item -> {
|
||||||
|
item.setType("line");
|
||||||
|
String index = item.getId().substring(item.getId().length()-1);
|
||||||
|
if (Objects.equals(index,"0")) {
|
||||||
|
item.setLineType(0);
|
||||||
|
} else {
|
||||||
|
item.setLineType(1);
|
||||||
|
}
|
||||||
|
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CsLinePO::getLineId,item.getId()).eq(CsLinePO::getStatus,1);
|
||||||
|
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||||
|
item.setConType(po.getConType());
|
||||||
|
}
|
||||||
|
)
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
checkDevSetData(deviceList);
|
checkDevSetData(deviceList);
|
||||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||||
|
engineeringList = engineeringList.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
//获取便携式设备树
|
//获取便携式设备树
|
||||||
CsLedgerVO portable = new CsLedgerVO();
|
CsLedgerVO portable = new CsLedgerVO();
|
||||||
portable.setLevel(0);
|
portable.setLevel(0);
|
||||||
portable.setName(DataParam.portableDev);
|
portable.setName(DataParam.portableDev);
|
||||||
portable.setPid("0");
|
portable.setPid("0");
|
||||||
portable.setId(IdUtil.simpleUUID());
|
portable.setId(IdUtil.simpleUUID());
|
||||||
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
|
//针对未启用的装置判断
|
||||||
for(CsLedgerVO c : portables){
|
List<CsLedgerVO> ledger = allList.stream()
|
||||||
c.setPid(portable.getId());
|
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
.collect(Collectors.toList());
|
||||||
c.setComFlag(po.getRunStatus());
|
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||||
c.setNDId(po.getNdid());
|
.collect(Collectors.toMap(
|
||||||
c.setType("device");
|
CsLedgerVO::getId,
|
||||||
}
|
csEquipmentDeliveryMapper::selectById,
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
));
|
||||||
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
|
.peek(c -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
|
c.setPid(portable.getId());
|
||||||
|
c.setComFlag(po.getRunStatus());
|
||||||
|
c.setNDId(po.getNdid());
|
||||||
|
c.setType("device");
|
||||||
|
c.setName(po.getName());
|
||||||
|
c.setSort(po.getSort());
|
||||||
|
})
|
||||||
|
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||||
checkDevSetData(portables);
|
checkDevSetData(portables);
|
||||||
portable.setChildren(portables);
|
portable.setChildren(portables);
|
||||||
@@ -167,17 +207,29 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
List<String> device = roleEngineerDevService.getDevice();
|
List<String> device = roleEngineerDevService.getDevice();
|
||||||
engineeringList = allList.stream().filter(item->roleengineer.contains(item.getId())).collect(Collectors.toList());
|
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> 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(
|
Map<String, CsEquipmentDeliveryPO> poMap = allList.stream()
|
||||||
temp->{
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
.map(CsLedgerVO::getId)
|
||||||
temp.setComFlag(po.getRunStatus());
|
.distinct()
|
||||||
temp.setNDId(po.getNdid());
|
.collect(Collectors.toMap(
|
||||||
temp.setType("device");
|
Function.identity(),
|
||||||
}
|
csEquipmentDeliveryMapper::selectById
|
||||||
).
|
));
|
||||||
sorted(Comparator.comparing(CsLedgerVO::getSort))
|
|
||||||
|
List<CsLedgerVO> deviceList = allList.stream()
|
||||||
|
.filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0"))
|
||||||
|
.peek(item -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap.get(item.getId());
|
||||||
|
item.setComFlag(po.getRunStatus());
|
||||||
|
item.setNDId(po.getNdid());
|
||||||
|
item.setType("device");
|
||||||
|
item.setProcess(po.getProcess());
|
||||||
|
})
|
||||||
|
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||||
|
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
checkDevSetData(deviceList);
|
checkDevSetData(deviceList);
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||||
@@ -188,15 +240,31 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
portable.setName(DataParam.portableDev);
|
portable.setName(DataParam.portableDev);
|
||||||
portable.setPid("0");
|
portable.setPid("0");
|
||||||
portable.setId(IdUtil.simpleUUID());
|
portable.setId(IdUtil.simpleUUID());
|
||||||
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){
|
List<CsLedgerVO> ledger = allList.stream()
|
||||||
c.setPid(portable.getId());
|
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
.collect(Collectors.toList());
|
||||||
c.setComFlag(po.getRunStatus());
|
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||||
c.setNDId(po.getNdid());
|
.collect(Collectors.toMap(
|
||||||
c.setType("device");
|
CsLedgerVO::getId,
|
||||||
}
|
csEquipmentDeliveryMapper::selectById,
|
||||||
|
(existing, replacement) -> existing
|
||||||
|
));
|
||||||
|
List<CsLedgerVO> portables = ledger.stream()
|
||||||
|
.peek(c -> {
|
||||||
|
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
|
||||||
|
c.setPid(portable.getId());
|
||||||
|
c.setComFlag(po.getRunStatus());
|
||||||
|
c.setNDId(po.getNdid());
|
||||||
|
c.setType("device");
|
||||||
|
c.setName(po.getName());
|
||||||
|
c.setSort(po.getSort());
|
||||||
|
})
|
||||||
|
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
|
||||||
|
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||||
portable.setChildren(portables);
|
portable.setChildren(portables);
|
||||||
|
|
||||||
CsLedgerVO government = new CsLedgerVO();
|
CsLedgerVO government = new CsLedgerVO();
|
||||||
@@ -288,10 +356,13 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
engineeringList.forEach(eng -> {
|
engineeringList.forEach(eng -> {
|
||||||
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
CsEngineeringPO csEngineeringPO = csEngineeringMapper.selectById(eng.getId());
|
||||||
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
eng.setArea(this.getAreaById(csEngineeringPO.getProvince())+this.getAreaById(csEngineeringPO.getCity()));
|
||||||
|
eng.setProvinceId(csEngineeringPO.getProvince());
|
||||||
|
eng.setCityId(csEngineeringPO.getCity());
|
||||||
eng.setRemark(csEngineeringPO.getDescription());
|
eng.setRemark(csEngineeringPO.getDescription());
|
||||||
eng.setChildren(getChildren(eng, projectList));
|
eng.setChildren(getChildren(eng, projectList));
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
return engineeringList;
|
return engineeringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import lombok.RequiredArgsConstructor;
|
|||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
@@ -67,7 +68,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
.set(CsLinePO::getVolGrade,csLineParam.getVolGrade())
|
.set(CsLinePO::getVolGrade,csLineParam.getVolGrade())
|
||||||
.set(CsLinePO::getPtRatio,csLineParam.getPtRatio())
|
.set(CsLinePO::getPtRatio,csLineParam.getPtRatio())
|
||||||
.set(CsLinePO::getCtRatio,csLineParam.getCtRatio())
|
.set(CsLinePO::getCtRatio,csLineParam.getCtRatio())
|
||||||
.set(CsLinePO::getConType,csLineParam.getConType());
|
.set(CsLinePO::getConType,csLineParam.getConType())
|
||||||
|
.set(CsLinePO::getLineInterval,csLineParam.getLineInterval());
|
||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,6 +83,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
|||||||
this.update(lambdaUpdateWrapper);
|
this.update(lambdaUpdateWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsLinePO> getLinesByDevList(List<String> list) {
|
||||||
|
return this.lambdaQuery().in(CsLinePO::getDeviceId,list).eq(CsLinePO::getStatus,1).list();
|
||||||
|
}
|
||||||
|
|
||||||
// /**
|
// /**
|
||||||
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
// * 1.平台端默认配置拓扑图模板,包含拓扑图信息(cs_topology_diagram_template)和拓扑图上监测点的点位信息(cs_line_topology_template)
|
||||||
// *
|
// *
|
||||||
|
|||||||
@@ -45,7 +45,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
public MakeUpVo askDeviceRootPath(String nDid) {
|
public MakeUpVo askDeviceRootPath(String nDid) {
|
||||||
MakeUpVo makeUpVo = new MakeUpVo();
|
MakeUpVo makeUpVo = new MakeUpVo();
|
||||||
try {
|
try {
|
||||||
judgeClientOnline(nDid);
|
boolean mqttClient = judgeClientOnline(nDid);
|
||||||
|
if (!mqttClient){
|
||||||
|
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||||
|
}
|
||||||
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
redisUtil.delete(AppRedisKey.DEVICE_ROOT_PATH + nDid);
|
||||||
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
askDeviceDataFeignClient.askDeviceRootPath(nDid);
|
||||||
Thread.sleep(3000);
|
Thread.sleep(3000);
|
||||||
@@ -55,7 +58,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
makeUpVo.setType("dir");
|
makeUpVo.setType("dir");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ROOT_ERROR);
|
throw new BusinessException(e.getMessage());
|
||||||
}
|
}
|
||||||
return makeUpVo;
|
return makeUpVo;
|
||||||
}
|
}
|
||||||
@@ -64,7 +67,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
public List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type) {
|
public List<MakeUpVo> askDeviceFileOrDir(String nDid, String name, String type) {
|
||||||
List<MakeUpVo> result = new ArrayList<>();
|
List<MakeUpVo> result = new ArrayList<>();
|
||||||
try {
|
try {
|
||||||
judgeClientOnline(nDid);
|
boolean mqttClient = judgeClientOnline(nDid);
|
||||||
|
if (!mqttClient){
|
||||||
|
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||||
|
}
|
||||||
// 删除旧的缓存信息
|
// 删除旧的缓存信息
|
||||||
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
redisUtil.delete(AppRedisKey.PROJECT_INFO + nDid);
|
||||||
// 请求设备文件或目录信息
|
// 请求设备文件或目录信息
|
||||||
@@ -78,7 +84,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
// 捕获特定异常并抛出运行时异常
|
// 捕获特定异常并抛出运行时异常
|
||||||
throw new BusinessException(AlgorithmResponseEnum.ASK_DEVICE_DIR_ERROR);
|
throw new BusinessException(e.getMessage());
|
||||||
}
|
}
|
||||||
if (CollUtil.isNotEmpty(result)) {
|
if (CollUtil.isNotEmpty(result)) {
|
||||||
result.stream().sorted(Comparator.comparing(MakeUpVo::getType)).collect(Collectors.toList());
|
result.stream().sorted(Comparator.comparing(MakeUpVo::getType)).collect(Collectors.toList());
|
||||||
@@ -89,7 +95,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
@Override
|
@Override
|
||||||
@Async
|
@Async
|
||||||
public void downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
public void downloadFile(String nDid, String name, Integer size, String fileCheck) {
|
||||||
judgeClientOnline(nDid);
|
boolean mqttClient = judgeClientOnline(nDid);
|
||||||
|
if (!mqttClient) {
|
||||||
|
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
||||||
|
}
|
||||||
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
|
Object task = redisUtil.getObjectByKey("fileDowning:"+nDid);
|
||||||
if (Objects.nonNull(task)) {
|
if (Objects.nonNull(task)) {
|
||||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
||||||
@@ -104,7 +113,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
redisUtil.delete("fileDowning:"+nDid);
|
redisUtil.delete("fileDowning:"+nDid);
|
||||||
redisUtil.delete("fileCheck"+nDid+name);
|
redisUtil.delete("fileCheck"+nDid+name);
|
||||||
throw new BusinessException(AlgorithmResponseEnum.FILE_DOWNLOADING);
|
throw new BusinessException(e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +128,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
redisUtil.delete("fileCheck"+nDid+name);
|
redisUtil.delete("fileCheck"+nDid+name);
|
||||||
redisUtil.delete("fileDowning:"+nDid);
|
redisUtil.delete("fileDowning:"+nDid);
|
||||||
redisUtil.delete(AppRedisKey.FILE_PART.concat(name));
|
redisUtil.delete(AppRedisKey.FILE_PART.concat(name));
|
||||||
|
redisUtil.delete("fileDownUserId"+nDid+name);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -134,7 +144,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -151,7 +161,7 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
result = true;
|
result = true;
|
||||||
}
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e.getMessage());
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
@@ -198,13 +208,10 @@ public class DeviceFtpServiceImpl implements DeviceFtpService {
|
|||||||
return vo;
|
return vo;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void judgeClientOnline(String nDid) {
|
public boolean judgeClientOnline(String nDid) {
|
||||||
//判断客户端是否在线
|
//判断客户端是否在线
|
||||||
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
String clientName = "NJCN-" + nDid.substring(nDid.length() - 6);
|
||||||
boolean mqttClient = mqttUtil.judgeClientOnline(clientName);
|
return mqttUtil.judgeClientOnline(clientName);
|
||||||
if (!mqttClient){
|
|
||||||
throw new BusinessException(AccessResponseEnum.MISSING_CLIENT);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,145 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||||
|
import com.njcn.csdevice.service.ICsCommunicateService;
|
||||||
|
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||||
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
|
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||||
|
import com.njcn.influx.utils.InfluxDbUtils;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.influxdb.InfluxDB;
|
||||||
|
import org.influxdb.dto.BatchPoints;
|
||||||
|
import org.influxdb.dto.Point;
|
||||||
|
import org.springframework.beans.BeanUtils;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
|
import javax.annotation.Resource;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.concurrent.TimeUnit;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description:
|
||||||
|
* @Author: wr
|
||||||
|
* @Date: 2025/3/7 10:13
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Service("InfluxdbCsCommunicateServiceImpl")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||||
|
|
||||||
|
private final InfluxDbUtils influxDbUtils;
|
||||||
|
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||||
|
@Resource
|
||||||
|
private PqsCommunicateMapper pqsCommunicateMapper;
|
||||||
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawDataLatest(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.regular(PqsCommunicate::getDevId, lineParam.getLineId())
|
||||||
|
.select(PqsCommunicate::getTime)
|
||||||
|
.select(PqsCommunicate::getDevId)
|
||||||
|
.select(PqsCommunicate::getDescription)
|
||||||
|
.select(PqsCommunicate::getType)
|
||||||
|
.timeDesc()
|
||||||
|
.limit(1);
|
||||||
|
List<PqsCommunicate> list = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
list.forEach(item -> {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 获取时间段内的数据
|
||||||
|
* @Param:
|
||||||
|
* @return: java.util.List<com.njcn.dataProcess.dto.DataVDTO>
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2025/02/24
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawData(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
List<PqsCommunicate> list = getPqsCommunicateData(lineParam);
|
||||||
|
list.forEach(item -> {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<PqsCommunicateDto> getRawDataEnd(LineCountEvaluateParam lineParam) {
|
||||||
|
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.regular(PqsCommunicate::getDevId, lineParam.getLineId())
|
||||||
|
.select(PqsCommunicate::getTime)
|
||||||
|
.select(PqsCommunicate::getDevId)
|
||||||
|
.select(PqsCommunicate::getDescription)
|
||||||
|
.select(PqsCommunicate::getType)
|
||||||
|
.between(PqsCommunicate::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.timeDesc()
|
||||||
|
.limit(1);
|
||||||
|
List<PqsCommunicate> list = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
list.forEach(item -> {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
BeanUtils.copyProperties(item, dto);
|
||||||
|
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||||
|
result.add(dto);
|
||||||
|
});
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertion(PqsCommunicateDto pqsCommunicateDto) {
|
||||||
|
//根据NDID获取装置信息
|
||||||
|
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(pqsCommunicateDto.getDevId());
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.eq(PqsCommunicate::getDevId,po.getId()).timeDesc().limit(1);
|
||||||
|
List<PqsCommunicate> pqsCommunicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
//如果不存数据或者状态不一样则插入数据
|
||||||
|
if(CollectionUtils.isEmpty(pqsCommunicates) || !Objects.equals(pqsCommunicates.get(0).getType(),pqsCommunicateDto.getType())){
|
||||||
|
Map<String, String> tags = new HashMap<>();
|
||||||
|
tags.put("dev_id",po.getId());
|
||||||
|
Map<String,Object> fields = new HashMap<>();
|
||||||
|
fields.put("type",pqsCommunicateDto.getType());
|
||||||
|
fields.put("description",pqsCommunicateDto.getDescription());
|
||||||
|
long time = LocalDateTime.parse(pqsCommunicateDto.getTime(), DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)).atZone(ZoneId.systemDefault()).toInstant().toEpochMilli();
|
||||||
|
Point point = influxDbUtils.pointBuilder("pqs_communicate", time, TimeUnit.MILLISECONDS, tags, fields);
|
||||||
|
BatchPoints batchPoints = BatchPoints.database(influxDbUtils.getDbName()).retentionPolicy("").consistency(InfluxDB.ConsistencyLevel.ALL).build();
|
||||||
|
batchPoints.point(point);
|
||||||
|
influxDbUtils.batchInsert(influxDbUtils.getDbName(), "", InfluxDB.ConsistencyLevel.ALL, TimeUnit.MILLISECONDS, Collections.singletonList(batchPoints.lineProtocol()));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public List<PqsCommunicate> getPqsCommunicateData(LineCountEvaluateParam lineParam) {
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||||
|
influxQueryWrapper.regular(PqsCommunicate::getDevId, lineParam.getLineId())
|
||||||
|
.select(PqsCommunicate::getTime)
|
||||||
|
.select(PqsCommunicate::getDevId)
|
||||||
|
.select(PqsCommunicate::getDescription)
|
||||||
|
.select(PqsCommunicate::getType)
|
||||||
|
.between(PqsCommunicate::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||||
|
.timeAsc();
|
||||||
|
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -2,20 +2,26 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.util.IdUtil;
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.alibaba.nacos.shaded.com.google.gson.Gson;
|
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.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.github.tocrhz.mqtt.publisher.MqttPublisher;
|
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.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.constant.DataParam;
|
import com.njcn.csdevice.constant.DataParam;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
|
||||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
import com.njcn.csdevice.pojo.po.PortableOffMainLog;
|
||||||
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
import com.njcn.csdevice.pojo.po.PortableOfflLog;
|
||||||
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.service.CsLinePOService;
|
||||||
import com.njcn.csdevice.service.IPortableOfflLogService;
|
import com.njcn.csdevice.service.IPortableOfflLogService;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.param.UploadDataParam;
|
import com.njcn.csdevice.param.UploadDataParam;
|
||||||
|
import com.njcn.csdevice.service.IWlRecordService;
|
||||||
import com.njcn.csdevice.service.PortableOffMainLogService;
|
import com.njcn.csdevice.service.PortableOffMainLogService;
|
||||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||||
import com.njcn.csharmonic.api.EventFeignClient;
|
import com.njcn.csharmonic.api.EventFeignClient;
|
||||||
@@ -50,9 +56,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
import org.springframework.util.CollectionUtils;
|
import org.springframework.util.CollectionUtils;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.text.DecimalFormat;
|
import java.text.DecimalFormat;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.Instant;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
@@ -93,6 +102,8 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
|
|
||||||
private final MqttPublisher publisher;
|
private final MqttPublisher publisher;
|
||||||
private final PortableOffMainLogService portableOffMainLogService;
|
private final PortableOffMainLogService portableOffMainLogService;
|
||||||
|
private final IWlRecordService wlRecordService;
|
||||||
|
private final CsLinePOService csLinePOService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
public Page<PortableOfflLog> queryPage(BaseParam baseParam) {
|
||||||
@@ -169,6 +180,10 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
@Transactional(rollbackFor = {Exception.class})
|
@Transactional(rollbackFor = {Exception.class})
|
||||||
public void importEquipment(UploadDataParam uploadDataParam){
|
public void importEquipment(UploadDataParam uploadDataParam){
|
||||||
String lineId = uploadDataParam.getLineId();
|
String lineId = uploadDataParam.getLineId();
|
||||||
|
//获取监测点信息
|
||||||
|
LambdaQueryWrapper<CsLinePO> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(CsLinePO::getLineId,lineId).eq(CsLinePO::getStatus,1);
|
||||||
|
CsLinePO po = csLinePOService.getOne(queryWrapper);
|
||||||
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
String cdid = uploadDataParam.getLineId().substring(uploadDataParam.getLineId().length() - 1);
|
||||||
//第一步解析redcord.bin文件获取监测点序号做校验
|
//第一步解析redcord.bin文件获取监测点序号做校验
|
||||||
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
|
List<MultipartFile> record = uploadDataParam.getFiles().stream().filter(
|
||||||
@@ -261,7 +276,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
int successcCount = 0;
|
int successcCount = 0;
|
||||||
portableOffMainLog.setStatus("1");
|
portableOffMainLog.setStatus("1");
|
||||||
|
|
||||||
|
List<PortableOfflLog> portableOfflLogs = new ArrayList<>();
|
||||||
for(MultipartFile file : uploadDataParam.getFiles()){
|
for(MultipartFile file : uploadDataParam.getFiles()){
|
||||||
|
|
||||||
//初始上传日志基本信息
|
//初始上传日志基本信息
|
||||||
@@ -275,11 +290,16 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
//默认总条数及入库数为0(防止解析的数据重复插入及上传的文件目录路径错误)
|
//默认总条数及入库数为0(防止解析的数据重复插入及上传的文件目录路径错误)
|
||||||
portableOfflLog.setAllCount(0);
|
portableOfflLog.setAllCount(0);
|
||||||
portableOfflLog.setRealCount(0);
|
portableOfflLog.setRealCount(0);
|
||||||
|
if(file.getOriginalFilename().contains("record.bin")){
|
||||||
|
portableOfflLog.setAllCount(1);
|
||||||
|
portableOfflLog.setState(1);
|
||||||
|
}
|
||||||
|
|
||||||
//开始匹配解析的文件结果入库
|
//开始匹配解析的文件结果入库
|
||||||
for(Response response : responses){
|
for(Response response : responses){
|
||||||
//min解析结果较为特殊所有的文件解析后只有一条结果
|
//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();
|
List<PqdData> pqdData = (List<PqdData>) response.getObj();
|
||||||
pqdData.forEach(temp->{
|
pqdData.forEach(temp->{
|
||||||
temp.setClDid(cdid);
|
temp.setClDid(cdid);
|
||||||
@@ -287,6 +307,37 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
temp.setProcess(data1.get(0).getProcess()+"");
|
temp.setProcess(data1.get(0).getProcess()+"");
|
||||||
temp.setLineId(uploadDataParam.getLineId());
|
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(po.getLineInterval());
|
||||||
|
wlRecord.setPt(po.getPtRatio().intValue());
|
||||||
|
wlRecord.setCt(po.getCtRatio().intValue());
|
||||||
|
//电压等级
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(channelVol(new Float(po.getVolGrade())) + "kV","Dev_Voltage_Stand").getData();
|
||||||
|
wlRecord.setVoltageLevel(Objects.isNull(dictData)?null:dictData.getId());
|
||||||
|
//电压接线方式
|
||||||
|
wlRecord.setVolConType(getVolConType(po.getConType()));
|
||||||
|
|
||||||
|
wlRecord.setStartTime(instantMin.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
|
wlRecord.setEndTime(instantMax.atZone(ZoneId.systemDefault()).toLocalDateTime());
|
||||||
|
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 那么当前文件解析出错
|
//如果明确返回了state 那么当前文件解析出错
|
||||||
if(response.getState() != null){
|
if(response.getState() != null){
|
||||||
portableOfflLog.setState(response.getState());
|
portableOfflLog.setState(response.getState());
|
||||||
@@ -294,6 +345,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
if(pqdData != null && !pqdData.isEmpty()){
|
if(pqdData != null && !pqdData.isEmpty()){
|
||||||
//否则正常标记为成功解析
|
//否则正常标记为成功解析
|
||||||
portableOfflLog.setState(1);
|
portableOfflLog.setState(1);
|
||||||
|
portableOfflLog.setName("min文件夹");
|
||||||
portableOfflLog.setAllCount(pqdData.size());
|
portableOfflLog.setAllCount(pqdData.size());
|
||||||
portableOfflLog.setRealCount(pqdData.size());
|
portableOfflLog.setRealCount(pqdData.size());
|
||||||
if(minFlag){
|
if(minFlag){
|
||||||
@@ -311,17 +363,16 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
//判断当前解析的数据属于哪种结果(目前来说三种:comtrade、log、min(除外))
|
//判断当前解析的数据属于哪种结果(目前来说三种:comtrade、log、min(除外))
|
||||||
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.COMTRADE)!=null){ //cfg
|
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.COMTRADE)!=null){ //cfg
|
||||||
//如果明确返回了state 那么当前文件解析出错
|
//如果明确返回了state 那么当前文件解析出错
|
||||||
if(response.getState() != null){
|
//由于dat文件不解析但是日志需要记载所以都设为1
|
||||||
portableOfflLog.setState(response.getState());
|
|
||||||
}
|
|
||||||
TagComtradeCfg tagComtradeCfg = (TagComtradeCfg) response.getObj();
|
TagComtradeCfg tagComtradeCfg = (TagComtradeCfg) response.getObj();
|
||||||
if(tagComtradeCfg != null){
|
|
||||||
//否则正常标记为成功解析
|
//否则正常标记为成功解析
|
||||||
portableOfflLog.setState(1);
|
portableOfflLog.setState(1);
|
||||||
portableOfflLog.setAllCount(1);
|
portableOfflLog.setAllCount(1);
|
||||||
portableOfflLog.setRealCount(1);
|
portableOfflLog.setRealCount(1);
|
||||||
//cfg入库
|
//cfg入库
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.LOG)!=null){ //事件
|
if(checkPrevsFolder(file.getOriginalFilename(),OfflineConstant.LOG)!=null){ //事件
|
||||||
//如果明确返回了state 那么当前文件解析出错
|
//如果明确返回了state 那么当前文件解析出错
|
||||||
@@ -378,7 +429,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
for (Response res : cfgResponse) {
|
for (Response res : cfgResponse) {
|
||||||
String cfg = res.getFilename();
|
String cfg = res.getFilename();
|
||||||
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.DAT;
|
String dat = cfg.substring(0,cfg.lastIndexOf("."))+OfflineConstant.DAT;
|
||||||
String sharPath = OfflineConstant.COMTRADE+"/"+csEquipmentDeliveryDTO.getMac()+"/";
|
String sharPath = OfflineConstant.COMTRADE+"/"+csEquipmentDeliveryDTO.getMac().replace(":", "-")+"/";
|
||||||
TagComtradeCfg sing = (TagComtradeCfg) res.getObj();
|
TagComtradeCfg sing = (TagComtradeCfg) res.getObj();
|
||||||
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
|
//如果匹配上则需要将当前cfg文件及对应的dat文件上传到comtrade文件夹中
|
||||||
if (sing!= null && sing.getTimeStart()!= null && sing.getTimeTrigger().compareTo(csEventPO.getStartTime())<=0
|
if (sing!= null && sing.getTimeStart()!= null && sing.getTimeTrigger().compareTo(csEventPO.getStartTime())<=0
|
||||||
@@ -471,7 +522,7 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
this.baseMapper.insert(portableOfflLog);
|
this.baseMapper.insert(portableOfflLog);
|
||||||
successcCount++;
|
successcCount++;
|
||||||
}
|
}
|
||||||
|
portableOfflLogs.add(portableOfflLog);
|
||||||
}
|
}
|
||||||
portableOffMainLog.setEndTime(LocalDateTime.now());
|
portableOffMainLog.setEndTime(LocalDateTime.now());
|
||||||
portableOffMainLog.setSuccessCount(successcCount);
|
portableOffMainLog.setSuccessCount(successcCount);
|
||||||
@@ -517,4 +568,40 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
|
|||||||
}
|
}
|
||||||
return s1;
|
return s1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 处理电压
|
||||||
|
* @param vol
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public String channelVol(Float vol) {
|
||||||
|
BigDecimal value = new BigDecimal(vol);
|
||||||
|
BigDecimal noZeros = value.stripTrailingZeros();
|
||||||
|
return noZeros.toPlainString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 0-星型, 1-角型, 2-V型
|
||||||
|
// star-星型、Star_Triangle-星三角、Open_Delta-开口三角
|
||||||
|
public String getVolConType(Integer volConType) {
|
||||||
|
String result = null;
|
||||||
|
String dictDataCode = null;
|
||||||
|
switch (volConType) {
|
||||||
|
case 0:
|
||||||
|
dictDataCode = "star";
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
dictDataCode = "Star_Triangle";
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
dictDataCode = "Open_Delta";
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (!Objects.isNull(dictDataCode)) {
|
||||||
|
DictData dictData = dicDataFeignClient.getDicDataByCodeAndType(dictDataCode,"Dev_Connect").getData();
|
||||||
|
result = dictData.getId();
|
||||||
|
}
|
||||||
|
return Objects.isNull(result)?null:result;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.mapper.RStatIntegrityDMapper;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||||
|
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||||
|
import com.njcn.csdevice.util.TimeUtil;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
|
import com.njcn.influx.service.CommonService;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.function.Function;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 数据完整性日表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@DS("sjzx")
|
||||||
|
@Slf4j
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class RStatIntegrityDServiceImpl extends MppServiceImpl<RStatIntegrityDMapper, RStatIntegrityD> implements IRStatIntegrityDService {
|
||||||
|
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final CsLineFeignClient csLineFeignClient;
|
||||||
|
private final CommonService commonService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addData(StatisticsDataParam param) {
|
||||||
|
List<RStatIntegrityD> result = new ArrayList<>();
|
||||||
|
//获取库中正常的所有装置
|
||||||
|
List<CsEquipmentDeliveryPO> devList = equipmentFeignClient.getAll().getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
|
Map<String, CsEquipmentDeliveryPO> devMap = devList.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||||
|
//获取所有监测点
|
||||||
|
List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||||
|
if (CollectionUtil.isNotEmpty(devIdList)) {
|
||||||
|
//获取需要计算的时间
|
||||||
|
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
||||||
|
//获取监测点信息
|
||||||
|
List<CsLinePO> csLinePOList = csLineFeignClient.getLinesByDevList(devIdList).getData();
|
||||||
|
csLinePOList.forEach(item->{
|
||||||
|
//应收数据
|
||||||
|
int dueCount = 1440 / item.getLineInterval();
|
||||||
|
Integer process = devMap.get(item.getDeviceId()).getProcess();
|
||||||
|
for (String time : dateRange) {
|
||||||
|
StatisticalDataDTO statisticalDataDTO;
|
||||||
|
RStatIntegrityD data = new RStatIntegrityD();
|
||||||
|
//治理监测点
|
||||||
|
if (item.getClDid() == 0) {
|
||||||
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"apf_data","Apf_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
|
}
|
||||||
|
//电能质量监测点
|
||||||
|
else {
|
||||||
|
statisticalDataDTO = commonService.getDataCounts(item.getLineId(),"pqd_data","Pq_Freq","value","M","avg",item.getClDid().toString(),process.toString(),time+" 00:00:00",time+" 23:59:59");
|
||||||
|
}
|
||||||
|
data.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
data.setLineIndex(item.getLineId());
|
||||||
|
data.setDueTime(dueCount);
|
||||||
|
data.setRealTime(statisticalDataDTO == null || statisticalDataDTO.getValue() == null
|
||||||
|
? 0 : (int)Math.round(statisticalDataDTO.getValue()));
|
||||||
|
result.add(data);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(result)) {
|
||||||
|
this.saveOrUpdateBatchByMultiId(result);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RStatIntegrityD> getData(List<String> list, String startTime, String endTime) {
|
||||||
|
return this.lambdaQuery()
|
||||||
|
.in(RStatIntegrityD::getLineIndex,list)
|
||||||
|
.between(RStatIntegrityD::getTimeId,startTime,endTime)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package com.njcn.csdevice.service.impl;
|
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.date.DatePattern;
|
||||||
|
import cn.hutool.core.date.DateUnit;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
|
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||||
|
import com.github.jeffreyning.mybatisplus.service.MppServiceImpl;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
|
import com.njcn.csdevice.mapper.RStatOnlineRateDMapper;
|
||||||
|
import com.njcn.csdevice.param.LineCountEvaluateParam;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||||
|
import com.njcn.csdevice.service.ICsCommunicateService;
|
||||||
|
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||||
|
import com.njcn.csdevice.util.TimeUtil;
|
||||||
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||||
|
import com.njcn.influx.deprecated.InfluxDBPublicParam;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import java.text.ParseException;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* <p>
|
||||||
|
* 在线率日表 服务实现类
|
||||||
|
* </p>
|
||||||
|
*
|
||||||
|
* @author xy
|
||||||
|
* @since 2025-06-23
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@Slf4j
|
||||||
|
@AllArgsConstructor
|
||||||
|
@DS("sjzx")
|
||||||
|
public class RStatOnlineRateDServiceImpl extends MppServiceImpl<RStatOnlineRateDMapper, RStatOnlineRateD> implements IRStatOnlineRateDService {
|
||||||
|
|
||||||
|
private final Integer online = 1;
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
private final ICsCommunicateService pqsCommunicateService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void addData(StatisticsDataParam param) {
|
||||||
|
List<RStatOnlineRateD> list = new ArrayList<>();
|
||||||
|
//获取库中正常的所有装置
|
||||||
|
List<CsEquipmentDeliveryPO> devList = equipmentFeignClient.getAll().getData();
|
||||||
|
if (CollectionUtil.isNotEmpty(devList)) {
|
||||||
|
//获取需要计算的时间
|
||||||
|
List<String> dateRange = TimeUtil.getDateRangeAsString(param.getStartTime(), param.getEndTime());
|
||||||
|
for (String time : dateRange) {
|
||||||
|
List<PqsCommunicateDto> outCommunicateData = new ArrayList<>();
|
||||||
|
LineCountEvaluateParam lineParam = new LineCountEvaluateParam();
|
||||||
|
lineParam.setStartTime(time + " 00:00:00");
|
||||||
|
lineParam.setEndTime(time + " 23:59:59");
|
||||||
|
for (CsEquipmentDeliveryPO s : devList) {
|
||||||
|
lineParam.setLineId(Collections.singletonList(s.getId()));
|
||||||
|
List<PqsCommunicateDto> data = pqsCommunicateService.getRawDataLatest(lineParam);
|
||||||
|
if (CollectionUtil.isEmpty(data)) {
|
||||||
|
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||||
|
dto.setTime(time + " 00:00:00");
|
||||||
|
dto.setDevId(s.getId());
|
||||||
|
if (s.getRunStatus() == 1) {
|
||||||
|
dto.setType(0);
|
||||||
|
dto.setDescription("通讯中断");
|
||||||
|
} else if (s.getRunStatus() == 2) {
|
||||||
|
dto.setType(1);
|
||||||
|
dto.setDescription("通讯正常");
|
||||||
|
}
|
||||||
|
outCommunicateData.add(dto);
|
||||||
|
}
|
||||||
|
outCommunicateData.addAll(data);
|
||||||
|
}
|
||||||
|
Date dateOut = DateUtil.parse(time);
|
||||||
|
for (PqsCommunicateDto pqsCommunicate : outCommunicateData) {
|
||||||
|
RStatOnlineRateD po = new RStatOnlineRateD();
|
||||||
|
Date newDate = DateUtil.parse(pqsCommunicate.getTime());
|
||||||
|
lineParam.setLineId(Collections.singletonList(pqsCommunicate.getDevId()));
|
||||||
|
RStatOnlineRateD onLineRate = onLineMinute(newDate, dateOut, pqsCommunicate.getType(), lineParam);
|
||||||
|
po.setTimeId(LocalDate.parse(time, DatePattern.NORM_DATE_FORMATTER));
|
||||||
|
po.setDevIndex(pqsCommunicate.getDevId());
|
||||||
|
po.setOnlineMin(onLineRate.getOnlineMin());
|
||||||
|
po.setOfflineMin(onLineRate.getOfflineMin());
|
||||||
|
list.add(po);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (CollectionUtil.isNotEmpty(list)) {
|
||||||
|
this.saveOrUpdateBatchByMultiId(list,1000);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<RStatOnlineRateD> getData(List<String> list, String startTime, String endTime) {
|
||||||
|
return this.lambdaQuery()
|
||||||
|
.in(RStatOnlineRateD::getDevIndex,list)
|
||||||
|
.between(RStatOnlineRateD::getTimeId,startTime,endTime)
|
||||||
|
.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* new的时间和当前统计时间 不是/是 同一天
|
||||||
|
*/
|
||||||
|
private RStatOnlineRateD onLineMinute(Date newDate, Date date, Integer type, LineCountEvaluateParam lineParam) {
|
||||||
|
RStatOnlineRateD onLineRate = new RStatOnlineRateD();
|
||||||
|
Integer minute = 0;
|
||||||
|
/*new的时间和当前统计时间是同一天*/
|
||||||
|
if (DateUtil.isSameDay(newDate, date)) {
|
||||||
|
minute = processData(newDate, date, type, lineParam);
|
||||||
|
} else {
|
||||||
|
/*new的时间和当前统计时间不是同一天*/
|
||||||
|
Date nowDate = new Date();
|
||||||
|
/*数据补招的情况下*/
|
||||||
|
if (DateUtil.between(date, nowDate, DateUnit.DAY) > DateUtil.between(newDate, nowDate, DateUnit.DAY)) {
|
||||||
|
minute = processData(newDate, date, null, lineParam);
|
||||||
|
} else {
|
||||||
|
if (online.equals(type)) {
|
||||||
|
minute = InfluxDBPublicParam.DAY_MINUTE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
onLineRate.setOnlineMin(minute);
|
||||||
|
onLineRate.setOfflineMin(InfluxDBPublicParam.DAY_MINUTE - minute);
|
||||||
|
return onLineRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Integer processData(Date newDate, Date date, Integer type,LineCountEvaluateParam lineParam) {
|
||||||
|
int minute = 0;
|
||||||
|
List<PqsCommunicateDto> communicateData = pqsCommunicateService.getRawData(lineParam);
|
||||||
|
/*当前统计时间内存在多条数据*/
|
||||||
|
if (communicateData.size() > 1) {
|
||||||
|
Date lastTime = null;
|
||||||
|
long onlineTime = 0;
|
||||||
|
long offlineTime = 0;
|
||||||
|
for (int i = 0; i < communicateData.size(); i++) {
|
||||||
|
long differ;
|
||||||
|
if (i == 0) {
|
||||||
|
/*首次比较取统计时间*/
|
||||||
|
differ = DateUtil.between(date, DateUtil.parse(communicateData.get(i).getTime()), DateUnit.MINUTE);
|
||||||
|
} else {
|
||||||
|
/*后续取上一次数据时间*/
|
||||||
|
differ = DateUtil.between(lastTime, DateUtil.parse(communicateData.get(i).getTime()), DateUnit.MINUTE);
|
||||||
|
}
|
||||||
|
if (online.equals(communicateData.get(i).getType())) {
|
||||||
|
offlineTime = offlineTime + differ;
|
||||||
|
} else {
|
||||||
|
onlineTime = onlineTime + differ;
|
||||||
|
}
|
||||||
|
lastTime = DateUtil.parse(communicateData.get(i).getTime());
|
||||||
|
}
|
||||||
|
if (online.equals(communicateData.get(communicateData.size() - 1).getType())) {
|
||||||
|
minute = InfluxDBPublicParam.DAY_MINUTE - (int) offlineTime;
|
||||||
|
} else {
|
||||||
|
minute = (int) onlineTime;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*当前统计时间内仅有一条数据*/
|
||||||
|
else {
|
||||||
|
if (type != null) {
|
||||||
|
long differ = DateUtil.between(date, newDate, DateUnit.MINUTE);
|
||||||
|
if (online.equals(type)) {
|
||||||
|
minute = InfluxDBPublicParam.DAY_MINUTE - (int) differ;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
List<PqsCommunicateDto> communicateDataOld = pqsCommunicateService.getRawDataEnd(lineParam);
|
||||||
|
// if (!communicateDataOld.isEmpty()){
|
||||||
|
// if (online.equals(communicateDataOld.get(0).getType())){
|
||||||
|
// minute = InfluxDBPublicParam.DAY_MINUTE;
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
if (!communicateDataOld.isEmpty()){
|
||||||
|
try {
|
||||||
|
if (online.equals(communicateDataOld.get(0).getType())){
|
||||||
|
minute = (int) DateUtil.between(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(communicateDataOld.get(0).getTime()), new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(lineParam.getEndTime()), DateUnit.MINUTE);
|
||||||
|
} else {
|
||||||
|
minute = (int) DateUtil.between(new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(lineParam.getStartTime()), new SimpleDateFormat(DatePattern.NORM_DATETIME_PATTERN).parse(communicateDataOld.get(0).getTime()), DateUnit.MINUTE);
|
||||||
|
}
|
||||||
|
} catch (ParseException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return minute;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -33,6 +33,7 @@ import com.njcn.csdevice.pojo.vo.RecordVo;
|
|||||||
import com.njcn.csdevice.service.IWlRecordService;
|
import com.njcn.csdevice.service.IWlRecordService;
|
||||||
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
import com.njcn.csdevice.util.InfluxDbParamUtil;
|
||||||
import com.njcn.csdevice.utils.DataChangeUtil;
|
import com.njcn.csdevice.utils.DataChangeUtil;
|
||||||
|
import com.njcn.csdevice.utils.StringUtil;
|
||||||
import com.njcn.csharmonic.constant.HarmonicConstant;
|
import com.njcn.csharmonic.constant.HarmonicConstant;
|
||||||
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
@@ -61,6 +62,7 @@ import java.time.LocalDateTime;
|
|||||||
import java.time.ZoneOffset;
|
import java.time.ZoneOffset;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
@@ -102,6 +104,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
@Override
|
@Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void addRecord(WlRecordParam.AddRecord records) {
|
public void addRecord(WlRecordParam.AddRecord records) {
|
||||||
|
checkRecord(records);
|
||||||
//整理的方案下测试项集合(可能添加多个测试项)
|
//整理的方案下测试项集合(可能添加多个测试项)
|
||||||
List<WlRecord> insertList = new ArrayList<>();
|
List<WlRecord> insertList = new ArrayList<>();
|
||||||
//校验方案ID是否存在
|
//校验方案ID是否存在
|
||||||
@@ -142,6 +145,34 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
this.saveBatch(insertList);
|
this.saveBatch(insertList);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkRecord(WlRecordParam record) {
|
||||||
|
if (record instanceof WlRecordParam.AddRecord) {
|
||||||
|
WlRecordParam.AddRecord temp =( WlRecordParam.AddRecord) record;
|
||||||
|
String itemName = temp.getRecords().get(0).getItemName();
|
||||||
|
StringUtil.containsSpecialCharacters(itemName);
|
||||||
|
if(StrUtil.isBlank(itemName)){
|
||||||
|
throw new BusinessException("测试项名称不能为空或空格");
|
||||||
|
}
|
||||||
|
List<WlRecord> list = this.lambdaQuery().eq(WlRecord::getPId, temp.getId()).eq(WlRecord::getState, 1).eq(WlRecord::getItemName, itemName).list();
|
||||||
|
if(!CollectionUtils.isEmpty(list)){
|
||||||
|
throw new BusinessException("数据列表中存在同名测试项");
|
||||||
|
}
|
||||||
|
}else if (record instanceof WlRecordParam.UpdateRecord) {
|
||||||
|
WlRecordParam.UpdateRecord temp =( WlRecordParam.UpdateRecord) record;
|
||||||
|
String itemName = temp.getItemName();
|
||||||
|
StringUtil.containsSpecialCharacters(itemName);
|
||||||
|
if(StrUtil.isBlank(itemName)){
|
||||||
|
throw new BusinessException("测试项名称不能为空或空格");
|
||||||
|
}
|
||||||
|
WlRecord one = this.lambdaQuery().eq(WlRecord::getId, temp.getId()).one();
|
||||||
|
List<WlRecord> list = this.lambdaQuery().eq(WlRecord::getPId, one.getPId()).ne(WlRecord::getId, temp.getId()).eq(WlRecord::getState, 1).eq(WlRecord::getItemName, itemName).list();
|
||||||
|
if(!CollectionUtils.isEmpty(list)){
|
||||||
|
throw new BusinessException("数据列表中存在同名测试项");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void addBaseData(WlRecord wlRecord) {
|
public void addBaseData(WlRecord wlRecord) {
|
||||||
this.save(wlRecord);
|
this.save(wlRecord);
|
||||||
@@ -155,6 +186,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
@Override
|
@Override
|
||||||
// @Transactional(rollbackFor = Exception.class)
|
// @Transactional(rollbackFor = Exception.class)
|
||||||
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
public void updateTestRecord(WlRecordParam.UpdateRecord record) {
|
||||||
|
checkRecord(record);
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
BeanUtils.copyProperties(record, wlRecord);
|
BeanUtils.copyProperties(record, wlRecord);
|
||||||
wlRecord.setStartTime(record.getProStartTime());
|
wlRecord.setStartTime(record.getProStartTime());
|
||||||
@@ -174,15 +206,37 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
overlimitService.saveOrUpdate(overlimit);
|
overlimitService.saveOrUpdate(overlimit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateRecordData(WlRecordParam.UpdateRecord record) {
|
||||||
|
LambdaQueryWrapper<WlRecord> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
queryWrapper.eq(WlRecord::getId, record.getId());
|
||||||
|
WlRecord wlRecord = this.getOne(queryWrapper);
|
||||||
|
if (Objects.isNull(wlRecord)) {
|
||||||
|
throw new BusinessException("测试项缺失!");
|
||||||
|
} else {
|
||||||
|
wlRecord.setStartTime(record.getProStartTime());
|
||||||
|
wlRecord.setEndTime(record.getProEndTime());
|
||||||
|
}
|
||||||
|
this.updateById(wlRecord);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateSchemeRecord(WlRecordParam.UpdateRecord record) {
|
public void updateSchemeRecord(WlRecordParam.UpdateRecord record) {
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
|
checkString(record.getItemName());
|
||||||
if(record.getId()!=null){
|
if(record.getId()!=null){
|
||||||
BeanUtils.copyProperties(record, wlRecord);
|
BeanUtils.copyProperties(record, wlRecord);
|
||||||
|
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||||
|
qw.eq(WlRecord::getItemName,record.getItemName()).isNull(WlRecord::getPId).eq(WlRecord::getType,0).eq(WlRecord::getState,1).ne(WlRecord::getId,record.getId());
|
||||||
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
|
//方案名称重复校验
|
||||||
|
if(!wlRecordList.isEmpty()){
|
||||||
|
throw new BusinessException(LineBaseEnum.EXISTWLRECORD_FAIL.getMessage());
|
||||||
|
}
|
||||||
this.updateById(wlRecord);
|
this.updateById(wlRecord);
|
||||||
}else{
|
}else{
|
||||||
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
LambdaQueryWrapper<WlRecord> qw = new LambdaQueryWrapper();
|
||||||
qw.eq(WlRecord::getItemName,record.getItemName()).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
qw.eq(WlRecord::getItemName,record.getItemName()).isNull(WlRecord::getPId).eq(WlRecord::getType,0).eq(WlRecord::getState,1);
|
||||||
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
//方案名称重复校验
|
//方案名称重复校验
|
||||||
if(!wlRecordList.isEmpty()){
|
if(!wlRecordList.isEmpty()){
|
||||||
@@ -196,6 +250,13 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkString(String itemName) {
|
||||||
|
StringUtil.containsSpecialCharacters(itemName);
|
||||||
|
if(StrUtil.isBlank(itemName)){
|
||||||
|
throw new BusinessException("测试项名称不能为空或空格");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
public RecordVo.RecordItemVo getTestRecordById(String testRecordId) {
|
||||||
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
RecordVo.RecordItemVo recordItemVo = new RecordVo.RecordItemVo();
|
||||||
@@ -408,94 +469,154 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
//格式化前端参数
|
//格式化前端参数
|
||||||
formatQueryParamList(commonStatisticalQueryParam);
|
formatQueryParamList(commonStatisticalQueryParam);
|
||||||
if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
|
if(commonStatisticalQueryParam.getList() != null && !commonStatisticalQueryParam.getList().isEmpty()){
|
||||||
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
for (CommonStatisticalQueryParam param : commonStatisticalQueryParam.getList()){
|
||||||
if(param.getStatisticalId() == null){
|
if(param.getStatisticalId() == null){
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
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缺失)");
|
||||||
}
|
}
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(param.getStatisticalId()).getData();
|
Double ct = Double.valueOf(wlRecord.getCt())/wlRecord.getCt1();
|
||||||
for(WlRecord wl : data){
|
Double pt =Double.valueOf(wlRecord.getPt())/wlRecord.getPt1();
|
||||||
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();
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
||||||
eleEpdPqds.forEach(epdPqd->{
|
eleEpdPqds.forEach(epdPqd->{
|
||||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
commonQueryParam.setLineId(temp.getLineId());
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
commonQueryParam.setTableName(influxDbParamUtil.getTableNameByClassId(epdPqd.getClassId()));
|
||||||
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
commonQueryParam.setColumnName(epdPqd.getName()+ (param.getFrequency() == null ? "":"_"+param.getFrequency()));
|
||||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern(DataParam.timeFormat)));
|
||||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
commonQueryParam.setClDid(influxDbParamUtil.getClDidByLineId(temp.getLineId()));
|
||||||
return commonQueryParam;
|
return commonQueryParam;
|
||||||
}).collect(Collectors.toList());
|
}).collect(Collectors.toList());
|
||||||
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
//此处设空时为了有多段时将线条断开前端显示
|
//此处设空时为了有多段时将线条断开前端显示
|
||||||
if(!CollectionUtils.isEmpty(deviceRtData)){
|
if(!CollectionUtils.isEmpty(deviceRtData)){
|
||||||
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
deviceRtData.get(deviceRtData.size()-1).setValue(null);
|
||||||
}
|
}
|
||||||
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
ThdDataVO vo = new ThdDataVO();
|
String unit;
|
||||||
vo.setLineId(temp.getLineId());
|
ThdDataVO vo = new ThdDataVO();
|
||||||
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
vo.setLineId(temp.getLineId());
|
||||||
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
vo.setPhase(Objects.equals("M",temp.getPhaseType())?null:temp.getPhaseType());
|
||||||
vo.setPosition(position);
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
vo.setTime(temp.getTime());
|
vo.setPosition(position);
|
||||||
vo.setStatMethod(temp.getValueType());
|
vo.setTime(temp.getTime());
|
||||||
if(temp.getValue()!=null) {
|
vo.setStatMethod(temp.getValueType());
|
||||||
double re;
|
if(temp.getValue()!=null) {
|
||||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
double re = 0;
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
vo.setUnit(epdPqd.getUnit());
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
} else {
|
unit = epdPqd.getUnit();
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
|
||||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
|
||||||
vo.setUnit("k" + epdPqd.getUnit());
|
|
||||||
} else {
|
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
|
||||||
vo.setUnit(epdPqd.getUnit());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
case "*PT":
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
re = temp.getValue() * pt / 1000;
|
||||||
} else {
|
unit = "k" + epdPqd.getUnit();
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
break;
|
||||||
vo.setUnit(epdPqd.getUnit());
|
case "*CT":
|
||||||
|
re = temp.getValue() * ct;
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() * pt * ct / 1000;
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
} else {
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
}
|
}
|
||||||
vo.setUnit(epdPqd.getUnit());
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
vo.setStatisticalData(null);
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
re = temp.getValue() / pt;
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
re = temp.getValue() / ct;
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
re = temp.getValue() / pt / ct;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
re = temp.getValue();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}else {
|
||||||
|
re = temp.getValue();
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
}
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
}
|
}
|
||||||
vo.setStatisticalIndex(epdPqd.getId());
|
} else {
|
||||||
vo.setStatisticalName(epdPqd.getName());
|
vo.setStatisticalData(null);
|
||||||
vo.setAnotherName(epdPqd.getShowName());
|
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||||
return vo;
|
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||||
}).collect(Collectors.toList());
|
unit = epdPqd.getUnit();
|
||||||
result.addAll(collect1);
|
} else {
|
||||||
});
|
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||||
}
|
switch (epdPqd.getPrimaryFormula()) {
|
||||||
|
case "*PT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*CT":
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
case "*PT*CT":
|
||||||
|
unit = "k" + epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
unit = epdPqd.getUnit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
vo.setUnit(unit);
|
||||||
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
result.addAll(collect1);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
public WlRecord findDevBaseData(WlRecordParam.Record param) {
|
||||||
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<WlRecord> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
@@ -508,6 +629,31 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
return this.getOne(lambdaQueryWrapper);
|
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);
|
||||||
|
if (Objects.equals(param.getDataSource(),0)) {
|
||||||
|
lambdaQueryWrapper.eq(WlRecord::getItemName,"补召");
|
||||||
|
} else if (Objects.equals(param.getDataSource(),1)) {
|
||||||
|
lambdaQueryWrapper.eq(WlRecord::getItemName,"在线监测");
|
||||||
|
}
|
||||||
|
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
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public void dayDealNoEndTimeEvent(String date) {
|
public void dayDealNoEndTimeEvent(String date) {
|
||||||
@@ -550,7 +696,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
StatisticalDataDTO statisticalDataDTO = commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
if(Objects.nonNull(statisticalDataDTO)){
|
if(Objects.nonNull(statisticalDataDTO)){
|
||||||
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
LocalDateTime endTime = statisticalDataDTO.getTime().atOffset(ZoneOffset.ofHours(0)).toLocalDateTime();
|
||||||
Duration duration = Duration.between(now, endTime);
|
Duration duration = Duration.between(endTime,now);
|
||||||
long hour = duration.toHours();
|
long hour = duration.toHours();
|
||||||
if(hour>6){
|
if(hour>6){
|
||||||
WlRecord wlRecord = new WlRecord();
|
WlRecord wlRecord = new WlRecord();
|
||||||
@@ -601,6 +747,18 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<WlRecord> getWlAssByWlId(String wlId) {
|
||||||
|
return this.baseMapper.getWlAssByWlId(wlId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@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之间存在时间冲突
|
* 数据项内的时间进行覆盖:解决多个数据项的startTime及endTime之间存在时间冲突
|
||||||
* @param data 数据项
|
* @param data 数据项
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.njcn.csdevice.util;
|
||||||
|
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
* 二维码工具
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/8/21 13:57
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class TimeUtil {
|
||||||
|
|
||||||
|
public static List<String> getDateRangeAsString(String startDateStr, String endDateStr) {
|
||||||
|
// 定义日期格式
|
||||||
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||||
|
// 解析为LocalDate对象
|
||||||
|
LocalDate startDate = LocalDate.parse(startDateStr, formatter);
|
||||||
|
LocalDate endDate = LocalDate.parse(endDateStr, formatter);
|
||||||
|
// 计算天数差
|
||||||
|
long numOfDays = ChronoUnit.DAYS.between(startDate, endDate) + 1;
|
||||||
|
// 生成日期流,格式化为字符串并收集为列表
|
||||||
|
return Stream.iterate(startDate, date -> date.plusDays(1))
|
||||||
|
.limit(numOfDays)
|
||||||
|
.map(formatter::format)
|
||||||
|
.collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -45,7 +45,10 @@ logging:
|
|||||||
level:
|
level:
|
||||||
root: info
|
root: info
|
||||||
|
|
||||||
|
data:
|
||||||
|
source:
|
||||||
|
query: Influxdb
|
||||||
|
insert: Relation
|
||||||
#mybatis配置信息
|
#mybatis配置信息
|
||||||
mybatis-plus:
|
mybatis-plus:
|
||||||
#别名扫描
|
#别名扫描
|
||||||
|
|||||||
@@ -1,14 +1,39 @@
|
|||||||
package com.njcn;
|
package com.njcn;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.CsDeviceBootApplication;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.csdevice.service.DeviceFtpService;
|
||||||
|
import com.njcn.csdevice.service.ICsCommunicateService;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.junit.Test;
|
import org.junit.Test;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
import static org.junit.Assert.assertTrue;
|
import static org.junit.Assert.assertTrue;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unit test for simple App.
|
* Unit test for simple App.
|
||||||
*/
|
*/
|
||||||
public class AppTest
|
@RunWith(SpringRunner.class)
|
||||||
{
|
@WebAppConfiguration
|
||||||
|
@SpringBootTest(classes = CsDeviceBootApplication.class)
|
||||||
|
@Slf4j
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class AppTest{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceFtpService deviceFtpService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ICsCommunicateService csCommunicateService;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rigorous Test :-)
|
* Rigorous Test :-)
|
||||||
*/
|
*/
|
||||||
@@ -17,4 +42,35 @@ public class AppTest
|
|||||||
{
|
{
|
||||||
assertTrue( true );
|
assertTrue( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试下载文件
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void downloadFileTest() {
|
||||||
|
String nDid = "00B78D016AB5";
|
||||||
|
String name = "/etc/pqs_arm.bin";
|
||||||
|
Integer size = 5123552;
|
||||||
|
String fileCheck = "859E36E8";
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
log.info("开始第{}次", i);
|
||||||
|
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||||
|
Thread.sleep(1000 * 60 * 4);
|
||||||
|
log.info("这是第{}次询问装置,结果为:{}", i, null);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void writeData() {
|
||||||
|
PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto();
|
||||||
|
pqsCommunicateDto.setTime("2024-01-01 00:00:00");
|
||||||
|
pqsCommunicateDto.setDevId("da7aa071bf89864bedea8833133676b7");
|
||||||
|
pqsCommunicateDto.setType(1);
|
||||||
|
pqsCommunicateDto.setDescription("通讯连接");
|
||||||
|
csCommunicateService.insertion(pqsCommunicateDto);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
package com.njcn;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.CsDeviceBootApplication;
|
||||||
|
import org.junit.runner.RunWith;
|
||||||
|
import org.springframework.boot.test.context.SpringBootTest;
|
||||||
|
import org.springframework.test.context.junit4.SpringRunner;
|
||||||
|
import org.springframework.test.context.web.WebAppConfiguration;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.math.RoundingMode;
|
||||||
|
|
||||||
|
@RunWith(SpringRunner.class)
|
||||||
|
@WebAppConfiguration
|
||||||
|
@SpringBootTest(classes = CsDeviceBootApplication.class)
|
||||||
|
public class BaseJunitTest {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
double num1 = 123.456;
|
||||||
|
double num2 = 123.4;
|
||||||
|
double num3 = 123.0;
|
||||||
|
|
||||||
|
System.out.println(roundToTwoDecimalPlaces(num1)); // 输出: 123.46
|
||||||
|
System.out.println(roundToTwoDecimalPlaces(num2)); // 输出: 123.40
|
||||||
|
System.out.println(roundToTwoDecimalPlaces(num3)); // 输出: 123.00
|
||||||
|
}
|
||||||
|
|
||||||
|
public static double roundToTwoDecimalPlaces(double num) {
|
||||||
|
// 乘以100,然后四舍五入,再除以100
|
||||||
|
return Math.round(num * 100.0) / 100.0;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,123 @@
|
|||||||
|
package com.njcn;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
|
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||||
|
import com.njcn.csdevice.service.DeviceFtpService;
|
||||||
|
import com.njcn.influx.imapper.EvtDataMapper;
|
||||||
|
import com.njcn.influx.imapper.PqsCommunicateMapper;
|
||||||
|
import com.njcn.influx.pojo.po.PqsCommunicate;
|
||||||
|
import com.njcn.influx.pojo.po.cs.EntData;
|
||||||
|
import com.njcn.oss.constant.OssPath;
|
||||||
|
import com.njcn.oss.utils.FileStorageUtil;
|
||||||
|
import lombok.SneakyThrows;
|
||||||
|
import org.junit.Test;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
public class DownloadFileTest extends BaseJunitTest{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private DeviceFtpService deviceFtpService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FileStorageUtil fileStorageUtil;
|
||||||
|
@Autowired
|
||||||
|
private EvtDataMapper evtDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private PqsCommunicateMapper pqsCommunicateMapper;
|
||||||
|
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||||
|
|
||||||
|
/**
|
||||||
|
* inflxudb写入
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void addInfluxdb() {
|
||||||
|
PqsCommunicateDto pqsCommunicate = new PqsCommunicateDto();
|
||||||
|
pqsCommunicate.setTime("2025-06-23 ");
|
||||||
|
pqsCommunicate.setDevId("da7aa071bf89864bedea8833133676b7");
|
||||||
|
pqsCommunicate.setType(1);
|
||||||
|
pqsCommunicate.setDescription("设备上线");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 测试下载文件
|
||||||
|
*/
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void downloadFileTest() {
|
||||||
|
String nDid = "00B78D016AB3";
|
||||||
|
String name = "/etc/pqs_arm.bin";
|
||||||
|
Integer size = 5127376;
|
||||||
|
String fileCheck = "E883C579";
|
||||||
|
String filePath = "C:\\Users\\徐扬\\Desktop\\download.txt";
|
||||||
|
for (int i = 0; i < 10; i++) {
|
||||||
|
System.out.println("开始第"+i+"次");
|
||||||
|
deviceFtpService.downloadFile(nDid,name,size,fileCheck);
|
||||||
|
String dataToAppend = LocalDateTime.now() + "开始下载,这是第"+i+"次,结果为:" + null + "\r\n";
|
||||||
|
// 第二个参数为 true 表示追加模式
|
||||||
|
try (FileWriter fileWriter = new FileWriter(filePath, true)) {
|
||||||
|
fileWriter.write(dataToAppend); // 写入数据
|
||||||
|
System.out.println("数据已成功追加到文件中。");
|
||||||
|
} catch (IOException e) {
|
||||||
|
System.err.println("写入文件时发生错误: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@SneakyThrows
|
||||||
|
@Test
|
||||||
|
public void moveFile() {
|
||||||
|
String oldPath = "/db0/cmn/07/min/20240925/line2_avg.bin";
|
||||||
|
StringBuilder result = null;
|
||||||
|
String[] arr = oldPath.split("/");
|
||||||
|
for (String s : arr) {
|
||||||
|
s = s + File.separator;
|
||||||
|
}
|
||||||
|
System.out.println("result==:" + result);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
String nDid = "00B78D016AB3";
|
||||||
|
String oldPath = "/db0/cmn/07/min/20240925/line2_avg.bin";
|
||||||
|
String path = getFilePath(oldPath,nDid);
|
||||||
|
System.out.println("path==:" + path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static String getFilePath(String path, String nDid) {
|
||||||
|
String[] parts = path.split("/");
|
||||||
|
StringBuilder sb = new StringBuilder();
|
||||||
|
boolean first = true;
|
||||||
|
for (int i = 3; i < parts.length; i++) {
|
||||||
|
if (!first) {
|
||||||
|
sb.append(File.separator);
|
||||||
|
}
|
||||||
|
sb.append(parts[i]);
|
||||||
|
first = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return nDid + File.separator + sb.toString();
|
||||||
|
}
|
||||||
|
|
||||||
|
// private static String getFilePath(String path, String nDid) {
|
||||||
|
// path = nDid + "/" + path;
|
||||||
|
// String[] parts = path.split("/");
|
||||||
|
// StringBuilder sb = new StringBuilder();
|
||||||
|
// boolean first = true;
|
||||||
|
// for (int i = 4; i < parts.length; i++) {
|
||||||
|
// if (!first) {
|
||||||
|
// sb.append("/");
|
||||||
|
// }
|
||||||
|
// sb.append(parts[i]);
|
||||||
|
// first = false;
|
||||||
|
// }
|
||||||
|
// return sb.toString();
|
||||||
|
// }
|
||||||
|
|
||||||
|
}
|
||||||
@@ -3,14 +3,12 @@ package com.njcn.csharmonic.api.fallback;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
|
||||||
import com.njcn.csharmonic.api.EventUserFeignClient;
|
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
|||||||
@@ -120,9 +120,9 @@ public class AnalyseComtradeCfg {
|
|||||||
hashMapA.put("pq_RmsI",rms[3]);
|
hashMapA.put("pq_RmsI",rms[3]);
|
||||||
hashMapB.put("pq_RmsI",rms[4]);
|
hashMapB.put("pq_RmsI",rms[4]);
|
||||||
hashMapC.put("pq_RmsI",rms[5]);
|
hashMapC.put("pq_RmsI",rms[5]);
|
||||||
hashMapA.put("pq_RmsLU",rms[6]);
|
hashMapAB.put("pq_RmsLU",rms[6]);
|
||||||
hashMapB.put("pq_RmsLU",rms[7]);
|
hashMapBC.put("pq_RmsLU",rms[7]);
|
||||||
hashMapC.put("pq_RmsLU",rms[8]);
|
hashMapCA.put("pq_RmsLU",rms[8]);
|
||||||
|
|
||||||
|
|
||||||
// pqdDataA.setpq_RmsU(rms[0]);
|
// pqdDataA.setpq_RmsU(rms[0]);
|
||||||
@@ -239,6 +239,9 @@ public class AnalyseComtradeCfg {
|
|||||||
|
|
||||||
for (int i = 0; i < 50; i++) {
|
for (int i = 0; i < 50; i++) {
|
||||||
//间谐波幅值
|
//间谐波幅值
|
||||||
|
hashMapA.put("pq_InHarmUR_"+(i+1),inHarm[0][i]);
|
||||||
|
hashMapB.put("pq_InHarmUR_"+(i+1),inHarm[1][i]);
|
||||||
|
hashMapC.put("pq_InHarmUR_"+(i+1),inHarm[2][i]);
|
||||||
hashMapA.put("pq_InHarmIAmp_"+(i+1),inHarm[3][i]);
|
hashMapA.put("pq_InHarmIAmp_"+(i+1),inHarm[3][i]);
|
||||||
hashMapB.put("pq_InHarmIAmp_"+(i+1),inHarm[4][i]);
|
hashMapB.put("pq_InHarmIAmp_"+(i+1),inHarm[4][i]);
|
||||||
hashMapC.put("pq_InHarmIAmp_"+(i+1),inHarm[5][i]);
|
hashMapC.put("pq_InHarmIAmp_"+(i+1),inHarm[5][i]);
|
||||||
@@ -260,9 +263,9 @@ public class AnalyseComtradeCfg {
|
|||||||
hashMapB.put("pq_S",totalPower[1][2]);
|
hashMapB.put("pq_S",totalPower[1][2]);
|
||||||
hashMapC.put("pq_S",totalPower[2][2]);
|
hashMapC.put("pq_S",totalPower[2][2]);
|
||||||
|
|
||||||
hashMapM.put("pq_TotHarmP",totalPower[3][0]);
|
hashMapM.put("pq_TotP",totalPower[3][0]);
|
||||||
hashMapM.put("pq_TotHarmQ",totalPower[3][1]);
|
hashMapM.put("pq_TotQ",totalPower[3][1]);
|
||||||
hashMapM.put("pq_TotHarmS",totalPower[3][2]);
|
hashMapM.put("pq_TotS",totalPower[3][2]);
|
||||||
|
|
||||||
/*todo 谐波畸变率,电压波动,电压闪变,电压长闪变会根据监测点接线方式是星型存A,B,C相,角型或者V型存AB,BC,CA相,目前全存在A,B,C相*/
|
/*todo 谐波畸变率,电压波动,电压闪变,电压长闪变会根据监测点接线方式是星型存A,B,C相,角型或者V型存AB,BC,CA相,目前全存在A,B,C相*/
|
||||||
//谐波畸变率
|
//谐波畸变率
|
||||||
@@ -294,9 +297,9 @@ public class AnalyseComtradeCfg {
|
|||||||
hashMapC.put("pq_Fluct",uFluctuation[2]);
|
hashMapC.put("pq_Fluct",uFluctuation[2]);
|
||||||
//电压闪变
|
//电压闪变
|
||||||
Float[] uFlicker = min.getU_Flicker();
|
Float[] uFlicker = min.getU_Flicker();
|
||||||
hashMapA.put("pq_Plt",uFlicker[0]);
|
hashMapA.put("pq_Pst",uFlicker[0]);
|
||||||
hashMapB.put("pq_Plt",uFlicker[1]);
|
hashMapB.put("pq_Pst",uFlicker[1]);
|
||||||
hashMapC.put("pq_Plt",uFlicker[2]);
|
hashMapC.put("pq_Pst",uFlicker[2]);
|
||||||
//电压长闪变
|
//电压长闪变
|
||||||
Float[] ulFlicker = min.getUL_Flicker();
|
Float[] ulFlicker = min.getUL_Flicker();
|
||||||
hashMapA.put("pq_Plt",ulFlicker[0]);
|
hashMapA.put("pq_Plt",ulFlicker[0]);
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ import lombok.NoArgsConstructor;
|
|||||||
|
|
||||||
import javax.validation.constraints.Min;
|
import javax.validation.constraints.Min;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -46,7 +45,4 @@ public class CsEventUserQueryPage extends CsEventUserQueryParam{
|
|||||||
|
|
||||||
@ApiModelProperty(value = "测点id")
|
@ApiModelProperty(value = "测点id")
|
||||||
private String lineId;
|
private String lineId;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -45,10 +45,14 @@ public class CsEventUserQueryParam {
|
|||||||
|
|
||||||
private String level;
|
private String level;
|
||||||
@ApiModelProperty(value="起始时间")
|
@ApiModelProperty(value="起始时间")
|
||||||
// @NotNull(message="起始时间不能为空!")
|
|
||||||
private String startTime;
|
private String startTime;
|
||||||
|
|
||||||
@ApiModelProperty(value="结束时间")
|
@ApiModelProperty(value="结束时间")
|
||||||
// @NotNull(message="结束时间不能为空!")
|
|
||||||
private String endTime;
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "事件类型 Evt_Sys_DipStr:电压暂降 Evt_Sys_SwlStr:电压暂升 Evt_Sys_IntrStr:电压中断")
|
||||||
|
private String eventType;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "位置 grid:电网侧 load:负载侧")
|
||||||
|
private String location;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.csharmonic.param;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DataParam implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("起始时间")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束时间")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("模块编号")
|
||||||
|
private Integer clDid;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标统计类型")
|
||||||
|
private String targetType;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据标志")
|
||||||
|
private String dataLevel;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据来源 0:补召 1:在线监测 ")
|
||||||
|
private Integer dataSource;
|
||||||
|
|
||||||
|
@ApiModelProperty("运行状态 1:离线 2:在线")
|
||||||
|
private Integer comFlag;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,38 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @Description: 在线率日表
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DataOnlineRateDto {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 在线条数
|
||||||
|
*/
|
||||||
|
private Integer onlineMin;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离线条数
|
||||||
|
*/
|
||||||
|
private Integer offlineMin;
|
||||||
|
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public static class Detail extends DataOnlineRateDto{
|
||||||
|
/**
|
||||||
|
* 日期
|
||||||
|
*/
|
||||||
|
private String timeId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置id
|
||||||
|
*/
|
||||||
|
private String devIndex;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DownloadMakeUpDto implements Serializable {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 全文件大小
|
||||||
|
*/
|
||||||
|
private Integer allStep;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 监测点id
|
||||||
|
*/
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置id
|
||||||
|
*/
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件工程名称
|
||||||
|
*/
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 需要补召的文件集合
|
||||||
|
*/
|
||||||
|
private List<String> fileList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.param;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsDataParam implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
@ApiModelProperty("起始时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private String startTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("结束时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
private String endTime;
|
||||||
|
|
||||||
|
private Integer process;
|
||||||
|
|
||||||
|
private List<String> idList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
|||||||
import com.baomidou.mybatisplus.annotation.TableField;
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.baomidou.mybatisplus.annotation.TableId;
|
import com.baomidou.mybatisplus.annotation.TableId;
|
||||||
import com.baomidou.mybatisplus.annotation.TableName;
|
import com.baomidou.mybatisplus.annotation.TableName;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
@@ -43,6 +44,7 @@ public class CsEventPO extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 事件时间
|
* 事件时间
|
||||||
*/
|
*/
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@TableField(value = "start_time")
|
@TableField(value = "start_time")
|
||||||
private LocalDateTime startTime;
|
private LocalDateTime startTime;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,33 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class DataVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("装置id")
|
||||||
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty("装置名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点id")
|
||||||
|
private String lineId;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点名称")
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点数据完整性")
|
||||||
|
private Double lineIntegrity;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端在线率")
|
||||||
|
private Double devOnlineRate;
|
||||||
|
}
|
||||||
@@ -116,8 +116,11 @@ public class EventDetailVO {
|
|||||||
//用于波形分析区别pms,pq
|
//用于波形分析区别pms,pq
|
||||||
private String systemType="ZL";
|
private String systemType="ZL";
|
||||||
|
|
||||||
|
@ApiModelProperty("子模块编号")
|
||||||
|
private String moduleNo;
|
||||||
|
|
||||||
|
|
||||||
|
@ApiModelProperty("逻辑子设备编码")
|
||||||
|
private Integer clDid;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,56 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HalfMonthReportVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("工程名称")
|
||||||
|
private String engineeringName;
|
||||||
|
|
||||||
|
@ApiModelProperty("项目名称")
|
||||||
|
private String projectName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备名称")
|
||||||
|
private String devName;
|
||||||
|
|
||||||
|
@ApiModelProperty("设备型号")
|
||||||
|
private String devType;
|
||||||
|
|
||||||
|
@ApiModelProperty("MAC地址")
|
||||||
|
private String mac;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点名称")
|
||||||
|
private String lineName;
|
||||||
|
|
||||||
|
@ApiModelProperty("运行状态")
|
||||||
|
private String operationalStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("监测点通讯状态")
|
||||||
|
private String communicationStatus;
|
||||||
|
|
||||||
|
@ApiModelProperty("投运时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime operationalTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("最新数据时间")
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private LocalDateTime latestTime;
|
||||||
|
|
||||||
|
@ApiModelProperty("流程状态")
|
||||||
|
private Integer process;
|
||||||
|
|
||||||
|
@ApiModelProperty("数据完整性")
|
||||||
|
private Double integrity;
|
||||||
|
|
||||||
|
@ApiModelProperty("终端在线率")
|
||||||
|
private Double onlineRate;
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.njcn.csharmonic.pojo.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
|
||||||
|
import com.njcn.influx.utils.InstantDateSerializer;
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.time.Instant;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RealTimeDataVo implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("数据时间")
|
||||||
|
@JsonSerialize(using = InstantDateSerializer.class)
|
||||||
|
private Instant time;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标别名")
|
||||||
|
private String otherName;
|
||||||
|
|
||||||
|
@ApiModelProperty("相别")
|
||||||
|
private String phase;
|
||||||
|
|
||||||
|
@ApiModelProperty("单位")
|
||||||
|
private String unit;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty("平均值")
|
||||||
|
private Double avgValue;
|
||||||
|
|
||||||
|
@ApiModelProperty("A相值")
|
||||||
|
private Double valueA;
|
||||||
|
|
||||||
|
@ApiModelProperty("B相值")
|
||||||
|
private Double valueB;
|
||||||
|
|
||||||
|
@ApiModelProperty("C相值")
|
||||||
|
private Double valueC;
|
||||||
|
|
||||||
|
@ApiModelProperty("无相值")
|
||||||
|
private Double valueM;
|
||||||
|
}
|
||||||
@@ -107,7 +107,12 @@
|
|||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.njcn</groupId>
|
<groupId>com.njcn</groupId>
|
||||||
<artifactId>access-api</artifactId>
|
<artifactId>access-api</artifactId>
|
||||||
<version>1.0.0</version>
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.njcn</groupId>
|
||||||
|
<artifactId>zl-event-api</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.baomidou</groupId>
|
<groupId>com.baomidou</groupId>
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.njcn.common.utils.HttpResultUtil;
|
|||||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||||
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||||
@@ -23,7 +24,6 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.time.LocalDateTime;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -91,7 +91,6 @@ public class CsEventController extends BaseController {
|
|||||||
public void getFileZip(String eventId, HttpServletResponse response) {
|
public void getFileZip(String eventId, HttpServletResponse response) {
|
||||||
String methodDescribe = getMethodDescribe("getFileZip");
|
String methodDescribe = getMethodDescribe("getFileZip");
|
||||||
csEventPOService.getFileZip(eventId,response);
|
csEventPOService.getFileZip(eventId,response);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@@ -112,4 +111,14 @@ public class CsEventController extends BaseController {
|
|||||||
CsEventPO po = csEventPOService.lambdaQuery().eq(CsEventPO::getDeviceId,csEventPO.getDeviceId()).eq(CsEventPO::getTag,csEventPO.getTag()).eq(CsEventPO::getStartTime,csEventPO.getStartTime()).one();
|
CsEventPO po = csEventPOService.lambdaQuery().eq(CsEventPO::getDeviceId,csEventPO.getDeviceId()).eq(CsEventPO::getTag,csEventPO.getTag()).eq(CsEventPO::getStartTime,csEventPO.getStartTime()).one();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/queryByModelId")
|
||||||
|
@ApiOperation("获取各模块事件")
|
||||||
|
public HttpResult<List<CsEventPO>> queryByModelId(@RequestBody DataParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("queryByModelId");
|
||||||
|
List<CsEventPO> list = csEventPOService.queryByModelId(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.njcn.csharmonic.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.EachModuleVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.RecordVo;
|
||||||
|
import com.njcn.csharmonic.param.DataParam;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.RealTimeDataVo;
|
||||||
|
import com.njcn.csharmonic.service.IDataService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/data")
|
||||||
|
@Api(tags = "装置数据")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class DataController extends BaseController {
|
||||||
|
|
||||||
|
private final IDataService dataService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/realTimeData")
|
||||||
|
@ApiOperation("设备监控-》准实时数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<RealTimeDataVo>> realTimeData(@RequestBody DataParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("realTimeData");
|
||||||
|
List<RealTimeDataVo> list = dataService.getRealTimeData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getTestData")
|
||||||
|
@ApiOperation("设备监控-》测试项数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<RecordVo>> getTestData(@RequestBody DataParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("getTestData");
|
||||||
|
List<RecordVo> list = dataService.getTestData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getEventByItem")
|
||||||
|
@ApiOperation("方案数据-》根据测试项获取暂态事件")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<List<DataGroupEventVO>> getEventByItem(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getEventByItem");
|
||||||
|
List<DataGroupEventVO> list = dataService.getEventByItem(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/allModelData")
|
||||||
|
@ApiOperation("设备监控-》模块数据")
|
||||||
|
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||||
|
public HttpResult<List<EachModuleVO>> allModelData(@RequestBody DataParam param) {
|
||||||
|
String methodDescribe = getMethodDescribe("allModelData");
|
||||||
|
List<EachModuleVO> list = dataService.allModelData(param);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getModuleState")
|
||||||
|
@ApiOperation("apf-》获取模块状态")
|
||||||
|
@ApiImplicitParam(name = "id", value = "id", required = true)
|
||||||
|
public HttpResult<List<EachModuleVO>> getModuleState(@RequestParam("id") String id) {
|
||||||
|
String methodDescribe = getMethodDescribe("getModuleState");
|
||||||
|
List<EachModuleVO> list = dataService.getModuleState(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -74,12 +74,16 @@ public class OfflineDataUploadController extends BaseController {
|
|||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping(value = "/makeUp")
|
@PostMapping(value = "/makeUp")
|
||||||
@ApiOperation("设备补招")
|
@ApiOperation("设备补召")
|
||||||
@ApiImplicitParam(name = "param", value = "补招参数", required = true)
|
@ApiImplicitParam(name = "param", value = "补招参数", required = true)
|
||||||
public HttpResult<String> makeUp(@RequestBody MakeUpParam param) {
|
public HttpResult<String> makeUp(@RequestBody MakeUpParam param) {
|
||||||
String methodDescribe = getMethodDescribe("makeUp");
|
String methodDescribe = getMethodDescribe("makeUp");
|
||||||
offlineDataUploadService.startMakeUpData(param);
|
boolean result = offlineDataUploadService.startMakeUpData(param);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
if (result) {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, "文件补召中,请稍后", methodDescribe);
|
||||||
|
} else {
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.FAIL, "文件补召失败", methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user