前台json无法解析问题修改

main
zhangyu 2023-02-23 10:28:30 +08:00
parent 07387c620e
commit 7a24cc710b
4 changed files with 10 additions and 8 deletions

View File

@ -4,6 +4,7 @@ import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.alibaba.fastjson2.JSON;
import com.hbt.safety.supervision.mapper.HiddenDangerMapper; import com.hbt.safety.supervision.mapper.HiddenDangerMapper;
import com.hbt.safety.supervision.pojo.HiddenDanger; import com.hbt.safety.supervision.pojo.HiddenDanger;
import com.hbt.safety.supervision.pojo.vo.DateVo; import com.hbt.safety.supervision.pojo.vo.DateVo;
@ -128,9 +129,9 @@ public class HiddenDangerServiceImpl implements IHiddenDangerService
if (list == null) { if (list == null) {
return ""; return "";
} }
Map<Object, List<HiddenDanger>> hiddenDangerMap = list.stream() Map<String, List<HiddenDanger>> hiddenDangerMap = list.stream()
.collect(Collectors.groupingBy(HiddenDanger::getReformStatus)); .collect(Collectors.groupingBy( s -> s.getReformStatus() + ""));
return JSONObject.toJSONString(hiddenDangerMap); return JSON.toJSONString(hiddenDangerMap);
} }
/** /**

View File

@ -2,7 +2,8 @@ package com.hbt.safety.supervision.service.impl;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONObject;
import com.hbt.safety.supervision.mapper.RiskMapper; import com.hbt.safety.supervision.mapper.RiskMapper;
import com.hbt.safety.supervision.pojo.Risk; import com.hbt.safety.supervision.pojo.Risk;
import com.hbt.safety.supervision.pojo.vo.DateVo; import com.hbt.safety.supervision.pojo.vo.DateVo;
@ -107,8 +108,8 @@ public class RiskServiceImpl implements IRiskService
if (list == null) { if (list == null) {
return ""; return "";
} }
Map<Object, List<Risk>> map = list.stream().collect(Collectors.groupingBy(Risk::getLevel)); Map<String, List<Risk>> map = list.stream().collect(Collectors.groupingBy(s -> s.getLevel() + ""));
return JSONObject.toJSONString(map); return JSON.toJSONString(map);
} }
/** /**

View File

@ -118,7 +118,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</delete> </delete>
<select id="selectHiddenDangers" resultType="com.hbt.safety.supervision.pojo.HiddenDanger"> <select id="selectHiddenDangers" resultType="com.hbt.safety.supervision.pojo.HiddenDanger">
select name, reform_status reformStatus from hidden_danger where exceed_time_limit_status = 0 select id, name, reform_status reformStatus from hidden_danger where exceed_time_limit_status = 0
</select> </select>
<select id="selectHiddenDangerSubmitDat" resultType="String"> <select id="selectHiddenDangerSubmitDat" resultType="String">

View File

@ -108,7 +108,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select> </select>
<select id="selectRisks" resultType="com.hbt.safety.supervision.pojo.Risk"> <select id="selectRisks" resultType="com.hbt.safety.supervision.pojo.Risk">
select name, level from risk select id, name, level from risk
</select> </select>
<select id="selectRiskSubmitDats" resultType="String"> <select id="selectRiskSubmitDats" resultType="String">