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; // 数量
|
||||||
|
}
|
|
@ -35,7 +35,6 @@ public class EscalateRiskServiceImpl implements IEscalateRiskService
|
||||||
/**
|
/**
|
||||||
* 查询上报风险列表
|
* 查询上报风险列表
|
||||||
*
|
*
|
||||||
* @param escalateRisk 上报风险
|
|
||||||
* @return 上报风险
|
* @return 上报风险
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -5,6 +5,7 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
import com.hbt.safety.supervision.pojo.HazardousOperation;
|
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.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.hbt.safety.supervision.mapper.HazardousOperationMapper;
|
import com.hbt.safety.supervision.mapper.HazardousOperationMapper;
|
||||||
|
@ -114,9 +115,12 @@ public class HazardousOperationServiceImpl implements IHazardousOperationService
|
||||||
Map<Object, List<HazardousOperation>> typeList = list.stream()
|
Map<Object, List<HazardousOperation>> typeList = list.stream()
|
||||||
.collect(Collectors.groupingBy(HazardousOperation::getOperationType));
|
.collect(Collectors.groupingBy(HazardousOperation::getOperationType));
|
||||||
// 组装类型统计数据
|
// 组装类型统计数据
|
||||||
Map<Object, Integer> operationTypeList = new HashMap<>();
|
List<StatisticsVo> operationTypeList = new ArrayList<>();
|
||||||
for(Object key : typeList.keySet()) {
|
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);
|
map.put("operationTypeList", operationTypeList);
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,15 @@
|
||||||
package com.hbt.safety.supervision.service.impl;
|
package com.hbt.safety.supervision.service.impl;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
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.service.IMajorHazardSourcesService;
|
||||||
import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
import com.hbt.safety.supervision.pojo.MajorHazardSources;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
@ -108,10 +112,14 @@ public class MajorHazardSourcesServiceImpl implements IMajorHazardSourcesService
|
||||||
// 根据风险等级分组
|
// 根据风险等级分组
|
||||||
Map<Object, List<MajorHazardSources>> typeList = list.stream()
|
Map<Object, List<MajorHazardSources>> typeList = list.stream()
|
||||||
.collect(Collectors.groupingBy(MajorHazardSources::getDangerLevel));
|
.collect(Collectors.groupingBy(MajorHazardSources::getDangerLevel));
|
||||||
|
|
||||||
// 组装风险等级统计数据
|
// 组装风险等级统计数据
|
||||||
Map<Object, Integer> dangerLevelList = new HashMap<>();
|
List<StatisticsVo> dangerLevelList = new ArrayList<>();
|
||||||
for(Object key : typeList.keySet()) {
|
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);
|
map.put("dangerLevelList", dangerLevelList);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue