组态功能开发
This commit is contained in:
@@ -1,20 +0,0 @@
|
|||||||
package com.njcn.csdevice.api;
|
|
||||||
|
|
||||||
import com.njcn.csdevice.api.fallback.CsEdDataFeignClientFallbackFactory;
|
|
||||||
import com.njcn.csdevice.pojo.dto.CsDictDTO;
|
|
||||||
import com.njcn.common.pojo.constant.ServerInfo;
|
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
|
||||||
import org.springframework.cloud.openfeign.FeignClient;
|
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @author xy
|
|
||||||
*/
|
|
||||||
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/dict", fallbackFactory = CsEdDataFeignClientFallbackFactory.class,contextId = "edData")
|
|
||||||
public interface CsDictFeignClient {
|
|
||||||
|
|
||||||
@PostMapping("/getOwnAndFatherData")
|
|
||||||
HttpResult<CsDictDTO> getOwnAndFatherData(@RequestParam("name")String name);
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.CsLedgerFeignClientFallbackFactory;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csLedger", fallbackFactory = CsLedgerFeignClientFallbackFactory.class,contextId = "csLedger")
|
||||||
|
public interface CsLedgerFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/findDevByLineId")
|
||||||
|
HttpResult<String> findDevByLineId(@RequestParam("lineId") String lineId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,40 @@
|
|||||||
|
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.DataArrayFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/csDataArray", fallbackFactory = DataArrayFeignClientFallbackFactory.class,contextId = "csDataArray")
|
||||||
|
|
||||||
|
public interface DataArrayFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/getArrayBySet")
|
||||||
|
HttpResult<List<CsDataArray>> getArrayBySet(@RequestBody List<CsDataSet> setList);
|
||||||
|
|
||||||
|
@PostMapping("/getDataArray")
|
||||||
|
HttpResult<List<LineTargetVO>> getDataArray(@RequestBody List<String> dataSetList);
|
||||||
|
|
||||||
|
@PostMapping("/getDataArrayById")
|
||||||
|
HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.DataSetFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
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 = "/csDataSet", fallbackFactory = DataSetFeignClientFallbackFactory.class,contextId = "csDataSet")
|
||||||
|
|
||||||
|
public interface DataSetFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/getSetByModelId")
|
||||||
|
HttpResult<List<CsDataSet>> getSetByModelId(@RequestParam("modelId") String modelId);
|
||||||
|
|
||||||
|
@PostMapping("/getDataSet")
|
||||||
|
HttpResult<List<LineTargetVO>> getDataSet(@RequestParam("modelId") String modelId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -28,4 +28,8 @@ public interface DevModelFeignClient {
|
|||||||
|
|
||||||
@PostMapping("/findModel")
|
@PostMapping("/findModel")
|
||||||
HttpResult<CsDevModelPO> findModel(@RequestParam("devType") String devType, @RequestParam("version") String version, @RequestParam("time") String time);
|
HttpResult<CsDevModelPO> findModel(@RequestParam("devType") String devType, @RequestParam("version") String version, @RequestParam("time") String time);
|
||||||
|
|
||||||
|
@PostMapping("/getModelById")
|
||||||
|
HttpResult<CsDevModelPO> getModelById(@RequestParam("id") String id);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.njcn.csdevice.api;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.constant.ServerInfo;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.fallback.DevModelRelationFeignClientFallbackFactory;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||||
|
import org.springframework.cloud.openfeign.FeignClient;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@FeignClient(value = ServerInfo.CS_DEVICE_BOOT, path = "/devmodelRelation", fallbackFactory = DevModelRelationFeignClientFallbackFactory.class,contextId = "devmodelRelation")
|
||||||
|
public interface DevModelRelationFeignClient {
|
||||||
|
|
||||||
|
@PostMapping("/getModelByDevId")
|
||||||
|
HttpResult<CsDevModelRelationPO> getModelByDevId(@RequestParam("devId") String devId);
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.njcn.csdevice.api.fallback;
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
import com.njcn.csdevice.api.CsDictFeignClient;
|
|
||||||
import com.njcn.csdevice.pojo.dto.CsDictDTO;
|
|
||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
|
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -14,20 +14,21 @@ import org.springframework.stereotype.Component;
|
|||||||
*/
|
*/
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Component
|
@Component
|
||||||
public class CsDictFeignClientFallbackFactory implements FallbackFactory<CsDictFeignClient> {
|
public class CsLedgerFeignClientFallbackFactory implements FallbackFactory<CsLedgerFeignClient> {
|
||||||
@Override
|
@Override
|
||||||
public CsDictFeignClient create(Throwable cause) {
|
public CsLedgerFeignClient create(Throwable cause) {
|
||||||
//判断抛出异常是否为解码器抛出的业务异常
|
//判断抛出异常是否为解码器抛出的业务异常
|
||||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
if (cause.getCause() instanceof BusinessException) {
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
BusinessException businessException = (BusinessException) cause.getCause();
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
|
exceptionEnum = CsDeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new CsDictFeignClient() {
|
return new CsLedgerFeignClient() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public HttpResult<CsDictDTO> getOwnAndFatherData(String name) {
|
public HttpResult<String> findDevByLineId(String lineId) {
|
||||||
log.error("{}异常,降级处理,异常为:{}","获取指标自身和父级信息",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据监测点获取装置失败",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -0,0 +1,56 @@
|
|||||||
|
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.DataArrayFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
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 DataArrayFeignClientFallbackFactory implements FallbackFactory<DataArrayFeignClient> {
|
||||||
|
@Override
|
||||||
|
public DataArrayFeignClient 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 DataArrayFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsDataArray>> getArrayBySet(List<CsDataSet> setList) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据数据集获取详细数据失败",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<LineTargetVO>> getDataArray(List<String> dataSetList) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","获取详细数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsDataArray>> getDataArrayById(String pid, String name) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据数据集id和名称获取详细数据",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,54 @@
|
|||||||
|
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.DataSetFeignClient;
|
||||||
|
import com.njcn.csdevice.api.DevModelFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||||
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
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 DataSetFeignClientFallbackFactory implements FallbackFactory<DataSetFeignClient> {
|
||||||
|
@Override
|
||||||
|
public DataSetFeignClient 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 DataSetFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<CsDataSet>> getSetByModelId(String modelId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据模板id获取数据集",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<List<LineTargetVO>> getDataSet(String modelId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","获取数据集",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
|||||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.common.pojo.response.HttpResult;
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||||
import feign.hystrix.FallbackFactory;
|
import feign.hystrix.FallbackFactory;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
@@ -28,7 +29,7 @@ public class DevModelFeignClientFallbackFactory implements FallbackFactory<DevMo
|
|||||||
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
Enum<?> exceptionEnum = CommonResponseEnum.SERVICE_FALLBACK;
|
||||||
if (cause.getCause() instanceof BusinessException) {
|
if (cause.getCause() instanceof BusinessException) {
|
||||||
BusinessException businessException = (BusinessException) cause.getCause();
|
BusinessException businessException = (BusinessException) cause.getCause();
|
||||||
// exceptionEnum = UserEnumUtil.getExceptionEnum(businessException.getResult());
|
exceptionEnum = CsDeviceEnumUtil.getExceptionEnum(businessException.getResult());
|
||||||
}
|
}
|
||||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||||
return new DevModelFeignClient() {
|
return new DevModelFeignClient() {
|
||||||
@@ -50,6 +51,12 @@ public class DevModelFeignClientFallbackFactory implements FallbackFactory<DevMo
|
|||||||
log.error("{}异常,降级处理,异常为:{}","根据条件查询模板",cause.toString());
|
log.error("{}异常,降级处理,异常为:{}","根据条件查询模板",cause.toString());
|
||||||
throw new BusinessException(finalExceptionEnum);
|
throw new BusinessException(finalExceptionEnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsDevModelPO> getModelById(String id) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据id查询模板失败",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.csdevice.api.fallback;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.csdevice.api.CsLedgerFeignClient;
|
||||||
|
import com.njcn.csdevice.api.DevModelRelationFeignClient;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||||
|
import com.njcn.csdevice.utils.CsDeviceEnumUtil;
|
||||||
|
import feign.hystrix.FallbackFactory;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xy
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@Component
|
||||||
|
public class DevModelRelationFeignClientFallbackFactory implements FallbackFactory<DevModelRelationFeignClient> {
|
||||||
|
@Override
|
||||||
|
public DevModelRelationFeignClient 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 DevModelRelationFeignClient() {
|
||||||
|
@Override
|
||||||
|
public HttpResult<CsDevModelRelationPO> getModelByDevId(String devId) {
|
||||||
|
log.error("{}异常,降级处理,异常为:{}","根据装置获取模板",cause.toString());
|
||||||
|
throw new BusinessException(finalExceptionEnum);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -14,6 +14,7 @@ public enum AlgorithmResponseEnum {
|
|||||||
/**
|
/**
|
||||||
* A00500 ~ A01550 用于终端模块的枚举
|
* A00500 ~ A01550 用于终端模块的枚举
|
||||||
*/
|
*/
|
||||||
|
CS_DEVICE_COMMON_ERROR("A00500","治理终端模块异常"),
|
||||||
PROJECT_COMMON_ERROR("A00500","同一用户下项目名不能相同"),
|
PROJECT_COMMON_ERROR("A00500","同一用户下项目名不能相同"),
|
||||||
DICT_DATA_ERROR("A00501","暂无此字典表类型"),
|
DICT_DATA_ERROR("A00501","暂无此字典表类型"),
|
||||||
NDID_ERROR("A00502","存在相同的ndid"),
|
NDID_ERROR("A00502","存在相同的ndid"),
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.njcn.csdevice.pojo.dto;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/1 16:57
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class DataArrayDTO implements Serializable {
|
||||||
|
|
||||||
|
private String dataSetId;
|
||||||
|
|
||||||
|
private String dataSetName;
|
||||||
|
|
||||||
|
private String dataArrayName;
|
||||||
|
|
||||||
|
private String dataArrayShowName;
|
||||||
|
}
|
||||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.TableName;
|
|||||||
import com.njcn.db.bo.BaseEntity;
|
import com.njcn.db.bo.BaseEntity;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
|
||||||
@@ -15,8 +17,7 @@ import lombok.Setter;
|
|||||||
* @author xuyang
|
* @author xuyang
|
||||||
* @since 2023-05-31
|
* @since 2023-05-31
|
||||||
*/
|
*/
|
||||||
@Getter
|
@Data
|
||||||
@Setter
|
|
||||||
@TableName("cs_data_array")
|
@TableName("cs_data_array")
|
||||||
public class CsDataArray extends BaseEntity {
|
public class CsDataArray extends BaseEntity {
|
||||||
|
|
||||||
|
|||||||
@@ -26,9 +26,11 @@ public class CsDevModelRelationPO extends BaseEntity {
|
|||||||
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
@TableId(value = "id",type = IdType.ASSIGN_UUID)
|
||||||
private String id;
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置id")
|
||||||
@TableField(value = "dev_id")
|
@TableField(value = "dev_id")
|
||||||
private String devId;
|
private String devId;
|
||||||
|
|
||||||
|
@ApiModelProperty(value="装置模板id")
|
||||||
@TableField(value = "model_id")
|
@TableField(value = "model_id")
|
||||||
private String modelId;
|
private String modelId;
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.njcn.csdevice.pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/1 10:13
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class LineTargetVO {
|
||||||
|
|
||||||
|
@ApiModelProperty("指标id")
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
@ApiModelProperty("父id")
|
||||||
|
private String pid;
|
||||||
|
|
||||||
|
@ApiModelProperty("指标名称")
|
||||||
|
private String name;
|
||||||
|
|
||||||
|
@ApiModelProperty("显示名称")
|
||||||
|
private String anotherName;
|
||||||
|
|
||||||
|
@ApiModelProperty("排序")
|
||||||
|
private Integer sort;
|
||||||
|
|
||||||
|
@ApiModelProperty("子集")
|
||||||
|
private List<LineTargetVO> children = new ArrayList<>();
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
package com.njcn.csdevice.utils;
|
||||||
|
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.EnumUtils;
|
||||||
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
|
|
||||||
|
import javax.validation.constraints.NotNull;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hongawen
|
||||||
|
* @version 1.0.0
|
||||||
|
* @date 2021年05月26日 17:17
|
||||||
|
*/
|
||||||
|
public class CsDeviceEnumUtil {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取UserResponseEnum实例
|
||||||
|
*/
|
||||||
|
public static AlgorithmResponseEnum getResponseEnumByMessage(@NotNull Object value) {
|
||||||
|
AlgorithmResponseEnum algorithmResponseEnum;
|
||||||
|
try {
|
||||||
|
String message = value.toString();
|
||||||
|
if(message.indexOf(StrUtil.C_COMMA)>0){
|
||||||
|
value = message.substring(message.indexOf(StrUtil.C_COMMA)+1);
|
||||||
|
}
|
||||||
|
algorithmResponseEnum = EnumUtils.valueOf(AlgorithmResponseEnum.class, value, AlgorithmResponseEnum.class.getMethod(BusinessException.GET_MESSAGE_METHOD));
|
||||||
|
return Objects.isNull(algorithmResponseEnum) ? AlgorithmResponseEnum.CS_DEVICE_COMMON_ERROR : algorithmResponseEnum;
|
||||||
|
} catch (NoSuchMethodException e) {
|
||||||
|
throw new BusinessException(CommonResponseEnum.INTERNAL_ERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static Enum<?> getExceptionEnum(HttpResult<Object> result){
|
||||||
|
//如果返回错误,且为内部错误,则直接抛出异常
|
||||||
|
CommonResponseEnum commonResponseEnum = EnumUtils.getCommonResponseEnumByCode(result.getCode());
|
||||||
|
if (commonResponseEnum == CommonResponseEnum.CS_DEVICE_RESPONSE_ENUM) {
|
||||||
|
return getResponseEnumByMessage(result.getMessage());
|
||||||
|
}
|
||||||
|
return commonResponseEnum;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,13 +1,25 @@
|
|||||||
package com.njcn.csdevice.controller.Equipment;
|
package com.njcn.csdevice.controller.Equipment;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
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.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import java.util.List;
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -20,9 +32,44 @@ import com.njcn.web.controller.BaseController;
|
|||||||
@Slf4j
|
@Slf4j
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/csDataArray")
|
@RequestMapping("/csDataArray")
|
||||||
@Api(tags = "终端指标集")
|
@Api(tags = "终端详细数据")
|
||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CsDataArrayController extends BaseController {
|
public class CsDataArrayController extends BaseController {
|
||||||
|
|
||||||
|
private final ICsDataArrayService csDataArrayService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getArrayBySet")
|
||||||
|
@ApiOperation("根据数据集获取详细数据")
|
||||||
|
@ApiImplicitParam(name = "dataSetList", value = "数据集集合", required = true)
|
||||||
|
public HttpResult<List<CsDataArray>> getArrayBySet(@RequestBody List<CsDataSet> dataSetList){
|
||||||
|
String methodDescribe = getMethodDescribe("getArrayBySet");
|
||||||
|
List<CsDataArray> list = csDataArrayService.getArrayBySet(dataSetList);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getDataArray")
|
||||||
|
@ApiOperation("获取详细数据")
|
||||||
|
@ApiImplicitParam(name = "dataSetList", value = "数据集集合", required = true)
|
||||||
|
public HttpResult<List<LineTargetVO>> getDataArray(@RequestBody List<String> dataSetList){
|
||||||
|
String methodDescribe = getMethodDescribe("getDataArray");
|
||||||
|
List<LineTargetVO> list = csDataArrayService.getDataArray(dataSetList);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getDataArrayById")
|
||||||
|
@ApiOperation("获取详细数据(id)")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "pid", value = "数据集id", required = true),
|
||||||
|
@ApiImplicitParam(name = "name", value = "名称", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<List<CsDataArray>> getDataArrayById(@RequestParam("pid") String pid, @RequestParam("name") String name){
|
||||||
|
String methodDescribe = getMethodDescribe("getDataArrayById");
|
||||||
|
List<CsDataArray> list = csDataArrayService.getDataArrayById(pid, name);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,26 @@
|
|||||||
package com.njcn.csdevice.controller.Equipment;
|
package com.njcn.csdevice.controller.Equipment;
|
||||||
|
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.njcn.web.controller.BaseController;
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -24,5 +37,27 @@ import com.njcn.web.controller.BaseController;
|
|||||||
@AllArgsConstructor
|
@AllArgsConstructor
|
||||||
public class CsDataSetController extends BaseController {
|
public class CsDataSetController extends BaseController {
|
||||||
|
|
||||||
|
private final ICsDataSetService csDataSetService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getSetByModelId")
|
||||||
|
@ApiOperation("根据模板Id获取数据集")
|
||||||
|
@ApiImplicitParam(name = "modelId", value = "模板id", required = true)
|
||||||
|
public HttpResult<List<CsDataSet>> getSetByModelId(@RequestParam("modelId") String modelId){
|
||||||
|
String methodDescribe = getMethodDescribe("getSetByModelId");
|
||||||
|
List<CsDataSet> list = csDataSetService.findDataSetByModelId(modelId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getDataSet")
|
||||||
|
@ApiOperation("获取数据集")
|
||||||
|
@ApiImplicitParam(name = "modelId", value = "模板id", required = true)
|
||||||
|
public HttpResult<List<LineTargetVO>> getDataSet(@RequestParam("modelId") String modelId){
|
||||||
|
String methodDescribe = getMethodDescribe("getDataSet");
|
||||||
|
List<LineTargetVO> list = csDataSetService.getDataSet(modelId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -95,12 +95,19 @@ public class DevModelController extends BaseController {
|
|||||||
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
@ApiImplicitParam(name = "time", value = "时间", required = true)
|
||||||
})
|
})
|
||||||
public HttpResult<CsDevModelPO> findModel(@RequestParam("devType") String devType,@RequestParam("version") String version,@RequestParam("time") String time){
|
public HttpResult<CsDevModelPO> findModel(@RequestParam("devType") String devType,@RequestParam("version") String version,@RequestParam("time") String time){
|
||||||
System.out.println(devType);
|
|
||||||
System.out.println(version);
|
|
||||||
System.out.println(time);
|
|
||||||
String methodDescribe = getMethodDescribe("findModel");
|
String methodDescribe = getMethodDescribe("findModel");
|
||||||
CsDevModelPO csDevModelPo = csDevModelService.findModel(devType,version,time);
|
CsDevModelPO csDevModelPo = csDevModelService.findModel(devType,version,time);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDevModelPo, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, csDevModelPo, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getModelById")
|
||||||
|
@ApiOperation("根据模板Id获取模板数据")
|
||||||
|
@ApiImplicitParam(name = "id", value = "模板id", required = true)
|
||||||
|
public HttpResult<CsDevModelPO> getModelById(@RequestParam("id") String id){
|
||||||
|
String methodDescribe = getMethodDescribe("getDataById");
|
||||||
|
CsDevModelPO po = csDevModelService.getModelById(id);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,10 +19,7 @@ import io.swagger.annotations.ApiOperation;
|
|||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.springframework.validation.annotation.Validated;
|
import org.springframework.validation.annotation.Validated;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.*;
|
||||||
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;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -80,6 +77,14 @@ public class DevModelRelationController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/getModelByDevId")
|
||||||
|
@ApiOperation("根据装置Id查询模板")
|
||||||
|
@ApiImplicitParam(name = "devId", value = "装置id", required = true)
|
||||||
|
public HttpResult<CsDevModelRelationPO> getModelByDevId(@RequestParam("devId") String devId){
|
||||||
|
String methodDescribe = getMethodDescribe("getModelByDevId");
|
||||||
|
CsDevModelRelationPO po = csDevModelRelationService.findModelByDevId(devId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, po, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.njcn.csdevice.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -13,4 +17,6 @@ import com.njcn.csdevice.pojo.po.CsDataArray;
|
|||||||
*/
|
*/
|
||||||
public interface CsDataArrayMapper extends BaseMapper<CsDataArray> {
|
public interface CsDataArrayMapper extends BaseMapper<CsDataArray> {
|
||||||
|
|
||||||
|
List<LineTargetVO> getDataArray(@Param("list") List<String> list);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,10 @@ package com.njcn.csdevice.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -13,4 +17,6 @@ import com.njcn.csdevice.pojo.po.CsDataSet;
|
|||||||
*/
|
*/
|
||||||
public interface CsDataSetMapper extends BaseMapper<CsDataSet> {
|
public interface CsDataSetMapper extends BaseMapper<CsDataSet> {
|
||||||
|
|
||||||
|
List<LineTargetVO> getDataSet(@Param("modelId") String modelId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,15 @@ package com.njcn.csdevice.mapper;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryParm;
|
||||||
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
import com.njcn.csdevice.pojo.vo.CsDevModelPageVO;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Description:
|
* Description:
|
||||||
@@ -21,4 +24,6 @@ public interface CsDevModelMapper extends BaseMapper<CsDevModelPO> {
|
|||||||
Page<CsDevModelPageVO> getPage(Page<CsDevModelPageVO> returnpage,@Param("csDevModelQueryParm") CsDevModelQueryParm csDevModelQueryParm);
|
Page<CsDevModelPageVO> getPage(Page<CsDevModelPageVO> returnpage,@Param("csDevModelQueryParm") CsDevModelQueryParm csDevModelQueryParm);
|
||||||
|
|
||||||
CsDevModelPageVO queryOne(@Param("csDevModelQueryListParm")CsDevModelQueryListParm csDevModelQueryListParm);
|
CsDevModelPageVO queryOne(@Param("csDevModelQueryListParm")CsDevModelQueryListParm csDevModelQueryListParm);
|
||||||
|
|
||||||
|
List<DataArrayDTO> getDataArrayByModelId(@Param("modelId")String modelId);
|
||||||
}
|
}
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
package com.njcn.csdevice.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.njcn.csdevice.pojo.dto.CsDictDTO;
|
|
||||||
import com.njcn.csdevice.pojo.po.CsDictPO;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* Description:
|
|
||||||
* 接口文档访问地址:http://serverIP:port/swagger-ui.html
|
|
||||||
* Date: 2023/4/3 14:53【需求编号】
|
|
||||||
*
|
|
||||||
* @author clam
|
|
||||||
* @version V1.0.0
|
|
||||||
*/
|
|
||||||
public interface CsDictMapper extends BaseMapper<CsDictPO> {
|
|
||||||
|
|
||||||
CsDictDTO getOwnAndFatherData(@Param("name") String name);
|
|
||||||
}
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.csdevice.mapper.CsDataArrayMapper">
|
||||||
|
|
||||||
|
<select id="getDataArray" resultType="LineTargetVO">
|
||||||
|
select
|
||||||
|
pid,
|
||||||
|
name,
|
||||||
|
another_name anotherName,
|
||||||
|
idx sort
|
||||||
|
from
|
||||||
|
cs_data_array
|
||||||
|
where
|
||||||
|
pid in
|
||||||
|
<foreach collection='list' item='item' index="index" open='(' separator=',' close=')'>
|
||||||
|
#{item}
|
||||||
|
</foreach>
|
||||||
|
group by pid,name,another_name,idx
|
||||||
|
order by idx
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
|
<mapper namespace="com.njcn.csdevice.mapper.CsDataSetMapper">
|
||||||
|
|
||||||
|
<select id="getDataSet" resultType="LineTargetVO">
|
||||||
|
select
|
||||||
|
id,
|
||||||
|
pid,
|
||||||
|
name,
|
||||||
|
another_name anotherName,
|
||||||
|
idx sort
|
||||||
|
from
|
||||||
|
cs_data_set
|
||||||
|
where
|
||||||
|
pid = #{modelId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
</mapper>
|
||||||
@@ -74,4 +74,18 @@
|
|||||||
</if>
|
</if>
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getDataArrayByModelId" resultType="com.njcn.csdevice.pojo.dto.DataArrayDTO">
|
||||||
|
select
|
||||||
|
distinct t1.id dataSetId,t1.another_name dataSetName ,t2.name dataArrayName,t2.another_name dataArrayShowName
|
||||||
|
from
|
||||||
|
cs_dev_model t0
|
||||||
|
left join cs_data_set t1 on
|
||||||
|
t0.id = t1.pid
|
||||||
|
left join cs_data_array t2 on
|
||||||
|
t1.id = t2.pid
|
||||||
|
where
|
||||||
|
t0.id = #{modelId}
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -38,4 +38,12 @@ public interface CsDevModelRelationService extends IService<CsDevModelRelationPO
|
|||||||
Boolean AuditDevModelRelation(CsDevModelRelationAuidtParm auditParm);
|
Boolean AuditDevModelRelation(CsDevModelRelationAuidtParm auditParm);
|
||||||
|
|
||||||
List<CsDevModelRelationVO> queryDevModelRelation(CsDevModelRelationQueryParm queryParm);
|
List<CsDevModelRelationVO> queryDevModelRelation(CsDevModelRelationQueryParm queryParm);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据装置id获取关联信息
|
||||||
|
* @param devId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
CsDevModelRelationPO findModelByDevId(String devId);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -64,11 +64,10 @@ public interface CsDevModelService extends IService<CsDevModelPO>{
|
|||||||
CsDevModelPO findModel(String devType, String version, String time);
|
CsDevModelPO findModel(String devType, String version, String time);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据装置型号查询模板
|
* 根据id获取模板信息
|
||||||
* @param devType 装置型号
|
* @param id
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
CsDevModelPO findModelByDevType(String devType);
|
CsDevModelPO getModelById(String id);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,9 @@ package com.njcn.csdevice.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -15,13 +18,16 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
public interface ICsDataArrayService extends IService<CsDataArray> {
|
public interface ICsDataArrayService extends IService<CsDataArray> {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据数据集id获取指标数据
|
* 根据数据集获取指标数据
|
||||||
* @param dataSetId 数据集Id
|
* @param list 数据集
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<CsDataArray> findDataArrayByDataSetId(String dataSetId);
|
List<CsDataArray> getArrayBySet(List<CsDataSet> list);
|
||||||
|
|
||||||
|
List<LineTargetVO> getDataArray(List<String> list);
|
||||||
|
|
||||||
|
List<CsDataArray> getDataArrayById(String pid, String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service;
|
|||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
import com.baomidou.mybatisplus.extension.service.IService;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@@ -22,4 +23,11 @@ public interface ICsDataSetService extends IService<CsDataSet> {
|
|||||||
*/
|
*/
|
||||||
List<CsDataSet> findDataSetByModelId(String modelId);
|
List<CsDataSet> findDataSetByModelId(String modelId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取数据集
|
||||||
|
* @param modelId 模板id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<LineTargetVO> getDataSet(String modelId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,10 +3,13 @@ package com.njcn.csdevice.service.impl;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -20,7 +23,20 @@ import java.util.List;
|
|||||||
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDataArray> implements ICsDataArrayService {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<CsDataArray> findDataArrayByDataSetId(String dataSetId) {
|
public List<CsDataArray> getArrayBySet(List<CsDataSet> list) {
|
||||||
return this.lambdaQuery().eq(CsDataArray::getPid,dataSetId).list();
|
List<String> setList = list.stream().map(CsDataSet::getId).collect(Collectors.toList());
|
||||||
|
return this.lambdaQuery().in(CsDataArray::getPid,setList).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LineTargetVO> getDataArray(List<String> list) {
|
||||||
|
return this.baseMapper.getDataArray(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<CsDataArray> getDataArrayById(String pid, String name) {
|
||||||
|
return this.lambdaQuery().eq(CsDataArray::getPid,pid).eq(CsDataArray::getName,name).list();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ package com.njcn.csdevice.service.impl;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
import com.njcn.csdevice.service.ICsDataSetService;
|
import com.njcn.csdevice.service.ICsDataSetService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -23,4 +24,10 @@ public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet
|
|||||||
public List<CsDataSet> findDataSetByModelId(String modelId) {
|
public List<CsDataSet> findDataSetByModelId(String modelId) {
|
||||||
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).list();
|
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).list();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LineTargetVO> getDataSet(String modelId) {
|
||||||
|
return this.baseMapper.getDataSet(modelId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,4 +87,9 @@ public class CsDevModelRelationServiceImpl extends ServiceImpl<CsDevModelRelatio
|
|||||||
}).collect (Collectors.toList ( ));
|
}).collect (Collectors.toList ( ));
|
||||||
return collect;
|
return collect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public CsDevModelRelationPO findModelByDevId(String devId) {
|
||||||
|
return this.lambdaQuery().eq(CsDevModelRelationPO::getDevId,devId).eq(CsDevModelRelationPO::getStatus,1).one();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
|||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
import com.njcn.csdevice.mapper.CsDevModelMapper;
|
||||||
|
import com.njcn.csdevice.pojo.dto.DataArrayDTO;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAddParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelAuditParm;
|
||||||
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
import com.njcn.csdevice.pojo.param.CsDevModelQueryListParm;
|
||||||
@@ -19,6 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@@ -77,7 +81,8 @@ public class CsDevModelServiceImpl extends ServiceImpl<CsDevModelMapper, CsDevMo
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public CsDevModelPO findModelByDevType(String devType) {
|
public CsDevModelPO getModelById(String id) {
|
||||||
return this.lambdaQuery().eq(CsDevModelPO::getDevType,devType).eq(CsDevModelPO::getStatus,1).one();
|
return this.lambdaQuery().eq(CsDevModelPO::getId,id).one();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package pojo.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/2 11:15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class TargetDetailVO implements Serializable {
|
||||||
|
|
||||||
|
@ApiModelProperty("数据类型")
|
||||||
|
private List<String> dataTypeList;
|
||||||
|
|
||||||
|
@ApiModelProperty("相别")
|
||||||
|
private List<String> phasicList;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
package com.njcn.harmonic.controller;
|
||||||
|
|
||||||
|
import com.njcn.common.pojo.annotation.OperateInfo;
|
||||||
|
import com.njcn.common.pojo.enums.common.LogEnum;
|
||||||
|
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||||
|
import com.njcn.common.pojo.response.HttpResult;
|
||||||
|
import com.njcn.common.utils.HttpResultUtil;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import com.njcn.harmonic.service.ILineTargetService;
|
||||||
|
import com.njcn.web.controller.BaseController;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import io.swagger.annotations.ApiImplicitParam;
|
||||||
|
import io.swagger.annotations.ApiImplicitParams;
|
||||||
|
import io.swagger.annotations.ApiOperation;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import pojo.vo.TargetDetailVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/1 10:03
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/lineTarget")
|
||||||
|
@Api(tags = "组态指标绑定")
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LineTargetController extends BaseController {
|
||||||
|
|
||||||
|
private final ILineTargetService lineTargetService;
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/target")
|
||||||
|
@ApiOperation("监测点指标")
|
||||||
|
@ApiImplicitParam(name = "lineId", value = "监测点Id", required = true)
|
||||||
|
public HttpResult<List<LineTargetVO>> getLineTarget(@RequestParam("lineId") String lineId) {
|
||||||
|
String methodDescribe = getMethodDescribe("getLineTarget");
|
||||||
|
List<LineTargetVO> list = lineTargetService.getLineTarget(lineId);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/targetDetail")
|
||||||
|
@ApiOperation("获取指标数据类型和相别")
|
||||||
|
@ApiImplicitParams({
|
||||||
|
@ApiImplicitParam(name = "pid", value = "数据集id", required = true),
|
||||||
|
@ApiImplicitParam(name = "name", value = "名称", required = true)
|
||||||
|
})
|
||||||
|
public HttpResult<TargetDetailVO> getTargetDetail(@RequestParam("pid") String pid, @RequestParam("name") String name) {
|
||||||
|
String methodDescribe = getMethodDescribe("getTargetDetail");
|
||||||
|
TargetDetailVO list = lineTargetService.getTargetDetail(pid,name);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.njcn.harmonic.service;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import pojo.vo.TargetDetailVO;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author xuyang
|
||||||
|
*/
|
||||||
|
public interface ILineTargetService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据监测点Id获取对应指标
|
||||||
|
* @param lineId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<LineTargetVO> getLineTarget(String lineId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取指标的数据类型和相别
|
||||||
|
* @param pid
|
||||||
|
* @param name
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
TargetDetailVO getTargetDetail(String pid, String name);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.njcn.harmonic.service.impl;
|
||||||
|
|
||||||
|
import com.njcn.csdevice.api.*;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelPO;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
|
import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||||
|
import com.njcn.harmonic.service.ILineTargetService;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import pojo.vo.TargetDetailVO;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类的介绍:
|
||||||
|
*
|
||||||
|
* @author xuyang
|
||||||
|
* @version 1.0.0
|
||||||
|
* @createTime 2023/6/1 10:11
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LineTargetServiceImpl implements ILineTargetService {
|
||||||
|
|
||||||
|
private final CsLedgerFeignClient csLedgerFeignClient;
|
||||||
|
|
||||||
|
private final DevModelRelationFeignClient devModelRelationFeignClient;
|
||||||
|
|
||||||
|
private final DevModelFeignClient devModelFeignClient;
|
||||||
|
|
||||||
|
private final DataSetFeignClient dataSetFeignClient;
|
||||||
|
|
||||||
|
private final DataArrayFeignClient dataArrayFeignClient;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<LineTargetVO> getLineTarget(String lineId) {
|
||||||
|
List<LineTargetVO> list = new ArrayList<>();
|
||||||
|
String devId = csLedgerFeignClient.findDevByLineId(lineId).getData();
|
||||||
|
CsDevModelRelationPO po = devModelRelationFeignClient.getModelByDevId(devId).getData();
|
||||||
|
if (!Objects.isNull(po)){
|
||||||
|
CsDevModelPO csDevModelPo = devModelFeignClient.getModelById(po.getModelId()).getData();
|
||||||
|
List<LineTargetVO> dataSetList = dataSetFeignClient.getDataSet(csDevModelPo.getId()).getData();
|
||||||
|
List<String> setList = dataSetList.stream().map(LineTargetVO::getId).collect(Collectors.toList());
|
||||||
|
List<LineTargetVO> dataArrayList = dataArrayFeignClient.getDataArray(setList).getData();
|
||||||
|
dataSetList.forEach(dev -> dev.setChildren(getChildren(dev, dataArrayList)));
|
||||||
|
list.addAll(dataSetList);
|
||||||
|
}
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TargetDetailVO getTargetDetail(String pid, String name) {
|
||||||
|
TargetDetailVO vo = new TargetDetailVO();
|
||||||
|
List<CsDataArray> dataArrayList = dataArrayFeignClient.getDataArrayById(pid,name).getData();
|
||||||
|
List<String> dataType = dataArrayList.stream().map(CsDataArray::getStatMethod).distinct().collect(Collectors.toList());
|
||||||
|
List<String> phasic = dataArrayList.stream().map(CsDataArray::getPhase).distinct().collect(Collectors.toList());
|
||||||
|
vo.setDataTypeList(dataType);
|
||||||
|
vo.setPhasicList(phasic);
|
||||||
|
return vo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取子节点
|
||||||
|
*/
|
||||||
|
public List<LineTargetVO> getChildren(LineTargetVO item, List<LineTargetVO> all) {
|
||||||
|
return all.stream().filter(allItem -> allItem.getPid().equals(item.getId())).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user