提交 cdaad871 作者: 张开石

1、添加会议纪要使用情况统计接口-

父级 1ef8cb83
...@@ -9,6 +9,9 @@ import cn.hutool.core.collection.CollUtil; ...@@ -9,6 +9,9 @@ import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.date.DateField; import cn.hutool.core.date.DateField;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdUtil; import cn.hutool.core.util.IdUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.poi.excel.ExcelUtil;
import cn.hutool.poi.excel.ExcelWriter;
import com.alibaba.fastjson2.JSON; import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray; import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject; import com.alibaba.fastjson2.JSONObject;
...@@ -278,9 +281,32 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti ...@@ -278,9 +281,32 @@ public class MeetingInfoServiceImpl extends ServiceImpl<MeetingInfoMapper, Meeti
map.put("name", userInfo.get("name")); map.put("name", userInfo.get("name"));
map.put("deptName", userInfo.get("deptName")); map.put("deptName", userInfo.get("deptName"));
}); });
// 横向加法
Integer sum = map.values().stream()
// 小于4是为了和用户编号区分开
.filter(value -> NumberUtil.isNumber(value) && value.length() < 4)
.map(value -> Integer.parseInt(value))
.reduce(Integer::sum)
.orElse(0);
map.put("sum", sum.toString());
} }
// TODO 加和 // 初始化一行用来纵向加和
Map<String, String> map = new LinkedHashMap<>();
for (String key : list.get(0).keySet()) {
map.put(key, "");
}
for (Map<String, String> stringMap : list) {
for (Map.Entry<String, String> entry : stringMap.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (NumberUtil.isNumber(value) && value.length() < 4) {
map.put(key, String.valueOf(NumberUtil.add(map.get(key), value)));
}
}
}
map.put("userId", "总计");
list.add(map);
return list; return list;
} }
......
...@@ -35,12 +35,12 @@ ...@@ -35,12 +35,12 @@
</select> </select>
<select id="statistics" resultType="java.util.Map"> <select id="statistics" resultType="java.util.LinkedHashMap">
SELECT SELECT
userid.wid as userId, userid.wid as userId,
t.host_uid, t.host_uid,
<foreach collection="dateList" item="d" separator=","> <foreach collection="dateList" item="d" separator=",">
MAX(CASE WHEN sync_time = #{d} THEN cnt ELSE 0 END) AS `${d}` cast(MAX(CASE WHEN sync_time = #{d} THEN cnt ELSE 0 END) as char) AS `${d}`
</foreach> </foreach>
FROM ( FROM (
SELECT SELECT
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论