设备监控代码提交(临时)
This commit is contained in:
@@ -154,6 +154,12 @@
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn</groupId>
|
||||
<artifactId>event-api</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.njcn.common.pojo.enums.common.LogEnum;
|
||||
import com.njcn.common.pojo.enums.response.CommonResponseEnum;
|
||||
import com.njcn.common.pojo.response.HttpResult;
|
||||
import com.njcn.common.utils.HttpResultUtil;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.DeviceOperate;
|
||||
import com.njcn.csdevice.pojo.dto.CsEquipmentDeliveryDTO;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
@@ -164,7 +165,7 @@ public class EquipmentDeliveryController extends BaseController {
|
||||
Page<CsEquipmentDeliveryVO> page = csEquipmentDeliveryService.list(param);
|
||||
//新增逻辑(只针对便携式设备):修改设备中的未注册状态(status = 1)改为5(前端定义的字典也即未接入)
|
||||
for(CsEquipmentDeliveryVO csEquipmentDeliveryVO : page.getRecords()){
|
||||
if("8b45cf6b7f5266e777d07c166ad5fa77".equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryVO.getDevType()) && csEquipmentDeliveryVO.getStatus() == 1){
|
||||
csEquipmentDeliveryVO.setStatus(5);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.njcn.csdevice.pojo.po.CsGroup;
|
||||
import com.njcn.csdevice.pojo.vo.CsGroupVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@@ -25,4 +26,6 @@ public interface CsGroupMapper extends BaseMapper<CsGroup> {
|
||||
List<CsGroupVO> getArrayData(@Param("list") List<String> list);
|
||||
|
||||
Page<DataGroupTemplateVO> getGroupDataList(IPage<DataGroupTemplateVO> page, @Param("id") String id, @Param("searchValue") String searchValue);
|
||||
|
||||
Page<DataGroupEventVO> getGroupEventList(IPage<DataGroupEventVO> page, @Param("id") String id, @Param("searchValue") String searchValue);
|
||||
}
|
||||
|
||||
@@ -75,4 +75,19 @@
|
||||
order by sort
|
||||
</select>
|
||||
|
||||
<select id="getGroupEventList" resultType="com.njcn.csdevice.pojo.vo.DataGroupEventVO">
|
||||
select REPLACE(UUID(),'-','') as id, ce.id as eventId,
|
||||
w1.item_name as projectName,w4.gc_name as gcName,
|
||||
w4.item_name as itemName,ce.persist_time as persistTime,ce.start_time as startTime,
|
||||
ce.tag
|
||||
from (select id,item_name,state from wl_record where type = 0 and p_id is null) w1
|
||||
inner join (select id,p_id,state from wl_record where type = 0 and p_id is not null) w2 on w1.id = w2.p_id
|
||||
inner join wl_record_test_data w3 on w2.id = w3.test_item_id
|
||||
inner join wl_record w4 on w3.data_id = w4.id
|
||||
inner join cs_event ce on w4.dev_id = ce.device_id and w4.line_id = ce.line_id
|
||||
where ce.type = 0 and w1.state = 1 and w2.state = 1 and w4.state = 1
|
||||
and ce.device_id = '893446032df751a48683a662691265e6' and ce.line_id = '0008C0A801C81'
|
||||
order by w1.item_name
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -24,17 +24,17 @@
|
||||
and not exists (select 1 from wl_record_test_data wd where wd.test_item_id = #{wlRecordPageParam.id} and a.id = wd.data_id)
|
||||
</if>
|
||||
<if test="wlRecordPageParam.treeIds != null and wlRecordPageParam.treeIds.size() > 0">
|
||||
and
|
||||
(
|
||||
a.dev_id in
|
||||
and a.line_id in
|
||||
<foreach collection="wlRecordPageParam.treeIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
or a.line_id in
|
||||
<foreach collection="wlRecordPageParam.treeIds" index="index" item="item" open="(" separator="," close=")">
|
||||
|
||||
</if>
|
||||
<if test="wlRecordPageParam.pIds != null and wlRecordPageParam.pIds.size() > 0">
|
||||
and a.dev_id in
|
||||
<foreach collection="wlRecordPageParam.pIds" index="index" item="item" open="(" separator="," close=")">
|
||||
#{item}
|
||||
</foreach>
|
||||
)
|
||||
</if>
|
||||
<if test="wlRecordPageParam.searchText != null and wlRecordPageParam.searchText != ''">
|
||||
and (b.name like concat('%',#{wlRecordPageParam.searchText},'%')
|
||||
@@ -92,7 +92,7 @@
|
||||
</select>
|
||||
|
||||
<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, #{devId} as pid 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
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.csdevice.constant.DataParam;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
import com.njcn.csdevice.mapper.CsEquipmentDeliveryMapper;
|
||||
import com.njcn.csdevice.pojo.param.*;
|
||||
@@ -355,24 +356,27 @@ public class CsEquipmentDeliveryServiceImpl extends ServiceImpl<CsEquipmentDeliv
|
||||
dataSetVo2.setName("历史" + item.getAnotherName());
|
||||
dataSetVo2.setType("history");
|
||||
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);
|
||||
//下面这些tab仅仅只限于设备监控的便携式设备才会有
|
||||
if(DataParam.portableDevType.equals(csEquipmentDeliveryPo.getDevType())){
|
||||
//趋势数据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);
|
||||
|
||||
@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.common.utils.PubUtils;
|
||||
import com.njcn.csdevice.api.CsLineFeignClient;
|
||||
import com.njcn.csdevice.api.EquipmentFeignClient;
|
||||
import com.njcn.csdevice.enums.AlgorithmResponseEnum;
|
||||
@@ -20,25 +21,31 @@ import com.njcn.csdevice.pojo.po.CsGroArr;
|
||||
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.DataGroupEventVO;
|
||||
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
|
||||
import com.njcn.csdevice.pojo.vo.EnergyTemplateVO;
|
||||
import com.njcn.csdevice.service.ICsDataArrayService;
|
||||
import com.njcn.csdevice.service.ICsGroupService;
|
||||
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
|
||||
import com.njcn.event.api.EventDetailFeignClient;
|
||||
import com.njcn.event.pojo.po.RmpEventDetailPO;
|
||||
import com.njcn.influx.pojo.bo.CommonQueryParam;
|
||||
import com.njcn.influx.pojo.dto.EventDataSetDTO;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.influx.service.EvtDataService;
|
||||
import com.njcn.system.api.CsStatisticalSetFeignClient;
|
||||
import com.njcn.system.api.DicDataFeignClient;
|
||||
import com.njcn.system.api.EleEvtFeignClient;
|
||||
import com.njcn.system.api.EpdFeignClient;
|
||||
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.EleEvtParm;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.text.DecimalFormat;
|
||||
@@ -79,8 +86,14 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
|
||||
private final CsStatisticalSetFeignClient csStatisticalSetFeignClient;
|
||||
|
||||
private final EvtDataService evtDataService;
|
||||
|
||||
private final EventDetailFeignClient eventDetailFeignClient;
|
||||
|
||||
private final DecimalFormat df = new DecimalFormat("#0.0000");
|
||||
|
||||
private final EleEvtFeignClient eleEvtFeignClient;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<CsGroupVO> getGroupData(String dataSet) {
|
||||
@@ -253,7 +266,6 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
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);
|
||||
@@ -278,8 +290,54 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
return result;
|
||||
}else if("2".equals(type.toString())){
|
||||
//传2 则是实时数据tab页面
|
||||
|
||||
}else if("3".equals(type.toString())){
|
||||
//传2 则是暂态事件tab页面
|
||||
//传3 则是暂态事件tab页面
|
||||
Object pageNum = map.get("pageNum");
|
||||
Object pageSize = map.get("pageSize");
|
||||
Object devId = map.get("devId");
|
||||
Object lineId = map.get("lineId");
|
||||
if (devId == null) throw new BusinessException("devId参数缺失!");
|
||||
if (lineId == null) throw new BusinessException("lineId参数缺失!");
|
||||
if (pageNum == null) throw new BusinessException("pageNum参数缺失!");
|
||||
if (pageSize == null) throw new BusinessException("pageSize参数缺失!");
|
||||
Page<DataGroupEventVO> returnpage = new Page<> (Integer.parseInt(pageNum.toString()),Integer.parseInt(pageSize.toString()));
|
||||
returnpage = this.getBaseMapper().getGroupEventList(returnpage,devId.toString(),lineId.toString());
|
||||
returnpage.getRecords().forEach(temp->{
|
||||
//事件描述、相别、暂降幅值,需要特殊处理赋值
|
||||
//事件描述
|
||||
EleEpdPqd ele = epdFeignClient.findByName(temp.getTag()).getData();
|
||||
if(ele!=null){
|
||||
temp.setShowName(ele.getShowName());
|
||||
//相别
|
||||
List<EleEvtParm> data1 = eleEvtFeignClient.queryByPid(ele.getId()).getData();
|
||||
List<EventDataSetDTO> eventDataSetDTOS = new ArrayList<>();
|
||||
for (EleEvtParm eleEvtParm : data1) {
|
||||
EventDataSetDTO eventDataSetDTO = new EventDataSetDTO();
|
||||
BeanUtils.copyProperties(eleEvtParm,eventDataSetDTO);
|
||||
EventDataSetDTO evtData = evtDataService.getEventDataSet("evt_data", temp.getId(), eleEvtParm.getName());
|
||||
if (evtData == null) {
|
||||
eventDataSetDTO.setValue("-");
|
||||
}else {
|
||||
eventDataSetDTO.setValue(Optional.ofNullable(evtData.getValue()).orElse("-"));
|
||||
|
||||
}
|
||||
eventDataSetDTOS.add(eventDataSetDTO);
|
||||
}
|
||||
List<EventDataSetDTO> evtParamPhase = eventDataSetDTOS.stream().
|
||||
filter(dataSetDTO -> Objects.equals(dataSetDTO.getName(), "Evt_Param_Phase")).
|
||||
collect(Collectors.toList());
|
||||
if(CollectionUtil.isEmpty(evtParamPhase)){
|
||||
temp.setPhaseType("-");
|
||||
}else {
|
||||
temp.setPhaseType(evtParamPhase.get(0).getValue()+(Objects.isNull(evtParamPhase.get(0).getUnit())?"":evtParamPhase.get(0).getUnit()));
|
||||
}
|
||||
}
|
||||
//暂降幅值
|
||||
List<RmpEventDetailPO> eventDetails = eventDetailFeignClient.getEventDetailByIdsList(Arrays.asList(temp.getEventId())).getData();
|
||||
if(eventDetails !=null && !eventDetails.isEmpty()) temp.setAmplitude(PubUtils.floatRound(2, eventDetails.get(0).getFeatureAmplitude().floatValue()));
|
||||
});
|
||||
return returnpage;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -174,8 +174,8 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
|
||||
@Override
|
||||
public Object queryPage(WlRecordPageParam wlRecordPageParam) {
|
||||
//根据isTrueFlag及treeIds判断返回的数据集
|
||||
if(wlRecordPageParam.getIsTrueFlag()!=1 && wlRecordPageParam.getTreeIds().isEmpty()){
|
||||
//如果没有分页请求则直接返回tree
|
||||
if(wlRecordPageParam.getPageNum() == null){
|
||||
//组装tree用于测试项绑定数据页面左侧的搜索树
|
||||
List<RecordAllDevTreeVo> recordAllDevTreeVos = this.baseMapper.getRecordAll();
|
||||
for (RecordAllDevTreeVo recordAllDevTreeVo : recordAllDevTreeVos){
|
||||
@@ -188,6 +188,10 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
Page<RecordPageVo> returnpage = new Page<> (wlRecordPageParam.getPageNum(), wlRecordPageParam.getPageSize ());
|
||||
if(wlRecordPageParam.getSearchBeginTime()!=null) wlRecordPageParam.setSearchBeginTime(wlRecordPageParam.getSearchBeginTime()+" 00:00:00");
|
||||
if(wlRecordPageParam.getSearchEndTime()!=null) wlRecordPageParam.setSearchEndTime(wlRecordPageParam.getSearchEndTime()+" 23:59:59");
|
||||
if(wlRecordPageParam.getIsTrueFlag() == 0 && wlRecordPageParam.getTreeIds().isEmpty()){
|
||||
wlRecordPageParam.setTreeIds(new ArrayList<>());
|
||||
wlRecordPageParam.getTreeIds().add("-1");
|
||||
}
|
||||
returnpage = this.getBaseMapper().queryPage(returnpage,wlRecordPageParam);
|
||||
return returnpage;
|
||||
}
|
||||
@@ -311,26 +315,26 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
List<CsEquipmentDeliveryDTO> data1 = equipmentFeignClient.queryDeviceById(Stream.of(wl.getDevId()).collect(Collectors.toList())).getData();
|
||||
//获取指标下的具体分类指标
|
||||
List<EleEpdPqd> eleEpdPqds = csStatisticalSetFeignClient.queryStatisticalSelect(commonStatisticalQueryParam.getStatisticalId()).getData();
|
||||
List<CommonQueryParam> commonQueryParams = new ArrayList<>();
|
||||
for(EleEpdPqd epdPqd : eleEpdPqds){
|
||||
commonQueryParams.clear();
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(wl.getLineId());
|
||||
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName()+ frequency);
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||
commonQueryParam.setProcess(data1.get(0).getProcess()+"");
|
||||
commonQueryParam.setClDid(getClDidByLineId(wl.getLineId()));
|
||||
commonQueryParams.add(commonQueryParam);
|
||||
eleEpdPqds.forEach(epdPqd->{
|
||||
List<CommonQueryParam> commonQueryParams = finalCsLinePOList.stream().map(temp -> {
|
||||
CommonQueryParam commonQueryParam = new CommonQueryParam();
|
||||
commonQueryParam.setLineId(temp.getLineId());
|
||||
commonQueryParam.setTableName(getTableNameByClassId(epdPqd.getClassId()));
|
||||
commonQueryParam.setColumnName(epdPqd.getName()+ frequency);
|
||||
commonQueryParam.setPhasic(epdPqd.getPhase());
|
||||
commonQueryParam.setStartTime(LocalDateTimeUtil.format(wl.getStartTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
commonQueryParam.setEndTime(LocalDateTimeUtil.format(wl.getEndTime(), DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss")));
|
||||
commonQueryParam.setDataType(commonStatisticalQueryParam.getValueType());
|
||||
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(wl.getLineId(), vo.getLineId())).collect(Collectors.toList()).get(0).getPosition();
|
||||
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());
|
||||
@@ -342,7 +346,7 @@ public class WlRecordServiceImpl extends ServiceImpl<WlRecordMapper, WlRecord> i
|
||||
return vo;
|
||||
}).collect(Collectors.toList());
|
||||
result.addAll(collect1);
|
||||
}
|
||||
});
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user