Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e7ba886b94 | |||
| c0cccc3479 | |||
| dbe09d70f4 | |||
| 33da822317 | |||
| 720afd42df | |||
| fc7694a1db | |||
| 349ee472d9 | |||
| 844f30965e | |||
| 6e0a36fd80 | |||
| bd1fb82532 |
@@ -3,9 +3,11 @@ 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.AppProjectClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
@@ -19,4 +21,11 @@ public interface AppProjectFeignClient {
|
||||
|
||||
@PostMapping("/queryProjectById")
|
||||
HttpResult<List<AppProjectPO>> queryProjectById(@RequestParam("ids") List<String> ids);
|
||||
|
||||
@PostMapping("/getProjectByName")
|
||||
HttpResult<AppProjectPO> getProjectByName(@RequestParam("name") String name);
|
||||
|
||||
@PostMapping("/addAppProject")
|
||||
HttpResult<AppProjectPO> addAppProject(@RequestBody AppProjectAddParm appProjectAddParm);
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,8 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsDeviceUserClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -29,4 +31,11 @@ public interface CsDeviceUserFeignClient {
|
||||
|
||||
@PostMapping("/channelDevByUserId")
|
||||
HttpResult<List<String>> channelDevByUserId(@RequestBody UserDevParam param);
|
||||
|
||||
@PostMapping("/queryUserById")
|
||||
HttpResult<DevUserVO> queryUserById(@RequestParam("devId") String devId);
|
||||
|
||||
@PostMapping("/getList")
|
||||
@ApiOperation("根据设备集合获取数据")
|
||||
HttpResult<List<CsDeviceUserPO>> getList(@RequestBody UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -35,6 +35,10 @@ public interface CsLedgerFeignClient {
|
||||
@PostMapping("/queryDevDetail")
|
||||
HttpResult<DevDetailDTO> queryDevDetail(@RequestParam("devId") String devId);
|
||||
|
||||
@PostMapping("/lineTree")
|
||||
@ApiOperation("五层设备树(监测点层,根节点为治理设备和便携式设备)")
|
||||
HttpResult<List<CsLedgerVO>> lineTree();
|
||||
|
||||
@PostMapping("/deviceTree")
|
||||
@ApiOperation("三层设备树(装置层)")
|
||||
HttpResult<List<CsLedgerVO>> getDeviceTree();
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.CsLineClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -68,6 +69,9 @@ public interface CsLineFeignClient {
|
||||
@PostMapping("/getAllLine")
|
||||
HttpResult<List<String>> getAllLine();
|
||||
|
||||
@PostMapping("/getAllLineDetail")
|
||||
HttpResult<List<CsLineDTO>> getAllLineDetail();
|
||||
|
||||
@PostMapping("/getOverLimitDataByIds")
|
||||
HttpResult<List<Overlimit>> getOverLimitData(@RequestBody List<String> ids);
|
||||
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.fallback.CsMarketDataClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
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 = "/csMarketData", fallbackFactory = CsMarketDataClientFallbackFactory.class,contextId = "csMarketData")
|
||||
public interface CsMarketDataFeignClient {
|
||||
|
||||
@PostMapping("/insert")
|
||||
HttpResult<Boolean> insertData(@RequestParam("userId")String userId, @RequestParam("engineeringId")String engineeringId);
|
||||
|
||||
@PostMapping("/queryByUseId")
|
||||
HttpResult<List<CsMarketDataVO>> queryByUseId(@RequestParam("userId")String userId);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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.ProcessFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.po.CsUserPins;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csUserPins", fallbackFactory = ProcessFeignClientFallbackFactory.class,contextId = "csUserPins")
|
||||
|
||||
public interface CsUserPinsFeignClient {
|
||||
|
||||
@PostMapping("/getPinToTopList")
|
||||
HttpResult<List<CsUserPins>> getPinToTopList();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.AppProjectClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/engineering", fallbackFactory = AppProjectClientFallbackFactory.class,contextId = "engineering")
|
||||
public interface EngineeringFeignClient {
|
||||
|
||||
@PostMapping("/queryEngineering")
|
||||
HttpResult<List<CsEngineeringVO>> queryEngineering(@Validated @RequestBody CsEngineeringQueryParm csEngineeringQueryParm);
|
||||
|
||||
@PostMapping("/getEngineeringByName")
|
||||
HttpResult<CsEngineeringPO> getEngineeringByName(@RequestParam("name") String name);
|
||||
|
||||
@PostMapping("/addEngineering")
|
||||
HttpResult<CsEngineeringPO> addEngineering(@Validated @RequestBody CsEngineeringAddParm csEngineeringAddParm);
|
||||
}
|
||||
@@ -1,22 +1,14 @@
|
||||
package com.njcn.csdevice.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.api.fallback.EquipmentFeignClientFallbackFactory;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -59,6 +51,9 @@ public interface EquipmentFeignClient {
|
||||
@PostMapping("/updateModuleNumber")
|
||||
HttpResult<String> updateModuleNumber(@RequestParam("nDid") String nDid,@RequestParam("number") Integer number);
|
||||
|
||||
@PostMapping("/updateLedger")
|
||||
HttpResult<String> updateLedger(@RequestParam("nDid") String nDid,@RequestParam("engineeringId") String engineeringId,@RequestParam("projectId") String projectId);
|
||||
|
||||
@PostMapping("/getAll")
|
||||
HttpResult<List<CsEquipmentDeliveryPO>> getAll();
|
||||
|
||||
@@ -72,5 +67,5 @@ public interface EquipmentFeignClient {
|
||||
HttpResult<Boolean> updateCldDevStatus(@RequestParam("nodeId") String nodeId, @RequestParam("processNo") Integer processNo);
|
||||
|
||||
@PostMapping("/flipCldDevStatus")
|
||||
HttpResult<Boolean> flipCldDevStatus(@RequestParam("devId") String devId, @RequestParam("status") Integer status);
|
||||
HttpResult<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status);
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ 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.param.IcdBzParam;
|
||||
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 org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,6 +19,6 @@ import java.util.List;
|
||||
public interface IntegrityFeignClient {
|
||||
|
||||
@PostMapping("/list")
|
||||
HttpResult<List<RStatIntegrityD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
|
||||
HttpResult<List<RStatIntegrityD>> list(@RequestBody @Validated IcdBzParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -3,11 +3,12 @@ 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.param.IcdBzParam;
|
||||
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 org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -18,6 +19,6 @@ import java.util.List;
|
||||
public interface OnlineRateFeignClient {
|
||||
|
||||
@PostMapping("/list")
|
||||
HttpResult<List<RStatOnlineRateD>> list(@Validated @RequestParam("list") List<String> list, @RequestParam("startTime") String startTime, @RequestParam("endTime") String endTime);
|
||||
HttpResult<List<RStatOnlineRateD>> list(@RequestBody @Validated IcdBzParam param);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.AppProjectFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.AppProjectAddParm;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -32,6 +33,18 @@ public class AppProjectClientFallbackFactory implements FallbackFactory<AppProje
|
||||
log.error("{}异常,降级处理,异常为:{}","获取项目详情接口异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<AppProjectPO> getProjectByName(String name) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据项目名称获取项目信息异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<AppProjectPO> addAppProject(AppProjectAddParm appProjectAddParm) {
|
||||
log.error("{}异常,降级处理,异常为:{}","新增项目异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsDeviceUserFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.UserDevParam;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
@@ -51,6 +52,18 @@ public class CsDeviceUserClientFallbackFactory implements FallbackFactory<CsDevi
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<DevUserVO> queryUserById(String devId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取设备主/子用户数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsDeviceUserPO>> getList(UserDevParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据设备集合获取数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,12 @@ public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLed
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLedgerVO>> lineTree() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询监测点数数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLedgerVO>> getDeviceTree() {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询设备树",cause.toString());
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.CsLineFeignClient;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -103,6 +104,12 @@ public class CsLineClientFallbackFactory implements FallbackFactory<CsLineFeignC
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsLineDTO>> getAllLineDetail() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取系统中所有监测点id详情异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<Overlimit>> getOverLimitData(List<String> ids) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据监测点id集合获取国标限值异常",cause.toString());
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
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.CsMarketDataFeignClient;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsMarketDataClientFallbackFactory implements FallbackFactory<CsMarketDataFeignClient> {
|
||||
@Override
|
||||
public CsMarketDataFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsMarketDataFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> insertData(String userId, String engineeringId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据用户、工程新增数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsMarketDataVO>> queryByUseId(String userId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询营销,工程数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.njcn.csdevice.api.fallback;
|
||||
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csdevice.api.CsUserPinsFeignClient;
|
||||
import com.njcn.csdevice.pojo.po.CsUserPins;
|
||||
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2023/4/10 20:09
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsUserPinsFeignClientFallbackFactory implements FallbackFactory<CsUserPinsFeignClient> {
|
||||
@Override
|
||||
public CsUserPinsFeignClient 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 CsUserPinsFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsUserPins>> getPinToTopList() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取用户置顶设备(工程)数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
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.EngineeringFeignClient;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEngineeringQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.vo.CsEngineeringVO;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class EngineeringClientFallbackFactory implements FallbackFactory<EngineeringFeignClient> {
|
||||
@Override
|
||||
public EngineeringFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new EngineeringFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsEngineeringVO>> queryEngineering(CsEngineeringQueryParm csEngineeringQueryParm) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询工程列表接口异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEngineeringPO> getEngineeringByName(String name) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据工程名称获取工程信息异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<CsEngineeringPO> addEngineering(CsEngineeringAddParm csEngineeringAddParm) {
|
||||
log.error("{}异常,降级处理,异常为:{}","新增工程异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -72,6 +72,12 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> updateLedger(String nDid, String engineeringId, String projectId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","更新设备预设工程和项目id数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsEquipmentDeliveryPO>> getAll() {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取所有装置",cause.toString());
|
||||
@@ -97,7 +103,7 @@ public class EquipmentFeignClientFallbackFactory implements FallbackFactory<Equi
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> flipCldDevStatus(String devId, Integer status) {
|
||||
public HttpResult<Boolean> flipCldDevStatus(String date, String devId, Integer status) {
|
||||
log.error("{}异常,降级处理,异常为:{}","云前置设备状态翻转",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.param.IcdBzParam;
|
||||
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -26,9 +27,8 @@ public class IntegrityClientFallbackFactory implements FallbackFactory<Integrity
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new IntegrityFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<RStatIntegrityD>> list(List<String> list, String startTime, String endTime) {
|
||||
public HttpResult<List<RStatIntegrityD>> list(IcdBzParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.param.IcdBzParam;
|
||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -28,7 +29,7 @@ public class onlineRateClientFallbackFactory implements FallbackFactory<OnlineRa
|
||||
return new OnlineRateFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<List<RStatOnlineRateD>> list(List<String> list, String startTime, String endTime) {
|
||||
public HttpResult<List<RStatOnlineRateD>> list(IcdBzParam param) {
|
||||
log.error("{}异常,降级处理,异常为:{}","查询数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.njcn.csdevice.param;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Data
|
||||
public class CsUserPinsParam implements Serializable {
|
||||
|
||||
@ApiModelProperty("用户id")
|
||||
@NotBlank(message = "用户id")
|
||||
private String userId;
|
||||
|
||||
@ApiModelProperty("目标类型:1-设备,2-工程")
|
||||
@NotNull(message = "目标类型:1-设备,2-工程")
|
||||
private Integer targetType;
|
||||
|
||||
@ApiModelProperty("目标ID(设备ID或工程ID)")
|
||||
@NotBlank(message = "目标ID(设备ID或工程ID)不能为空")
|
||||
private String targetId;
|
||||
|
||||
}
|
||||
@@ -100,4 +100,19 @@ public class CsEquipmentDeliveryDTO {
|
||||
|
||||
private Integer moduleNumber;
|
||||
private Integer process;
|
||||
|
||||
/**
|
||||
* 前置服务器IP
|
||||
*/
|
||||
private String nodeId;
|
||||
|
||||
/**
|
||||
* 前置进程号
|
||||
*/
|
||||
private Integer nodeProcess;
|
||||
|
||||
/**
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
private String devLogLevel;
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.njcn.csdevice.pojo.dto;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class CsLineDTO implements Serializable {
|
||||
/**
|
||||
* 监测点id
|
||||
*/
|
||||
private String lineId;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
private String deviceId;
|
||||
|
||||
/**
|
||||
* 装置id
|
||||
*/
|
||||
private String deviceType;
|
||||
|
||||
|
||||
/**
|
||||
* 监测点名称
|
||||
*/
|
||||
private String name;
|
||||
|
||||
/**
|
||||
* 字典表:安装位置(负载侧,电网侧, 输出侧)
|
||||
*/
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 数据集id
|
||||
*/
|
||||
private String dataSetId;
|
||||
|
||||
/**
|
||||
* 模板id
|
||||
*/
|
||||
private String dataModelId;
|
||||
|
||||
/**
|
||||
* 电压等级
|
||||
*/
|
||||
private Double volGrade;
|
||||
|
||||
/**
|
||||
* PT变比
|
||||
*/
|
||||
private Double ptRatio;
|
||||
|
||||
/**
|
||||
* PT2次变比
|
||||
*/
|
||||
private Double pt2Ratio;
|
||||
|
||||
/**
|
||||
* CT变比
|
||||
*/
|
||||
private Double ctRatio;
|
||||
|
||||
/**
|
||||
* CT2变比
|
||||
*/
|
||||
private Double ct2Ratio;
|
||||
|
||||
/**
|
||||
* 状态(0:删除 1:正常)
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 接线方式(0-星型 1-角型 2-V型)
|
||||
*/
|
||||
private Integer conType;
|
||||
|
||||
/**
|
||||
* 逻辑子设备id(与模板对应)
|
||||
*/
|
||||
private Integer clDid;
|
||||
|
||||
|
||||
/**
|
||||
* 监测点统计间隔
|
||||
*/
|
||||
private Integer lineInterval;
|
||||
|
||||
/**
|
||||
* 运行状态
|
||||
*/
|
||||
private Integer runStatus;
|
||||
|
||||
/**
|
||||
* 监测点线路号
|
||||
*/
|
||||
private Integer lineNo;
|
||||
/**
|
||||
* 监测对象类型
|
||||
*/
|
||||
private String monitorObj;
|
||||
/**
|
||||
* 是否治理(0:未治理 1:已治理)
|
||||
*/
|
||||
private Integer govern;
|
||||
|
||||
private String monitorUser;
|
||||
|
||||
/**
|
||||
* 短路容量
|
||||
*/
|
||||
private Double shortCircuitCapacity;
|
||||
|
||||
/**
|
||||
* 设备容量
|
||||
*/
|
||||
private Double devCapacity;
|
||||
|
||||
/**
|
||||
* 基准容量
|
||||
*/
|
||||
private Double basicCapacity;
|
||||
|
||||
/**
|
||||
* 协议容量
|
||||
*/
|
||||
private Double protocolCapacity;
|
||||
|
||||
/**
|
||||
* 治理报告文件路径
|
||||
*/
|
||||
private String reportFilePath;
|
||||
|
||||
/**
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
private String lineLogLevel;
|
||||
|
||||
/**
|
||||
* 是否是主要监测点(0: 不是 1:是)
|
||||
*/
|
||||
|
||||
private Integer isImportant;
|
||||
}
|
||||
@@ -31,4 +31,10 @@ public class DevDetailDTO {
|
||||
|
||||
@ApiModelProperty(value = "设备名称")
|
||||
private String equipmentName;
|
||||
|
||||
@ApiModelProperty(value = "设备通讯状态")
|
||||
private Integer runStatus;
|
||||
|
||||
@ApiModelProperty(value = "设备MAC地址")
|
||||
private String devMac;
|
||||
}
|
||||
|
||||
@@ -3,6 +3,8 @@ package com.njcn.csdevice.pojo.dto;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/8/1 15:25【需求编号】
|
||||
@@ -26,4 +28,29 @@ public class LineParamDTO {
|
||||
|
||||
@ApiModelProperty(value = "监测点id")
|
||||
private String lineId;
|
||||
|
||||
@ApiModelProperty(value = "时间类型 0:日报 1:月报")
|
||||
private Integer timeType;
|
||||
|
||||
@ApiModelProperty(value = "时间")
|
||||
private String time;
|
||||
|
||||
@ApiModelProperty(value = "起始时间")
|
||||
private String startTime;
|
||||
|
||||
@ApiModelProperty(value = "结束时间")
|
||||
private String endTime;
|
||||
|
||||
@ApiModelProperty(value = "集合")
|
||||
private List<String> list;
|
||||
|
||||
@Data
|
||||
public static class DevParamDTO {
|
||||
|
||||
@ApiModelProperty(value = "时间")
|
||||
private String time;
|
||||
|
||||
@ApiModelProperty(value = "设备id集合")
|
||||
private List<String> devList;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,4 +97,13 @@ public class CsEquipmentDeliveryAddParm implements Serializable {
|
||||
@ApiModelProperty(value="项目id")
|
||||
private String projectId;
|
||||
|
||||
@ApiModelProperty(value="日志等级(NORMAL、DEBUG、WARN、ERROR)")
|
||||
private String devLogLevel;
|
||||
|
||||
@ApiModelProperty(value="所属工程")
|
||||
private String associatedEngineering;
|
||||
|
||||
@ApiModelProperty(value="所属项目")
|
||||
private String associatedProject;
|
||||
|
||||
}
|
||||
@@ -101,4 +101,13 @@ public class CsEquipmentDeliveryAuditParm {
|
||||
|
||||
@ApiModelProperty(value="前置机进程号")
|
||||
private Integer nodeProcess;
|
||||
|
||||
@ApiModelProperty(value="日志等级(NORMAL、DEBUG、WARN、ERROR)")
|
||||
private String devLogLevel;
|
||||
|
||||
@ApiModelProperty(value="所属工程")
|
||||
private String associatedEngineering;
|
||||
|
||||
@ApiModelProperty(value="所属项目")
|
||||
private String associatedProject;
|
||||
}
|
||||
@@ -56,6 +56,8 @@ public class CsLedgerParam extends BaseEntity {
|
||||
@NotBlank(message = "台账表Id不能为空")
|
||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = ValidMessage.ID_FORMAT_ERROR)
|
||||
private String id;
|
||||
|
||||
private String pids;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -145,6 +145,14 @@ public class CsLineParam extends BaseEntity {
|
||||
*/
|
||||
private String position;
|
||||
|
||||
/**
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
private String lineLogLevel;
|
||||
|
||||
/**
|
||||
* 是否是主要监测点(0: 不是 1:是)
|
||||
*/
|
||||
private Integer isImportant;
|
||||
|
||||
}
|
||||
@@ -28,26 +28,18 @@ public class AppProjectPO extends BaseEntity {
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID)
|
||||
private String id;
|
||||
|
||||
|
||||
/**
|
||||
* 项目名称
|
||||
*/
|
||||
@TableField(value = "name")
|
||||
private String name;
|
||||
|
||||
// @TableField(value = "engineering_id")
|
||||
// private String engineeringId;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 地市Id
|
||||
*/
|
||||
@TableField(value = "area")
|
||||
private String area;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 0:删除 1:正常
|
||||
*/
|
||||
|
||||
@@ -130,4 +130,22 @@ public class CsEquipmentDeliveryPO extends BaseEntity {
|
||||
@TableField(value = "node_process")
|
||||
private Integer nodeProcess;
|
||||
|
||||
/**
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
@TableField(value = "dev_log_level")
|
||||
private String devLogLevel;
|
||||
|
||||
/**
|
||||
* 所属工程
|
||||
*/
|
||||
@TableField(value = "associated_engineering")
|
||||
private String associatedEngineering;
|
||||
|
||||
/**
|
||||
* 所属项目
|
||||
*/
|
||||
@TableField(value = "associated_project")
|
||||
private String associatedProject;
|
||||
|
||||
}
|
||||
@@ -165,4 +165,16 @@ public class CsLinePO extends BaseEntity {
|
||||
*/
|
||||
@TableField(value = "report_file_path")
|
||||
private String reportFilePath;
|
||||
|
||||
/**
|
||||
* 日志等级(NORMAL、DEBUG、WARN、ERROR)
|
||||
*/
|
||||
@TableField(value = "line_log_level")
|
||||
private String lineLogLevel;
|
||||
|
||||
/**
|
||||
* 是否是主要监测点(0: 不是 1:是)
|
||||
*/
|
||||
@TableField(value = "is_important")
|
||||
private Integer isImportant;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package com.njcn.csdevice.pojo.po;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.njcn.db.bo.BaseEntity;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户置顶表
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-03-04
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@TableName("cs_user_pins")
|
||||
public class CsUserPins extends BaseEntity implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 主键ID
|
||||
*/
|
||||
private String id;
|
||||
|
||||
/**
|
||||
* 用户ID
|
||||
*/
|
||||
private String userId;
|
||||
|
||||
/**
|
||||
* 目标类型:1-设备,2-工程
|
||||
*/
|
||||
private Integer targetType;
|
||||
|
||||
/**
|
||||
* 目标ID(设备ID或工程ID)
|
||||
*/
|
||||
private String targetId;
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class CldLedgerVo implements Serializable {
|
||||
private String engineeringDescription;
|
||||
|
||||
@ApiModelProperty(value = "项目信息")
|
||||
private List<AppProjectPO> projectInfoList;
|
||||
private List<ProjectVO> projectInfoList;
|
||||
|
||||
@ApiModelProperty(value = "设备信息")
|
||||
private List<CsEquipmentDeliveryPO> deviceInfoList;
|
||||
@@ -39,4 +39,7 @@ public class CldLedgerVo implements Serializable {
|
||||
@ApiModelProperty(value = "监测点信息")
|
||||
private List<CsLinePO> lineInfoList;
|
||||
|
||||
@ApiModelProperty("工程排序")
|
||||
private Integer sort;
|
||||
|
||||
}
|
||||
@@ -67,5 +67,6 @@ public class CsEngineeringVO extends BaseEntity {
|
||||
@ApiModelProperty(value = "状态")
|
||||
private String status;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -94,4 +94,16 @@ public class CsEquipmentDeliveryVO extends BaseEntity {
|
||||
@ApiModelProperty(value="前置服务器id")
|
||||
private String nodeId ;
|
||||
|
||||
@ApiModelProperty(value="所属工程id")
|
||||
private String associatedEngineering;
|
||||
|
||||
@ApiModelProperty(value="所属工程名称")
|
||||
private String associatedEngineeringName;
|
||||
|
||||
@ApiModelProperty(value="所属项目id")
|
||||
private String associatedProject;
|
||||
|
||||
@ApiModelProperty(value="所属项目名称")
|
||||
private String associatedProjectName;
|
||||
|
||||
}
|
||||
@@ -69,6 +69,12 @@ public class CsLedgerVO implements Serializable {
|
||||
@ApiModelProperty(name = "process",value = "流程状态")
|
||||
private Integer process;
|
||||
|
||||
@ApiModelProperty(name = "isTop",value = "是否置顶,默认不置顶")
|
||||
private Integer isTop = 0;
|
||||
|
||||
@ApiModelProperty(name = "devConType",value = "设备连接方式 MQTT || CLD")
|
||||
private String devConType;
|
||||
|
||||
@ApiModelProperty(name = "children",value = "子节点")
|
||||
private List<CsLedgerVO> children = new ArrayList<>();
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -15,54 +16,59 @@ import java.util.List;
|
||||
*/
|
||||
|
||||
@Data
|
||||
public class DevCountVO {
|
||||
//
|
||||
@ApiModelProperty(value = "设备在线总数")
|
||||
private Integer onLineDevCount;
|
||||
public class DevCountVO implements Serializable {
|
||||
|
||||
/** 所有工程相关数据 **/
|
||||
@ApiModelProperty(value = "所有工程设备在线总数")
|
||||
private Integer onLineDevCount = 0;
|
||||
private List<CsEquipmentDeliveryPO> onLineDevs;
|
||||
|
||||
@ApiModelProperty(value = "设备离线总数")
|
||||
private Integer offLineDevCount;
|
||||
@ApiModelProperty(value = "所有工程设备离线总数")
|
||||
private Integer offLineDevCount = 0;
|
||||
private List<CsEquipmentDeliveryPO> offLineDevs;
|
||||
@ApiModelProperty(value = "警告数")
|
||||
private Integer alarmCount;
|
||||
@ApiModelProperty(value = "事件数")
|
||||
private Integer eventCount;
|
||||
|
||||
@ApiModelProperty(value = "所有工程暂态事件数量(未读)")
|
||||
private Integer eventCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "所有工程稳态事件数量(未读)")
|
||||
private Integer harmonicCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "所有工程运行告警数量(未读)")
|
||||
private Integer alarmCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "所有工程运行事件数量(未读)")
|
||||
private Integer runCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "工程个数")
|
||||
private Integer eningerCount;
|
||||
|
||||
@ApiModelProperty(value = "运行事件数")
|
||||
private Integer runCount;
|
||||
@ApiModelProperty(value = "稳态件数")
|
||||
private Integer harmonicCount;
|
||||
private Integer eningerCount = 0;
|
||||
|
||||
/** 当前工程相关数据 **/
|
||||
@ApiModelProperty(value = "当前工程id")
|
||||
private String currentId;
|
||||
|
||||
@ApiModelProperty(value = "当前工程设备在线总数")
|
||||
private Integer currentOnLineDevCount;
|
||||
private Integer currentOnLineDevCount = 0;
|
||||
private List<CsEquipmentDeliveryPO> currentOnLineDevs;
|
||||
|
||||
@ApiModelProperty(value = "当前工程设备离线总数")
|
||||
private Integer currentOffLineDevCount;
|
||||
private Integer currentOffLineDevCount = 0;
|
||||
private List<CsEquipmentDeliveryPO> currentOffLineDevs;
|
||||
|
||||
@ApiModelProperty(value = "设备警告数")
|
||||
private Integer currentAlarmCount;
|
||||
@ApiModelProperty(value = "暂态事件数")
|
||||
private Integer currentEventCount;
|
||||
@ApiModelProperty(value = "运行事件数")
|
||||
private Integer currentRunCount;
|
||||
@ApiModelProperty(value = "稳态件数")
|
||||
private Integer currentHarmonicCount;
|
||||
@ApiModelProperty(value = "当前工程暂态事件数量(未读)")
|
||||
private Integer currentEventCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "当前工程稳态事件数量(未读)")
|
||||
private Integer currentHarmonicCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "当前工程运行告警数量(未读)")
|
||||
private Integer currentAlarmCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "当前工程运行事件数量(未读)")
|
||||
private Integer currentRunCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "当前项目数")
|
||||
private Integer currentProjectCount;
|
||||
private Integer currentProjectCount = 0;
|
||||
|
||||
@ApiModelProperty(value = "反馈数")
|
||||
private Integer feedBackCount;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
private Integer feedBackCount = 0;
|
||||
}
|
||||
|
||||
@@ -6,7 +6,9 @@ import lombok.Data;
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
//台账信息
|
||||
/**
|
||||
* @author xy
|
||||
*/ //台账信息
|
||||
@Data
|
||||
public class DeviceInfo implements Serializable {
|
||||
|
||||
@@ -31,6 +33,9 @@ public class DeviceInfo implements Serializable {
|
||||
@ApiModelProperty("对时启动标志")
|
||||
private boolean rightTime;
|
||||
|
||||
@ApiModelProperty("终端日志等级")
|
||||
private String devLogLevel;
|
||||
|
||||
@ApiModelProperty("监测点集合")
|
||||
private List<MonitorInfo> monitorData;
|
||||
|
||||
@@ -70,6 +75,9 @@ public class DeviceInfo implements Serializable {
|
||||
|
||||
@ApiModelProperty("ct2")
|
||||
private Double ct2;
|
||||
|
||||
@ApiModelProperty("监测点日志等级")
|
||||
private String lineLogLevel;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 类的介绍:
|
||||
*
|
||||
* @author xuyang
|
||||
* @version 1.0.0
|
||||
* @createTime 2026/3/5
|
||||
*/
|
||||
@Data
|
||||
public class EngineeringHomePageVO implements Serializable {
|
||||
|
||||
@ApiModelProperty(name = "engineeringId",value = "工程id")
|
||||
private String engineeringId;
|
||||
|
||||
@ApiModelProperty(name = "engineeringName",value = "工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty(name = "devTotal",value = "设备总数")
|
||||
private Integer devTotal = 0;
|
||||
|
||||
@ApiModelProperty(name = "onlineDevTotal",value = "在线设备数")
|
||||
private Integer onlineDevTotal = 0;
|
||||
|
||||
@ApiModelProperty(name = "offlineDevTotal",value = "离线设备数")
|
||||
private Integer offlineDevTotal = 0;
|
||||
|
||||
@ApiModelProperty(name = "alarmTotal",value = "告警数量(未读)")
|
||||
private Integer alarmTotal = 0;
|
||||
|
||||
@ApiModelProperty(name = "isTop",value = "是否置顶 0:未置顶 1:已置顶")
|
||||
private Integer isTop = 0;
|
||||
|
||||
@ApiModelProperty(name = "sort",value = "排序")
|
||||
private Integer sort;
|
||||
}
|
||||
@@ -20,8 +20,14 @@ public class EngineeringProjectRelationVo implements Serializable {
|
||||
@ApiModelProperty("工程名称")
|
||||
private String engineeringName;
|
||||
|
||||
@ApiModelProperty("区域")
|
||||
private String engineeringArea;
|
||||
@ApiModelProperty("省ID")
|
||||
private String provinceId;
|
||||
|
||||
@ApiModelProperty("市ID")
|
||||
private String cityId;
|
||||
|
||||
@ApiModelProperty("区域名称")
|
||||
private String engineeringAreaName;
|
||||
|
||||
@ApiModelProperty("工程备注")
|
||||
private String engineeringRemark;
|
||||
@@ -51,6 +57,9 @@ public class EngineeringProjectRelationVo implements Serializable {
|
||||
@ApiModelProperty("项目排序")
|
||||
private Integer projectSort;
|
||||
|
||||
@ApiModelProperty("拓扑图id")
|
||||
private String topologyInfoId;
|
||||
|
||||
@ApiModelProperty("拓扑图信息")
|
||||
private String topologyInfo;
|
||||
|
||||
|
||||
@@ -132,4 +132,7 @@ public class LineDetailDataVO {
|
||||
|
||||
@ApiModelProperty(name = "对象类型大类")
|
||||
private String bigObjType;
|
||||
|
||||
@ApiModelProperty(name = "监测点数据类型 一次值:Primary 二次值:Secondary")
|
||||
private String dataLevel;
|
||||
}
|
||||
|
||||
@@ -1,8 +1,11 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -54,4 +57,16 @@ public class ProjectEquipmentVO {
|
||||
@ApiModelProperty(value = "设备nDid")
|
||||
private String nDid;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否置顶(0:未置顶 1:置顶),默认是0")
|
||||
private Integer isTop = 0;
|
||||
|
||||
@ApiModelProperty(value = "设备类型(监测设备:DEV_CLD 治理设备:Direct_Connected_Device)")
|
||||
private String devType;
|
||||
|
||||
@ApiModelProperty(value = "监测点集合")
|
||||
private List<CsLinePO> lineList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.njcn.csdevice.pojo.vo;
|
||||
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @author 徐扬
|
||||
*/
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@Data
|
||||
public class ProjectVO extends AppProjectPO {
|
||||
|
||||
private String topoId;
|
||||
}
|
||||
@@ -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.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.csdevice.pojo.po.RStatIntegrityD;
|
||||
import com.njcn.csdevice.service.IRStatIntegrityDService;
|
||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||
@@ -50,9 +51,9 @@ public class RStatIntegrityDController extends BaseController {
|
||||
@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){
|
||||
public HttpResult<List<RStatIntegrityD>> list(@RequestBody @Validated IcdBzParam param){
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<RStatIntegrityD> result = irStatIntegrityDService.getData(list,startTime,endTime);
|
||||
List<RStatIntegrityD> result = irStatIntegrityDService.getData(param.getLineList(),param.getStartTime(),param.getEndTime());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, 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.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.param.IcdBzParam;
|
||||
import com.njcn.csdevice.pojo.po.RStatOnlineRateD;
|
||||
import com.njcn.csdevice.service.IRStatOnlineRateDService;
|
||||
import com.njcn.csharmonic.pojo.param.StatisticsDataParam;
|
||||
@@ -16,7 +17,10 @@ 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 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;
|
||||
|
||||
@@ -50,9 +54,9 @@ public class RStatOnlineRateDController extends BaseController {
|
||||
@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){
|
||||
public HttpResult<List<RStatOnlineRateD>> list(@RequestBody @Validated IcdBzParam param){
|
||||
String methodDescribe = getMethodDescribe("list");
|
||||
List<RStatOnlineRateD> result = rStatOnlineRateDService.getData(list,startTime,endTime);
|
||||
List<RStatOnlineRateD> result = rStatOnlineRateDService.getData(param.getLineList(),param.getStartTime(),param.getEndTime());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.njcn.web.advice.DeviceLog;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -77,11 +78,13 @@ public class DeviceUserController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/devCount")
|
||||
@ApiOperation("设备统计")
|
||||
@ApiImplicitParam(name = "id", value = "工程id", required = true)
|
||||
public HttpResult<DevCountVO> devCount(@RequestParam("id") String id){
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "id", value = "工程id"),
|
||||
@ApiImplicitParam(name = "time", value = "时间")
|
||||
})
|
||||
public HttpResult<DevCountVO> devCount(@RequestParam("id") String id,@RequestParam("time") String time){
|
||||
String methodDescribe = getMethodDescribe("devCount");
|
||||
|
||||
DevCountVO result = csDeviceUserPOService.devCount (id);
|
||||
DevCountVO result = csDeviceUserPOService.devCount(id,time);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@@ -161,4 +164,14 @@ public class DeviceUserController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getList")
|
||||
@ApiOperation("根据设备集合获取数据")
|
||||
@ApiImplicitParam(name = "param", value = "参数", required = true)
|
||||
public HttpResult<List<CsDeviceUserPO>> getList(@RequestBody UserDevParam param){
|
||||
String methodDescribe = getMethodDescribe("getList");
|
||||
List<CsDeviceUserPO> list = csDeviceUserPOService.getList(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -303,6 +303,20 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/updateLedger")
|
||||
@ApiOperation("更新设备预设工程和项目id")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "nDid", value = "网络设备码", required = true),
|
||||
@ApiImplicitParam(name = "engineeringId", value = "工程id", required = true),
|
||||
@ApiImplicitParam(name = "projectId", value = "项目id", required = true)
|
||||
})
|
||||
public HttpResult<String> updateLedger(@RequestParam("nDid") String nDid,@RequestParam("engineeringId") String engineeringId,@RequestParam("projectId") String projectId){
|
||||
String methodDescribe = getMethodDescribe("updateLedger");
|
||||
csEquipmentDeliveryService.updateLedger(nDid,engineeringId,projectId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/rebootDevice")
|
||||
@ApiOperation("重启设备")
|
||||
@@ -395,13 +409,14 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@PostMapping("/flipCldDevStatus")
|
||||
@ApiOperation("云前置设备状态翻转")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||
@ApiImplicitParam(name = "date", value = "时间", required = true),
|
||||
@ApiImplicitParam(name = "devId", value = "设备id", required = true),
|
||||
@ApiImplicitParam(name = "status", value = "状态", required = true)
|
||||
})
|
||||
@ApiIgnore
|
||||
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
||||
public HttpResult<Boolean> flipCldDevStatus(@RequestParam("date") String date, @RequestParam("devId") String devId, @RequestParam("status") Integer status){
|
||||
String methodDescribe = getMethodDescribe("flipCldDevStatus");
|
||||
csEquipmentDeliveryService.flipCldDevStatus(devId,status);
|
||||
csEquipmentDeliveryService.flipCldDevStatus(date,devId,status);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, null, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -54,18 +54,29 @@ public class CsLedgerController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/lineTree")
|
||||
@ApiOperation("五层设备树(监测点层,根节点为治理设备和便携式设备)")
|
||||
public HttpResult<List<CsLedgerVO>> lineTree(){
|
||||
@ApiImplicitParam(name = "type", value = "台账树类型")
|
||||
public HttpResult<List<CsLedgerVO>> lineTree(@RequestParam(required = false) @Validated String type){
|
||||
String methodDescribe = getMethodDescribe("lineTree");
|
||||
List<CsLedgerVO> list = csLedgerService.getLineTree();
|
||||
List<CsLedgerVO> list = csLedgerService.getLineTree(type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/AppLineTree")
|
||||
@ApiOperation("app端监测点树")
|
||||
public HttpResult<List<CsLedgerVO>> appLineTree(){
|
||||
String methodDescribe = getMethodDescribe("AppLineTree");
|
||||
List<CsLedgerVO> list = csLedgerService.appLineTree();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deviceTree")
|
||||
@ApiOperation("四层设备树(装置层,根节点为治理设备和便携式设备)")
|
||||
public HttpResult<List<CsLedgerVO>> getDeviceTree(){
|
||||
@ApiImplicitParam(name = "type", value = "台账树类型")
|
||||
public HttpResult<List<CsLedgerVO>> getDeviceTree(@RequestParam(required = false) @Validated String type){
|
||||
String methodDescribe = getMethodDescribe("getDeviceTree");
|
||||
List<CsLedgerVO> list = csLedgerService.getDeviceTree();
|
||||
List<CsLedgerVO> list = csLedgerService.getDeviceTree(type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ 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.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -254,6 +255,15 @@ public class CslineController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getAllLineDetail")
|
||||
@ApiOperation("获取所有监测点id详情")
|
||||
public HttpResult<List<CsLineDTO>> getAllLineDetail(){
|
||||
String methodDescribe = getMethodDescribe("getAllLineDetail");
|
||||
List<CsLineDTO> list = csLinePOService.getAllLineDetail();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@GetMapping("/getSimpleLine")
|
||||
@ApiOperation("查询登录用户拥有的监测点台账")
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.csdevice.controller.project;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
@@ -66,11 +65,11 @@ public class AppProjectController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addAppProject")
|
||||
@ApiOperation("新增项目")
|
||||
public HttpResult<Boolean> addAppProject(@Validated AppProjectAddParm appProjectAddParm){
|
||||
public HttpResult<AppProjectPO> addAppProject(@Validated @RequestBody AppProjectAddParm appProjectAddParm){
|
||||
String methodDescribe = getMethodDescribe("addAppProject");
|
||||
|
||||
AppProjectPO po = appProjectService.addAppProject(appProjectAddParm);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, ObjectUtil.isNotNull(po), methodDescribe);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/auditAppProject")
|
||||
@@ -91,4 +90,14 @@ public class AppProjectController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, flag, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getProjectByName")
|
||||
@ApiOperation("根据项目名称获取项目信息")
|
||||
@ApiImplicitParam(name = "name", value = "项目名称", required = true)
|
||||
public HttpResult<AppProjectPO> getProjectByName(@RequestParam("name") String name){
|
||||
String methodDescribe = getMethodDescribe("getProjectByName");
|
||||
AppProjectPO po = appProjectService.getProjectByName(name);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -99,4 +99,13 @@ public class CsMarketDataController extends BaseController {
|
||||
List<CsMarketDataVO> list = csMarketDataService.queryAllEnginner(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/insert")
|
||||
@ApiOperation("根据用户、工程新增数据")
|
||||
public HttpResult<Boolean> insertData(@RequestParam("userId")String userId, @RequestParam("engineeringId")String engineeringId){
|
||||
String methodDescribe = getMethodDescribe("insertData");
|
||||
Boolean result = csMarketDataService.insertData(userId,engineeringId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
package com.njcn.csdevice.controller.project;
|
||||
|
||||
|
||||
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.param.CsUserPinsParam;
|
||||
import com.njcn.csdevice.pojo.po.CsUserPins;
|
||||
import com.njcn.csdevice.service.ICsUserPinsService;
|
||||
import com.njcn.web.controller.BaseController;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户置顶表 前端控制器
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-03-04
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/csUserPins")
|
||||
@Api(tags = "置顶设备(工程)")
|
||||
@AllArgsConstructor
|
||||
public class CsUserPinsController extends BaseController {
|
||||
|
||||
private final ICsUserPinsService csUserPinsService;
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/engineeringPinToTop")
|
||||
@ApiOperation("用户置顶工程(取消置顶)")
|
||||
public HttpResult<Boolean> engineeringPinToTop(@Validated @RequestBody CsUserPinsParam param){
|
||||
String methodDescribe = getMethodDescribe("engineeringPinToTop");
|
||||
Boolean result = csUserPinsService.engineeringPinToTop(param);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getPinToTopList")
|
||||
@ApiOperation("获取用户置顶设备(工程)")
|
||||
public HttpResult<List<CsUserPins>> getPinToTopList(){
|
||||
String methodDescribe = getMethodDescribe("getPinToTopList");
|
||||
List<CsUserPins> result = csUserPinsService.getPinToTopList();
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -103,4 +103,15 @@ public class EngineeringController extends BaseController {
|
||||
List<CsEngineeringPO> result = csEngineeringService.getUnlinkedEngineering(userId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getEngineeringByName")
|
||||
@ApiOperation("根据工程名称获取工程信息")
|
||||
@ApiImplicitParam(name = "name", value = "工程名称", required = true)
|
||||
public HttpResult<CsEngineeringPO> getEngineeringByName(@RequestParam("name") String name){
|
||||
String methodDescribe = getMethodDescribe("getEngineeringByName");
|
||||
CsEngineeringPO po = csEngineeringService.getEngineeringByName(name);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -12,4 +15,17 @@ import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsDeviceUserPOMapper extends BaseMapper<CsDeviceUserPO> {
|
||||
|
||||
//查询暂态事件(未读)
|
||||
int queryTempEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||
|
||||
//查询稳态事件(未读)
|
||||
int queryTempHarmonic(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||
|
||||
//查询告警事件(未读)
|
||||
int queryAlarmEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||
|
||||
//查询运行事件(未读)
|
||||
int queryRunEvent(@Param("userId") String userId, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("ids") List<String> ids);
|
||||
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -21,4 +22,6 @@ public interface CsLinePOMapper extends BaseMapper<CsLinePO> {
|
||||
|
||||
|
||||
Map<String,String> getCustomDetailByLineId(@Param("lineId")String lineId);
|
||||
|
||||
List<CsLineDTO> findLineList();
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsUserPins;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户置顶表 Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-03-04
|
||||
*/
|
||||
public interface CsUserPinsMapper extends BaseMapper<CsUserPins> {
|
||||
|
||||
}
|
||||
@@ -45,6 +45,7 @@
|
||||
<if test="temp!=null and temp.searchValue != null and temp.searchValue !=''">
|
||||
AND a.`name` like concat('%',#{temp.searchValue},'%')
|
||||
</if>
|
||||
AND a.`name` != '便携式项目'
|
||||
order by a.create_time desc
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -16,4 +16,72 @@
|
||||
<!--@mbg.generated-->
|
||||
primary_user_id, sub_user_id, device_id, create_by, create_time, update_by, update_time
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="queryTempEvent" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM
|
||||
cs_event_user t1 right join cs_event t2 on t1.event_id = t2.id
|
||||
WHERE
|
||||
t1.user_id = #{userId}
|
||||
and t1.`status`= 0
|
||||
and t2.type = 0
|
||||
<if test="ids != null and ids.size > 0">
|
||||
and t2.line_id in
|
||||
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryAlarmEvent" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM
|
||||
cs_event_user t1 right join cs_alarm t2 on t1.event_id = t2.id
|
||||
WHERE
|
||||
t1.user_id = #{userId}
|
||||
and t1.`status`= 0
|
||||
<if test="ids != null and ids.size > 0">
|
||||
and (
|
||||
<foreach collection="ids" item="tag" separator=" OR ">
|
||||
FIND_IN_SET(#{tag}, t2.dev_list) > 0
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryRunEvent" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM
|
||||
cs_event_user t1 right join cs_event t2 on t1.event_id = t2.id
|
||||
WHERE
|
||||
t1.user_id = #{userId}
|
||||
and t1.`status`= 0
|
||||
and t2.type = 2
|
||||
<if test="ids != null and ids.size > 0">
|
||||
and t2.device_id in
|
||||
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="queryTempHarmonic" resultType="java.lang.Integer">
|
||||
SELECT
|
||||
COUNT(1)
|
||||
FROM
|
||||
cs_event_user t1 right join cs_harmonic t2 on t1.event_id = t2.id
|
||||
WHERE
|
||||
t1.user_id = #{userId}
|
||||
and t1.`status`= 0
|
||||
<if test="ids != null and ids.size > 0">
|
||||
and t2.line_id in
|
||||
<foreach collection="ids" item="item" index="index" open="(" close=")" separator=",">
|
||||
#{item}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -41,7 +41,9 @@
|
||||
c.create_time createTime,
|
||||
c.run_status,
|
||||
c.mac mac,
|
||||
c.process process
|
||||
c.process process,
|
||||
c.sort sort,
|
||||
c.dev_type devType
|
||||
FROM
|
||||
(select * from cs_ledger where LEVEL = 0 and State =1
|
||||
) a,
|
||||
@@ -97,9 +99,14 @@
|
||||
<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>
|
||||
<choose>
|
||||
<when test="queryParam.runStatus != null and queryParam.runStatus != ''">
|
||||
AND run_status = #{queryParam.runStatus}
|
||||
</when>
|
||||
<otherwise>
|
||||
AND run_status IN (1,2)
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="queryParam.searchValue != null and queryParam.searchValue !=''">
|
||||
and (name like concat('%',#{queryParam.searchValue},'%') or ndid like concat('%',#{queryParam.searchValue},'%'))
|
||||
</if>
|
||||
|
||||
@@ -53,4 +53,15 @@
|
||||
WHERE
|
||||
line.line_id = #{lineId}
|
||||
</select>
|
||||
|
||||
<select id="findLineList" resultType="com.njcn.csdevice.pojo.dto.CsLineDTO">
|
||||
SELECT
|
||||
t1.*,
|
||||
t2.dev_type deviceType
|
||||
FROM
|
||||
cs_line t1
|
||||
LEFT JOIN cs_equipment_delivery t2 ON t1.device_id = t2.id
|
||||
WHERE
|
||||
t1.`status` = 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@@ -62,4 +62,7 @@ public interface AppProjectService extends IService<AppProjectPO> {
|
||||
AppProjectPO updateData(AppProjectAuditParm param);
|
||||
|
||||
boolean delete(String id);
|
||||
|
||||
AppProjectPO getProjectByName(String name);
|
||||
|
||||
}
|
||||
|
||||
@@ -56,4 +56,6 @@ public interface AppTopologyDiagramService extends IService<AppTopologyDiagramPO
|
||||
IPage<AppTopologyDiagramVO> queryTopologyDiagramPage(AppTopologyDiagramQueryPageParm appTopologyDiagramQueryPageParm);
|
||||
|
||||
Boolean checkCanDelete(String id);
|
||||
|
||||
AppTopologyDiagramPO getByProjectId(String projectId);
|
||||
}
|
||||
|
||||
@@ -1,25 +1,17 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
|
||||
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface CsCommTerminalService {
|
||||
|
||||
|
||||
List<String> getLineIdsByUser(String userId);
|
||||
|
||||
|
||||
|
||||
List<String> getPqUserIdsByUser(String userId);
|
||||
|
||||
|
||||
PqsDeviceUnit lineUnitDetail(String lineId);
|
||||
|
||||
|
||||
List<String> commGetDevIds(String userId);
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
|
||||
Boolean share(List<String> ids);
|
||||
|
||||
DevCountVO devCount(String id);
|
||||
DevCountVO devCount(String id,String time);
|
||||
|
||||
String isPrimaryUser(String deviceId);
|
||||
|
||||
@@ -53,4 +53,6 @@ public interface CsDeviceUserPOService extends IService<CsDeviceUserPO>{
|
||||
List<String> findDevByUserId(String userId);
|
||||
|
||||
void channelDevByUserId(UserDevParam param);
|
||||
|
||||
List<CsDeviceUserPO> getList(UserDevParam param);
|
||||
}
|
||||
|
||||
@@ -66,4 +66,6 @@ public interface CsEngineeringService extends IService<CsEngineeringPO>{
|
||||
|
||||
boolean deleteData(String id);
|
||||
|
||||
CsEngineeringPO getEngineeringByName(String name);
|
||||
|
||||
}
|
||||
|
||||
@@ -122,6 +122,8 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
*/
|
||||
void updateModuleNumber(String nDid, Integer number);
|
||||
|
||||
void updateLedger(String nDid,String engineeringId,String projectId);
|
||||
|
||||
boolean rebootDevice(String nDid);
|
||||
|
||||
/**
|
||||
@@ -179,10 +181,11 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
|
||||
/**
|
||||
* 根据设备id和状态来修改设备运行状态;同时修改设备下的监测点的状态
|
||||
* @param date
|
||||
* @param devId
|
||||
* @param status
|
||||
*/
|
||||
void flipCldDevStatus(String devId, Integer status);
|
||||
void flipCldDevStatus(String date, String devId, Integer status);
|
||||
|
||||
/**
|
||||
* 根据项目id获取设备列表
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -81,6 +82,8 @@ public interface CsLinePOService extends IService<CsLinePO>{
|
||||
|
||||
List<String> getAllLine();
|
||||
|
||||
List<CsLineDTO> getAllLineDetail();
|
||||
|
||||
List<CsLinePO> getSimpleLine();
|
||||
|
||||
List<CsLinePO> getLineBySensitiveUser(List<String> list);
|
||||
|
||||
@@ -30,4 +30,6 @@ public interface CsMarketDataService extends IService<CsMarketData> {
|
||||
List<CsMarketDataVO> queryAllEnginner(String userId);
|
||||
|
||||
Boolean follow(EngineerIdParam engineerIdParams);
|
||||
|
||||
Boolean insertData(String userId,String engineeringId);
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ import java.util.List;
|
||||
public interface CsTouristDataPOService extends IService<CsTouristDataPO>{
|
||||
|
||||
|
||||
Boolean add(List<CsTouristDataParm> csTouristDataParms);
|
||||
Boolean add(List<CsTouristDataParm> csTouristDataParms);
|
||||
|
||||
List<CsTouristDataParmVO> queryAll();
|
||||
|
||||
|
||||
@@ -29,13 +29,15 @@ public interface ICsLedgerService extends IService<CsLedger> {
|
||||
* 获取终端台账树
|
||||
* @return
|
||||
*/
|
||||
List<CsLedgerVO> getLineTree();
|
||||
List<CsLedgerVO> getLineTree(String type);
|
||||
|
||||
List<CsLedgerVO> appLineTree();
|
||||
|
||||
/**
|
||||
* 终端三层树
|
||||
* @return
|
||||
*/
|
||||
List<CsLedgerVO> getDeviceTree();
|
||||
List<CsLedgerVO> getDeviceTree(String type);
|
||||
|
||||
/**
|
||||
* 新增台账数据
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.njcn.csdevice.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.csdevice.param.CsUserPinsParam;
|
||||
import com.njcn.csdevice.pojo.po.CsUserPins;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户置顶表 服务类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-03-04
|
||||
*/
|
||||
public interface ICsUserPinsService extends IService<CsUserPins> {
|
||||
|
||||
boolean engineeringPinToTop(CsUserPinsParam param);
|
||||
|
||||
List<CsUserPins> getPinToTopList();
|
||||
|
||||
/**
|
||||
* 针对台账树中存在置顶的数据进行排序
|
||||
*
|
||||
* @param list 置顶数据
|
||||
* @param tree 台账树
|
||||
* @param level 树的层级
|
||||
* 如果第一层不是工程,并且是5层树,level = 5 ,5层树层级必须是 0:设备类型 1:工程 2:项目 3:设备 4:监测点
|
||||
* 如果第一层是工程,level = 4 ,4层树层级必须是 0:工程 1:项目 2:设备 3:监测点,其余层级的树也可以使用level = 4,只要是工程、项目、设备、监测点这样的结构就行
|
||||
*/
|
||||
void channelTree(List<CsUserPins> list, List<CsLedgerVO> tree, Integer level);
|
||||
|
||||
}
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.cloud.commons.lang.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -57,10 +58,6 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public AppProjectPO addAppProject(AppProjectAddParm appProjectAddOrAuditParm) {
|
||||
AppProjectPO appProjectPO = new AppProjectPO ( );
|
||||
// Boolean result = checkName (appProjectAddOrAuditParm.getUserId ( ), appProjectAddOrAuditParm.getName ( ));
|
||||
// if (result) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
// }
|
||||
|
||||
if(checkName(appProjectAddOrAuditParm.getName(),"",appProjectAddOrAuditParm.getEngineeringId())){
|
||||
throw new BusinessException(AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
@@ -81,22 +78,8 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
appTopologyDiagramPO.setStatus ("1");
|
||||
appTopologyDiagramPO.setTopoId(temp);
|
||||
appTopologyDiagramService.save(appTopologyDiagramPO);
|
||||
|
||||
//如何使用拓扑图模板生成监测点模版
|
||||
// List<CsLineTopologyTemplateVO> csLineTopologyTemplateVOS = csLineTopologyDiagramTemplateService.queryByTopoId(temp);
|
||||
// List<CsLineTopologyTemplate> collect = csLineTopologyTemplateVOS.stream().map(temp1 -> {
|
||||
// CsLineTopologyTemplate csLineTopologyTemplate = new CsLineTopologyTemplate();
|
||||
// BeanUtils.copyProperties(temp1, csLineTopologyTemplate);
|
||||
// csLineTopologyTemplate.setId(null);
|
||||
// csLineTopologyTemplate.setStatus("1");
|
||||
// csLineTopologyTemplate.setTopoId(appTopologyDiagramPO.getId());
|
||||
// return csLineTopologyTemplate;
|
||||
// }).collect(Collectors.toList());
|
||||
// csLineTopologyTemplates.addAll(collect);
|
||||
});
|
||||
csLineTopologyDiagramTemplateService.saveBatch(csLineTopologyTemplates);
|
||||
|
||||
|
||||
}
|
||||
if(Objects.nonNull( appProjectAddOrAuditParm.getFiles ( ))){
|
||||
for (int i = 0; i < appProjectAddOrAuditParm.getFiles ( ).length; i++) {
|
||||
@@ -157,13 +140,6 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
QueryWrapper<AppProjectPO> queryWrapper = new QueryWrapper ( );
|
||||
queryWrapper.eq ("id", appProjectAuditParm.getId ( ));
|
||||
AppProjectPO appProjectPO1 = appProjectMapper.selectOne (queryWrapper);
|
||||
// if (appProjectAuditParm.getUserId ( ) != null || appProjectAuditParm.getName ( ) != null) {
|
||||
// Boolean result = checkName (appProjectAuditParm.getUserId ( ) != null ? appProjectAuditParm.getUserId ( ) : appProjectPO1.getUserId ( ),
|
||||
// appProjectAuditParm.getName ( ) != null ? appProjectAuditParm.getName ( ) : appProjectPO1.getName ( ));
|
||||
// if (result) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
// }
|
||||
// }
|
||||
//删除项目
|
||||
if(Objects.equals("0",appProjectAuditParm.getStatus())){
|
||||
QueryWrapper<CsLedger> queryWrapper1 = new QueryWrapper<>();
|
||||
@@ -175,38 +151,26 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
this.lambdaUpdate().eq(AppProjectPO::getId,appProjectAuditParm.getId()).set(AppProjectPO::getStatus,"0").update();
|
||||
appTopologyDiagramService.lambdaUpdate().eq(AppTopologyDiagramPO::getProjectId,appProjectAuditParm.getId()).set(AppTopologyDiagramPO::getStatus,"0").update();
|
||||
CsLedger csLedger1 = new CsLedger();
|
||||
|
||||
csLedger1.setId(appProjectAuditParm.getId());
|
||||
|
||||
csLedger1.setState(0);
|
||||
csLedger1.setState(0);
|
||||
csLedgerMapper.updateById(csLedger1);
|
||||
|
||||
|
||||
}
|
||||
|
||||
if(checkName(appProjectAuditParm.getName(),appProjectAuditParm.getId(),appProjectAuditParm.getEngineeringId())){
|
||||
throw new BusinessException(AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
}
|
||||
|
||||
|
||||
|
||||
BeanUtils.copyProperties (appProjectAuditParm, appProjectPO);
|
||||
UpdateWrapper<AppProjectPO> updateWrapper = new UpdateWrapper ( );
|
||||
updateWrapper.eq ("id", appProjectAuditParm.getId ( ));
|
||||
|
||||
int i = appProjectMapper.update (appProjectPO, updateWrapper);
|
||||
// Boolean result = checkName (appProjectPO.getUserId ( ), appProjectPO.getName ( ));
|
||||
// if (result) {
|
||||
// throw new BusinessException (AlgorithmResponseEnum.PROJECT_COMMON_ERROR);
|
||||
// }
|
||||
//删除拓扑图
|
||||
if(CollectionUtils.isEmpty(appProjectAuditParm.getNewTopoIds())){
|
||||
appTopologyDiagramService.lambdaUpdate().eq(AppTopologyDiagramPO::getProjectId,appProjectAuditParm.getId()).set(AppTopologyDiagramPO::getStatus,"0").update();
|
||||
|
||||
}else {
|
||||
appTopologyDiagramService.lambdaUpdate().eq(AppTopologyDiagramPO::getProjectId,appProjectAuditParm.getId()).notIn(AppTopologyDiagramPO::getId,appProjectAuditParm.getNewTopoIds()).set(AppTopologyDiagramPO::getStatus,"0").update();
|
||||
|
||||
}
|
||||
|
||||
//如何使用拓扑图模板则将拓扑图模板复制绑定
|
||||
@@ -227,26 +191,11 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
appTopologyDiagramPO.setStatus ("1");
|
||||
appTopologyDiagramPO.setTopoId(temp);
|
||||
appTopologyDiagramService.save(appTopologyDiagramPO);
|
||||
|
||||
//如何使用拓扑图模板生成监测点模版
|
||||
// List<CsLineTopologyTemplateVO> csLineTopologyTemplateVOS = csLineTopologyDiagramTemplateService.queryByTopoId(temp);
|
||||
// List<CsLineTopologyTemplate> collect = csLineTopologyTemplateVOS.stream().map(temp1 -> {
|
||||
// CsLineTopologyTemplate csLineTopologyTemplate = new CsLineTopologyTemplate();
|
||||
// BeanUtils.copyProperties(temp1, csLineTopologyTemplate);
|
||||
// csLineTopologyTemplate.setId(null);
|
||||
// csLineTopologyTemplate.setStatus("1");
|
||||
// csLineTopologyTemplate.setTopoId(appTopologyDiagramPO.getId());
|
||||
// return csLineTopologyTemplate;
|
||||
// }).collect(Collectors.toList());
|
||||
// csLineTopologyTemplates.addAll(collect);
|
||||
});
|
||||
csLineTopologyDiagramTemplateService.saveBatch(csLineTopologyTemplates);
|
||||
|
||||
|
||||
}
|
||||
if(Objects.nonNull( appProjectAuditParm.getFiles ( ))){
|
||||
for (int k = 0; k < appProjectAuditParm.getFiles ( ).length; k++) {
|
||||
|
||||
AppTopologyDiagramAddParm appTopologyDiagramAddParm = new AppTopologyDiagramAddParm ( );
|
||||
appTopologyDiagramAddParm.setProjectId (appProjectPO.getId ( ));
|
||||
appTopologyDiagramAddParm.setTopologyDiagramName (appProjectAuditParm.getFiles ( )[k].getOriginalFilename ( ));
|
||||
@@ -255,10 +204,8 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
CsLedger csLedger2 = new CsLedger();
|
||||
csLedger2.setId(appProjectAuditParm.getId());
|
||||
|
||||
if(StringUtils.isNotBlank(appProjectAuditParm.getName())){
|
||||
csLedger2.setName(appProjectAuditParm.getName());
|
||||
}
|
||||
@@ -403,5 +350,12 @@ class AppProjectServiceImpl extends ServiceImpl<AppProjectMapper, AppProjectPO>
|
||||
return this.update(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppProjectPO getProjectByName(String name) {
|
||||
LambdaQueryWrapper<AppProjectPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AppProjectPO::getName,name).eq(AppProjectPO::getStatus,1);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.Query;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
@@ -10,15 +10,18 @@ import com.google.common.base.Objects;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.mapper.AppLineTopologyDiagramMapper;
|
||||
import com.njcn.csdevice.mapper.AppProjectMapper;
|
||||
import com.njcn.csdevice.mapper.AppTopologyDiagramMapper;
|
||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramAddParm;
|
||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryPageParm;
|
||||
import com.njcn.csdevice.pojo.param.AppTopologyDiagramQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.po.AppLineTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.vo.AppTopologyDiagramVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsLineTopologyTemplateVO;
|
||||
import com.njcn.csdevice.service.AppLineTopologyDiagramService;
|
||||
import com.njcn.csdevice.service.AppTopologyDiagramService;
|
||||
import com.njcn.csdevice.service.CsLineTopologyTemplateService;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
@@ -178,4 +181,11 @@ public class AppTopologyDiagramServiceImpl extends ServiceImpl<AppTopologyDiagra
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AppTopologyDiagramPO getByProjectId(String projectId) {
|
||||
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(AppTopologyDiagramPO::getProjectId,projectId).eq(AppTopologyDiagramPO::getStatus,"1");
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,21 +5,23 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.mapper.CsLinePOMapper;
|
||||
import com.njcn.csdevice.mapper.PqsDeviceUnitMapper;
|
||||
import com.njcn.csdevice.pojo.dto.DevDetailDTO;
|
||||
import com.njcn.csdevice.pojo.po.CsDeviceUserPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||
import com.njcn.csdevice.service.CsCommTerminalService;
|
||||
import com.njcn.csdevice.service.CsDeviceUserPOService;
|
||||
import com.njcn.csdevice.service.CsEquipmentDeliveryService;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsTouristDataParmVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.device.biz.pojo.po.PqsDeviceUnit;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.constant.UserType;
|
||||
import com.njcn.user.pojo.vo.UserVO;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -38,6 +40,9 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
private final CsLinePOMapper csLinePOMapper;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
private final CsMarketDataService csMarketDataService;
|
||||
private final ICsLedgerService csLedgerService;
|
||||
private final CsTouristDataPOService csTouristDataPOService;
|
||||
|
||||
|
||||
@Override
|
||||
@@ -96,6 +101,22 @@ public class CsCommTerminalServiceImpl implements CsCommTerminalService {
|
||||
.and(w -> w.eq(CsDeviceUserPO::getPrimaryUserId, userId).or().eq(CsDeviceUserPO::getSubUserId, userId))
|
||||
.eq(CsDeviceUserPO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
devIds = devList.stream().map(CsDeviceUserPO::getDeviceId).distinct().collect(Collectors.toList());
|
||||
//note 黄是在cs_market_data写入数据,是用户和工程的关系;
|
||||
// 但是权限根据用户和设备来判断会有问题,还需要用户和工程的关系(针对营销 工程用户),所以这边还要添加用户和工程的关系
|
||||
List<CsMarketDataVO> list = csMarketDataService.queryByUseId(userId);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
List<String> engineerIds = list.stream().map(CsMarketDataVO::getEngineerId).distinct().collect(Collectors.toList());
|
||||
List<DevDetailDTO> devs = csLedgerService.getDevInfoByEngineerIds(engineerIds);
|
||||
devIds.addAll(devs.stream().map(DevDetailDTO::getEquipmentId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
//note 如果是游客,则还需要加入系统配置的设备
|
||||
String roleString = RequestUtil.getUserRole();
|
||||
if (roleString.contains(AppRoleEnum.TOURIST.getCode())) {
|
||||
devIds.addAll(csTouristDataPOService.queryAll().stream().map(CsTouristDataParmVO::getDeviceId).distinct().collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
if (!CollUtil.isEmpty(devIds)) {
|
||||
devIds = devIds.stream().distinct().collect(Collectors.toList());
|
||||
}
|
||||
return devIds;
|
||||
}
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
@@ -18,22 +17,19 @@ import com.njcn.csdevice.pojo.vo.DevCountVO;
|
||||
import com.njcn.csdevice.pojo.vo.DevUserVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.EventUserFeignClient;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import com.njcn.cssystem.api.FeedBackFeignClient;
|
||||
import com.njcn.cssystem.pojo.param.CsFeedbackQueryParm;
|
||||
import com.njcn.cssystem.pojo.vo.CsFeedbackVO;
|
||||
import com.njcn.harmonic.utils.PublicDataUtils;
|
||||
import com.njcn.user.api.UserFeignClient;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
import com.njcn.user.pojo.po.User;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -122,114 +118,251 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
}
|
||||
|
||||
@Override
|
||||
public DevCountVO devCount(String id) {
|
||||
QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
||||
public DevCountVO devCount(String id,String time) {
|
||||
DevCountVO vo = new DevCountVO();
|
||||
//获取app用户的台账树,包含四个层级 工程、项目、设备、监测点
|
||||
List<CsLedgerVO> appLedger = iCsLedgerService.appLineTree();
|
||||
if (CollectionUtil.isNotEmpty(appLedger)) {
|
||||
//获取第一层项目层级
|
||||
List<CsLedgerVO> firstLevelList = new ArrayList<>();
|
||||
//获取第三层设备层级
|
||||
List<CsLedgerVO> thirdLevelList = new ArrayList<>();
|
||||
for (CsLedgerVO firstLevel : appLedger) {
|
||||
firstLevelList.add(firstLevel);
|
||||
if (CollectionUtil.isNotEmpty(firstLevel.getChildren())) {
|
||||
for (CsLedgerVO secondLevel : firstLevel.getChildren()) {
|
||||
if (CollectionUtil.isNotEmpty(secondLevel.getChildren())) {
|
||||
thirdLevelList.addAll(secondLevel.getChildren());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//note 所有工程数据
|
||||
//获取工程数量
|
||||
if (CollectionUtil.isNotEmpty(firstLevelList)) {
|
||||
vo.setEningerCount(firstLevelList.size());
|
||||
}
|
||||
|
||||
DevCountVO devCountVO = new DevCountVO();
|
||||
//获取设备总数、在线设备、离线设备
|
||||
if (CollectionUtil.isNotEmpty(thirdLevelList)) {
|
||||
List<String> devIds = thirdLevelList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
//在线设备
|
||||
List<CsEquipmentDeliveryPO> onlineDevs = devList.stream().filter(dev -> Objects.equals(dev.getRunStatus(), 2)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(onlineDevs)) {
|
||||
vo.setOnLineDevCount(onlineDevs.size());
|
||||
vo.setOnLineDevs(onlineDevs);
|
||||
}
|
||||
//离线设备
|
||||
List<CsEquipmentDeliveryPO> offlineDevs = devList.stream().filter(dev -> Objects.equals(dev.getRunStatus(), 1)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(offlineDevs)) {
|
||||
vo.setOffLineDevCount(offlineDevs.size());
|
||||
vo.setOffLineDevs(offlineDevs);
|
||||
}
|
||||
}
|
||||
//获取未读事件数量
|
||||
int eventCount = this.baseMapper.queryTempEvent(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),null);
|
||||
vo.setEventCount(eventCount);
|
||||
|
||||
String userRole = RequestUtil.getUserRole();
|
||||
List<String> strings = JSONArray.parseArray(userRole, String.class);
|
||||
if(CollectionUtils.isEmpty(strings)){
|
||||
throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
|
||||
int harmonicCount = this.baseMapper.queryTempHarmonic(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),null);
|
||||
vo.setHarmonicCount(harmonicCount);
|
||||
|
||||
int alarmCount = this.baseMapper.queryAlarmEvent(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),null);
|
||||
vo.setAlarmCount(alarmCount);
|
||||
|
||||
int runCount = this.baseMapper.queryRunEvent(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),null);
|
||||
vo.setRunCount(runCount);
|
||||
|
||||
//note 当前工程数据
|
||||
//当前工程id
|
||||
vo.setCurrentId(id);
|
||||
//设备集合
|
||||
List<String> currentDevIds = new ArrayList<>();
|
||||
//监测点集合
|
||||
List<String> currentLineIds = new ArrayList<>();
|
||||
//获取第一层项目层级
|
||||
List<CsLedgerVO> currentProjectIds = new ArrayList<>();
|
||||
// 遍历树结构,找到匹配的工程节点
|
||||
for (CsLedgerVO engineering : appLedger) {
|
||||
if (id.equals(engineering.getId())) {
|
||||
// 找到工程节点,获取其子节点(项目层级)
|
||||
if (CollectionUtil.isNotEmpty(engineering.getChildren())) {
|
||||
for (CsLedgerVO project : engineering.getChildren()) {
|
||||
currentProjectIds.add(project);
|
||||
// 获取项目下的设备层级
|
||||
if (CollectionUtil.isNotEmpty(project.getChildren())) {
|
||||
currentDevIds.addAll(project.getChildren().stream().map(CsLedgerVO::getId).collect(Collectors.toList()));
|
||||
// 获取设备下的监测点层级
|
||||
for (CsLedgerVO device : project.getChildren()) {
|
||||
if (CollectionUtil.isNotEmpty(device.getChildren())) {
|
||||
currentLineIds.addAll(device.getChildren().stream().map(CsLedgerVO::getId).collect(Collectors.toList()));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
//获取项目数量
|
||||
if (CollectionUtil.isNotEmpty(currentProjectIds)) {
|
||||
vo.setCurrentProjectCount(currentProjectIds.size());
|
||||
}
|
||||
//获取设备总数、在线设备、离线设备
|
||||
if (CollectionUtil.isNotEmpty(currentDevIds)) {
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryMapper.selectBatchIds(currentDevIds);
|
||||
//在线设备
|
||||
List<CsEquipmentDeliveryPO> onlineDevs = devList.stream().filter(dev -> Objects.equals(dev.getRunStatus(), 2)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(onlineDevs)) {
|
||||
vo.setCurrentOnLineDevCount(onlineDevs.size());
|
||||
vo.setCurrentOnLineDevs(onlineDevs);
|
||||
}
|
||||
//离线设备
|
||||
List<CsEquipmentDeliveryPO> offlineDevs = devList.stream().filter(dev -> Objects.equals(dev.getRunStatus(), 1)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(offlineDevs)) {
|
||||
vo.setCurrentOffLineDevCount(offlineDevs.size());
|
||||
vo.setCurrentOffLineDevs(offlineDevs);
|
||||
}
|
||||
}
|
||||
//获取未读事件数量
|
||||
if (CollectionUtil.isNotEmpty(currentLineIds)) {
|
||||
int eventCount2 = this.baseMapper.queryTempEvent(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),currentLineIds);
|
||||
vo.setCurrentEventCount(eventCount2);
|
||||
|
||||
int harmonicCount2 = this.baseMapper.queryTempHarmonic(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),currentLineIds);
|
||||
vo.setCurrentHarmonicCount(harmonicCount2);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(currentDevIds)) {
|
||||
int alarmCount2 = this.baseMapper.queryAlarmEvent(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),currentDevIds);
|
||||
vo.setCurrentAlarmCount(alarmCount2);
|
||||
|
||||
int runCount2 = this.baseMapper.queryRunEvent(RequestUtil.getUserIndex(),PublicDataUtils.calculateMonthStart(time),PublicDataUtils.calculateMonthEnd(time),currentDevIds);
|
||||
vo.setCurrentRunCount(runCount2);
|
||||
}
|
||||
}
|
||||
userRole=strings.get(0);
|
||||
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
if(CollectionUtils.isEmpty(device)){
|
||||
devCountVO.setOnLineDevCount(0);
|
||||
devCountVO.setOnLineDevs(new ArrayList<>());
|
||||
devCountVO.setOffLineDevCount(0);
|
||||
devCountVO.setOffLineDevs(new ArrayList<>());
|
||||
}else {
|
||||
queryWrapper.clear();
|
||||
queryWrapper.in("id",device);
|
||||
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||
devCountVO.setOnLineDevCount(collect2.size());
|
||||
devCountVO.setOnLineDevs(collect2);
|
||||
devCountVO.setOffLineDevCount(collect.size());
|
||||
devCountVO.setOffLineDevs(collect);
|
||||
List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
devCountVO.setEningerCount(roleengineer.size());
|
||||
}
|
||||
|
||||
List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree();
|
||||
//由于多加了一程便携式设备
|
||||
List<String> collect1 = deviceTree.stream()
|
||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
||||
.filter(temp -> temp.getId().equals(id))
|
||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
||||
.map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
||||
.map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
//求交集
|
||||
device.retainAll(collect1);
|
||||
if(CollectionUtils.isEmpty(device)){
|
||||
devCountVO.setCurrentOnLineDevCount(0);
|
||||
devCountVO.setCurrentOnLineDevs(new ArrayList<>());
|
||||
devCountVO.setCurrentOffLineDevCount(0);
|
||||
devCountVO.setCurrentOffLineDevs(new ArrayList<>());
|
||||
devCountVO.setCurrentProjectCount(0);
|
||||
|
||||
}else {
|
||||
queryWrapper.clear();
|
||||
queryWrapper.in("id",device);
|
||||
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||
devCountVO.setCurrentOnLineDevCount(collect2.size());
|
||||
devCountVO.setCurrentOnLineDevs(collect2);
|
||||
devCountVO.setCurrentOffLineDevCount(collect.size());
|
||||
devCountVO.setCurrentOffLineDevs(collect);
|
||||
List<CsLedger> list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list();
|
||||
devCountVO.setCurrentProjectCount(list.size());
|
||||
}
|
||||
CsEventUserQueryParam csEventUserQueryParam = new CsEventUserQueryParam();
|
||||
csEventUserQueryParam.setStatus("0");
|
||||
List<EventDetailVO> data = eventUserFeignClient.queryEventList(csEventUserQueryParam).getData();
|
||||
List<EventDetailVO> event = data.stream().filter(temp -> temp.getType() == 0).collect(Collectors.toList());
|
||||
List<EventDetailVO> harmonic = data.stream().filter(temp -> temp.getType() == 1).collect(Collectors.toList());
|
||||
List<EventDetailVO> alarm = data.stream().filter(temp -> temp.getType() == 3).collect(Collectors.toList());
|
||||
|
||||
if(Objects.equals(userRole, AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
alarm = alarm.stream().filter(temp -> Objects.equals("3", temp.getLevel())).collect(Collectors.toList());
|
||||
}
|
||||
List<EventDetailVO> run = data.stream().filter(temp -> temp.getType() == 2).collect(Collectors.toList());
|
||||
if(Objects.equals(userRole,AppRoleEnum.APP_VIP_USER.getCode())||Objects.equals(userRole,AppRoleEnum.TOURIST.getCode())
|
||||
||Objects.equals(userRole,AppRoleEnum.MARKET_USER.getCode())){
|
||||
devCountVO.setFeedBackCount(0);
|
||||
|
||||
}else {
|
||||
CsFeedbackQueryParm csFeedbackQueryParm = new CsFeedbackQueryParm();
|
||||
csFeedbackQueryParm.setPageNum(1);
|
||||
csFeedbackQueryParm.setPageSize(100000);
|
||||
csFeedbackQueryParm.setStatus("1");
|
||||
Page<CsFeedbackVO> data1 = feedBackFeignClient.queryFeedBackPage(csFeedbackQueryParm).getData();
|
||||
List<CsFeedbackVO> collect = data1.getRecords().stream().filter(temp -> !Objects.equals(temp.getUserId(), RequestUtil.getUserIndex())).collect(Collectors.toList());
|
||||
devCountVO.setFeedBackCount(collect.size());
|
||||
}
|
||||
|
||||
//todo 后续添加警告数,事件数
|
||||
devCountVO.setEventCount(event.size());
|
||||
devCountVO.setAlarmCount(alarm.size());
|
||||
devCountVO.setRunCount(run.size());
|
||||
devCountVO.setHarmonicCount(harmonic.size());
|
||||
List<EventDetailVO> curEvent = event.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
List<EventDetailVO> curHarmonic = harmonic.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
List<EventDetailVO> curAlarm = alarm.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
List<EventDetailVO> curRun = run.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
|
||||
devCountVO.setCurrentEventCount(curEvent.size());
|
||||
devCountVO.setCurrentAlarmCount(curAlarm.size());
|
||||
devCountVO.setCurrentRunCount(curRun.size());
|
||||
devCountVO.setCurrentHarmonicCount(curHarmonic.size());
|
||||
|
||||
|
||||
return devCountVO;
|
||||
return vo;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public DevCountVO devCount(String id,String time) {
|
||||
// QueryWrapper<CsEquipmentDeliveryPO> queryWrapper = new QueryWrapper<>();
|
||||
//
|
||||
// DevCountVO devCountVO = new DevCountVO();
|
||||
//
|
||||
// String userRole = RequestUtil.getUserRole();
|
||||
// List<String> strings = JSONArray.parseArray(userRole, String.class);
|
||||
// if(CollectionUtils.isEmpty(strings)){
|
||||
// throw new BusinessException(AlgorithmResponseEnum.UNKNOW_ROLE);
|
||||
//
|
||||
// }
|
||||
// userRole=strings.get(0);
|
||||
//
|
||||
// List<String> device = roleEngineerDevService.getDevice();
|
||||
// if(CollectionUtils.isEmpty(device)){
|
||||
// devCountVO.setOnLineDevCount(0);
|
||||
// devCountVO.setOnLineDevs(new ArrayList<>());
|
||||
// devCountVO.setOffLineDevCount(0);
|
||||
// devCountVO.setOffLineDevs(new ArrayList<>());
|
||||
// }else {
|
||||
// queryWrapper.clear();
|
||||
// queryWrapper.in("id",device);
|
||||
//
|
||||
// List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
// List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||
// List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||
// devCountVO.setOnLineDevCount(collect2.size());
|
||||
// devCountVO.setOnLineDevs(collect2);
|
||||
// devCountVO.setOffLineDevCount(collect.size());
|
||||
// devCountVO.setOffLineDevs(collect);
|
||||
// List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
// devCountVO.setEningerCount(roleengineer.size());
|
||||
// }
|
||||
//
|
||||
// List<CsLedgerVO> deviceTree = iCsLedgerService.getDeviceTree(null);
|
||||
// //由于多加了一程便携式设备
|
||||
// List<String> collect1 = deviceTree.stream()
|
||||
// .map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
||||
// .filter(temp -> temp.getId().equals(id))
|
||||
// .map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
||||
// .map(CsLedgerVO::getChildren).flatMap(Collection::stream)
|
||||
// .map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
// //求交集
|
||||
// device.retainAll(collect1);
|
||||
// if(CollectionUtils.isEmpty(device)){
|
||||
// devCountVO.setCurrentOnLineDevCount(0);
|
||||
// devCountVO.setCurrentOnLineDevs(new ArrayList<>());
|
||||
// devCountVO.setCurrentOffLineDevCount(0);
|
||||
// devCountVO.setCurrentOffLineDevs(new ArrayList<>());
|
||||
// devCountVO.setCurrentProjectCount(0);
|
||||
//
|
||||
// }else {
|
||||
// queryWrapper.clear();
|
||||
// queryWrapper.in("id",device);
|
||||
//
|
||||
// List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectList(queryWrapper);
|
||||
// List<CsEquipmentDeliveryPO> collect = csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 1).collect(Collectors.toList());
|
||||
// List<CsEquipmentDeliveryPO> collect2= csEquipmentDeliveryPOS.stream().filter(temp -> temp.getRunStatus() == 2).collect(Collectors.toList());
|
||||
// devCountVO.setCurrentOnLineDevCount(collect2.size());
|
||||
// devCountVO.setCurrentOnLineDevs(collect2);
|
||||
// devCountVO.setCurrentOffLineDevCount(collect.size());
|
||||
// devCountVO.setCurrentOffLineDevs(collect);
|
||||
// List<CsLedger> list = iCsLedgerService.lambdaQuery().eq(CsLedger::getPid, id).eq(CsLedger::getState, 1).list();
|
||||
// devCountVO.setCurrentProjectCount(list.size());
|
||||
// }
|
||||
// CsEventUserQueryParam csEventUserQueryParam = new CsEventUserQueryParam();
|
||||
// csEventUserQueryParam.setStatus("0");
|
||||
//
|
||||
// //查询暂态事件、运行事件还是使用之前的方法
|
||||
// List<EventDetailVO> data = eventUserFeignClient.queryEventList(csEventUserQueryParam).getData();
|
||||
// //查询稳态事件 先获取监测点id
|
||||
// csLinePOService.getLinesByDevList(device);
|
||||
//
|
||||
//
|
||||
// //查询运行告警事件
|
||||
//
|
||||
//
|
||||
//
|
||||
//
|
||||
// List<EventDetailVO> event = data.stream().filter(temp -> temp.getType() == 0).collect(Collectors.toList());
|
||||
// List<EventDetailVO> harmonic = data.stream().filter(temp -> temp.getType() == 1).collect(Collectors.toList());
|
||||
// List<EventDetailVO> alarm = data.stream().filter(temp -> temp.getType() == 3).collect(Collectors.toList());
|
||||
//
|
||||
// if(Objects.equals(userRole, AppRoleEnum.APP_VIP_USER.getCode())){
|
||||
// alarm = alarm.stream().filter(temp -> Objects.equals("3", temp.getLevel())).collect(Collectors.toList());
|
||||
// }
|
||||
// List<EventDetailVO> run = data.stream().filter(temp -> temp.getType() == 2).collect(Collectors.toList());
|
||||
// if(Objects.equals(userRole,AppRoleEnum.APP_VIP_USER.getCode())||Objects.equals(userRole,AppRoleEnum.TOURIST.getCode())
|
||||
// ||Objects.equals(userRole,AppRoleEnum.MARKET_USER.getCode())){
|
||||
// devCountVO.setFeedBackCount(0);
|
||||
//
|
||||
// }else {
|
||||
// CsFeedbackQueryParm csFeedbackQueryParm = new CsFeedbackQueryParm();
|
||||
// csFeedbackQueryParm.setPageNum(1);
|
||||
// csFeedbackQueryParm.setPageSize(100000);
|
||||
// csFeedbackQueryParm.setStatus("1");
|
||||
// Page<CsFeedbackVO> data1 = feedBackFeignClient.queryFeedBackPage(csFeedbackQueryParm).getData();
|
||||
// List<CsFeedbackVO> collect = data1.getRecords().stream().filter(temp -> !Objects.equals(temp.getUserId(), RequestUtil.getUserIndex())).collect(Collectors.toList());
|
||||
// devCountVO.setFeedBackCount(collect.size());
|
||||
// }
|
||||
//
|
||||
// //todo 后续添加警告数,事件数
|
||||
// devCountVO.setEventCount(event.size());
|
||||
// devCountVO.setAlarmCount(alarm.size());
|
||||
// devCountVO.setRunCount(run.size());
|
||||
// devCountVO.setHarmonicCount(harmonic.size());
|
||||
// List<EventDetailVO> curEvent = event.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
// List<EventDetailVO> curHarmonic = harmonic.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
// List<EventDetailVO> curAlarm = alarm.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
// List<EventDetailVO> curRun = run.stream().filter(temp -> Objects.equals(temp.getEngineeringid(), id)).collect(Collectors.toList());
|
||||
//
|
||||
// devCountVO.setCurrentEventCount(curEvent.size());
|
||||
// devCountVO.setCurrentAlarmCount(curAlarm.size());
|
||||
// devCountVO.setCurrentRunCount(curRun.size());
|
||||
// devCountVO.setCurrentHarmonicCount(curHarmonic.size());
|
||||
//
|
||||
//
|
||||
// return devCountVO;
|
||||
// }
|
||||
/**
|
||||
* @Description: 判断当前用户是否是主用户 0-否1-是
|
||||
* @Param:
|
||||
@@ -406,7 +539,12 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
@Override
|
||||
public List<String> findDevByUserId(String userId) {
|
||||
List<String> result = new ArrayList<>();
|
||||
List<CsDeviceUserPO> list = this.lambdaQuery().eq(CsDeviceUserPO::getPrimaryUserId,userId).list();
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.and(wrapper ->
|
||||
wrapper.eq(CsDeviceUserPO::getPrimaryUserId, userId)
|
||||
.or()
|
||||
.eq(CsDeviceUserPO::getSubUserId, userId));
|
||||
List<CsDeviceUserPO> list = this.list(queryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
result = list.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
@@ -416,8 +554,28 @@ public class CsDeviceUserPOServiceImpl extends ServiceImpl<CsDeviceUserPOMapper,
|
||||
@Override
|
||||
public void channelDevByUserId(UserDevParam param) {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId,param.getUserId())
|
||||
.in(CsDeviceUserPO::getDeviceId,param.getList());
|
||||
queryWrapper.and(wrapper ->
|
||||
wrapper.eq(CsDeviceUserPO::getPrimaryUserId, param.getUserId())
|
||||
.or()
|
||||
.eq(CsDeviceUserPO::getSubUserId, param.getUserId())
|
||||
).in(CsDeviceUserPO::getDeviceId, param.getList());
|
||||
this.remove(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsDeviceUserPO> getList(UserDevParam param) {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.isNotBlank(param.getUserId())) {
|
||||
queryWrapper.and(wrapper ->
|
||||
wrapper.eq(CsDeviceUserPO::getPrimaryUserId, param.getUserId())
|
||||
.or()
|
||||
.eq(CsDeviceUserPO::getSubUserId, param.getUserId())
|
||||
);
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(param.getList())) {
|
||||
queryWrapper.in(CsDeviceUserPO::getDeviceId, param.getList());
|
||||
}
|
||||
queryWrapper.eq(CsDeviceUserPO::getStatus, "1");
|
||||
return this.list(queryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
csLedger1.setLevel(0);
|
||||
csLedger1.setName(csEngineeringPO.getName());
|
||||
csLedger1.setState(1);
|
||||
csLedger1.setSort(0);
|
||||
csLedger1.setSort(csEngineeringAddParm.getSort());
|
||||
csLedgerMapper.insert(csLedger1);
|
||||
//绑定用户
|
||||
CsEngineeringUserPO po = new CsEngineeringUserPO();
|
||||
@@ -164,8 +164,9 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
|
||||
queryWrapper.eq (StringUtils.isNotBlank (csEngineeringQueryParm.getProvince ()),"province",csEngineeringQueryParm.getProvince ()).
|
||||
eq (StringUtils.isNotBlank (csEngineeringQueryParm.getCity ()),"city",csEngineeringQueryParm.getCity ()).
|
||||
eq ("status","1" ).
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryParm.getName ()),"name",csEngineeringQueryParm.getName ()).orderByDesc("create_time");
|
||||
eq ("status","1" )
|
||||
.ne("name","便携式工程").
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryParm.getName ()),"name",csEngineeringQueryParm.getName ()).orderByAsc("sort");
|
||||
List<CsEngineeringPO> csEngineeringPOS = this.getBaseMapper ( ).selectList (queryWrapper);
|
||||
csEngineeringVOList = csEngineeringPOS.stream ().map (temp->{
|
||||
CsEngineeringVO vo = new CsEngineeringVO();
|
||||
@@ -196,6 +197,7 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
queryWrapper.eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getProvince ()),"province",csEngineeringQueryPageParm.getProvince ()).
|
||||
eq (StringUtils.isNotBlank (csEngineeringQueryPageParm.getCity ()),"city",csEngineeringQueryPageParm.getCity ()).
|
||||
eq ("status","1" ).
|
||||
ne("name","便携式工程").
|
||||
like (StringUtils.isNotBlank (csEngineeringQueryPageParm.getName ()),"name",csEngineeringQueryPageParm.getName ()).orderByDesc("create_time");
|
||||
Page<CsEngineeringPO> csEngineeringPOPage = this.getBaseMapper ( ).selectPage (tempPage, queryWrapper);
|
||||
List<CsEngineeringVO> collect = csEngineeringPOPage.getRecords ( ).stream ( ).map (temp -> {
|
||||
@@ -297,6 +299,12 @@ public class CsEngineeringServiceImpl extends ServiceImpl<CsEngineeringMapper, C
|
||||
return this.update(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CsEngineeringPO getEngineeringByName(String name) {
|
||||
LambdaQueryWrapper<CsEngineeringPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsEngineeringPO::getName,name).eq(CsEngineeringPO::getStatus,1);
|
||||
return this.getOne(queryWrapper);
|
||||
}
|
||||
|
||||
public String getAreaById(String id){
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@ import cn.afterturn.easypoi.excel.entity.ImportParams;
|
||||
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.text.StrPool;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
@@ -23,12 +24,14 @@ import com.njcn.access.utils.MqttUtil;
|
||||
import com.njcn.common.pojo.dto.DeviceLogDTO;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.api.CsLogsFeignClient;
|
||||
import com.njcn.csdevice.api.EngineeringFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.mapper.CsSoftInfoMapper;
|
||||
import com.njcn.csdevice.mapper.CsTerminalLogsMapper;
|
||||
import com.njcn.csdevice.pojo.dto.PqsCommunicateDto;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
@@ -46,7 +49,6 @@ import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.enums.DicDataTypeEnum;
|
||||
import com.njcn.system.enums.DicTreeEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import com.njcn.system.pojo.vo.DictTreeVO;
|
||||
import com.njcn.user.enums.AppRoleEnum;
|
||||
@@ -67,6 +69,7 @@ import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
/**
|
||||
@@ -103,7 +106,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final CsDevModelService csDevModelService;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final CsTerminalLogsMapper csTerminalLogsMapper;
|
||||
|
||||
private final ICsCommunicateService csCommunicateService;
|
||||
private final ICsUserPinsService csUserPinsService;
|
||||
private final EngineeringFeignClient engineeringFeignClient;
|
||||
|
||||
@Override
|
||||
public void refreshDeviceDataCache() {
|
||||
@@ -135,12 +140,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csEquipmentDeliveryPo.setStatus (1);
|
||||
csEquipmentDeliveryPo.setRunStatus(1);
|
||||
csEquipmentDeliveryPo.setUsageStatus(1);
|
||||
String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(4);
|
||||
} else if (Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),code)) {
|
||||
csEquipmentDeliveryPo.setProcess(2);
|
||||
}
|
||||
// String code = dictTreeFeignClient.queryById(csEquipmentDeliveryAddParm.getDevType()).getData().getCode();
|
||||
// if (Objects.equals(DicDataEnum.PORTABLE.getCode(),code)) {
|
||||
// csEquipmentDeliveryPo.setProcess(4);
|
||||
// } else if (Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),code)) {
|
||||
// csEquipmentDeliveryPo.setProcess(2);
|
||||
// }
|
||||
csEquipmentDeliveryPo.setProcess(4);
|
||||
//生成二维码文件
|
||||
String qr = this.createQr(csEquipmentDeliveryAddParm.getNdid());
|
||||
csEquipmentDeliveryPo.setQrPath(qr);
|
||||
@@ -151,11 +157,16 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csEquipmentProcess.setDevId(csEquipmentDeliveryAddParm.getNdid());
|
||||
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
|
||||
csEquipmentProcess.setStartTime(LocalDateTime.now());
|
||||
csEquipmentProcess.setProcess(1);
|
||||
// csEquipmentProcess.setProcess(1);
|
||||
csEquipmentProcess.setProcess(4);
|
||||
csEquipmentProcess.setStatus (1);
|
||||
csEquipmentProcessPOService.save(csEquipmentProcess);
|
||||
result = this.save (csEquipmentDeliveryPo);
|
||||
if (result) {
|
||||
|
||||
//谁新建的设备,则认为是该设备的主用户,新建用户设备关系表数据
|
||||
boolean addUser = csDeviceUserPOService.add(csEquipmentDeliveryPo.getId());
|
||||
|
||||
if (result && addUser) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return csEquipmentDeliveryPo;
|
||||
@@ -210,6 +221,8 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return result;
|
||||
}
|
||||
BeanUtils.copyProperties (csEquipmentDeliveryPO,result);
|
||||
result.setAssociatedEngineeringName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedEngineering()).getName());
|
||||
result.setAssociatedProjectName(csLedgerService.findDataById(csEquipmentDeliveryPO.getAssociatedProject()).getName());
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -229,9 +242,49 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return returnpage;
|
||||
}
|
||||
Page<ProjectEquipmentVO> list = this.baseMapper.queryProjectEquipmentVO(returnpage,projectEquipmentQueryParm,device);
|
||||
list.getRecords().stream().forEach(temp->{
|
||||
//根据设备id获取监测点id集合
|
||||
List<CsLinePO> lineIds = csLinePOService.getLineByDev(device);
|
||||
|
||||
|
||||
List<ProjectEquipmentVO> recordList = new ArrayList<>();
|
||||
list.getRecords().forEach(temp->{
|
||||
temp.setIsPrimaryUser(csDeviceUserPOService.isPrimaryUser(temp.getEquipmentId()));
|
||||
//获取设备类型
|
||||
SysDicTreePO po = dictTreeFeignClient.queryById(temp.getDevType()).getData();
|
||||
temp.setDevType(po.getCode());
|
||||
temp.setLineList(lineIds.stream().filter(line -> line.getDevId().equals(temp.getEquipmentId())).sorted(Comparator.comparing(CsLinePO::getLineId)).collect(Collectors.toList()));
|
||||
if (!Objects.equals(DicDataEnum.PORTABLE.getCode(),temp.getDevType())) {
|
||||
recordList.add(temp);
|
||||
}
|
||||
});
|
||||
|
||||
//获取用户置顶的设备
|
||||
List<CsUserPins> topList = csUserPinsService.getPinToTopList();
|
||||
List<String> targetIdList = topList.stream()
|
||||
.filter(item -> Objects.equals(item.getTargetType(), 1))
|
||||
.map(CsUserPins::getTargetId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
||||
List<ProjectEquipmentVO> matchedList = new ArrayList<>();
|
||||
List<ProjectEquipmentVO> unmatchedList = new ArrayList<>();
|
||||
for (ProjectEquipmentVO node : recordList) {
|
||||
if (targetIdList.contains(node.getEquipmentId())) {
|
||||
node.setIsTop(1);
|
||||
matchedList.add(node);
|
||||
} else {
|
||||
unmatchedList.add(node);
|
||||
}
|
||||
}
|
||||
// 根据 targetIdList 的顺序对匹配的节点进行排序
|
||||
matchedList.sort(Comparator.comparingInt(node -> targetIdList.indexOf(node.getEquipmentId())));
|
||||
// 未匹配的节点按照原有的 sort 字段排序,处理 null 值情况
|
||||
unmatchedList.sort(Comparator.comparing(node -> node.getSort() != null ? node.getSort() : Integer.MAX_VALUE));
|
||||
// 清空原列表并添加排序后的数据
|
||||
recordList.clear();
|
||||
recordList.addAll(matchedList);
|
||||
recordList.addAll(unmatchedList);
|
||||
list.setRecords(recordList);
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
@@ -382,7 +435,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
dataSet = csDataSetService.findDataSetByModelId(modelId,2);
|
||||
}
|
||||
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||
} else if(Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode()) || Objects.equals(devTypeCode, DicDataEnum.DEV_CLD.getCode())){
|
||||
} else if(Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode())){
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
||||
if (CollUtil.isNotEmpty(modelId)){
|
||||
@@ -391,6 +444,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||
}
|
||||
} else if(Objects.equals(devTypeCode, DicDataEnum.DEV_CLD.getCode())){
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
||||
if (CollUtil.isNotEmpty(modelId)){
|
||||
for (CsDevModelRelationPO item : modelId) {
|
||||
dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId(),1));
|
||||
}
|
||||
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||
}
|
||||
}
|
||||
}
|
||||
return deviceManagerVo;
|
||||
@@ -437,6 +499,7 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
addDataSet(dataSetList, item, "实时数据", "realtimedata");
|
||||
addDataSet(dataSetList, item, "暂态事件", "event");
|
||||
}
|
||||
addDataSet(dataSetList, item, "运行趋势", "devRunTrend");
|
||||
deviceManagerVo.setDataLevel(item.getDataLevel());
|
||||
}
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
@@ -553,13 +616,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csEquipmentDeliveryPO.setMac(path);
|
||||
csEquipmentDeliveryPO.setRunStatus(1);
|
||||
csEquipmentDeliveryPO.setStatus(1);
|
||||
csEquipmentDeliveryPO.setProcess(2);
|
||||
// csEquipmentDeliveryPO.setProcess(2);
|
||||
csEquipmentDeliveryPO.setProcess(4);
|
||||
csEquipmentDeliveryPO.setSort(100);
|
||||
CsEquipmentProcessPO csEquipmentProcess = new CsEquipmentProcessPO();
|
||||
csEquipmentProcess.setDevId(csEquipmentDeliveryPO.getNdid());
|
||||
csEquipmentProcess.setOperator(RequestUtil.getUserIndex());
|
||||
csEquipmentProcess.setStartTime(LocalDateTime.now());
|
||||
csEquipmentProcess.setProcess(1);
|
||||
// csEquipmentProcess.setProcess(1);
|
||||
csEquipmentProcess.setProcess(4);
|
||||
csEquipmentProcess.setStatus(1);
|
||||
collect1.add(csEquipmentProcess);
|
||||
return csEquipmentDeliveryPO;
|
||||
@@ -690,6 +755,20 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateLedger(String nDid,String engineeringId,String projectId) {
|
||||
boolean result;
|
||||
LambdaUpdateWrapper<CsEquipmentDeliveryPO> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(CsEquipmentDeliveryPO::getNdid,nDid)
|
||||
.ne(CsEquipmentDeliveryPO::getRunStatus,0)
|
||||
.set(CsEquipmentDeliveryPO::getAssociatedEngineering,engineeringId)
|
||||
.set(CsEquipmentDeliveryPO::getAssociatedProject,projectId);
|
||||
result = this.update(lambdaUpdateWrapper);
|
||||
if (result) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rebootDevice(String nDid) {
|
||||
boolean result = false;
|
||||
@@ -729,9 +808,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
boolean result = false;
|
||||
//获取装置id
|
||||
CsEquipmentDeliveryPO po = findDevByNDid(nDid);
|
||||
//设备型号
|
||||
String code = dictTreeFeignClient.queryById(po.getDevModel()).getData().getCode();
|
||||
if (Objects.equals(DicTreeEnum.PQ_COM.getCode(),code)) {
|
||||
//设备类型
|
||||
String code = dictTreeFeignClient.queryById(po.getDevType()).getData().getCode();
|
||||
if (Objects.equals(DicDataEnum.DEV_CLD.getCode(),code) || Objects.equals(DicDataEnum.CONNECT_DEV.getCode(),code)) {
|
||||
result = true;
|
||||
}
|
||||
return result;
|
||||
@@ -747,10 +826,11 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public CsEquipmentDeliveryPO saveCld(CsEquipmentDeliveryAddParm param) {
|
||||
boolean result;
|
||||
CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
if(Objects.nonNull (one)){
|
||||
throw new BusinessException ("设备名称不能重复");
|
||||
}
|
||||
//设备名称可以重复
|
||||
//CsEquipmentDeliveryPO one = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getName, param.getName()).ne(CsEquipmentDeliveryPO::getRunStatus, 0).one();
|
||||
//if(Objects.nonNull (one)){
|
||||
// throw new BusinessException ("设备名称不能重复");
|
||||
//}
|
||||
StringUtil.containsSpecialCharacters(param.getNdid());
|
||||
CsEquipmentDeliveryPO po = this.queryEquipmentPOByndid (param.getNdid());
|
||||
if(!Objects.isNull (po)){
|
||||
@@ -796,7 +876,10 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
csLedger.setSort(0);
|
||||
int addLedger = csLedgerMapper.insert(csLedger);
|
||||
|
||||
if (result && ObjectUtil.isNotNull(relation) && addLedger > 0) {
|
||||
//谁新建的设备,则认为是该设备的主用户,新建用户设备关系表数据
|
||||
boolean addUser = csDeviceUserPOService.add(csEquipmentDeliveryPo.getId());
|
||||
|
||||
if (result && ObjectUtil.isNotNull(relation) && addLedger > 0 && addUser) {
|
||||
refreshDeviceDataCache();
|
||||
}
|
||||
return csEquipmentDeliveryPo;
|
||||
@@ -939,17 +1022,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
List<CsEquipmentDeliveryPO> devList = this.list(lambdaQueryWrapper);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
//修改设备运行状态
|
||||
devList.forEach(item->{item.setRunStatus(1);});
|
||||
devList.forEach(item->{
|
||||
item.setRunStatus(1);
|
||||
insertPqsCommunicateRecord(LocalDateTime.now().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)), item.getNdid(), 0);
|
||||
});
|
||||
this.updateBatchById(devList);
|
||||
//修改监测点运行状态
|
||||
//List<String> devIdList = devList.stream().map(CsEquipmentDeliveryPO::getId).collect(Collectors.toList());
|
||||
//List<CsLinePO> lineList = csLinePOService.getLinesByDevList(devIdList);
|
||||
//csLinePOService.updateCldLineStatus(lineList,2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void flipCldDevStatus(String devId, Integer status) {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void flipCldDevStatus(String time, String devId, Integer status) {
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getId,devId)
|
||||
.eq(CsEquipmentDeliveryPO::getUsageStatus,1)
|
||||
@@ -958,13 +1041,22 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
if (ObjectUtil.isNotNull(po)) {
|
||||
po.setRunStatus(status);
|
||||
this.updateById(po);
|
||||
//这边是监测点的运行状态 不是通讯状态,所以不要修改,通讯状态跟着设备的通讯状态来
|
||||
//修改监测点运行状态
|
||||
//List<CsLinePO> lineList = csLinePOService.getLinesByDevList(Collections.singletonList(po.getId()));
|
||||
//csLinePOService.updateCldLineStatus(lineList,status==1?2:0);
|
||||
//修改设备的运行状态,则录入influxdb表数据
|
||||
int communicateType = status == 2 ? 1 : 0;
|
||||
insertPqsCommunicateRecord(time, po.getNdid(), communicateType);
|
||||
}
|
||||
}
|
||||
|
||||
// 时序数据库写入数据
|
||||
private void insertPqsCommunicateRecord(String time, String devId, Integer status) {
|
||||
PqsCommunicateDto pqsCommunicateDto = new PqsCommunicateDto();
|
||||
pqsCommunicateDto.setTime(time);
|
||||
pqsCommunicateDto.setDevId(devId);
|
||||
pqsCommunicateDto.setType(status);
|
||||
pqsCommunicateDto.setDescription(status == 0 ? "通讯中断" : "通讯正常");
|
||||
csCommunicateService.insertion(pqsCommunicateDto);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsEquipmentDeliveryPO> getDevListByProjectId(String projectId) {
|
||||
QueryWrapper<CsLedger> csLedgerQueryWrapper = new QueryWrapper();
|
||||
@@ -1024,6 +1116,9 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
return result.stream()
|
||||
.filter(data -> idSet.contains(data.getId()))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
result.clear();
|
||||
return result;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
|
||||
@@ -65,6 +65,11 @@ import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDate;
|
||||
import java.time.ZoneId;
|
||||
import java.time.ZonedDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
import java.util.function.Function;
|
||||
@@ -102,6 +107,8 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
private final InfluxDbParamUtil influxDbParamUtil;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
private static final DateTimeFormatter DATE_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd");
|
||||
private static final ZoneId DEFAULT_ZONE = ZoneId.systemDefault();
|
||||
|
||||
private final String GRID_SIDE_DICT_CODE = "Grid_Side";
|
||||
private final String LOAD_SIDE_DICT_CODE = "Load_Side";
|
||||
@@ -302,9 +309,9 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
//传1 则是趋势数据tab页面
|
||||
if("1".equals(type)){
|
||||
formatQueryParamList(commonStatisticalQueryParam);
|
||||
List<ThdDataVO> result = new ArrayList();
|
||||
List<ThdDataVO> result = new ArrayList<>();
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(commonStatisticalQueryParam.getDevId()).collect(Collectors.toList())).getData();
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Arrays.asList(commonStatisticalQueryParam.getLineId())).getData();
|
||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(Collections.singletonList(commonStatisticalQueryParam.getLineId())).getData();
|
||||
CsDataSet csDataSet = csDataSetMapper.selectOne(new LambdaQueryWrapper<CsDataSet>().eq(CsDataSet::getId,finalCsLinePOList.get(0).getDataSetId()));
|
||||
if(Objects.isNull(csDataSet) || StrUtil.isBlank(csDataSet.getDataLevel())){
|
||||
throw new BusinessException("当前测点数据集主要信息缺失,请联系管理员排查(测点表里面数据集id缺失)");
|
||||
@@ -444,6 +451,21 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//长时闪变
|
||||
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
||||
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
||||
collect1 = collect1.stream()
|
||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
//短时闪变 || 电压波动
|
||||
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
||||
List<Instant> timeInstants = getTimeInstants(commonStatisticalQueryParam.getStartTime(), commonStatisticalQueryParam.getEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
||||
collect1 = collect1.stream()
|
||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
result.addAll(collect1);
|
||||
});
|
||||
}
|
||||
@@ -561,6 +583,20 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<Instant> getTimeInstants(String startDateStr, String endDateStr, long interval, ChronoUnit unit, ZoneId zone) {
|
||||
List<Instant> instants = new ArrayList<>();
|
||||
LocalDate startDate = LocalDate.parse(startDateStr, DATE_FORMATTER);
|
||||
LocalDate endDate = LocalDate.parse(endDateStr, DATE_FORMATTER);
|
||||
// 转换为指定时区的 ZonedDateTime
|
||||
ZonedDateTime current = startDate.atStartOfDay(zone);
|
||||
ZonedDateTime endDateTime = endDate.atTime(23, 59, 59).atZone(zone);
|
||||
while (!current.isAfter(endDateTime)) {
|
||||
instants.add(current.toInstant());
|
||||
current = current.plus(interval, unit);
|
||||
}
|
||||
return instants;
|
||||
}
|
||||
|
||||
private void formatQueryParamList(CommonStatisticalQueryParam commonStatisticalQueryParam){
|
||||
List<CommonStatisticalQueryParam> list = new ArrayList<>();
|
||||
if(commonStatisticalQueryParam.getList() != null && commonStatisticalQueryParam.getList().size() > 0){
|
||||
@@ -934,6 +970,21 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
vo.setAnotherName(epdPqd.getShowName());
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
//长时闪变
|
||||
if (Objects.equals(epdPqd.getOtherName(), "plt")) {
|
||||
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 2, ChronoUnit.HOURS, DEFAULT_ZONE);
|
||||
collect1 = collect1.stream()
|
||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
//短时闪变 || 电压波动
|
||||
else if (Objects.equals(epdPqd.getOtherName(), "pst") || Objects.equals(epdPqd.getOtherName(), "fluc")) {
|
||||
List<Instant> timeInstants = getTimeInstants(trendDataQueryParam.getSearchBeginTime(), trendDataQueryParam.getSearchEndTime(), 10, ChronoUnit.MINUTES, DEFAULT_ZONE);
|
||||
collect1 = collect1.stream()
|
||||
.filter(vo -> timeInstants.contains(vo.getTime()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
result.addAll(collect1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,15 @@ import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.csdevice.api.CsCommTerminalFeignClient;
|
||||
import com.njcn.csdevice.api.CsMarketDataFeignClient;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
@@ -18,9 +21,10 @@ import com.njcn.csdevice.pojo.dto.LineParamDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLedgerParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
@@ -66,12 +70,15 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
private final CsDeviceUserPOMapper csDeviceUserPOMapper;
|
||||
private final PqSensitiveUserFeignClient pqSensitiveUserFeignClient;
|
||||
private final UserFeignClient userFeignClient;
|
||||
private final ICsUserPinsService csUserPinsService;
|
||||
private final CsCommTerminalFeignClient csCommTerminalFeignClient;
|
||||
private final CsMarketDataFeignClient csMarketDataFeignClient;
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLedgerTree() {
|
||||
List<CsLedgerVO> list = new ArrayList<>();
|
||||
List<CsLedgerVO> engineeringList = getLineTree();
|
||||
List<CsLedgerVO> engineeringList = getLineTree(null);
|
||||
CsLedgerVO vo = new CsLedgerVO();
|
||||
vo.setId("9999999");
|
||||
vo.setLevel(0);
|
||||
@@ -84,7 +91,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getLineTree() {
|
||||
public List<CsLedgerVO> getLineTree(String type) {
|
||||
List<CsLedgerVO> engineeringList;
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
@@ -92,6 +99,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
//区分治理装置和云前置装置
|
||||
List<String> zhiLianDevice = new ArrayList<>();
|
||||
List<String> portableDevice = new ArrayList<>();
|
||||
List<String> cldDevice = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(device)) {
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
|
||||
@@ -111,6 +119,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
DictTreeVO vo3 = dictTreeFeignClient.queryByCode(DicDataEnum.PORTABLE.getCode()).getData();
|
||||
Optional.ofNullable(vo3)
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(portableDevice::add)
|
||||
);
|
||||
}
|
||||
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());
|
||||
@@ -132,6 +148,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
item.setNDId(po.getNdid());
|
||||
item.setType("device");
|
||||
item.setProcess(po.getProcess());
|
||||
item.setDevConType(po.getDevAccessMethod());
|
||||
})
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
@@ -145,6 +162,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
item.setNDId(po.getNdid());
|
||||
item.setType("device");
|
||||
item.setProcess(po.getProcess());
|
||||
item.setDevConType(po.getDevAccessMethod());
|
||||
})
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
@@ -205,28 +223,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
|
||||
//根据当前用户获取便携式设备
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
List<CsLedgerVO> ledger = allList.stream().filter(obj -> portableDevice.contains(obj.getId())).collect(Collectors.toList());
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
@@ -242,6 +239,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
c.setType("device");
|
||||
c.setName(po.getName());
|
||||
c.setSort(po.getSort());
|
||||
c.setDevConType(po.getDevAccessMethod());
|
||||
})
|
||||
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
|
||||
.collect(Collectors.toList());
|
||||
@@ -266,18 +264,237 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
cld.setChildren(engineeringList2);
|
||||
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(cldDeviceList)) {
|
||||
tree.add(cld);
|
||||
//获取置顶的工程
|
||||
List<CsUserPins> list = csUserPinsService.getPinToTopList();
|
||||
if (Objects.equals(type,"engineering")) {
|
||||
|
||||
Map<String, CsLedgerVO> engineeringMap = new HashMap<>();
|
||||
|
||||
engineeringList1.forEach(eng -> {
|
||||
CsLedgerVO existingEng = engineeringMap.get(eng.getId());
|
||||
if (existingEng == null) {
|
||||
engineeringMap.put(eng.getId(), eng);
|
||||
} else {
|
||||
List<CsLedgerVO> mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren());
|
||||
existingEng.setChildren(mergedChildren);
|
||||
}
|
||||
});
|
||||
|
||||
engineeringList2.forEach(eng -> {
|
||||
CsLedgerVO existingEng = engineeringMap.get(eng.getId());
|
||||
if (existingEng == null) {
|
||||
engineeringMap.put(eng.getId(), eng);
|
||||
} else {
|
||||
List<CsLedgerVO> mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren());
|
||||
existingEng.setChildren(mergedChildren);
|
||||
}
|
||||
});
|
||||
|
||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setChildren(portables);
|
||||
|
||||
portable1.setChildren(Collections.singletonList(portable2));
|
||||
tree.add(portable1);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
csUserPinsService.channelTree(list, tree, 4);
|
||||
}
|
||||
} else {
|
||||
//按设备类型统计
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(cldDeviceList)) {
|
||||
tree.add(cld);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
csUserPinsService.channelTree(list, tree, 5);
|
||||
}
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> appLineTree() {
|
||||
//根据用户获取监测点
|
||||
List<String> lineIds = csCommTerminalFeignClient.getLineIdsByUser(RequestUtil.getUserIndex()).getData();
|
||||
List<String> engineeringIds = roleEngineerDevService.getRoleengineer();
|
||||
|
||||
if (CollectionUtil.isEmpty(lineIds) && CollectionUtil.isEmpty(engineeringIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
//获取所有台账数据
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
if (CollectionUtil.isEmpty(allList)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
Set<String> resultEngineeringIds = new HashSet<>();
|
||||
|
||||
//1. 反推:从监测点向上找到所有相关的工程
|
||||
if (CollectionUtil.isNotEmpty(lineIds)) {
|
||||
//过滤出监测点数据 (level=3)
|
||||
List<CsLedgerVO> lineList = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.filter(item -> lineIds.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//从监测点向上追溯到工程
|
||||
lineList.forEach(line -> {
|
||||
String[] pids = line.getPids().split(",");
|
||||
//根据层级结构,工程 ID 在 pids 的第一个位置(索引为 1,因为索引 0 是"0")
|
||||
if (pids.length > LineBaseEnum.ENGINEERING_LEVEL.getCode() + 1) {
|
||||
String engineeringId = pids[LineBaseEnum.ENGINEERING_LEVEL.getCode() + 1];
|
||||
resultEngineeringIds.add(engineeringId);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//2. 正推:添加用户已有的工程 ID
|
||||
if (CollectionUtil.isNotEmpty(engineeringIds)) {
|
||||
resultEngineeringIds.addAll(engineeringIds);
|
||||
}
|
||||
|
||||
if (CollectionUtil.isEmpty(resultEngineeringIds)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
//获取所有层级数据并排序
|
||||
//监测点数据
|
||||
List<CsLedgerVO> lineList = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.filter(item -> lineIds.contains(item.getId()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//设备数据
|
||||
List<CsLedgerVO> deviceList = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), LineBaseEnum.DEVICE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//项目数据
|
||||
List<CsLedgerVO> projectList = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), LineBaseEnum.PROJECT_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//工程数据,过滤掉名字是"便携式工程"的数据
|
||||
List<CsLedgerVO> engineeringList = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), LineBaseEnum.ENGINEERING_LEVEL.getCode()))
|
||||
.filter(item -> resultEngineeringIds.contains(item.getId()))
|
||||
.filter(item -> !Objects.equals(item.getName(), "便携式工程"))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//构建设备与监测点的关系
|
||||
deviceList.forEach(device -> {
|
||||
List<CsLedgerVO> children = lineList.stream()
|
||||
.filter(line -> Objects.equals(line.getPid(), device.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
device.setChildren(children);
|
||||
}
|
||||
});
|
||||
|
||||
//构建项目与设备的关系
|
||||
projectList.forEach(project -> {
|
||||
List<CsLedgerVO> children = deviceList.stream()
|
||||
.filter(device -> Objects.equals(device.getPid(), project.getId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(children)) {
|
||||
project.setChildren(children);
|
||||
}
|
||||
});
|
||||
|
||||
//构建工程与项目的关系
|
||||
engineeringList.forEach(engineering -> {
|
||||
List<CsLedgerVO> children = projectList.stream()
|
||||
.filter(project -> Objects.equals(project.getPid(), engineering.getId()))
|
||||
.collect(Collectors.toList());
|
||||
//工程下面可以没有项目,所以即使 children 为空也要保留
|
||||
engineering.setChildren(children);
|
||||
});
|
||||
|
||||
return engineeringList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 合并两个项目列表,根据项目 ID 去重并合并子节点
|
||||
*/
|
||||
private List<CsLedgerVO> mergeProjectList(List<CsLedgerVO> list1, List<CsLedgerVO> list2) {
|
||||
if (CollectionUtil.isEmpty(list1)) {
|
||||
return list2 != null ? new ArrayList<>(list2) : new ArrayList<>();
|
||||
}
|
||||
if (CollectionUtil.isEmpty(list2)) {
|
||||
return new ArrayList<>(list1);
|
||||
}
|
||||
|
||||
Map<String, CsLedgerVO> projectMap = new HashMap<>();
|
||||
|
||||
list1.forEach(project -> {
|
||||
projectMap.put(project.getId(), cloneProject(project));
|
||||
});
|
||||
|
||||
list2.forEach(project -> {
|
||||
CsLedgerVO existingProject = projectMap.get(project.getId());
|
||||
if (existingProject == null) {
|
||||
projectMap.put(project.getId(), cloneProject(project));
|
||||
} else {
|
||||
List<CsLedgerVO> mergedDevices = new ArrayList<>();
|
||||
if (existingProject.getChildren() != null) {
|
||||
mergedDevices.addAll(existingProject.getChildren());
|
||||
}
|
||||
if (project.getChildren() != null) {
|
||||
mergedDevices.addAll(project.getChildren());
|
||||
}
|
||||
existingProject.setChildren(mergedDevices);
|
||||
}
|
||||
});
|
||||
|
||||
return new ArrayList<>(projectMap.values());
|
||||
}
|
||||
|
||||
/**
|
||||
* 克隆项目对象,避免引用问题
|
||||
*/
|
||||
private CsLedgerVO cloneProject(CsLedgerVO project) {
|
||||
CsLedgerVO cloned = new CsLedgerVO();
|
||||
cloned.setId(project.getId());
|
||||
cloned.setPid(project.getPid());
|
||||
cloned.setLevel(project.getLevel());
|
||||
cloned.setName(project.getName());
|
||||
cloned.setType(project.getType());
|
||||
cloned.setComFlag(project.getComFlag());
|
||||
cloned.setNDId(project.getNDId());
|
||||
cloned.setProcess(project.getProcess());
|
||||
cloned.setLineType(project.getLineType());
|
||||
cloned.setConType(project.getConType());
|
||||
cloned.setSort(project.getSort());
|
||||
if (project.getChildren() != null) {
|
||||
cloned.setChildren(new ArrayList<>(project.getChildren()));
|
||||
}
|
||||
return cloned;
|
||||
}
|
||||
|
||||
//剔除未接入的设备(根据status判断不太稳,所有这里直接判断该设备有没有对应的模板指标)
|
||||
private void checkDevSetData(List<CsLedgerVO> ledgerVOS) {
|
||||
Iterator<CsLedgerVO> iterator = ledgerVOS.iterator();
|
||||
@@ -308,7 +525,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> getDeviceTree() {
|
||||
public List<CsLedgerVO> getDeviceTree(String type) {
|
||||
List<CsLedgerVO> engineeringList;
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
/*获取用户工程,设备信息过滤*/
|
||||
@@ -316,6 +533,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
List<String> device = roleEngineerDevService.getDevice();
|
||||
|
||||
List<String> zhiLianDevice = new ArrayList<>();
|
||||
List<String> portableDevice = new ArrayList<>();
|
||||
List<String> cldDevice = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(device)) {
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryMapper.selectBatchIds(device);
|
||||
@@ -335,6 +553,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(zhiLianDevice::add)
|
||||
);
|
||||
DictTreeVO vo3 = dictTreeFeignClient.queryByCode(DicDataEnum.PORTABLE.getCode()).getData();
|
||||
Optional.ofNullable(vo3)
|
||||
.map(DictTreeVO::getId)
|
||||
.ifPresent(id -> csEquipmentDeliveryPOS.stream()
|
||||
.filter(item -> Objects.equals(item.getDevType(), id))
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.forEach(portableDevice::add)
|
||||
);
|
||||
}
|
||||
|
||||
engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
@@ -358,6 +584,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
item.setNDId(po.getNdid());
|
||||
item.setType("device");
|
||||
item.setProcess(po.getProcess());
|
||||
item.setDevConType(po.getDevAccessMethod());
|
||||
})
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
@@ -385,6 +612,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
item.setNDId(po.getNdid());
|
||||
item.setType("device");
|
||||
item.setProcess(po.getProcess());
|
||||
item.setDevConType(po.getDevAccessMethod());
|
||||
})
|
||||
.filter(item -> Objects.equals(poMap.get(item.getId()).getUsageStatus(), 1))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
@@ -410,28 +638,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setPid("0");
|
||||
portable.setId(IdUtil.simpleUUID());
|
||||
|
||||
List<CsLedgerVO> ledger;
|
||||
String role = RequestUtil.getUserRole();
|
||||
List<String> roles = JSONArray.parseArray(role, String.class);
|
||||
if(roles.contains(AppRoleEnum.ROOT.getCode()) || roles.contains(AppRoleEnum.OPERATION_MANAGER.getCode()) || roles.contains(AppRoleEnum.REGULAR_USER.getCode())){
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
|
||||
.collect(Collectors.toList());
|
||||
} else {
|
||||
LambdaQueryWrapper<CsDeviceUserPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(CsDeviceUserPO::getPrimaryUserId, RequestUtil.getUserIndex());
|
||||
List<CsDeviceUserPO> list1 = csDeviceUserPOMapper.selectList(queryWrapper);
|
||||
List<String> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
result = list1.stream().map(CsDeviceUserPO::getDeviceId).collect(Collectors.toList());
|
||||
}
|
||||
//针对未启用的装置判断
|
||||
List<String> finalResult = result;
|
||||
ledger = allList.stream()
|
||||
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0") && finalResult.contains(item.getId()))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
List<CsLedgerVO> ledger = allList.stream().filter(obj -> portableDevice.contains(obj.getId())).collect(Collectors.toList());
|
||||
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
|
||||
.collect(Collectors.toMap(
|
||||
CsLedgerVO::getId,
|
||||
@@ -470,14 +677,69 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
cld.setChildren(engineeringList2);
|
||||
|
||||
List<CsLedgerVO> tree = new ArrayList<>();
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
List<CsUserPins> list = csUserPinsService.getPinToTopList();
|
||||
if (Objects.equals(type,"engineering")) {
|
||||
|
||||
Map<String, CsLedgerVO> engineeringMap = new HashMap<>();
|
||||
|
||||
engineeringList1.forEach(eng -> {
|
||||
CsLedgerVO existingEng = engineeringMap.get(eng.getId());
|
||||
if (existingEng == null) {
|
||||
engineeringMap.put(eng.getId(), eng);
|
||||
} else {
|
||||
List<CsLedgerVO> mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren());
|
||||
existingEng.setChildren(mergedChildren);
|
||||
}
|
||||
});
|
||||
|
||||
engineeringList2.forEach(eng -> {
|
||||
CsLedgerVO existingEng = engineeringMap.get(eng.getId());
|
||||
if (existingEng == null) {
|
||||
engineeringMap.put(eng.getId(), eng);
|
||||
} else {
|
||||
List<CsLedgerVO> mergedChildren = mergeProjectList(existingEng.getChildren(), eng.getChildren());
|
||||
existingEng.setChildren(mergedChildren);
|
||||
}
|
||||
});
|
||||
|
||||
tree.addAll(new ArrayList<>(engineeringMap.values()));
|
||||
|
||||
String id = IdUtil.simpleUUID();
|
||||
CsLedgerVO portable1 = new CsLedgerVO();
|
||||
portable1.setLevel(0);
|
||||
portable1.setName("便携式工程");
|
||||
portable1.setPid("0");
|
||||
portable1.setId(id);
|
||||
|
||||
CsLedgerVO portable2 = new CsLedgerVO();
|
||||
portable2.setLevel(1);
|
||||
portable2.setName("便携式项目");
|
||||
portable2.setPid(id);
|
||||
portable2.setId(IdUtil.simpleUUID());
|
||||
portable2.setChildren(portables);
|
||||
|
||||
List<CsLedgerVO> portable2List = new ArrayList<>();
|
||||
portable2List.add(portable2);
|
||||
portable1.setChildren(portable2List);
|
||||
tree.add(portable1);
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
csUserPinsService.channelTree(list, tree, 4);
|
||||
}
|
||||
} else {
|
||||
//按设备类型统计
|
||||
if (CollUtil.isNotEmpty(portables)) {
|
||||
tree.add(portable);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(cldDevList)) {
|
||||
tree.add(cld);
|
||||
}
|
||||
}
|
||||
if (CollUtil.isNotEmpty(deviceList)) {
|
||||
tree.add(government);
|
||||
}
|
||||
if (CollUtil.isNotEmpty(cldDevList)) {
|
||||
tree.add(cld);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
csUserPinsService.channelTree(list, tree, 5);
|
||||
}
|
||||
return tree;
|
||||
}
|
||||
@@ -574,10 +836,14 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
public DevDetailDTO queryDevDetail(String devId) {
|
||||
DevDetailDTO device = new DevDetailDTO();
|
||||
CsLedger dev = this.findDataById(devId);
|
||||
//获取设备mac
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(devId);
|
||||
|
||||
//如果是便携式设备,pid为0,项目,工程都设置为/
|
||||
if (Objects.equals(dev.getPid(), "0")) {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setDevMac(po.getMac());
|
||||
device.setProjectId("/");
|
||||
device.setProjectName("/");
|
||||
device.setEngineeringid("/");
|
||||
@@ -585,15 +851,18 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
} else {
|
||||
device.setEquipmentName(dev.getName());
|
||||
device.setEquipmentId(devId);
|
||||
device.setDevMac(po.getMac());
|
||||
CsLedger project = this.findDataById(dev.getPid());
|
||||
device.setProjectId(project.getId());
|
||||
device.setProjectName(project.getName());
|
||||
CsLedger engineer = this.findDataById(project.getPid());
|
||||
device.setEngineeringid(engineer.getId());
|
||||
device.setEngineeringName(engineer.getName());
|
||||
if (ObjectUtil.isNotNull(project)) {
|
||||
device.setProjectId(project.getId());
|
||||
device.setProjectName(project.getName());
|
||||
CsLedger engineer = this.findDataById(project.getPid());
|
||||
if (ObjectUtil.isNotNull(engineer)) {
|
||||
device.setEngineeringid(engineer.getId());
|
||||
device.setEngineeringName(engineer.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return device;
|
||||
}
|
||||
@Override
|
||||
@@ -784,78 +1053,6 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
return tree;
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public List<CsLedgerVO> getztProjectTree() {
|
||||
// List<CsLedgerVO> engineeringList;
|
||||
// List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
// /*获取用户工程,设备信息过滤*/
|
||||
// List<String> roleengineer = roleEngineerDevService.getRoleengineer();
|
||||
// List<String> device = roleEngineerDevService.getDevice();
|
||||
// engineeringList = allList.stream().filter(item -> roleengineer.contains(item.getId())).collect(Collectors.toList());
|
||||
// List<CsLedgerVO> projectList = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
//
|
||||
// List<CsLedgerVO> deviceList = allList.stream().filter(item -> device.contains(item.getId()) && !Objects.equals(item.getPid(), "0")).
|
||||
// peek(
|
||||
// temp -> {
|
||||
// CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(temp.getId());
|
||||
// temp.setComFlag(po.getRunStatus());
|
||||
// temp.setNDId(po.getNdid());
|
||||
// temp.setType("device");
|
||||
// }
|
||||
// ).
|
||||
// sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
// .collect(Collectors.toList());
|
||||
// checkDevSetData(deviceList);
|
||||
// projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||
// engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||
//
|
||||
// //获取便携式项目数
|
||||
// CsLedgerVO portable = new CsLedgerVO();
|
||||
// portable.setLevel(0);
|
||||
// portable.setName(DataParam.PORTABLE_SYSTEM);
|
||||
// portable.setPid("0");
|
||||
// portable.setId(IdUtil.simpleUUID());
|
||||
//
|
||||
// CsLedgerVO project = new CsLedgerVO();
|
||||
// project.setLevel(1);
|
||||
// project.setName(DataParam.WIRELESS_PROJECT);
|
||||
// project.setPid("0");
|
||||
// project.setId(DataParam.WIRELESS_PROJECT_ID);
|
||||
//
|
||||
// List<CsLedgerVO> portables = allList.stream().filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0")).collect(Collectors.toList());
|
||||
// checkDevSetData(portables);
|
||||
// for (CsLedgerVO c : portables) {
|
||||
// c.setPid(project.getId());
|
||||
// CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
// c.setComFlag(po.getRunStatus());
|
||||
// c.setNDId(po.getNdid());
|
||||
// c.setType("device");
|
||||
// }
|
||||
// project.setChildren(portables);
|
||||
//
|
||||
// List<CsLedgerVO> wxProjectList = new ArrayList<>();
|
||||
// wxProjectList.add(project);
|
||||
//
|
||||
// portable.setChildren(wxProjectList);
|
||||
//
|
||||
//
|
||||
// CsLedgerVO government = new CsLedgerVO();
|
||||
// government.setLevel(0);
|
||||
// government.setName(DataParam.GOVERNANCE_SYSTEM);
|
||||
// government.setPid("0");
|
||||
// government.setId(IdUtil.simpleUUID());
|
||||
// government.setChildren(engineeringList);
|
||||
// List<CsLedgerVO> tree = new ArrayList<>();
|
||||
//
|
||||
// if (CollUtil.isNotEmpty(portables)) {
|
||||
// tree.add(portable);
|
||||
// }
|
||||
// if (CollUtil.isNotEmpty(deviceList)) {
|
||||
// tree.add(government);
|
||||
// }
|
||||
//
|
||||
// return tree;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public List<CsLedgerVO> objTree() {
|
||||
@@ -968,96 +1165,111 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public CsLedgerVO cldTree() {
|
||||
|
||||
List<CsLedgerVO> engineerTree = new ArrayList<>();
|
||||
List<CsLedgerVO> projectTree = new ArrayList<>();
|
||||
List<CsLedgerVO> deviceTree = new ArrayList<>();
|
||||
List<CsLedgerVO> lineTree = new ArrayList<>();
|
||||
|
||||
List<CsLedgerVO> allList = this.baseMapper.getAll();
|
||||
if (CollectionUtil.isNotEmpty(allList)) {
|
||||
//工程集合
|
||||
List<CsLedgerVO> tree1 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode())).collect(Collectors.toList());
|
||||
//项目集合
|
||||
List<CsLedgerVO> tree2 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.PROJECT_LEVEL.getCode())).collect(Collectors.toList());
|
||||
//设备集合
|
||||
List<CsLedgerVO> tree3 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode())).collect(Collectors.toList());
|
||||
//监测点集合
|
||||
List<CsLedgerVO> tree4 = allList.stream().filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode())).collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(allList)) {
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(new ArrayList<>());
|
||||
return government;
|
||||
}
|
||||
|
||||
//筛选出云前置设备
|
||||
if (CollectionUtil.isNotEmpty(tree3)) {
|
||||
Set<String> list1 = new HashSet<>();
|
||||
List<String> devList = tree3.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devList);
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
DictTreeVO vo1 = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
List<CsLedgerVO> engineeringList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.ENGINEERING_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
//list1是 cld设备
|
||||
devs.forEach(item -> {
|
||||
if (item.getDevType().equals(vo1.getId())) {
|
||||
list1.add(item.getId());
|
||||
}
|
||||
});
|
||||
//list2是 非cld设备
|
||||
Set<String> list2 = devList.stream().filter(item -> !list1.contains(item)).collect(Collectors.toSet());
|
||||
List<CsLedgerVO> tree5 = tree3.stream().filter(vo -> list2.contains(vo.getId())).collect(Collectors.toList());
|
||||
Set<String> list3 = tree5.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet());
|
||||
projectTree = tree2.stream().filter(vo -> !list3.contains(vo.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> tree6 = tree2.stream().filter(vo -> list3.contains(vo.getId())).collect(Collectors.toList());
|
||||
Set<String> proList = tree6.stream().map(CsLedgerVO::getPid).collect(Collectors.toSet());
|
||||
engineerTree = tree1.stream().filter(vo -> !proList.contains(vo.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> deviceList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.DEVICE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list1)) {
|
||||
deviceTree = tree3.stream()
|
||||
.filter(vo -> list1.contains(vo.getId()))
|
||||
.peek(item -> {
|
||||
CsEquipmentDeliveryPO dev = devsMap.get(item.getId());
|
||||
if (dev != null) {
|
||||
item.setComFlag(dev.getRunStatus());
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
List<CsLedgerVO> lineList = allList.stream()
|
||||
.filter(item -> item.getLevel().equals(LineBaseEnum.LINE_LEVEL.getCode()))
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
|
||||
lineTree = tree4.stream()
|
||||
.filter(vo -> list1.contains(vo.getPid()))
|
||||
.peek(item -> {
|
||||
CsEquipmentDeliveryPO dev = devsMap.get(item.getId());
|
||||
if (dev != null) {
|
||||
item.setComFlag(dev.getRunStatus());
|
||||
}
|
||||
})
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isEmpty(deviceList)) {
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineeringList);
|
||||
return government;
|
||||
}
|
||||
|
||||
List<String> devIds = deviceList.stream().map(CsLedgerVO::getId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, Function.identity()));
|
||||
Map<String, String> lineDevMap = lineList.stream().collect(Collectors.toMap(CsLedgerVO::getId, CsLedgerVO::getPid));
|
||||
|
||||
Set<String> cldDevIds = devs.stream()
|
||||
.map(CsEquipmentDeliveryPO::getId)
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
Map<String, List<CsLedgerVO>> projectToDeviceMap = deviceList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
|
||||
Map<String, List<CsLedgerVO>> deviceToLineMap = lineList.stream()
|
||||
.collect(Collectors.groupingBy(CsLedgerVO::getPid));
|
||||
|
||||
deviceList.forEach(device -> {
|
||||
CsEquipmentDeliveryPO dev = devsMap.get(device.getId());
|
||||
if (dev != null) {
|
||||
device.setComFlag(dev.getRunStatus());
|
||||
device.setDevConType(dev.getDevAccessMethod());
|
||||
}
|
||||
});
|
||||
|
||||
lineList.forEach(line -> {
|
||||
String devId = lineDevMap.get(line.getId());
|
||||
if (devId != null) {
|
||||
CsEquipmentDeliveryPO dev = devsMap.get(devId);
|
||||
if (dev != null) {
|
||||
line.setComFlag(dev.getRunStatus());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
if (CollectionUtil.isNotEmpty(deviceTree)) {
|
||||
List<CsLedgerVO> finalLineTree = lineTree;
|
||||
deviceTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalLineTree));
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(projectTree)) {
|
||||
List<CsLedgerVO> finalDeviceTree = deviceTree;
|
||||
projectTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalDeviceTree));
|
||||
});
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(engineerTree)) {
|
||||
List<CsLedgerVO> finalProjectTree = projectTree;
|
||||
engineerTree.forEach(item -> {
|
||||
item.setChildren(getChildren(item, finalProjectTree));
|
||||
});
|
||||
}
|
||||
engineeringList.forEach(engineering -> {
|
||||
List<CsLedgerVO> sortedProjects = projectList.stream()
|
||||
.filter(project -> project.getPid().equals(engineering.getId()))
|
||||
.peek(project -> {
|
||||
List<CsLedgerVO> projectDevices = projectToDeviceMap.getOrDefault(project.getId(), new ArrayList<>());
|
||||
if (CollectionUtil.isNotEmpty(projectDevices)) {
|
||||
List<CsLedgerVO> sortedDevices = projectDevices.stream()
|
||||
.filter(device -> cldDevIds.contains(device.getId()))
|
||||
.peek(device -> {
|
||||
List<CsLedgerVO> sortedLines = deviceToLineMap.getOrDefault(device.getId(), new ArrayList<>())
|
||||
.stream()
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
device.setChildren(sortedLines);
|
||||
})
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
project.setChildren(sortedDevices);
|
||||
}
|
||||
})
|
||||
.sorted(Comparator.comparing(CsLedgerVO::getSort))
|
||||
.collect(Collectors.toList());
|
||||
engineering.setChildren(sortedProjects);
|
||||
});
|
||||
|
||||
CsLedgerVO government = new CsLedgerVO();
|
||||
government.setLevel(0);
|
||||
government.setName(DataParam.cldDev);
|
||||
government.setLevel(-1);
|
||||
government.setName("台账树");
|
||||
government.setPid("0");
|
||||
government.setId(IdUtil.simpleUUID());
|
||||
government.setChildren(engineerTree);
|
||||
government.setChildren(engineeringList);
|
||||
|
||||
return government;
|
||||
}
|
||||
@@ -1095,24 +1307,73 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getDevInfoByEngineerIds(List<String> list) {
|
||||
// 参数校验,确保 list 不为空
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
|
||||
List<DevDetailDTO> details = new ArrayList<>();
|
||||
|
||||
// 工程
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper0 = new LambdaQueryWrapper<>();
|
||||
queryWrapper0.in(CsLedger::getId, list);
|
||||
List<CsLedger> engineering = this.list(queryWrapper0);
|
||||
if (CollUtil.isEmpty(engineering)) {
|
||||
return details;
|
||||
}
|
||||
Map<String, CsLedger> engineeringMap = engineering.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
|
||||
// 项目
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(CsLedger::getPid, list);
|
||||
List<CsLedger> project = this.list(queryWrapper);
|
||||
//工程id
|
||||
if (CollUtil.isEmpty(project)) {
|
||||
return details;
|
||||
}
|
||||
Map<String, CsLedger> projectMap = project.stream().collect(Collectors.toMap(CsLedger::getId, item -> item));
|
||||
|
||||
// 设备
|
||||
List<String> projectIds = project.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
dev.forEach(item -> {
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEquipmentName(item.getName());
|
||||
detail.setEquipmentId(item.getId());
|
||||
details.add(detail);
|
||||
});
|
||||
if (CollUtil.isNotEmpty(projectIds)) {
|
||||
LambdaQueryWrapper<CsLedger> queryWrapper2 = new LambdaQueryWrapper<>();
|
||||
queryWrapper2.in(CsLedger::getPid, projectIds);
|
||||
List<CsLedger> dev = this.list(queryWrapper2);
|
||||
|
||||
if (CollUtil.isNotEmpty(dev)) {
|
||||
List<String> devIds = dev.stream().map(CsLedger::getId).collect(Collectors.toList());
|
||||
List<CsEquipmentDeliveryPO> devs = csEquipmentDeliveryMapper.selectBatchIds(devIds);
|
||||
Map<String, CsEquipmentDeliveryPO> devsMap = devs.stream().collect(Collectors.toMap(CsEquipmentDeliveryPO::getId, item -> item));
|
||||
|
||||
dev.forEach(item -> {
|
||||
DevDetailDTO detail = new DevDetailDTO();
|
||||
detail.setEquipmentName(item.getName());
|
||||
detail.setEquipmentId(item.getId());
|
||||
|
||||
CsLedger csLedger = projectMap.get(item.getPid());
|
||||
if (csLedger != null) {
|
||||
detail.setProjectId(csLedger.getId());
|
||||
detail.setProjectName(csLedger.getName());
|
||||
|
||||
CsLedger csLedger1 = engineeringMap.get(csLedger.getPid());
|
||||
if (csLedger1 != null) {
|
||||
detail.setEngineeringid(csLedger1.getId());
|
||||
detail.setEngineeringName(csLedger1.getName());
|
||||
}
|
||||
}
|
||||
|
||||
CsEquipmentDeliveryPO devInfo = devsMap.get(item.getId());
|
||||
if (devInfo != null) {
|
||||
detail.setRunStatus(devInfo.getRunStatus());
|
||||
}
|
||||
|
||||
details.add(detail);
|
||||
});
|
||||
}
|
||||
}
|
||||
return details;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DevDetailDTO> getEngineeringHaveDevs(List<String> list) {
|
||||
List<DevDetailDTO> result = new ArrayList<>();
|
||||
|
||||
@@ -11,12 +11,12 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.access.api.CsLineLatestDataFeignClient;
|
||||
import com.njcn.access.pojo.po.CsLineLatestData;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||
import com.njcn.csdevice.mapper.*;
|
||||
import com.njcn.csdevice.pojo.dto.CsLineDTO;
|
||||
import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.LineDetailDataVO;
|
||||
@@ -25,7 +25,7 @@ import com.njcn.csdevice.service.CsDevModelService;
|
||||
import com.njcn.csdevice.service.CsLinePOService;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import com.njcn.csharmonic.api.PqSensitiveUserFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.oss.constant.OssPath;
|
||||
import com.njcn.oss.utils.FileStorageUtil;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
@@ -44,7 +44,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -155,8 +154,8 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
List<CsDataSet> list = csDataSetService.findDataSetByModelId(po1.getId());
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
po.setDataSetId(list.get(0).getId());
|
||||
po.setClDid(list.get(0).getClDev());
|
||||
}
|
||||
po.setClDid(param.getLineNo());
|
||||
//监测位置
|
||||
//DictData data = dicDataFeignClient.getDicDataByCode(DicDataEnum.GRID_SIDE.getCode()).getData();
|
||||
po.setPosition(param.getPosition());
|
||||
@@ -208,7 +207,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.set(CsLinePO::getMonitorObj,param.getMonitorObj())
|
||||
.set(CsLinePO::getGovern,param.getGovern())
|
||||
.set(CsLinePO::getPosition,param.getPosition())
|
||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser());
|
||||
.set(CsLinePO::getMonitorUser,param.getMonitorUser())
|
||||
.set(CsLinePO::getLineLogLevel,param.getLineLogLevel())
|
||||
.set(CsLinePO::getIsImportant,param.getIsImportant());
|
||||
this.update(lambdaUpdateWrapper);
|
||||
|
||||
//修改台账树中监测点的名称
|
||||
@@ -270,11 +271,16 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLineDTO> getAllLineDetail() {
|
||||
return this.baseMapper.findLineList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsLinePO> getSimpleLine() {
|
||||
List<String> devIds = commGetDevIds(RequestUtil.getUserIndex());
|
||||
if(CollUtil.isNotEmpty(devIds)){
|
||||
List<CsLinePO> poList = this.lambdaQuery().select(CsLinePO::getLineId,CsLinePO::getName,CsLinePO::getMonitorUser).in(CsLinePO::getDeviceId,devIds)
|
||||
List<CsLinePO> poList = this.lambdaQuery().in(CsLinePO::getDeviceId,devIds)
|
||||
.eq(CsLinePO::getStatus, DataStateEnum.ENABLE.getCode()).list();
|
||||
return poList;
|
||||
}else {
|
||||
@@ -325,6 +331,9 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
List<String> lineList = poList.stream().map(CsLinePO::getLineId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(CsLinePO::getLineId, lineList);
|
||||
}
|
||||
if (ObjectUtil.isNotNull(param.getSearchValue())) {
|
||||
lambdaQueryWrapper.and(par -> par.like(CsLinePO::getName, param.getSearchValue()));
|
||||
}
|
||||
Page<CsLinePO> linePage = this.page(new Page<>(param.getPageNum(), param.getPageSize()), lambdaQueryWrapper);
|
||||
BeanUtil.copyProperties(linePage, result);
|
||||
List<CsLinePO> records = linePage.getRecords();
|
||||
@@ -451,7 +460,11 @@ public class CsLinePOServiceImpl extends ServiceImpl<CsLinePOMapper, CsLinePO> i
|
||||
lineDetailDataVO.setShortCapacity(Objects.isNull(csLinePO.getShortCircuitCapacity())?0.0f:csLinePO.getShortCircuitCapacity().floatValue());
|
||||
lineDetailDataVO.setStandardCapacity(Objects.isNull(csLinePO.getBasicCapacity())?0.0f:csLinePO.getBasicCapacity().floatValue());
|
||||
lineDetailDataVO.setTimeInterval(csLinePO.getLineInterval());
|
||||
|
||||
//获取监测点数据类型
|
||||
CsDataSet dataSet = csDataSetService.getById(csLinePO.getDataSetId());
|
||||
if (ObjectUtil.isNotNull(dataSet)) {
|
||||
lineDetailDataVO.setDataLevel(dataSet.getDataLevel());
|
||||
}
|
||||
return lineDetailDataVO;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsEngineeringMapper;
|
||||
import com.njcn.csdevice.mapper.CsMarketDataMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsMarketDataParam;
|
||||
import com.njcn.csdevice.pojo.param.EngineerIdParam;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.CsMarketData;
|
||||
import com.njcn.csdevice.pojo.vo.CsMarketDataVO;
|
||||
import com.njcn.csdevice.service.CsMarketDataService;
|
||||
import com.njcn.csdevice.service.ICsLedgerService;
|
||||
@@ -13,16 +17,12 @@ import com.njcn.web.utils.RequestUtil;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.pojo.po.CsMarketData;
|
||||
import com.njcn.csdevice.mapper.CsMarketDataMapper;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
*
|
||||
* Description:
|
||||
@@ -79,7 +79,11 @@ public class CsMarketDataServiceImpl extends ServiceImpl<CsMarketDataMapper, CsM
|
||||
@Override
|
||||
public List<CsMarketDataVO> queryAllEnginner(String userId) {
|
||||
List<CsMarketDataVO> result = new ArrayList<>();
|
||||
List<CsLedger> list = csLedgerService.lambdaQuery().eq(CsLedger::getState, 1).eq(CsLedger::getLevel, 0).list();
|
||||
List<CsLedger> list = csLedgerService.lambdaQuery()
|
||||
.eq(CsLedger::getState, 1)
|
||||
.eq(CsLedger::getLevel, 0)
|
||||
.ne(CsLedger::getName, "便携式工程")
|
||||
.list();
|
||||
List<CsMarketDataVO> csMarketDataVOS = this.queryByUseId(userId);
|
||||
List<String> collect = csMarketDataVOS.stream().map(CsMarketDataVO::getEngineerId).collect(Collectors.toList());
|
||||
List<CsLedger> collect1 = list.stream().filter(temp -> !collect.contains(temp.getId())).collect(Collectors.toList());
|
||||
@@ -115,4 +119,19 @@ public class CsMarketDataServiceImpl extends ServiceImpl<CsMarketDataMapper, CsM
|
||||
this.saveBatch(csMarketData,20);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean insertData(String userId, String engineeringId) {
|
||||
LambdaQueryWrapper<CsMarketData> queryWrap = new LambdaQueryWrapper<>();
|
||||
queryWrap.eq(CsMarketData::getUserId,userId);
|
||||
queryWrap.eq(CsMarketData::getEngineerId,engineeringId);
|
||||
CsMarketData csMarketData = this.getOne(queryWrap);
|
||||
if (csMarketData == null) {
|
||||
csMarketData = new CsMarketData();
|
||||
csMarketData.setUserId(userId);
|
||||
csMarketData.setEngineerId(engineeringId);
|
||||
this.save(csMarketData);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -58,8 +58,7 @@ public class CsTouristDataPOServiceImpl extends ServiceImpl<CsTouristDataPOMappe
|
||||
list.add(csTouristDataPO);
|
||||
|
||||
});
|
||||
boolean b = this.saveBatch(list);
|
||||
return b;
|
||||
return this.saveBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,184 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsUserPinsMapper;
|
||||
import com.njcn.csdevice.param.CsUserPinsParam;
|
||||
import com.njcn.csdevice.pojo.po.CsUserPins;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.service.ICsUserPinsService;
|
||||
import com.njcn.web.utils.RequestUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 用户置顶表 服务实现类
|
||||
* </p>
|
||||
*
|
||||
* @author xy
|
||||
* @since 2026-03-04
|
||||
*/
|
||||
@Service
|
||||
public class CsUserPinsServiceImpl extends ServiceImpl<CsUserPinsMapper, CsUserPins> implements ICsUserPinsService {
|
||||
|
||||
@Override
|
||||
public boolean engineeringPinToTop(CsUserPinsParam param) {
|
||||
LambdaUpdateWrapper<CsUserPins> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(CsUserPins::getUserId, param.getUserId())
|
||||
.eq(CsUserPins::getTargetId, param.getTargetId())
|
||||
.eq(CsUserPins::getTargetType, param.getTargetType());
|
||||
CsUserPins csUserPins = this.getOne(wrapper);
|
||||
//为空,则是置顶
|
||||
if (Objects.isNull(csUserPins)) {
|
||||
CsUserPins po = new CsUserPins();
|
||||
BeanUtils.copyProperties(param, po);
|
||||
this.save(po);
|
||||
}
|
||||
//有数据则是取消置顶
|
||||
else {
|
||||
this.removeById(csUserPins.getId());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CsUserPins> getPinToTopList() {
|
||||
LambdaUpdateWrapper<CsUserPins> wrapper = new LambdaUpdateWrapper<>();
|
||||
wrapper.eq(CsUserPins::getUserId, RequestUtil.getUserIndex())
|
||||
.orderByDesc(CsUserPins::getCreateTime);
|
||||
return this.list(wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void channelTree(List<CsUserPins> list, List<CsLedgerVO> tree, Integer level) {
|
||||
List<String> targetIdList = new ArrayList<>();
|
||||
List<String> devList = new ArrayList<>();
|
||||
switch (level) {
|
||||
case 1:
|
||||
break;
|
||||
case 2:
|
||||
break;
|
||||
case 3:
|
||||
break;
|
||||
case 4:
|
||||
// 处理工程置顶(第一层)
|
||||
targetIdList = list.stream()
|
||||
.filter(item -> Objects.equals(item.getTargetType(), 2))
|
||||
.map(CsUserPins::getTargetId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
||||
sortByTargetList(tree, targetIdList);
|
||||
}
|
||||
|
||||
// 处理设备置顶(第三层)
|
||||
devList = list.stream()
|
||||
.filter(item -> Objects.equals(item.getTargetType(), 1))
|
||||
.map(CsUserPins::getTargetId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
// 遍历 tree,找到第三层的数据进行排序
|
||||
for (CsLedgerVO firstLevelNode : tree) {
|
||||
if (firstLevelNode.getLevel() == 0 && CollectionUtil.isNotEmpty(firstLevelNode.getChildren())) {
|
||||
// 第二层
|
||||
for (CsLedgerVO secondLevelNode : firstLevelNode.getChildren()) {
|
||||
if (CollectionUtil.isNotEmpty(secondLevelNode.getChildren())) {
|
||||
// 第三层
|
||||
sortByTargetList(secondLevelNode.getChildren(), devList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case 5:
|
||||
// 处理工程置顶(第二层,因为最上面加了一层)
|
||||
targetIdList = list.stream()
|
||||
.filter(item -> Objects.equals(item.getTargetType(), 2))
|
||||
.map(CsUserPins::getTargetId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(targetIdList)) {
|
||||
sortSecondLevelByTargetList(tree, targetIdList);
|
||||
}
|
||||
// 处理设备置顶(第四层)
|
||||
devList = list.stream()
|
||||
.filter(item -> Objects.equals(item.getTargetType(), 1))
|
||||
.map(CsUserPins::getTargetId)
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
sortFourthLevelByDevList(tree, devList);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据目标 ID 列表对节点列表进行排序
|
||||
* @param nodeList 需要排序的节点列表
|
||||
* @param targetIdList 目标 ID 列表(决定排序顺序)
|
||||
*/
|
||||
private void sortByTargetList(List<CsLedgerVO> nodeList, List<String> targetIdList) {
|
||||
// 分离出匹配 targetIdList 的节点和未匹配的节点
|
||||
List<CsLedgerVO> matchedList = new ArrayList<>();
|
||||
List<CsLedgerVO> unmatchedList = new ArrayList<>();
|
||||
for (CsLedgerVO node : nodeList) {
|
||||
if (targetIdList.contains(node.getId())) {
|
||||
node.setIsTop(1);
|
||||
matchedList.add(node);
|
||||
} else {
|
||||
unmatchedList.add(node);
|
||||
}
|
||||
}
|
||||
// 根据 targetIdList 的顺序对匹配的节点进行排序
|
||||
matchedList.sort(Comparator.comparingInt(node -> targetIdList.indexOf(node.getId())));
|
||||
// 未匹配的节点按照原有的 sort 字段排序,处理 null 值情况
|
||||
unmatchedList.sort(Comparator.comparing(node -> node.getSort() != null ? node.getSort() : Integer.MAX_VALUE));
|
||||
// 清空原列表并添加排序后的数据
|
||||
nodeList.clear();
|
||||
nodeList.addAll(matchedList);
|
||||
nodeList.addAll(unmatchedList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据目标 ID 列表对第二层节点进行排序(因为最上面加了一层)
|
||||
*/
|
||||
private void sortSecondLevelByTargetList(List<CsLedgerVO> tree, List<String> targetIdList) {
|
||||
for (CsLedgerVO firstLevelNode : tree) {
|
||||
if (CollectionUtil.isNotEmpty(firstLevelNode.getChildren())) {
|
||||
sortByTargetList(firstLevelNode.getChildren(), targetIdList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据设备 ID 列表对第四层节点进行排序
|
||||
*/
|
||||
private void sortFourthLevelByDevList(List<CsLedgerVO> tree, List<String> devList) {
|
||||
for (CsLedgerVO firstLevelNode : tree) {
|
||||
if (CollectionUtil.isNotEmpty(firstLevelNode.getChildren())) {
|
||||
for (CsLedgerVO secondLevelNode : firstLevelNode.getChildren()) {
|
||||
if (CollectionUtil.isNotEmpty(secondLevelNode.getChildren())) {
|
||||
for (CsLedgerVO thirdLevelNode : secondLevelNode.getChildren()) {
|
||||
if (CollectionUtil.isNotEmpty(thirdLevelNode.getChildren())) {
|
||||
// 第四层
|
||||
sortByTargetList(thirdLevelNode.getChildren(), devList);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -5,22 +5,19 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.mapper.CsTopologyDiagramTemplateMapper;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
import com.njcn.csdevice.pojo.po.AppProjectPO;
|
||||
import com.njcn.csdevice.pojo.po.AppTopologyDiagramPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEngineeringPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||
import com.njcn.csdevice.pojo.vo.EngineeringProjectRelationVo;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.system.api.AreaFeignClient;
|
||||
import com.njcn.system.pojo.po.Area;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -40,6 +37,8 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
||||
private final ICsLedgerService csLedgerService;
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
private final AreaFeignClient areaFeignClient;
|
||||
private final CsTopologyDiagramTemplateMapper csTopologyDiagramTemplateMapper;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -94,6 +93,7 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean addProject(AppProjectAddParm param) {
|
||||
boolean result = false;
|
||||
//新增项目信息
|
||||
@@ -109,29 +109,61 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
||||
if (ObjectUtil.isNotNull(po1) && ObjectUtil.isNotNull(po2)) {
|
||||
result = true;
|
||||
}
|
||||
//新增项目拓扑图
|
||||
if (CollectionUtil.isNotEmpty(param.getTopoIds())) {
|
||||
CsTopologyDiagramTemplate csTopologyDiagramTemplate = csTopologyDiagramTemplateMapper.selectById(param.getTopoIds().get(0));
|
||||
AppTopologyDiagramPO po3 = new AppTopologyDiagramPO();
|
||||
po3.setFilePath (csTopologyDiagramTemplate.getFilePath());
|
||||
po3.setProjectId (po1.getId());
|
||||
po3.setName (csTopologyDiagramTemplate.getName());
|
||||
po3.setStatus ("1");
|
||||
po3.setTopoId(param.getTopoIds().get(0));
|
||||
appTopologyDiagramService.save(po3);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean updateProject(AppProjectAuditParm param) {
|
||||
//修改工程信息
|
||||
AppProjectPO po1 = appProjectService.updateData(param);
|
||||
//修改cs_ledger数据
|
||||
CsLedgerParam.Update csLedgerParam = new CsLedgerParam.Update();
|
||||
csLedgerParam.setId(po1.getId());
|
||||
csLedgerParam.setPid(param.getEngineeringId());
|
||||
csLedgerParam.setPids("0," + param.getEngineeringId());
|
||||
csLedgerParam.setName(param.getName());
|
||||
csLedgerParam.setSort(param.getSort());
|
||||
csLedgerParam.setRemark(param.getDescription());
|
||||
csLedgerParam.setSort(param.getSort());
|
||||
csLedgerService.updateLedgerTree(csLedgerParam);
|
||||
//修改项目拓扑图
|
||||
AppTopologyDiagramPO po2 = appTopologyDiagramService.getByProjectId(param.getId());
|
||||
if (ObjectUtil.isNotNull(po2)) {
|
||||
CsTopologyDiagramTemplate csTopologyDiagramTemplate = csTopologyDiagramTemplateMapper.selectById(param.getTopoIds().get(0));
|
||||
po2.setId(po2.getId());
|
||||
po2.setFilePath (csTopologyDiagramTemplate.getFilePath());
|
||||
po2.setName (csTopologyDiagramTemplate.getName());
|
||||
po2.setStatus ("1");
|
||||
po2.setTopoId(param.getTopoIds().get(0));
|
||||
appTopologyDiagramService.updateById(po2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean deleteProject(String id) {
|
||||
//删除项目信息
|
||||
appProjectService.delete(id);
|
||||
//删除台账信息
|
||||
csLedgerService.deleteLedgerTree(id);
|
||||
//删除项目拓扑图
|
||||
AppTopologyDiagramPO po2 = appTopologyDiagramService.getByProjectId(id);
|
||||
if (ObjectUtil.isNotNull(po2)) {
|
||||
po2.setStatus("0");
|
||||
appTopologyDiagramService.updateById(po2);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -163,11 +195,15 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
||||
EngineeringProjectRelationVo temp = new EngineeringProjectRelationVo();
|
||||
temp.setEngineeringId(item.getId());
|
||||
temp.setEngineeringName(item.getName());
|
||||
temp.setEngineeringArea(item.getProvince()+item.getCity());
|
||||
temp.setProvinceId(item.getProvince());
|
||||
temp.setCityId(item.getCity());
|
||||
Area area1 = areaFeignClient.selectIdArea(item.getProvince()).getData();
|
||||
Area area2 = areaFeignClient.selectIdArea(item.getCity()).getData();
|
||||
temp.setEngineeringAreaName((ObjectUtil.isNotNull(area1)?area1.getName():"") + (ObjectUtil.isNotNull(area2)?area2.getName():""));
|
||||
temp.setEngineeringRemark(item.getDescription());
|
||||
temp.setEngineeringSort(item.getSort());
|
||||
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item2->item2.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||
List<CsLedgerVO> projectList = allList.stream().filter(item2->item2.getPid().equals(item.getId())).sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(projectList)) {
|
||||
List<EngineeringProjectRelationVo.ProjectInfo> projectInfoList = new ArrayList<>();
|
||||
projectList.forEach(item2->{
|
||||
@@ -178,6 +214,7 @@ public class EngineeringProjectServiceImpl implements IEngineeringProjectService
|
||||
projectInfo.setProjectArea(po.getArea());
|
||||
projectInfo.setProjectRemark(po.getDescription());
|
||||
projectInfo.setProjectSort(po.getSort());
|
||||
projectInfo.setTopologyInfoId(Objects.isNull(map3.get(po.getId()))?null:map3.get(po.getId()).getTopoId());
|
||||
projectInfo.setTopologyInfo(Objects.isNull(map3.get(po.getId()))?null:map3.get(po.getId()).getFilePath());
|
||||
projectInfoList.add(projectInfo);
|
||||
});
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.njcn.csdevice.pojo.param.CsLineParam;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CldLedgerVo;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceInfo;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.csharmonic.api.EventFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
@@ -31,11 +32,13 @@ import com.njcn.mq.message.BZEventMessage;
|
||||
import com.njcn.mq.template.BZEventMessageTemplate;
|
||||
import com.njcn.redis.pojo.enums.AppRedisKey;
|
||||
import com.njcn.redis.utils.RedisUtil;
|
||||
import com.njcn.system.api.DictTreeFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.system.pojo.po.SysDicTreePO;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -63,7 +66,9 @@ class IcdServiceImpl implements IcdService {
|
||||
private final ICsTerminalLogsService csTerminalLogsService;
|
||||
private final ICsTerminalReplyService csTerminalReplyService;
|
||||
private final OverLimitWlMapper overLimitWlMapper;
|
||||
private final DictTreeFeignClient dictTreeFeignClient;
|
||||
private final DateTimeFormatter microsecondFormatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.SSSSSS");
|
||||
private final AppTopologyDiagramService appTopologyDiagramService;
|
||||
|
||||
@Override
|
||||
public List<DeviceInfo> getLedgerInfo(IcdParam param) {
|
||||
@@ -98,6 +103,7 @@ class IcdServiceImpl implements IcdService {
|
||||
detail.setDevType(Objects.isNull(finalSysDicTreeMap.get(dev.getDevModel())) ? "/":finalSysDicTreeMap.get(dev.getDevModel()).getCode());
|
||||
detail.setNode(dev.getNodeProcess());
|
||||
detail.setMaxProcessNum(node.getMaxProcessNum());
|
||||
detail.setDevLogLevel(dev.getDevLogLevel());
|
||||
|
||||
// 只获取当前设备的监测点数据
|
||||
List<CsLinePO> lines = lineMap.get(dev.getId());
|
||||
@@ -116,6 +122,7 @@ class IcdServiceImpl implements IcdService {
|
||||
monitorInfo.setPt2(line.getPt2Ratio());
|
||||
monitorInfo.setCt1(line.getCtRatio());
|
||||
monitorInfo.setCt2(line.getCt2Ratio());
|
||||
monitorInfo.setLineLogLevel(line.getLineLogLevel());
|
||||
monitorInfos.add(monitorInfo);
|
||||
});
|
||||
detail.setMonitorData(monitorInfos);
|
||||
@@ -157,8 +164,9 @@ class IcdServiceImpl implements IcdService {
|
||||
}
|
||||
Integer level = csLedger.getLevel();
|
||||
String[] pids = csLedger.getPids().split(StrUtil.COMMA);
|
||||
Integer sort = csLedger.getSort();
|
||||
// 设置工程信息(所有级别都需要)
|
||||
setEngineeringInfo(vo, level, pids, id);
|
||||
setEngineeringInfo(vo, level, pids, id, sort);
|
||||
// 根据级别设置不同的业务数据
|
||||
switch (level) {
|
||||
case 0:
|
||||
@@ -364,24 +372,6 @@ class IcdServiceImpl implements IcdService {
|
||||
return replies;
|
||||
}
|
||||
|
||||
// private CsTerminalReply buildTerminalReply(String replyId, CsEquipmentDeliveryPO device,
|
||||
// List<CsLinePO> csLineList) {
|
||||
// List<String> lineIds = csLineList.stream()
|
||||
// .filter(line -> Objects.equals(line.getDeviceId(), device.getId()))
|
||||
// .map(CsLinePO::getLineId)
|
||||
// .collect(Collectors.toList());
|
||||
//
|
||||
// CsTerminalReply reply = new CsTerminalReply();
|
||||
// reply.setId(IdUtil.simpleUUID());
|
||||
// reply.setReplyId(replyId);
|
||||
// reply.setNodeId(device.getNodeId());
|
||||
// reply.setProcessNo(device.getNodeProcess());
|
||||
// reply.setDeviceId(device.getId());
|
||||
// reply.setLineId(String.join(",", lineIds));
|
||||
// reply.setIsReceived(0);
|
||||
// reply.setCode("allEvent");
|
||||
// return reply;
|
||||
// }
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -495,7 +485,7 @@ class IcdServiceImpl implements IcdService {
|
||||
/**
|
||||
* 设置工程信息
|
||||
*/
|
||||
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id) {
|
||||
private void setEngineeringInfo(CldLedgerVo vo, Integer level, String[] pids, String id, Integer sort) {
|
||||
String engineeringId;
|
||||
|
||||
if (level == 0) {
|
||||
@@ -514,6 +504,7 @@ class IcdServiceImpl implements IcdService {
|
||||
vo.setProvince(po.getProvince());
|
||||
vo.setCity(po.getCity());
|
||||
vo.setEngineeringDescription(po.getDescription());
|
||||
vo.setSort(sort);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,8 +512,22 @@ class IcdServiceImpl implements IcdService {
|
||||
* 处理0级数据(工程级别)
|
||||
*/
|
||||
private void handleLevel0(CldLedgerVo vo, String id) {
|
||||
List<ProjectVO> result = new ArrayList<>();
|
||||
List<AppProjectPO> projectInfoList = appProjectService.getProjectByEngineering(Collections.singletonList(id));
|
||||
vo.setProjectInfoList(projectInfoList);
|
||||
if (CollectionUtil.isNotEmpty(projectInfoList)) {
|
||||
List<String> projectIds = projectInfoList.stream().map(AppProjectPO::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AppTopologyDiagramPO::getProjectId,projectIds).eq(AppTopologyDiagramPO::getStatus,1);
|
||||
List<AppTopologyDiagramPO> appTopologyDiagramPOList = appTopologyDiagramService.list(queryWrapper);
|
||||
Map<String, AppTopologyDiagramPO> appTopologyDiagramPOMap = appTopologyDiagramPOList.stream().collect(Collectors.toMap(AppTopologyDiagramPO::getProjectId, item -> item));
|
||||
projectInfoList.forEach(item->{
|
||||
ProjectVO vo1 = new ProjectVO();
|
||||
BeanUtils.copyProperties(item,vo1);
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -530,13 +535,34 @@ class IcdServiceImpl implements IcdService {
|
||||
*/
|
||||
private void handleLevel1(CldLedgerVo vo, String id, String[] pids) {
|
||||
// 设置项目信息
|
||||
List<ProjectVO> result = new ArrayList<>();
|
||||
List<AppProjectPO> appProjectPOS = appProjectService.listByIds(Collections.singletonList(id));
|
||||
vo.setProjectInfoList(appProjectPOS);
|
||||
if (CollectionUtil.isNotEmpty(appProjectPOS)) {
|
||||
List<String> projectIds = appProjectPOS.stream().map(AppProjectPO::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AppTopologyDiagramPO::getProjectId,projectIds).eq(AppTopologyDiagramPO::getStatus,1);
|
||||
List<AppTopologyDiagramPO> appTopologyDiagramPOList = appTopologyDiagramService.list(queryWrapper);
|
||||
Map<String, AppTopologyDiagramPO> appTopologyDiagramPOMap = appTopologyDiagramPOList.stream().collect(Collectors.toMap(AppTopologyDiagramPO::getProjectId, item -> item));
|
||||
appProjectPOS.forEach(item->{
|
||||
ProjectVO vo1 = new ProjectVO();
|
||||
BeanUtils.copyProperties(item,vo1);
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
// 设置设备信息
|
||||
List<CsEquipmentDeliveryPO> devList = csEquipmentDeliveryService.getDevListByProjectId(id);
|
||||
if (CollectionUtil.isNotEmpty(devList)) {
|
||||
vo.setDeviceInfoList(devList);
|
||||
}
|
||||
vo.setDeviceInfoList(devList);
|
||||
// if (CollectionUtil.isNotEmpty(devList)) {
|
||||
// //如果不是监测设备,则不展示
|
||||
// DictTreeVO cldDict = dictTreeFeignClient.queryByCode(DicDataEnum.DEV_CLD.getCode()).getData();
|
||||
// String cldDevTypeId = cldDict.getId();
|
||||
// List<CsEquipmentDeliveryPO> cldDevIds = devList.stream()
|
||||
// .filter(item -> item.getDevType().equals(cldDevTypeId))
|
||||
// .collect(Collectors.toList());
|
||||
// vo.setDeviceInfoList(cldDevIds);
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,13 +573,43 @@ class IcdServiceImpl implements IcdService {
|
||||
if (pids.length > 2) {
|
||||
String projectId = pids[2];
|
||||
List<AppProjectPO> project = appProjectService.listByIds(Collections.singletonList(projectId));
|
||||
vo.setProjectInfoList(project);
|
||||
List<ProjectVO> result = new ArrayList<>();
|
||||
if (CollectionUtil.isNotEmpty(project)) {
|
||||
List<String> projectIds = project.stream().map(AppProjectPO::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AppTopologyDiagramPO::getProjectId,projectIds).eq(AppTopologyDiagramPO::getStatus,1);
|
||||
List<AppTopologyDiagramPO> appTopologyDiagramPOList = appTopologyDiagramService.list(queryWrapper);
|
||||
Map<String, AppTopologyDiagramPO> appTopologyDiagramPOMap = appTopologyDiagramPOList.stream().collect(Collectors.toMap(AppTopologyDiagramPO::getProjectId, item -> item));
|
||||
project.forEach(item->{
|
||||
ProjectVO vo1 = new ProjectVO();
|
||||
BeanUtils.copyProperties(item,vo1);
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
// 设置设备信息
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(id));
|
||||
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||
// 设置线路信息
|
||||
List<CsLinePO> list = csLinePOService.queryByDevId(id);
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
list.forEach(item->{
|
||||
if (Objects.isNull(item.getPt2Ratio())) {
|
||||
item.setPt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getCt2Ratio())) {
|
||||
item.setCt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getLineNo())) {
|
||||
item.setLineNo(item.getClDid() == 0 ? null:item.getClDid());
|
||||
}
|
||||
if (Objects.isNull(item.getRunStatus())) {
|
||||
item.setRunStatus(csEquipmentDeliveryPOS.get(0).getRunStatus());
|
||||
}
|
||||
});
|
||||
}
|
||||
vo.setLineInfoList(list);
|
||||
}
|
||||
|
||||
@@ -563,18 +619,48 @@ class IcdServiceImpl implements IcdService {
|
||||
private void handleLevel3(CldLedgerVo vo, String id, String[] pids) {
|
||||
// 设置项目信息(项目ID在pids[2]位置)
|
||||
if (pids.length > 2) {
|
||||
List<ProjectVO> result = new ArrayList<>();
|
||||
String projectId = pids[2];
|
||||
List<AppProjectPO> appProjectPOS = appProjectService.listByIds(Collections.singletonList(projectId));
|
||||
vo.setProjectInfoList(appProjectPOS);
|
||||
if (CollectionUtil.isNotEmpty(appProjectPOS)) {
|
||||
List<String> projectIds = appProjectPOS.stream().map(AppProjectPO::getId).collect(Collectors.toList());
|
||||
LambdaQueryWrapper<AppTopologyDiagramPO> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.in(AppTopologyDiagramPO::getProjectId,projectIds).eq(AppTopologyDiagramPO::getStatus,1);
|
||||
List<AppTopologyDiagramPO> appTopologyDiagramPOList = appTopologyDiagramService.list(queryWrapper);
|
||||
Map<String, AppTopologyDiagramPO> appTopologyDiagramPOMap = appTopologyDiagramPOList.stream().collect(Collectors.toMap(AppTopologyDiagramPO::getProjectId, item -> item));
|
||||
appProjectPOS.forEach(item->{
|
||||
ProjectVO vo1 = new ProjectVO();
|
||||
BeanUtils.copyProperties(item,vo1);
|
||||
vo1.setTopoId(Objects.isNull(appTopologyDiagramPOMap.get(item.getId()))?null:appTopologyDiagramPOMap.get(item.getId()).getTopoId());
|
||||
result.add(vo1);
|
||||
});
|
||||
}
|
||||
vo.setProjectInfoList(result);
|
||||
}
|
||||
// 设置设备信息(设备ID在pids[3]位置)
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS;
|
||||
if (pids.length > 3) {
|
||||
String deviceId = pids[3];
|
||||
List<CsEquipmentDeliveryPO> csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId));
|
||||
csEquipmentDeliveryPOS = csEquipmentDeliveryService.listByIds(Collections.singletonList(deviceId));
|
||||
vo.setDeviceInfoList(csEquipmentDeliveryPOS);
|
||||
} else {
|
||||
csEquipmentDeliveryPOS = new ArrayList<>();
|
||||
}
|
||||
// 设置线路信息
|
||||
List<CsLinePO> line = csLinePOService.listByIds(Collections.singletonList(id));
|
||||
if (CollectionUtil.isNotEmpty(line)) {
|
||||
line.forEach(item->{
|
||||
if (Objects.isNull(item.getPt2Ratio())) {
|
||||
item.setPt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getCt2Ratio())) {
|
||||
item.setCt2Ratio(1.0);
|
||||
}
|
||||
if (Objects.isNull(item.getLineNo())) {
|
||||
item.setLineNo(item.getClDid() == 0 ? null:item.getClDid());
|
||||
}
|
||||
});
|
||||
}
|
||||
vo.setLineInfoList(line);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.date.DatePattern;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
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;
|
||||
@@ -26,6 +27,7 @@ import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
|
||||
/**
|
||||
@@ -39,7 +41,7 @@ import java.util.concurrent.TimeUnit;
|
||||
public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
|
||||
private final InfluxDbUtils influxDbUtils;
|
||||
private final CsEquipmentDeliveryService csEquipmentDeliveryService;
|
||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||
@Resource
|
||||
private PqsCommunicateMapper pqsCommunicateMapper;
|
||||
private final DateTimeFormatter DATE_TIME_FORMATTER = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault());
|
||||
@@ -76,14 +78,154 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
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;
|
||||
|
||||
if (CollectionUtil.isNotEmpty(list)) {
|
||||
result = processWithData(list, lineParam);
|
||||
} else {
|
||||
result = processWithoutData(lineParam);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理有数据的情况
|
||||
*/
|
||||
private List<PqsCommunicateDto> processWithData(List<PqsCommunicate> list, LineCountEvaluateParam lineParam) {
|
||||
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||
int lastIndex = list.size() - 1;
|
||||
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
PqsCommunicate item = list.get(i);
|
||||
PqsCommunicateDto dto = convertToDto(item);
|
||||
result.add(dto);
|
||||
|
||||
// 如果是最后一组数据,补充结束数据点
|
||||
if (i == lastIndex) {
|
||||
PqsCommunicateDto endData = createEndDataDto(item, lineParam);
|
||||
result.add(endData);
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理无数据的情况
|
||||
*/
|
||||
private List<PqsCommunicateDto> processWithoutData(LineCountEvaluateParam lineParam) {
|
||||
LocalDateTime endTime = getEndDateTime(lineParam.getEndTime());
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
|
||||
// 判断 endTime 是否早于最早入库时间
|
||||
List<PqsCommunicateDto> firstData = getRawDataFirst(lineParam);
|
||||
if (CollectionUtil.isNotEmpty(firstData)) {
|
||||
LocalDateTime firstTime = parseDateTime(firstData.get(0).getTime());
|
||||
if (endTime.isBefore(firstTime)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
|
||||
// 判断 startTime 是否晚于当前时间
|
||||
LocalDateTime startTime = getStartDateTime(lineParam.getStartTime());
|
||||
if (startTime.isAfter(currentTime)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
// 获取最新数据并创建起始和结束点
|
||||
List<PqsCommunicateDto> latestData = getRawDataLatest(lineParam);
|
||||
if (CollectionUtil.isEmpty(latestData)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return createStartAndEndDtos(latestData.get(0), lineParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建起始和结束数据点
|
||||
*/
|
||||
private List<PqsCommunicateDto> createStartAndEndDtos(PqsCommunicateDto templateDto, LineCountEvaluateParam lineParam) {
|
||||
List<PqsCommunicateDto> result = new ArrayList<>();
|
||||
|
||||
// 创建起始点
|
||||
PqsCommunicateDto startDto = new PqsCommunicateDto();
|
||||
copyDtoProperties(templateDto, startDto);
|
||||
startDto.setTime(lineParam.getStartTime() + " 00:00:00");
|
||||
result.add(startDto);
|
||||
|
||||
// 创建结束点
|
||||
PqsCommunicateDto endDto = new PqsCommunicateDto();
|
||||
copyDtoProperties(templateDto, endDto);
|
||||
endDto.setTime(getEndTimeString(lineParam));
|
||||
result.add(endDto);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建结束数据点
|
||||
*/
|
||||
private PqsCommunicateDto createEndDataDto(PqsCommunicate item, LineCountEvaluateParam lineParam) {
|
||||
PqsCommunicateDto endData = new PqsCommunicateDto();
|
||||
endData.setTime(getEndTimeString(lineParam));
|
||||
endData.setDevId(lineParam.getLineId().get(0));
|
||||
endData.setType(item.getType());
|
||||
endData.setDescription(item.getDescription());
|
||||
return endData;
|
||||
}
|
||||
|
||||
/**
|
||||
* 转换实体为DTO
|
||||
*/
|
||||
private PqsCommunicateDto convertToDto(PqsCommunicate item) {
|
||||
PqsCommunicateDto dto = new PqsCommunicateDto();
|
||||
BeanUtils.copyProperties(item, dto);
|
||||
dto.setTime(DATE_TIME_FORMATTER.format(item.getTime()));
|
||||
return dto;
|
||||
}
|
||||
|
||||
/**
|
||||
* 复制DTO属性
|
||||
*/
|
||||
private void copyDtoProperties(PqsCommunicateDto source, PqsCommunicateDto target) {
|
||||
target.setDevId(source.getDevId());
|
||||
target.setType(source.getType());
|
||||
target.setDescription(source.getDescription());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结束时间字符串
|
||||
*/
|
||||
private String getEndTimeString(LineCountEvaluateParam lineParam) {
|
||||
LocalDateTime currentTime = LocalDateTime.now();
|
||||
LocalDateTime endTime = getEndDateTime(lineParam.getEndTime());
|
||||
|
||||
if (endTime.isBefore(currentTime)) {
|
||||
return lineParam.getEndTime() + " 23:59:59";
|
||||
} else {
|
||||
return currentTime.format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析日期时间字符串
|
||||
*/
|
||||
private LocalDateTime parseDateTime(String dateTimeStr) {
|
||||
return LocalDateTime.parse(dateTimeStr, DATE_TIME_FORMATTER);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取开始时间
|
||||
*/
|
||||
private LocalDateTime getStartDateTime(String startDate) {
|
||||
return parseDateTime(startDate + " 00:00:00");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取结束时间
|
||||
*/
|
||||
private LocalDateTime getEndDateTime(String endDate) {
|
||||
return parseDateTime(endDate + " 23:59:59");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -111,7 +253,10 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
@Override
|
||||
public void insertion(PqsCommunicateDto pqsCommunicateDto) {
|
||||
//根据NDID获取装置信息
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryService.findDevByNDid(pqsCommunicateDto.getDevId());
|
||||
LambdaQueryWrapper<CsEquipmentDeliveryPO> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(CsEquipmentDeliveryPO::getNdid,pqsCommunicateDto.getDevId()).ne(CsEquipmentDeliveryPO::getRunStatus,0);
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectOne(lambdaQueryWrapper);
|
||||
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(PqsCommunicate.class);
|
||||
influxQueryWrapper.eq(PqsCommunicate::getDevId,po.getId()).timeDesc().limit(1);
|
||||
List<PqsCommunicate> pqsCommunicates = pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
@@ -138,8 +283,28 @@ public class InfluxdbCsCommunicateServiceImpl implements ICsCommunicateService {
|
||||
.select(PqsCommunicate::getDevId)
|
||||
.select(PqsCommunicate::getDescription)
|
||||
.select(PqsCommunicate::getType)
|
||||
.between(PqsCommunicate::getTime, lineParam.getStartTime(), lineParam.getEndTime())
|
||||
.between(PqsCommunicate::getTime, lineParam.getStartTime() + " 00:00:00", lineParam.getEndTime() + " 23:59:59")
|
||||
.timeAsc();
|
||||
return pqsCommunicateMapper.selectByQueryWrapper(influxQueryWrapper);
|
||||
}
|
||||
|
||||
public List<PqsCommunicateDto> getRawDataFirst(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)
|
||||
.timeAsc()
|
||||
.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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ public class RoleEngineerDevServiceImpl implements RoleEngineerDevService {
|
||||
|
||||
List<String> collect = new ArrayList<>();
|
||||
if(
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode())){
|
||||
Objects.equals(role,AppRoleEnum.APP_VIP_USER.getCode()) || Objects.equals(role,AppRoleEnum.REGULAR_USER_8000.getCode()) || Objects.equals(role,"bxs_user")){
|
||||
csDeviceUserPOQueryWrapper.clear();
|
||||
csDeviceUserPOQueryWrapper.eq("status","1").and(wq -> {
|
||||
wq.eq("primary_user_id", userIndex)
|
||||
|
||||
@@ -62,6 +62,11 @@
|
||||
<artifactId>common-poi</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>harmonic-common</artifactId>
|
||||
<version>${project.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -0,0 +1,42 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.CsAlarmFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.CsAlarm;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/csAlarm", fallbackFactory = CsAlarmFeignClientFallbackFactory.class,contextId = "csAlarm")
|
||||
public interface CsAlarmFeignClient {
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/addList")
|
||||
@ApiOperation("批量写入数据")
|
||||
@ApiImplicitParam(name = "list", value = "参数", required = true)
|
||||
HttpResult<Boolean> addList(@RequestBody List<CsAlarm> list);
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/queryListByTime")
|
||||
@ApiOperation("按日期查询数据")
|
||||
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
||||
HttpResult<List<CsAlarm>> queryListByTime(@RequestParam("time") String time);
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/deleteListByTime")
|
||||
@ApiOperation("按日期删除数据")
|
||||
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
||||
HttpResult<Boolean> deleteListByTime(@RequestParam("time") String time);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.CsHarmonicFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.CsHarmonic;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/csHarmonic", fallbackFactory = CsHarmonicFeignClientFallbackFactory.class,contextId = "csHarmonic")
|
||||
public interface CsHarmonicFeignClient {
|
||||
|
||||
@PostMapping("/addList")
|
||||
@ApiOperation("批量写入数据")
|
||||
HttpResult<Boolean> addList(@RequestBody List<CsHarmonic> list);
|
||||
|
||||
@PostMapping("/queryListByTime")
|
||||
@ApiOperation("按日期查询数据")
|
||||
HttpResult<List<CsHarmonic>> queryListByTime(@RequestParam(value = "time") String time);
|
||||
|
||||
|
||||
@PostMapping("/deleteListByTime")
|
||||
@ApiOperation("按日期删除数据")
|
||||
HttpResult<Boolean> deleteListByTime(@RequestParam(value = "time") String time);
|
||||
|
||||
}
|
||||
@@ -1,19 +1,13 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csharmonic.api.fallback.EventFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryPage;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventPO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
@@ -40,4 +34,11 @@ public interface EventFeignClient {
|
||||
|
||||
@PostMapping("/getEventByTime")
|
||||
HttpResult<List<CsEventPO>> getEventByTime(@RequestParam(name = "lineList", required = false) List<String> lineList,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);
|
||||
|
||||
@PostMapping("/getDevAlarmList")
|
||||
HttpResult<List<CsEventPO>> getDevAlarmList(@RequestBody CsEventUserQueryParam param);
|
||||
|
||||
@PostMapping("/getEventByIdList")
|
||||
HttpResult<List<CsEventPO>> getEventByIdList(@RequestBody List<String> list);
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.param.CsEventUserQueryParam;
|
||||
import com.njcn.csharmonic.pojo.po.CsEventUserPO;
|
||||
import com.njcn.csharmonic.pojo.vo.EventDetailVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
@@ -20,4 +21,10 @@ public interface EventUserFeignClient {
|
||||
|
||||
@PostMapping("/queryEventList")
|
||||
HttpResult<List<EventDetailVO>> queryEventList(@RequestBody CsEventUserQueryParam csEventUserQueryParam) ;
|
||||
|
||||
@PostMapping("/addUserEventList")
|
||||
HttpResult<Boolean> addUserEventList(@RequestBody List<CsEventUserPO> list);
|
||||
|
||||
@PostMapping("/deleteByIds")
|
||||
HttpResult<Boolean> deleteByIds(@RequestBody List<String> eventList);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ package com.njcn.csharmonic.api;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.EventUserFeignClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.po.PqSensitiveUser;
|
||||
import com.njcn.device.biz.pojo.po.PqSensitiveUser;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.api.fallback.RStatLimitRateDClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.param.RStatLimitQueryParam;
|
||||
import com.njcn.csharmonic.pojo.param.StatSubstationBizBaseParam;
|
||||
import com.njcn.csharmonic.pojo.po.RStatLimitRateDPO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "", fallbackFactory = RStatLimitRateDClientFallbackFactory.class,contextId = "")
|
||||
|
||||
public interface RStatLimitRateDFeignClient {
|
||||
|
||||
@PostMapping("/limitRateD/monitorIdsGetLimitRateInfo")
|
||||
HttpResult<List<RStatLimitRateDPO>> monitorIdsGetLimitRateInfo(@RequestBody RStatLimitQueryParam rStatLimitQueryParam);
|
||||
|
||||
@PostMapping("/harmonic/getLinesRate")
|
||||
HttpResult<List<RStatLimitRateDPO>> getLinesRate(@RequestBody StatSubstationBizBaseParam param);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.SysExcelClientFallbackFactory;
|
||||
import com.njcn.harmonic.pojo.po.excel.SysExcel;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/sysExcel", fallbackFactory = SysExcelClientFallbackFactory.class,contextId = "sysExcel")
|
||||
|
||||
public interface SysExcelFeignClient {
|
||||
|
||||
@PostMapping("/querySysExcel")
|
||||
@ApiOperation("查询")
|
||||
HttpResult<List<SysExcel>> querySysExcel();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.csharmonic.api.fallback.SysExcelRelationClientFallbackFactory;
|
||||
import com.njcn.harmonic.common.pojo.vo.ReportTemplateVO;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@FeignClient(value = ServerInfo.CS_HARMONIC_BOOT, path = "/sysExcelRelation", fallbackFactory = SysExcelRelationClientFallbackFactory.class,contextId = "sysExcelRelation")
|
||||
|
||||
public interface SysExcelRelationFeignClient {
|
||||
|
||||
@PostMapping("/queryList")
|
||||
HttpResult<List<ReportTemplateVO>> queryList(@RequestParam("id") String id);
|
||||
|
||||
}
|
||||
@@ -1,11 +1,18 @@
|
||||
package com.njcn.csharmonic.api;
|
||||
|
||||
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||
import com.njcn.common.pojo.constant.ServerInfo;
|
||||
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csharmonic.api.fallback.WavePicClientFallbackFactory;
|
||||
import com.njcn.csharmonic.pojo.vo.CsEventVO;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
@@ -18,4 +25,7 @@ public interface WavePicFeignClient {
|
||||
@GetMapping("/getWavePics")
|
||||
HttpResult<CsEventVO> getWavePics(@RequestParam("eventId") String eventId);
|
||||
|
||||
@PostMapping("/updateEventById")
|
||||
HttpResult<Boolean> updateEventById(@RequestParam("id") String id);
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.njcn.csharmonic.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.csharmonic.api.CsAlarmFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsAlarm;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsAlarmFeignClientFallbackFactory implements FallbackFactory<CsAlarmFeignClient> {
|
||||
@Override
|
||||
public CsAlarmFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsAlarmFeignClient() {
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> addList(List<CsAlarm> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量写入数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsAlarm>> queryListByTime(String time) {
|
||||
log.error("{}异常,降级处理,异常为:{}","按日期查询数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> deleteListByTime(String time) {
|
||||
log.error("{}异常,降级处理,异常为:{}","按日期删除数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.njcn.csharmonic.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.csharmonic.api.CsHarmonicFeignClient;
|
||||
import com.njcn.csharmonic.pojo.po.CsHarmonic;
|
||||
import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class CsHarmonicFeignClientFallbackFactory implements FallbackFactory<CsHarmonicFeignClient> {
|
||||
@Override
|
||||
public CsHarmonicFeignClient create(Throwable cause) {
|
||||
//判断抛出异常是否为解码器抛出的业务异常
|
||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||
if (cause.getCause() instanceof BusinessException) {
|
||||
BusinessException businessException = (BusinessException) cause.getCause();
|
||||
}
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new CsHarmonicFeignClient() {
|
||||
@Override
|
||||
public HttpResult<Boolean> addList(List<CsHarmonic> list) {
|
||||
log.error("{}异常,降级处理,异常为:{}","批量写入数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<CsHarmonic>> queryListByTime(String time) {
|
||||
log.error("{}异常,降级处理,异常为:{}","按日期查询数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<Boolean> deleteListByTime(String time) {
|
||||
log.error("{}异常,降级处理,异常为:{}","按日期删除数据异常",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user