设备管理及设备监控融合便携式设备业务第一版(仅仅提交)
This commit is contained in:
@@ -21,6 +21,7 @@ import lombok.extern.slf4j.Slf4j;
|
|||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -75,6 +76,16 @@ public class CsGroupController extends BaseController {
|
|||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
|
@PostMapping("/deviceDataByType")
|
||||||
|
@ApiOperation("根据类型查询趋势数据、暂态数据、实时数据")
|
||||||
|
@ApiImplicitParam(name = "energyBaseParam",required = true)
|
||||||
|
public HttpResult<Object> deviceDataByType(@RequestBody Map map){
|
||||||
|
String methodDescribe = getMethodDescribe("deviceDataByType");
|
||||||
|
Object obj = csGroupService.deviceDataByType(map);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, obj, methodDescribe);
|
||||||
|
}
|
||||||
|
|
||||||
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
|
||||||
@PostMapping("/deleteGroup")
|
@PostMapping("/deleteGroup")
|
||||||
@ApiOperation("删除分组")
|
@ApiOperation("删除分组")
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ 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.param.WlRecordPageParam;
|
import com.njcn.csdevice.param.WlRecordPageParam;
|
||||||
import com.njcn.csdevice.pojo.po.WlRecord;
|
import com.njcn.csdevice.pojo.po.WlRecord;
|
||||||
|
import com.njcn.csdevice.pojo.vo.CsLedgerVO;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo;
|
import com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo;
|
||||||
import com.njcn.csdevice.pojo.vo.RecordPageVo;
|
import com.njcn.csdevice.pojo.vo.RecordPageVo;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
@@ -49,4 +50,8 @@ public interface WlRecordMapper extends BaseMapper<WlRecord> {
|
|||||||
* 根据测试项ID或方案ID获取其下关联的所有设备基础数据信息
|
* 根据测试项ID或方案ID获取其下关联的所有设备基础数据信息
|
||||||
*/
|
*/
|
||||||
List<WlRecord> getDataRecordByTestId(@Param("testRecordId") String testRecordId,@Param("flag") Integer flag);
|
List<WlRecord> getDataRecordByTestId(@Param("testRecordId") String testRecordId,@Param("flag") Integer flag);
|
||||||
|
|
||||||
|
List<CsLedgerVO> getAll();
|
||||||
|
|
||||||
|
List<CsLedgerVO> getAllLine(@Param("devId") String devId);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -84,6 +84,13 @@
|
|||||||
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAll" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
||||||
|
select a.dev_id as id,b.name as name from wl_record a
|
||||||
|
left join cs_equipment_delivery b on a.dev_id = b.id
|
||||||
|
where a.type=1 and a.state =1
|
||||||
|
group by a.dev_id,b.name having a.dev_id is not null and b.name is not null
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getRecordAllLine" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo$RecordAllLineTreeVo">
|
<select id="getRecordAllLine" resultType="com.njcn.csdevice.pojo.vo.RecordAllDevTreeVo$RecordAllLineTreeVo">
|
||||||
select a.line_id as id,c.name as name from wl_record a
|
select a.line_id as id,c.name as name from wl_record a
|
||||||
left join cs_line c on a.line_id = c.line_id
|
left join cs_line c on a.line_id = c.line_id
|
||||||
@@ -91,6 +98,13 @@
|
|||||||
group by a.line_id,c.name having a.line_id is not null and c.name is not null
|
group by a.line_id,c.name having a.line_id is not null and c.name is not null
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllLine" resultType="com.njcn.csdevice.pojo.vo.CsLedgerVO">
|
||||||
|
select a.line_id as id,c.name as name from wl_record a
|
||||||
|
left join cs_line c on a.line_id = c.line_id
|
||||||
|
where a.type=1 and a.state =1 and a.dev_id=#{devId}
|
||||||
|
group by a.line_id,c.name having a.line_id is not null and c.name is not null
|
||||||
|
</select>
|
||||||
|
|
||||||
<select id="getDataRecordByTestId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
<select id="getDataRecordByTestId" resultType="com.njcn.csdevice.pojo.po.WlRecord">
|
||||||
select * from wl_record b where b.id in (
|
select * from wl_record b where b.id in (
|
||||||
select data_id from wl_record_test_data where
|
select data_id from wl_record_test_data where
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
|||||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -37,6 +38,12 @@ public interface ICsGroupService extends IService<CsGroup> {
|
|||||||
*/
|
*/
|
||||||
IPage<DataGroupTemplateVO> getDeviceHistoryData(EnergyBaseParam energyBaseParam);
|
IPage<DataGroupTemplateVO> getDeviceHistoryData(EnergyBaseParam energyBaseParam);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据类型查询趋势数据、暂态数据、实时数据
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Object deviceDataByType(Map map);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 删除组信息
|
* 删除组信息
|
||||||
* @param groupId 组id
|
* @param groupId 组id
|
||||||
|
|||||||
@@ -282,14 +282,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
CsEquipmentDeliveryPO csEquipmentDeliveryPo = this.lambdaQuery().eq(CsEquipmentDeliveryPO::getId, deviceId).one();
|
||||||
if (lineId == null || lineId.isEmpty()) {
|
if (lineId == null || lineId.isEmpty()) {
|
||||||
List<CsDataSet> dataSet = new ArrayList<>();
|
List<CsDataSet> dataSet = new ArrayList<>();
|
||||||
|
//如果没有传lineId(测点ID) 则根据设备ID获取对应的模板 select modelId from cs_dev_model_relation where dev_id = ?
|
||||||
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
||||||
if (CollUtil.isNotEmpty(modelId)){
|
if (CollUtil.isNotEmpty(modelId)){
|
||||||
for (CsDevModelRelationPO item : modelId) {
|
for (CsDevModelRelationPO item : modelId) {
|
||||||
|
//再根据模板ID获取数据集 作为页面展示的Tab项 SELECT * FROM cs_data_set WHERE (pid = ? AND type IN (0,2))
|
||||||
dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId()));
|
dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||||
} else {
|
} else {
|
||||||
|
//治理设备 devTypeCode = Direct_Connected_Device 便携式设备 = Portable
|
||||||
String devTypeCode = dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode();
|
String devTypeCode = dictTreeFeignClient.queryById(csEquipmentDeliveryPo.getDevType()).getData().getCode();
|
||||||
if (Objects.equals(devTypeCode, DicDataEnum.CONNECT_DEV.getCode())) {
|
if (Objects.equals(devTypeCode, DicDataEnum.CONNECT_DEV.getCode())) {
|
||||||
CsLinePO line = csLinePOService.getById(lineId);
|
CsLinePO line = csLinePOService.getById(lineId);
|
||||||
@@ -298,7 +301,17 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
List<CsDataSet> dataSet = new ArrayList<>();
|
List<CsDataSet> dataSet = new ArrayList<>();
|
||||||
//治理监测点
|
//治理监测点
|
||||||
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
|
if (Objects.equals(code, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
|
// select
|
||||||
|
// t1.id
|
||||||
|
// from
|
||||||
|
// cs_dev_model_relation t0
|
||||||
|
// left join cs_dev_model t1 on
|
||||||
|
// t0.model_id = t1.id
|
||||||
|
// where
|
||||||
|
// t0.status="1" and
|
||||||
|
// t0.dev_id = #{devId} and t1.`type` = #{type}
|
||||||
modelId = csDevModelRelationService.getModelByType(deviceId,0);
|
modelId = csDevModelRelationService.getModelByType(deviceId,0);
|
||||||
|
//select * from cs_data_set where pid = modelId and clDev = 0
|
||||||
dataSet = csDataSetService.findDataSetByModelId(modelId,0);
|
dataSet = csDataSetService.findDataSetByModelId(modelId,0);
|
||||||
}
|
}
|
||||||
//电网侧监测点
|
//电网侧监测点
|
||||||
@@ -312,6 +325,15 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSet = csDataSetService.findDataSetByModelId(modelId,2);
|
dataSet = csDataSetService.findDataSetByModelId(modelId,2);
|
||||||
}
|
}
|
||||||
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||||
|
}else if(Objects.equals(devTypeCode, DicDataEnum.PORTABLE.getCode())){
|
||||||
|
List<CsDataSet> dataSet = new ArrayList<>();
|
||||||
|
List<CsDevModelRelationPO> modelId = csDevModelRelationService.findModelByDevId(deviceId);
|
||||||
|
if (CollUtil.isNotEmpty(modelId)){
|
||||||
|
for (CsDevModelRelationPO item : modelId) {
|
||||||
|
dataSet.addAll(csDataSetService.findDataSetByModelId(item.getModelId()));
|
||||||
|
}
|
||||||
|
setDataSetValues(csEquipmentDeliveryPo, dataSet, dataSetList, type, deviceManagerVo);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return deviceManagerVo;
|
return deviceManagerVo;
|
||||||
@@ -327,11 +349,30 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
|||||||
dataSetVO.setType("rt");
|
dataSetVO.setType("rt");
|
||||||
dataSetList.add(dataSetVO);
|
dataSetList.add(dataSetVO);
|
||||||
if (Objects.equals(type, "history")) {
|
if (Objects.equals(type, "history")) {
|
||||||
|
//历史数据tab
|
||||||
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
DeviceManagerVO.DataSetVO dataSetVo2 = new DeviceManagerVO.DataSetVO();
|
||||||
dataSetVo2.setId(item.getId());
|
dataSetVo2.setId(item.getId());
|
||||||
dataSetVo2.setName("历史" + item.getAnotherName());
|
dataSetVo2.setName("历史" + item.getAnotherName());
|
||||||
dataSetVo2.setType("history");
|
dataSetVo2.setType("history");
|
||||||
dataSetList.add(dataSetVo2);
|
dataSetList.add(dataSetVo2);
|
||||||
|
//趋势数据tab
|
||||||
|
DeviceManagerVO.DataSetVO dataSetVo3 = new DeviceManagerVO.DataSetVO();
|
||||||
|
dataSetVo3.setId(item.getId());
|
||||||
|
dataSetVo3.setName(item.getAnotherName() + "趋势数据");
|
||||||
|
dataSetVo3.setType("trenddata");
|
||||||
|
dataSetList.add(dataSetVo3);
|
||||||
|
//实时数据tab
|
||||||
|
DeviceManagerVO.DataSetVO dataSetVo4 = new DeviceManagerVO.DataSetVO();
|
||||||
|
dataSetVo4.setId(item.getId());
|
||||||
|
dataSetVo4.setName(item.getAnotherName() + "实时数据");
|
||||||
|
dataSetVo4.setType("realtimedata");
|
||||||
|
dataSetList.add(dataSetVo4);
|
||||||
|
//暂态事件tab
|
||||||
|
DeviceManagerVO.DataSetVO dataSetVo5 = new DeviceManagerVO.DataSetVO();
|
||||||
|
dataSetVo5.setId(item.getId());
|
||||||
|
dataSetVo5.setName(item.getAnotherName() + "暂态事件");
|
||||||
|
dataSetVo5.setType("event");
|
||||||
|
dataSetList.add(dataSetVo5);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
deviceManagerVo.setDataSetList(dataSetList);
|
deviceManagerVo.setDataSetList(dataSetList);
|
||||||
|
|||||||
@@ -8,24 +8,31 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.common.pojo.exception.BusinessException;
|
import com.njcn.common.pojo.exception.BusinessException;
|
||||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||||
|
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||||
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
import com.njcn.csdevice.mapper.CsDataArrayMapper;
|
||||||
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
import com.njcn.csdevice.mapper.CsGroArrMapper;
|
||||||
import com.njcn.csdevice.mapper.CsGroupMapper;
|
import com.njcn.csdevice.mapper.CsGroupMapper;
|
||||||
|
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||||
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
|
import com.njcn.csdevice.pojo.param.EnergyBaseParam;
|
||||||
import com.njcn.csdevice.pojo.po.CsDataArray;
|
import com.njcn.csdevice.pojo.po.CsDataArray;
|
||||||
import com.njcn.csdevice.pojo.po.CsGroArr;
|
import com.njcn.csdevice.pojo.po.CsGroArr;
|
||||||
import com.njcn.csdevice.pojo.po.CsGroup;
|
import com.njcn.csdevice.pojo.po.CsGroup;
|
||||||
|
import com.njcn.csdevice.pojo.po.CsLinePO;
|
||||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||||
import com.njcn.csdevice.service.ICsGroupService;
|
import com.njcn.csdevice.service.ICsGroupService;
|
||||||
|
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||||
|
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||||
import com.njcn.influx.service.CommonService;
|
import com.njcn.influx.service.CommonService;
|
||||||
|
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||||
import com.njcn.system.api.DicDataFeignClient;
|
import com.njcn.system.api.DicDataFeignClient;
|
||||||
import com.njcn.system.api.EpdFeignClient;
|
import com.njcn.system.api.EpdFeignClient;
|
||||||
import com.njcn.system.enums.DicDataEnum;
|
import com.njcn.system.enums.DicDataEnum;
|
||||||
|
import com.njcn.system.pojo.po.DictData;
|
||||||
import com.njcn.system.pojo.po.EleEpdPqd;
|
import com.njcn.system.pojo.po.EleEpdPqd;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
@@ -34,9 +41,11 @@ import org.springframework.transaction.annotation.Transactional;
|
|||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.text.DecimalFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.atomic.AtomicReference;
|
import java.util.concurrent.atomic.AtomicReference;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>
|
* <p>
|
||||||
@@ -66,6 +75,12 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
|
|
||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
|
|
||||||
|
private final EquipmentFeignClient equipmentFeignClient;
|
||||||
|
|
||||||
|
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||||
|
|
||||||
|
private final DecimalFormat df = new DecimalFormat("#0.0000");
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional(rollbackFor = Exception.class)
|
@Transactional(rollbackFor = Exception.class)
|
||||||
public List<CsGroupVO> getGroupData(String dataSet) {
|
public List<CsGroupVO> getGroupData(String dataSet) {
|
||||||
@@ -198,6 +213,102 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
|||||||
return pageTurn;
|
return pageTurn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object deviceDataByType(Map map) {
|
||||||
|
Object type = map.get("type");
|
||||||
|
if (type == null) throw new BusinessException("type参数缺失!");
|
||||||
|
//传1 则是趋势数据tab页面
|
||||||
|
if("1".equals(type.toString())){
|
||||||
|
List<ThdDataVO> result = new ArrayList();
|
||||||
|
Object devId = map.get("devId");
|
||||||
|
Object lineId = map.get("lineId");
|
||||||
|
Object startTime = map.get("startTime");
|
||||||
|
Object endTime = map.get("endTime");
|
||||||
|
Object statisticalId = map.get("statisticalId");
|
||||||
|
Object valueType = map.get("valueType");
|
||||||
|
Object frequency = map.get("frequency");
|
||||||
|
if (devId == null) throw new BusinessException("devId参数缺失!");
|
||||||
|
if (lineId == null) throw new BusinessException("lineId参数缺失!");
|
||||||
|
if (startTime == null) throw new BusinessException("startTime参数缺失!");
|
||||||
|
if (endTime == null) throw new BusinessException("endTime参数缺失!");
|
||||||
|
if (statisticalId == null) throw new BusinessException("statisticalId参数缺失!");
|
||||||
|
if (valueType == null) throw new BusinessException("valueType参数缺失!");
|
||||||
|
if (frequency == null) throw new BusinessException("frequency参数缺失!");
|
||||||
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(devId.toString()).collect(Collectors.toList())).getData();
|
||||||
|
List<String> ids = new ArrayList();
|
||||||
|
ids.add(lineId.toString());
|
||||||
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(ids).getData();
|
||||||
|
List<EleEpdPqd> data = csStatisticalSetFeignClient.queryStatisticalSelect(statisticalId.toString()).getData();
|
||||||
|
if(CollectionUtil.isNotEmpty(data)){
|
||||||
|
data.forEach(epdPqd->{
|
||||||
|
String finalFrequency1 = Optional.ofNullable(frequency.toString()).orElse("");
|
||||||
|
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||||
|
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||||
|
commonQueryParam.setLineId(temp.getLineId());
|
||||||
|
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
|
||||||
|
commonQueryParam.setColumnName(epdPqd.getName()+ finalFrequency1);
|
||||||
|
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||||
|
commonQueryParam.setStartTime(startTime.toString());
|
||||||
|
commonQueryParam.setEndTime(endTime.toString());
|
||||||
|
commonQueryParam.setDataType(valueType.toString());
|
||||||
|
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||||
|
commonQueryParam.setClDid(getClDidByLineId(temp.getLineId()));
|
||||||
|
|
||||||
|
return commonQueryParam;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
List<StatisticalDataDTO> deviceRtData = commonService.getDeviceRtDataByTime(commonQueryParams);
|
||||||
|
List<ThdDataVO> collect1 = deviceRtData.stream().map(temp -> {
|
||||||
|
ThdDataVO vo = new ThdDataVO();
|
||||||
|
vo.setLineId(temp.getLineId());
|
||||||
|
vo.setPhase(temp.getPhaseType());
|
||||||
|
String position = finalCsLinePOList.stream().filter(csLinePO -> Objects.equals(csLinePO.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||||
|
vo.setPosition(position);
|
||||||
|
vo.setTime(temp.getTime());
|
||||||
|
vo.setStatMethod(temp.getValueType());
|
||||||
|
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||||
|
vo.setStatisticalIndex(epdPqd.getId());
|
||||||
|
vo.setUnit(epdPqd.getUnit());
|
||||||
|
vo.setStatisticalName(epdPqd.getName());
|
||||||
|
vo.setAnotherName(epdPqd.getShowName());
|
||||||
|
return vo;
|
||||||
|
}).collect(Collectors.toList());
|
||||||
|
result.addAll(collect1);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}else if("2".equals(type.toString())){
|
||||||
|
//传2 则是实时数据tab页面
|
||||||
|
}else if("3".equals(type.toString())){
|
||||||
|
//传2 则是暂态事件tab页面
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/*表名换成了id本方法做转换*/
|
||||||
|
private String getTableNameByClassId(String classId){
|
||||||
|
DictData data = dicDataFeignClient.getDicDataById(classId).getData();
|
||||||
|
if(Objects.isNull(data)){
|
||||||
|
throw new BusinessException("数据缺失");
|
||||||
|
}
|
||||||
|
return data.getCode();
|
||||||
|
}
|
||||||
|
private String getClDidByLineId(String lineId){
|
||||||
|
String position = csLineFeignClient.getPositionById(lineId).getData();
|
||||||
|
if (Objects.isNull(position)){
|
||||||
|
throw new BusinessException(AlgorithmResponseEnum.POSITION_ERROR);
|
||||||
|
}
|
||||||
|
String clDid = null;
|
||||||
|
String areaCode = dicDataFeignClient.getDicDataById(position).getData().getCode();
|
||||||
|
if (Objects.equals(areaCode, DicDataEnum.OUTPUT_SIDE.getCode())){
|
||||||
|
clDid = "0";
|
||||||
|
} else if (Objects.equals(areaCode, DicDataEnum.GRID_SIDE.getCode())){
|
||||||
|
clDid = "1";
|
||||||
|
} else if (Objects.equals(areaCode, DicDataEnum.LOAD_SIDE.getCode())){
|
||||||
|
clDid = "2";
|
||||||
|
}
|
||||||
|
return clDid;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteGroup(String groupId) {
|
public void deleteGroup(String groupId) {
|
||||||
LambdaQueryWrapper<CsGroArr> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<CsGroArr> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package com.njcn.csdevice.service.impl;
|
|||||||
|
|
||||||
import cn.hutool.core.bean.BeanUtil;
|
import cn.hutool.core.bean.BeanUtil;
|
||||||
import cn.hutool.core.collection.CollectionUtil;
|
import cn.hutool.core.collection.CollectionUtil;
|
||||||
|
import cn.hutool.core.util.IdUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.njcn.csdevice.enums.LineBaseEnum;
|
import com.njcn.csdevice.enums.LineBaseEnum;
|
||||||
@@ -50,6 +51,7 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
private final DicDataFeignClient dicDataFeignClient;
|
private final DicDataFeignClient dicDataFeignClient;
|
||||||
private final FileStorageUtil fileStorageUtil;
|
private final FileStorageUtil fileStorageUtil;
|
||||||
private final RoleEngineerDevService roleEngineerDevService;
|
private final RoleEngineerDevService roleEngineerDevService;
|
||||||
|
private final WlRecordMapper wlRecordMapper;
|
||||||
|
|
||||||
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
private final CsEquipmentDeliveryMapper csEquipmentDeliveryMapper;
|
||||||
|
|
||||||
@@ -111,7 +113,35 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
deviceList.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||||
return engineeringList;
|
//整理整个树并新增便携式设备树
|
||||||
|
CsLedgerVO portable = new CsLedgerVO();
|
||||||
|
portable.setLevel(0);
|
||||||
|
portable.setName("便携式设备");
|
||||||
|
portable.setPid("0");
|
||||||
|
portable.setId(IdUtil.simpleUUID());
|
||||||
|
List<CsLedgerVO> portables = wlRecordMapper.getAll();
|
||||||
|
for(CsLedgerVO c : portables){
|
||||||
|
c.setPid(portable.getId());
|
||||||
|
c.setLevel(2);
|
||||||
|
c.setChildren(wlRecordMapper.getAllLine(c.getId()));
|
||||||
|
for(CsLedgerVO cs : c.getChildren()){
|
||||||
|
cs.setPid(c.getId());
|
||||||
|
cs.setLevel(3);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
portable.setChildren(portables);
|
||||||
|
|
||||||
|
CsLedgerVO government = new CsLedgerVO();
|
||||||
|
government.setLevel(0);
|
||||||
|
government.setName("治理设备");
|
||||||
|
government.setPid("0");
|
||||||
|
government.setId(IdUtil.simpleUUID());
|
||||||
|
government.setChildren(engineeringList);
|
||||||
|
List<CsLedgerVO> tree = new ArrayList<>();
|
||||||
|
tree.add(portable);
|
||||||
|
tree.add(government);
|
||||||
|
return tree;
|
||||||
|
//return engineeringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -142,7 +172,30 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
|||||||
|
|
||||||
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
projectList.forEach(pro -> pro.setChildren(getChildren(pro, deviceList)));
|
||||||
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
engineeringList.forEach(eng -> eng.setChildren(getChildren(eng, projectList)));
|
||||||
return engineeringList;
|
//整理整个树并新增便携式设备树
|
||||||
|
CsLedgerVO portable = new CsLedgerVO();
|
||||||
|
portable.setLevel(0);
|
||||||
|
portable.setName("便携式设备");
|
||||||
|
portable.setPid("0");
|
||||||
|
portable.setId(IdUtil.simpleUUID());
|
||||||
|
List<CsLedgerVO> portables = wlRecordMapper.getAll();
|
||||||
|
for(CsLedgerVO c : portables){
|
||||||
|
c.setPid(portable.getId());
|
||||||
|
c.setLevel(2);
|
||||||
|
}
|
||||||
|
portable.setChildren(portables);
|
||||||
|
|
||||||
|
CsLedgerVO government = new CsLedgerVO();
|
||||||
|
government.setLevel(0);
|
||||||
|
government.setName("治理设备");
|
||||||
|
government.setPid("0");
|
||||||
|
government.setId(IdUtil.simpleUUID());
|
||||||
|
government.setChildren(engineeringList);
|
||||||
|
List<CsLedgerVO> tree = new ArrayList<>();
|
||||||
|
tree.add(portable);
|
||||||
|
tree.add(government);
|
||||||
|
return tree;
|
||||||
|
//return engineeringList;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -162,8 +162,8 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
qw.eq("p_id",testRecordId).eq("type",0).eq("state",1).orderByAsc("create_time");;
|
qw.eq("p_id",testRecordId).eq("type",0).eq("state",1).orderByAsc("create_time");;
|
||||||
for (WlRecord wl : this.baseMapper.selectList(qw)){
|
for (WlRecord wl : this.baseMapper.selectList(qw)){
|
||||||
RecordVo recordVo = new RecordVo();
|
RecordVo recordVo = new RecordVo();
|
||||||
wl.setStartTime(getFirstTimeById(wlRecord.getId()));
|
wl.setStartTime(getFirstTimeById(wl.getId()));
|
||||||
wl.setEndTime(getLastTimeById(wlRecord.getId()));
|
wl.setEndTime(getLastTimeById(wl.getId()));
|
||||||
BeanUtils.copyProperties(wl, recordVo);
|
BeanUtils.copyProperties(wl, recordVo);
|
||||||
recordVoList.add(recordVo);
|
recordVoList.add(recordVo);
|
||||||
}
|
}
|
||||||
@@ -174,8 +174,9 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Object queryPage(WlRecordPageParam wlRecordPageParam) {
|
public Object queryPage(WlRecordPageParam wlRecordPageParam) {
|
||||||
|
//根据isTrueFlag及treeIds判断返回的数据集
|
||||||
if(wlRecordPageParam.getIsTrueFlag()!=1 && wlRecordPageParam.getTreeIds().isEmpty()){
|
if(wlRecordPageParam.getIsTrueFlag()!=1 && wlRecordPageParam.getTreeIds().isEmpty()){
|
||||||
//组装tree
|
//组装tree用于测试项绑定数据页面左侧的搜索树
|
||||||
List<RecordAllDevTreeVo> recordAllDevTreeVos = this.baseMapper.getRecordAll();
|
List<RecordAllDevTreeVo> recordAllDevTreeVos = this.baseMapper.getRecordAll();
|
||||||
for (RecordAllDevTreeVo recordAllDevTreeVo : recordAllDevTreeVos){
|
for (RecordAllDevTreeVo recordAllDevTreeVo : recordAllDevTreeVos){
|
||||||
List<RecordAllDevTreeVo.RecordAllLineTreeVo> recordAllLineTreeVos = this.baseMapper.getRecordAllLine(recordAllDevTreeVo.getId());
|
List<RecordAllDevTreeVo.RecordAllLineTreeVo> recordAllLineTreeVos = this.baseMapper.getRecordAllLine(recordAllDevTreeVo.getId());
|
||||||
@@ -208,6 +209,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
vo.setId(scheme.getId());
|
vo.setId(scheme.getId());
|
||||||
vo.setName(scheme.getItemName());
|
vo.setName(scheme.getItemName());
|
||||||
List<RecordTreeVo.Children> childrens = new ArrayList<>();
|
List<RecordTreeVo.Children> childrens = new ArrayList<>();
|
||||||
|
//遍历测试项 并且绑定对应的父级方案节点
|
||||||
for(WlRecord testItem : testItems.stream().filter(e->e.getPId() .equals( scheme.getId())).collect(Collectors.toList())){
|
for(WlRecord testItem : testItems.stream().filter(e->e.getPId() .equals( scheme.getId())).collect(Collectors.toList())){
|
||||||
RecordTreeVo.Children children = new RecordTreeVo.Children();
|
RecordTreeVo.Children children = new RecordTreeVo.Children();
|
||||||
children.setId(testItem.getId());
|
children.setId(testItem.getId());
|
||||||
@@ -231,6 +233,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
qw.eq("id",id).eq("state","1").eq("type","0");
|
qw.eq("id",id).eq("state","1").eq("type","0");
|
||||||
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
List<WlRecord> wlRecordList = this.baseMapper.selectList(qw);
|
||||||
if(!wlRecordList.isEmpty()){
|
if(!wlRecordList.isEmpty()){
|
||||||
|
//首先先删除本条数据
|
||||||
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
LambdaUpdateWrapper<WlRecord> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||||
lambdaUpdateWrapper.set(WlRecord::getState,0)
|
lambdaUpdateWrapper.set(WlRecord::getState,0)
|
||||||
.eq(WlRecord::getId, id)
|
.eq(WlRecord::getId, id)
|
||||||
@@ -306,7 +309,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
|||||||
ids.add(wl.getLineId());
|
ids.add(wl.getLineId());
|
||||||
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(ids).getData();
|
List<CsLinePO> finalCsLinePOList = csLineFeignClient.queryLineById(ids).getData();
|
||||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
||||||
//获取指标下的相别
|
//获取指标下的具体分类指标
|
||||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||||
List<CommonQueryParam> commonQueryParams = new ArrayList<>();
|
List<CommonQueryParam> commonQueryParams = new ArrayList<>();
|
||||||
for(EleEpdPqd epdPqd : eleEpdPqds){
|
for(EleEpdPqd epdPqd : eleEpdPqds){
|
||||||
|
|||||||
Reference in New Issue
Block a user