设备监控接口相关调整

This commit is contained in:
guofeihu
2024-07-05 16:38:14 +08:00
parent 815b90f47f
commit 33155a534f
9 changed files with 87 additions and 52 deletions

View File

@@ -13,6 +13,8 @@ import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csdevice.service.ICsGroupService;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
import com.njcn.web.controller.BaseController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -111,6 +113,15 @@ public class CsGroupController extends BaseController {
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@GetMapping("/getGroupPortableStatistical")
@ApiOperation("查询稳态指标并按照指标名称分组(A、B、...)")
public HttpResult<List<List<EleEpdPqd>>> getGroupPortableStatistical(){
String methodDescribe = getMethodDescribe("getGroupPortableStatistical");
List<List<EleEpdPqd>> list = csGroupService.getGroupPortableStatistical();
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, list, methodDescribe);
}
@OperateInfo(info = LogEnum.BUSINESS_COMMON)
@PostMapping("/deleteGroup")
@ApiOperation("删除分组")

View File

@@ -12,7 +12,10 @@ import com.njcn.csdevice.pojo.param.WlRecordTemplete;
import com.njcn.csdevice.pojo.po.PortableOfflLog;
import com.njcn.csdevice.service.IPortableOfflLogService;
import com.njcn.csdevice.utils.ExcelStyleUtil;
import com.njcn.poi.excel.ExcelUtil;
import com.njcn.poi.util.PoiUtil;
import com.njcn.system.api.DicDataFeignClient;
import com.njcn.system.pojo.po.DictData;
import com.njcn.web.pojo.param.BaseParam;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@@ -25,6 +28,9 @@ import com.njcn.web.controller.BaseController;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* <p>
@@ -42,6 +48,8 @@ public class PortableOfflLogController extends BaseController {
private final IPortableOfflLogService iPortableOfflLogService;
private final DicDataFeignClient dicDataFeignClient;
@ResponseBody
@ApiOperation("导出设备基础数据模板")
@GetMapping(value = "getExcelTemplate")
@@ -49,8 +57,9 @@ public class PortableOfflLogController extends BaseController {
ExportParams exportParams = new ExportParams("批量导入模板(请严格按照模板标准填入数据,带*表示必填)", "便携式终端基础数据录入信息");
exportParams.setStyle(ExcelStyleUtil.class);
Workbook workbook = ExcelExportUtil.exportExcel(exportParams, WlRecordTemplete.class, new ArrayList<WlRecordTemplete>());
//ExcelUtil.selectList(workbook, 2, 2, Stream.of("直连设备","网关设备").collect(Collectors.toList()).toArray(new String[]{}));
//ExcelUtil.selectList(workbook, 4, 4, Stream.of("MQTT","CLD").collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 5, 5, Stream.of("1分钟","3分钟","5分钟","10分钟").collect(Collectors.toList()).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 8, 8, Stream.of(dicDataFeignClient.getDicDataByTypeCode("Dev_Voltage").getData().stream().map(DictData::getName).collect(Collectors.toList())).collect(Collectors.toList()).get(0).toArray(new String[]{}));
ExcelUtil.selectList(workbook, 13, 13, Stream.of(dicDataFeignClient.getDicDataByTypeCode("Dev_Connect").getData().stream().map(DictData::getName).collect(Collectors.toList())).collect(Collectors.toList()).get(0).toArray(new String[]{}));
String fileName = "便携式设备模板.xlsx";
PoiUtil.exportFileByWorkbook(workbook, fileName, response);
return null;

View File

@@ -27,5 +27,5 @@ public interface CsGroupMapper extends BaseMapper<CsGroup> {
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);
Page<DataGroupEventVO> getGroupEventList(IPage<DataGroupEventVO> page, @Param("devId") String devId, @Param("lindId") String lindId);
}

View File

@@ -86,7 +86,7 @@
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'
and ce.device_id = #{devId} and ce.line_id = #{lindId}
order by w1.item_name
</select>

View File

@@ -8,6 +8,9 @@ import com.njcn.csdevice.pojo.vo.CsGroupVO;
import com.njcn.csdevice.pojo.vo.DataGroupTemplateVO;
import com.njcn.csharmonic.param.CommonStatisticalQueryParam;
import com.njcn.csharmonic.pojo.vo.ThdDataVO;
import com.njcn.system.pojo.po.EleEpdPqd;
import com.njcn.system.pojo.vo.EleEpdPqdListVO;
import java.util.List;
/**
@@ -56,6 +59,12 @@ public interface ICsGroupService extends IService<CsGroup> {
*/
List<ThdDataVO> getDeviceHarmonicSpectrumData(CommonStatisticalQueryParam commonStatisticalQueryParam);
/**
* 查询稳态指标并按照指标名称分组(A、B、...)
* @return
*/
List<List<EleEpdPqd>> getGroupPortableStatistical();
/**
* 删除组信息
* @param groupId 组id

View File

@@ -487,6 +487,23 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
return result;
}
@Override
public List<List<EleEpdPqd>> getGroupPortableStatistical() {
List<List<EleEpdPqd>> data = new ArrayList<>();
CsStatisticalSetVO csStatisticalSetVO = csStatisticalSetFeignClient.queryStatistical(DataParam.portableDevStatisticalId).getData();
List<EleEpdPqd> eleEpdPqds = new ArrayList<>();
csStatisticalSetVO.getSelectedList().forEach(css->{
for(EleEpdPqd epdPqd : css.getEleEpdPqdVOS()){
eleEpdPqds.add(epdPqd);
}
});
Map<String,List<EleEpdPqd>> map = eleEpdPqds.stream().collect(Collectors.groupingBy(EleEpdPqd::getName,LinkedHashMap::new,Collectors.toList()));
map.forEach((k,v)->{
data.add(v);
});
return data;
}
/*表名换成了id本方法做转换*/
private String getTableNameByClassId(String classId){
DictData data = dicDataFeignClient.getDicDataById(classId).getData();

View File

@@ -3,9 +3,10 @@ package com.njcn.csdevice.service.impl;
import cn.afterturn.easypoi.excel.ExcelImportUtil;
import cn.afterturn.easypoi.excel.entity.ImportParams;
import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult;
import cn.hutool.core.util.IdUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.njcn.csdevice.mapper.PortableOfflLogMapper;
import com.njcn.csdevice.pojo.param.DeviceExcelTemplete;
import com.njcn.csdevice.pojo.param.WlRecordTemplete;
import com.njcn.csdevice.pojo.po.PortableOfflLog;
import com.njcn.csdevice.service.IPortableOfflLogService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -13,6 +14,7 @@ import com.njcn.web.pojo.param.BaseParam;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* <p>
@@ -43,11 +45,20 @@ public class PortableOfflLogServiceImpl extends ServiceImpl<PortableOfflLogMappe
params.setStartSheetIndex(0);
params.setSheetNum(1);
try {
ExcelImportResult<DeviceExcelTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), DeviceExcelTemplete.class, params);
ExcelImportResult<WlRecordTemplete> terminalBaseList = ExcelImportUtil.importExcelMore (file.getInputStream ( ), WlRecordTemplete.class, params);
List<WlRecordTemplete> list = terminalBaseList.getList();
//开始解析.......
} catch (Exception e) {
e.printStackTrace();
}
//记录导入信息
PortableOfflLog portableOfflLog = new PortableOfflLog();
portableOfflLog.setName(file.getOriginalFilename());
portableOfflLog.setDataPath("D//file//"+file.getOriginalFilename());
portableOfflLog.setLogsIndex(IdUtil.simpleUUID());
portableOfflLog.setAllCount(100);
portableOfflLog.setRealCount(70);
portableOfflLog.setState(1);
this.baseMapper.insert(portableOfflLog);
}
}