forked from xxhjsb/wit-park-backend
接口返回值修改
parent
2ec9a26365
commit
7f855e50eb
|
@ -0,0 +1,14 @@
|
|||
package com.hbt.safety.supervision.pojo.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 统计数据vo
|
||||
*/
|
||||
@Data
|
||||
public class StatisticsVo {
|
||||
|
||||
private int classify; // 分类
|
||||
|
||||
private int count; // 数量
|
||||
}
|
|
@ -34,8 +34,7 @@ public class EscalateRiskServiceImpl implements IEscalateRiskService
|
|||
|
||||
/**
|
||||
* 查询上报风险列表
|
||||
*
|
||||
* @param escalateRisk 上报风险
|
||||
*
|
||||
* @return 上报风险
|
||||
*/
|
||||
@Override
|
||||
|
|
|
@ -5,6 +5,7 @@ import java.util.stream.Collectors;
|
|||
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hbt.safety.supervision.pojo.HazardousOperation;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.hbt.safety.supervision.mapper.HazardousOperationMapper;
|
||||
|
@ -114,9 +115,12 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
|||
Map<Object, List<HazardousOperation>> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(HazardousOperation::getOperationType));
|
||||
// 组装类型统计数据
|
||||
Map<Object, Integer> operationTypeList = new HashMap<>();
|
||||
List<StatisticsVo> operationTypeList = new ArrayList<>();
|
||||
for(Object key : typeList.keySet()) {
|
||||
operationTypeList.put(key, typeList.get(key).size());
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setClassify(Integer.parseInt(key.toString()));
|
||||
statisticsVo.setCount(typeList.get(key).size());
|
||||
operationTypeList.add(statisticsVo);
|
||||
}
|
||||
map.put("operationTypeList", operationTypeList);
|
||||
|
||||
|
|
|
@ -1,11 +1,15 @@
|
|||
package com.hbt.safety.supervision.service.impl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.hbt.safety.supervision.pojo.vo.StatisticsVo;
|
||||
import com.hbt.safety.supervision.service.IMajorHazardSourcesService;
|
||||
import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -108,10 +112,14 @@ public class MajorHazardSourcesServiceImpl implements IMajorHazardSourcesService
|
|||
// 根据风险等级分组
|
||||
Map<Object, List<MajorHazardSources>> typeList = list.stream()
|
||||
.collect(Collectors.groupingBy(MajorHazardSources::getDangerLevel));
|
||||
|
||||
// 组装风险等级统计数据
|
||||
Map<Object, Integer> dangerLevelList = new HashMap<>();
|
||||
List<StatisticsVo> dangerLevelList = new ArrayList<>();
|
||||
for(Object key : typeList.keySet()) {
|
||||
dangerLevelList.put(key, typeList.get(key).size());
|
||||
StatisticsVo statisticsVo = new StatisticsVo();
|
||||
statisticsVo.setClassify(Integer.parseInt(key.toString()));
|
||||
statisticsVo.setCount(typeList.get(key).size());
|
||||
dangerLevelList.add(statisticsVo);
|
||||
}
|
||||
map.put("dangerLevelList", dangerLevelList);
|
||||
|
||||
|
|
Loading…
Reference in New Issue