代码调整
This commit is contained in:
@@ -19,9 +19,9 @@ import java.util.List;
|
||||
public interface DataSetFeignClient {
|
||||
|
||||
@PostMapping("/getSetByModelId")
|
||||
HttpResult<List<CsDataSet>> getSetByModelId(@RequestParam("modelId") String modelId);
|
||||
HttpResult<List<CsDataSet>> getSetByModelId(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev);
|
||||
|
||||
@PostMapping("/getDataSet")
|
||||
HttpResult<List<LineTargetVO>> getDataSet(@RequestParam("modelId") String modelId);
|
||||
HttpResult<List<LineTargetVO>> getDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev);
|
||||
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ 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
|
||||
*/
|
||||
@@ -18,9 +20,12 @@ import org.springframework.web.bind.annotation.RequestParam;
|
||||
public interface DevModelRelationFeignClient {
|
||||
|
||||
@PostMapping("/getModelByDevId")
|
||||
HttpResult<CsDevModelRelationPO> getModelByDevId(@RequestParam("devId") String devId);
|
||||
HttpResult<List<CsDevModelRelationPO>> getModelByDevId(@RequestParam("devId") String devId);
|
||||
|
||||
@PostMapping("/addDevModelRelation")
|
||||
HttpResult<CsDevModelRelationPO> addDevModelRelation(@RequestBody @Validated CsDevModelRelationAddParm addParm);
|
||||
|
||||
@PostMapping("/getModelByType")
|
||||
HttpResult<String> getModelByType(@RequestParam("devId") String devId, @RequestParam("type") Integer type);
|
||||
|
||||
}
|
||||
|
||||
@@ -34,13 +34,13 @@ public class DataSetFeignClientFallbackFactory implements FallbackFactory<DataSe
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DataSetFeignClient() {
|
||||
@Override
|
||||
public HttpResult<List<CsDataSet>> getSetByModelId(String modelId) {
|
||||
public HttpResult<List<CsDataSet>> getSetByModelId(String modelId,Integer clDev) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据模板id获取数据集",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<List<LineTargetVO>> getDataSet(String modelId) {
|
||||
public HttpResult<List<LineTargetVO>> getDataSet(String modelId,Integer clDev) {
|
||||
log.error("{}异常,降级处理,异常为:{}","获取数据集",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@@ -11,6 +11,8 @@ import feign.hystrix.FallbackFactory;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author xy
|
||||
*/
|
||||
@@ -28,7 +30,7 @@ public class DevModelRelationFeignClientFallbackFactory implements FallbackFacto
|
||||
Enum<?> finalExceptionEnum = exceptionEnum;
|
||||
return new DevModelRelationFeignClient() {
|
||||
@Override
|
||||
public HttpResult<CsDevModelRelationPO> getModelByDevId(String devId) {
|
||||
public HttpResult<List<CsDevModelRelationPO>> getModelByDevId(String devId) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置获取模板",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
@@ -38,6 +40,12 @@ public class DevModelRelationFeignClientFallbackFactory implements FallbackFacto
|
||||
log.error("{}异常,降级处理,异常为:{}","绑定设备与模板",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public HttpResult<String> getModelByType(String devId, Integer type) {
|
||||
log.error("{}异常,降级处理,异常为:{}","根据装置类型查询模板",cause.toString());
|
||||
throw new BusinessException(finalExceptionEnum);
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.njcn.csdevice.service.ICsDataSetService;
|
||||
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;
|
||||
@@ -42,20 +43,26 @@ public class CsDataSetController extends BaseController {
|
||||
@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){
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
|
||||
@ApiImplicitParam(name = "clDev", value = "逻辑子设备标识", required = true),
|
||||
})
|
||||
public HttpResult<List<CsDataSet>> getSetByModelId(@RequestParam("modelId") String modelId, @RequestParam("clDev") Integer clDev){
|
||||
String methodDescribe = getMethodDescribe("getSetByModelId");
|
||||
List<CsDataSet> list = csDataSetService.findDataSetByModelId(modelId);
|
||||
List<CsDataSet> list = csDataSetService.findDataSetByModelId(modelId,clDev);
|
||||
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){
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "modelId", value = "模板id", required = true),
|
||||
@ApiImplicitParam(name = "clDev", value = "逻辑子设备标识", required = true)
|
||||
})
|
||||
public HttpResult<List<LineTargetVO>> getDataSet(@RequestParam("modelId") String modelId,@RequestParam("clDev") Integer clDev){
|
||||
String methodDescribe = getMethodDescribe("getDataSet");
|
||||
List<LineTargetVO> list = csDataSetService.getDataSet(modelId);
|
||||
List<LineTargetVO> list = csDataSetService.getDataSet(modelId,clDev);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -15,11 +15,13 @@ import com.njcn.csdevice.service.CsDevModelRelationService;
|
||||
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.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import springfox.documentation.annotations.ApiIgnore;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -87,4 +89,18 @@ public class DevModelRelationController extends BaseController {
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||
}
|
||||
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/getModelByType")
|
||||
@ApiOperation("根据装置类型查询模板")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "devId", value = "装置id", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "模板类型", required = true)
|
||||
})
|
||||
@ApiIgnore
|
||||
public HttpResult<String> getModelByType(@RequestParam("devId") String devId, @RequestParam("type") Integer type){
|
||||
String methodDescribe = getMethodDescribe("getModelByType");
|
||||
String modelId = csDevModelRelationService.getModelByType(devId,type);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, modelId, methodDescribe);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -151,10 +151,11 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "deviceId", value = "装置id", required = true),
|
||||
@ApiImplicitParam(name = "type", value = "类型", required = true),
|
||||
@ApiImplicitParam(name = "lineId", value = "监测点id", required = true)
|
||||
})
|
||||
public HttpResult<DeviceManagerVO> getDeviceData(@RequestParam String deviceId,@RequestParam String type){
|
||||
public HttpResult<DeviceManagerVO> getDeviceData(@RequestParam String deviceId,@RequestParam String type,@RequestParam String lineId){
|
||||
String methodDescribe = getMethodDescribe("getDeviceData");
|
||||
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId,type);
|
||||
DeviceManagerVO vo = csEquipmentDeliveryService.getDeviceData(deviceId,type,lineId);
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, vo, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -87,7 +87,7 @@ public class LineTopologyDiagramController extends BaseController {
|
||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||
@PostMapping("/auditList")
|
||||
@ApiOperation("批量修改监测点拓扑图关系")
|
||||
@ApiImplicitParam(name = "list", value = "监测点拓扑图数据集", required = true)
|
||||
@ApiImplicitParam(name = "linePostionParam", value = "监测点拓扑图数据集", required = true)
|
||||
public HttpResult<String> auditList(@RequestBody LinePostionParam linePostionParam){
|
||||
String methodDescribe = getMethodDescribe("auditList");
|
||||
appLineTopologyDiagramService.auditList(linePostionParam.getPointList());
|
||||
|
||||
@@ -17,6 +17,6 @@ import java.util.List;
|
||||
*/
|
||||
public interface CsDataSetMapper extends BaseMapper<CsDataSet> {
|
||||
|
||||
List<LineTargetVO> getDataSet(@Param("modelId") String modelId);
|
||||
List<LineTargetVO> getDataSet(@Param("modelId") String modelId,@Param("clDev") Integer clDev);
|
||||
|
||||
}
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -13,4 +14,7 @@ import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CsDevModelRelationMapper extends BaseMapper<CsDevModelRelationPO> {
|
||||
|
||||
String getModelByType(@Param("devId") String devId, @Param("type") Integer type);
|
||||
|
||||
}
|
||||
@@ -12,7 +12,8 @@
|
||||
from
|
||||
cs_data_set
|
||||
where
|
||||
pid = #{modelId}
|
||||
pid = #{modelId} and cl_dev = #{clDev}
|
||||
order by type,cl_dev
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -17,4 +17,16 @@
|
||||
<!--@mbg.generated-->
|
||||
id, dev_id, `model id`, create_by, create_time, update_by, update_time, `status`
|
||||
</sql>
|
||||
|
||||
|
||||
<select id="getModelByType" resultType="string">
|
||||
select
|
||||
t1.id
|
||||
from
|
||||
cs_dev_model_relation t0
|
||||
left join cs_dev_model t1 on
|
||||
t0.model_id = t1.id
|
||||
where
|
||||
t0.dev_id = #{devId} and t1.`type` = #{type}
|
||||
</select>
|
||||
</mapper>
|
||||
@@ -46,4 +46,11 @@ public interface CsDevModelRelationService extends IService<CsDevModelRelationPO
|
||||
*/
|
||||
List<CsDevModelRelationPO> findModelByDevId(String devId);
|
||||
|
||||
/**
|
||||
* 根据装置id获取关联信息
|
||||
* @param devId
|
||||
* @return
|
||||
*/
|
||||
String getModelByType(String devId, Integer type);
|
||||
|
||||
}
|
||||
|
||||
@@ -75,5 +75,5 @@ public interface CsEquipmentDeliveryService extends IService<CsEquipmentDelivery
|
||||
* 获取装置基础数据和模板数据
|
||||
* @return
|
||||
*/
|
||||
DeviceManagerVO getDeviceData(String deviceId,String type);
|
||||
DeviceManagerVO getDeviceData(String deviceId,String type,String lineId);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,14 @@ import java.util.List;
|
||||
*/
|
||||
public interface ICsDataSetService extends IService<CsDataSet> {
|
||||
|
||||
/**
|
||||
* 根据模板、逻辑子设备标识获取数据集
|
||||
* @param modelId 模板id
|
||||
* @param clDev 逻辑子设备标识
|
||||
* @return
|
||||
*/
|
||||
List<CsDataSet> findDataSetByModelId(String modelId, Integer clDev);
|
||||
|
||||
/**
|
||||
* 根据模板获取数据集
|
||||
* @param modelId 模板id
|
||||
@@ -23,11 +31,11 @@ public interface ICsDataSetService extends IService<CsDataSet> {
|
||||
*/
|
||||
List<CsDataSet> findDataSetByModelId(String modelId);
|
||||
|
||||
|
||||
/**
|
||||
* 获取数据集
|
||||
* @param modelId 模板id
|
||||
* @param clDev 逻辑子设备标识
|
||||
* @return
|
||||
*/
|
||||
List<LineTargetVO> getDataSet(String modelId);
|
||||
List<LineTargetVO> getDataSet(String modelId,Integer clDev);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,6 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
vo2.setId(item.getDataSetId() + item.getDataArrayName());
|
||||
vo2.setName(item.getDataArrayName());
|
||||
vo2.setShowName(item.getDataArrayShowName());
|
||||
List<String> statMethodList = Arrays.asList(item.getStatMethod().split(","));
|
||||
List<String> phaseList = Arrays.asList(item.getPhase().split(","));
|
||||
phaseList.forEach(item2->{
|
||||
List<DataArrayTreeVO> list4 = new ArrayList<>();
|
||||
@@ -108,29 +107,38 @@ public class CsDataArrayServiceImpl extends ServiceImpl<CsDataArrayMapper, CsDat
|
||||
} else {
|
||||
vo3.setShowName(item2);
|
||||
}
|
||||
statMethodList.forEach(item3->{
|
||||
if (Objects.isNull(item.getStatMethod())){
|
||||
DataArrayTreeVO vo4 = new DataArrayTreeVO();
|
||||
vo4.setId(item.getDataSetId() + item.getDataArrayName()+item2 + item3);
|
||||
vo4.setName(item3);
|
||||
switch (item3) {
|
||||
case "avg":
|
||||
vo4.setShowName("平均值");
|
||||
break;
|
||||
case "max":
|
||||
vo4.setShowName("最大值");
|
||||
break;
|
||||
case "min":
|
||||
vo4.setShowName("最小值");
|
||||
break;
|
||||
case "cp95":
|
||||
vo4.setShowName("CP95");
|
||||
break;
|
||||
default:
|
||||
vo4.setShowName(item3);
|
||||
break;
|
||||
}
|
||||
vo4.setId(item.getDataSetId() + item.getDataArrayName()+item2+"M");
|
||||
vo4.setName("无数据类型");
|
||||
vo4.setShowName("无数据类型");
|
||||
list4.add(vo4);
|
||||
});
|
||||
} else {
|
||||
List<String> statMethodList = Arrays.asList(item.getStatMethod().split(","));
|
||||
statMethodList.forEach(item3->{
|
||||
DataArrayTreeVO vo4 = new DataArrayTreeVO();
|
||||
vo4.setId(item.getDataSetId() + item.getDataArrayName()+item2 + item3);
|
||||
vo4.setName(item3);
|
||||
switch (item3) {
|
||||
case "avg":
|
||||
vo4.setShowName("平均值");
|
||||
break;
|
||||
case "max":
|
||||
vo4.setShowName("最大值");
|
||||
break;
|
||||
case "min":
|
||||
vo4.setShowName("最小值");
|
||||
break;
|
||||
case "cp95":
|
||||
vo4.setShowName("CP95");
|
||||
break;
|
||||
default:
|
||||
vo4.setShowName(item3);
|
||||
break;
|
||||
}
|
||||
list4.add(vo4);
|
||||
});
|
||||
}
|
||||
vo3.setChildren(list4);
|
||||
list3.add(vo3);
|
||||
});
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.njcn.csdevice.service.impl;
|
||||
|
||||
import com.alibaba.excel.util.CollectionUtils;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.csdevice.mapper.CsDataSetMapper;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
@@ -8,7 +7,7 @@ import com.njcn.csdevice.pojo.vo.LineTargetVO;
|
||||
import com.njcn.csdevice.service.ICsDataSetService;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -23,18 +22,18 @@ import java.util.List;
|
||||
public class CsDataSetServiceImpl extends ServiceImpl<CsDataSetMapper, CsDataSet> implements ICsDataSetService {
|
||||
|
||||
@Override
|
||||
public List<CsDataSet> findDataSetByModelId(String modelId) {
|
||||
List<CsDataSet> list = new ArrayList<>();
|
||||
list = this.lambdaQuery().eq(CsDataSet::getPid,modelId).eq(CsDataSet::getType,0).list();
|
||||
if (CollectionUtils.isEmpty(list)){
|
||||
list = this.lambdaQuery().eq(CsDataSet::getPid,modelId).orderByAsc(CsDataSet::getClDev).list();
|
||||
}
|
||||
return list;
|
||||
public List<CsDataSet> findDataSetByModelId(String modelId, Integer clDev) {
|
||||
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).eq(CsDataSet::getClDev,clDev).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineTargetVO> getDataSet(String modelId) {
|
||||
return this.baseMapper.getDataSet(modelId);
|
||||
public List<CsDataSet> findDataSetByModelId(String modelId) {
|
||||
return this.lambdaQuery().eq(CsDataSet::getPid,modelId).in(CsDataSet::getType, Arrays.asList(0,2)).orderByAsc(CsDataSet::getType,CsDataSet::getClDev).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LineTargetVO> getDataSet(String modelId,Integer clDev) {
|
||||
return this.baseMapper.getDataSet(modelId,clDev);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -92,4 +92,9 @@ public class CsDevModelRelationServiceImpl extends ServiceImpl<CsDevModelRelatio
|
||||
public List<CsDevModelRelationPO> findModelByDevId(String devId) {
|
||||
return this.lambdaQuery().eq(CsDevModelRelationPO::getDevId,devId).eq(CsDevModelRelationPO::getStatus,1).list();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModelByType(String devId, Integer type) {
|
||||
return this.baseMapper.getModelByType(devId,type);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -13,32 +13,26 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.mapper.CsLedgerMapper;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAddParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryAuditParm;
|
||||
import com.njcn.csdevice.pojo.param.CsEquipmentDeliveryQueryParm;
|
||||
import com.njcn.csdevice.pojo.param.ProjectEquipmentQueryParm;
|
||||
import com.njcn.csdevice.pojo.po.CsDataSet;
|
||||
import com.njcn.csdevice.pojo.po.CsDevModelRelationPO;
|
||||
import com.njcn.csdevice.pojo.po.CsEquipmentDeliveryPO;
|
||||
import com.njcn.csdevice.pojo.po.CsLedger;
|
||||
import com.njcn.csdevice.pojo.po.*;
|
||||
import com.njcn.csdevice.pojo.vo.CsEquipmentDeliveryVO;
|
||||
import com.njcn.csdevice.pojo.vo.DeviceManagerVO;
|
||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.ProjectEquipmentVO;
|
||||
import com.njcn.csdevice.service.*;
|
||||
import com.njcn.db.constant.DbConstant;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.enums.DicDataEnum;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
*
|
||||
@@ -53,10 +47,6 @@ import java.util.stream.Collectors;
|
||||
@RequiredArgsConstructor
|
||||
public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliveryMapper, CsEquipmentDeliveryPO> implements CsEquipmentDeliveryService{
|
||||
|
||||
private final CsLedgerMapper csLedgerMapper;
|
||||
|
||||
private final ICsEngineeringUserService csEngineeringUserService;
|
||||
|
||||
private final CsDevModelRelationService csDevModelRelationService;
|
||||
|
||||
private final ICsDataSetService csDataSetService;
|
||||
@@ -64,8 +54,13 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
private final ICsLedgerService csLedgerService;
|
||||
|
||||
private final RoleEngineerDevService roleEngineerDevService;
|
||||
|
||||
private final CsDeviceUserPOService csDeviceUserPOService;
|
||||
|
||||
private final CsLinePOService csLinePOService;
|
||||
|
||||
private final DicDataFeignClient dicDataFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public Boolean save(CsEquipmentDeliveryAddParm csEquipmentDeliveryAddParm) {
|
||||
@@ -189,37 +184,74 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceManagerVO getDeviceData(String deviceId,String type) {
|
||||
public DeviceManagerVO getDeviceData(String deviceId,String type,String lineId) {
|
||||
DeviceManagerVO deviceManagerVo = new DeviceManagerVO();
|
||||
List<DeviceManagerVO.DataSetVO> dataSetList = new ArrayList<>();
|
||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId,deviceId).one();
|
||||
List<CsDevModelRelationPO> list = csDevModelRelationService.findModelByDevId(deviceId);
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
list.forEach(item->{
|
||||
dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId()));
|
||||
});
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPo,deviceManagerVo);
|
||||
dataSet.forEach(item->{
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
if (Objects.equals(type,"history")){
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
dataSetVo2.setName("历史"+item.getAnotherName());
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
if (Objects.isNull(lineId) || StringUtils.isBlank(lineId)){
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
||||
modelId.forEach(item->{
|
||||
dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId()));
|
||||
});
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPo,deviceManagerVo);
|
||||
dataSet.forEach(item->{
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
if (Objects.equals(type,"history")){
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
dataSetVo2.setName("历史"+item.getAnotherName());
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
}
|
||||
});
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
CsLedger csLedger = csLedgerService.findDataById(deviceId);
|
||||
deviceManagerVo.setTime(csLedger.getCreateTime());
|
||||
} else {
|
||||
CsLinePO line = csLinePOService.listByIds(Collections.singletonList(lineId)).get(0);
|
||||
String code = dicDataFeignClient.getDicDataById(line.getPosition()).getData().getCode();
|
||||
String modelId = null;
|
||||
List<CsDataSet> dataSet = new ArrayList<>();
|
||||
//治理监测点
|
||||
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||
modelId = csDevModelRelationService.getModelByType(deviceId,0);
|
||||
dataSet = csDataSetService.findDataSetByModelId(modelId,0);
|
||||
}
|
||||
});
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
CsLedger csLedger = csLedgerService.findDataById(deviceId);
|
||||
deviceManagerVo.setTime(csLedger.getCreateTime());
|
||||
//负载侧监测点
|
||||
else if (Objects.equals(code, DicDataEnum.LOAD_SIDE.getCode())){
|
||||
modelId = csDevModelRelationService.getModelByType(deviceId,1);
|
||||
dataSet = csDataSetService.findDataSetByModelId(modelId,1);
|
||||
}
|
||||
//电网侧监测点
|
||||
else if (Objects.equals(code, DicDataEnum.GRID_SIDE.getCode())){
|
||||
modelId = csDevModelRelationService.getModelByType(deviceId,1);
|
||||
dataSet = csDataSetService.findDataSetByModelId(modelId,2);
|
||||
}
|
||||
BeanUtils.copyProperties(csEquipmentDeliveryPo,deviceManagerVo);
|
||||
dataSet.forEach(item->{
|
||||
DeviceManagerVO.DataSetVO dataSetVO = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVO.setId(item.getId());
|
||||
dataSetVO.setName(item.getAnotherName());
|
||||
dataSetVO.setType("rt");
|
||||
dataSetList.add(dataSetVO);
|
||||
if (Objects.equals(type,"history")){
|
||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||
dataSetVo2.setId(item.getId());
|
||||
dataSetVo2.setName("历史"+item.getAnotherName());
|
||||
dataSetVo2.setType("history");
|
||||
dataSetList.add(dataSetVo2);
|
||||
}
|
||||
});
|
||||
deviceManagerVo.setDataSetList(dataSetList);
|
||||
CsLedger csLedger = csLedgerService.findDataById(deviceId);
|
||||
deviceManagerVo.setTime(csLedger.getCreateTime());
|
||||
}
|
||||
return deviceManagerVo;
|
||||
}
|
||||
|
||||
private List<EnergyTemplateVO> getChildren(String tabId, List<EnergyTemplateVO> all) {
|
||||
return all.stream().filter(item -> item.getPid().equals(tabId)).collect(Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user