代码调整

This commit is contained in:
2023-08-04 11:20:36 +08:00
parent 448af492d6
commit 15d8494cac
21 changed files with 238 additions and 108 deletions

View File

@@ -19,6 +19,7 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
/**
* <p>
@@ -33,6 +34,7 @@ import org.springframework.web.multipart.MultipartFile;
@Api(tags = "组态图元")
@AllArgsConstructor
@Deprecated
@ApiIgnore
public class CsElementController extends BaseController {
private final ICsElementService csElementService;

View File

@@ -5,8 +5,7 @@ import com.google.common.reflect.TypeToken;
import com.njcn.common.pojo.exception.BusinessException;
import com.njcn.csdevice.api.*;
import com.njcn.csdevice.pojo.po.CsDataArray;
import com.njcn.csdevice.pojo.po.CsDevModelPO;
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
import com.njcn.csdevice.pojo.po.CsLinePO;
import com.njcn.csdevice.pojo.vo.DataArrayTreeVO;
import com.njcn.csdevice.pojo.vo.LineTargetVO;
import com.njcn.csharmonic.enums.CsHarmonicResponseEnum;
@@ -17,7 +16,9 @@ import com.njcn.csharmonic.service.ILineTargetService;
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
import com.njcn.influx.service.CommonService;
import com.njcn.oss.utils.FileStorageUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.api.EpdFeignClient;
import com.njcn.system.enums.DicDataEnum;
import lombok.AllArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;
@@ -30,6 +31,7 @@ import java.math.BigDecimal;
import java.math.RoundingMode;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
@@ -49,8 +51,6 @@ public class LineTargetServiceImpl implements ILineTargetService {
private final DevModelRelationFeignClient devModelRelationFeignClient;
private final DevModelFeignClient devModelFeignClient;
private final DataSetFeignClient dataSetFeignClient;
private final DataArrayFeignClient dataArrayFeignClient;
@@ -63,21 +63,36 @@ public class LineTargetServiceImpl implements ILineTargetService {
private final CommonService commonService;
private final CsLineFeignClient csLineFeignClient;
private final DicDataFeignClient dicDataFeignClient;
@Override
public List<DataArrayTreeVO> getLineTarget(String lineId) {
List<DataArrayTreeVO> dataArrayList = new ArrayList<>();
List<String> setList = new ArrayList<>();
String devId = csLedgerFeignClient.findDevByLineId(lineId).getData();
if (!Objects.isNull(devId)){
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());
dataArrayList = dataArrayFeignClient.getDataArray(setList).getData();
}
//1.获取监测点的安装位置
CsLinePO line = csLineFeignClient.queryLineById(Collections.singletonList(lineId)).getData().get(0);
String code = dicDataFeignClient.getDicDataById(line.getPosition()).getData().getCode();
String modelId = null;
List<LineTargetVO> dataSetList = new ArrayList<>();
//治理监测点
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
modelId = devModelRelationFeignClient.getModelByType(devId,0).getData();
dataSetList = dataSetFeignClient.getDataSet(modelId,0).getData();
}
return dataArrayList;
//负载侧监测点
else if (Objects.equals(code, DicDataEnum.LOAD_SIDE.getCode())){
modelId = devModelRelationFeignClient.getModelByType(devId,1).getData();
dataSetList = dataSetFeignClient.getDataSet(modelId,1).getData();
}
//电网侧监测点
else if (Objects.equals(code, DicDataEnum.GRID_SIDE.getCode())){
modelId = devModelRelationFeignClient.getModelByType(devId,1).getData();
dataSetList = dataSetFeignClient.getDataSet(modelId,2).getData();
}
setList = dataSetList.stream().map(LineTargetVO::getId).collect(Collectors.toList());
return dataArrayFeignClient.getDataArray(setList).getData();
}
@Override