Commit bf755375 authored by 李秀明's avatar 李秀明

feat: 驻站消防员新增查询条件

parent 5b620747
...@@ -82,8 +82,11 @@ ...@@ -82,8 +82,11 @@
<if test="map.positionType != null and map.positionType != ''"> <if test="map.positionType != null and map.positionType != ''">
AND FIND_IN_SET(#{map.positionType},g.positionType) AND FIND_IN_SET(#{map.positionType},g.positionType)
</if> </if>
<if test="map.peopleType != null and map.peopleType != ''"> <if test="map.peopleTypes != null and map.peopleTypes.size() > 0">
AND g.peopleType = #{map.peopleType} AND g.peopleType IN
<foreach item="item" index="index" collection="map.peopleTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="map.fireManagementPostOne != null and map.fireManagementPostOne != ''"> <if test="map.fireManagementPostOne != null and map.fireManagementPostOne != ''">
AND locate(#{map.fireManagementPostOne}, g.fireManagementPost) AND locate(#{map.fireManagementPostOne}, g.fireManagementPost)
...@@ -189,8 +192,11 @@ ...@@ -189,8 +192,11 @@
<if test="map.positionType != null and map.positionType != ''"> <if test="map.positionType != null and map.positionType != ''">
AND FIND_IN_SET(#{map.positionType},g.positionType) AND FIND_IN_SET(#{map.positionType},g.positionType)
</if> </if>
<if test="map.peopleType != null and map.peopleType != ''"> <if test="map.peopleTypes != null and map.peopleTypes.size() > 0">
AND g.peopleType = #{map.peopleType} AND g.peopleType IN
<foreach item="item" index="index" collection="map.peopleTypes" open="(" separator="," close=")">
#{item}
</foreach>
</if> </if>
<if test="map.fireManagementPostOne != null and map.fireManagementPostOne != ''"> <if test="map.fireManagementPostOne != null and map.fireManagementPostOne != ''">
AND locate(#{map.fireManagementPostOne}, g.fireManagementPost) AND locate(#{map.fireManagementPostOne}, g.fireManagementPost)
...@@ -211,12 +217,9 @@ ...@@ -211,12 +217,9 @@
) a where a.sequenceNbr is not null ) a where a.sequenceNbr is not null
<if test="map.fieldsValue != null"> <if test="map.fieldsValue != null">
<foreach collection="map.fieldsValue.keys" item="item"> <foreach collection="map.fieldsValue.keys" item="item">
<if test="item != 'bizOrgName'"> <if test="item != 'bizOrgName'">
AND a.${item} = #{map.fieldsValue[${item}]} AND a.${item} = #{map.fieldsValue[${item}]}
</if> </if>
</foreach> </foreach>
</if> </if>
order by CONVERT(a.companyName USING gbk) ASC, a.personStatus DESC, a.recDate DESC order by CONVERT(a.companyName USING gbk) ASC, a.personStatus DESC, a.recDate DESC
......
...@@ -624,7 +624,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -624,7 +624,8 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
String peopleType = ""; String peopleType = "";
if(req.containsKey("peopleType")) { if(req.containsKey("peopleType")) {
peopleType = req.get("peopleType").toString(); peopleType = req.get("peopleType").toString();
map.put("peopleType", peopleType); List<String> peopleTypes = Arrays.stream(peopleType.split(",")).filter(StringUtils::isNotBlank).distinct().collect(Collectors.toList());
map.put("peopleTypes", peopleTypes);
} }
String personStatus = ""; String personStatus = "";
...@@ -943,11 +944,39 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp ...@@ -943,11 +944,39 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
@Override @Override
public List<Map<String, Object>> selectStatic(String bizOrgCode, String type) { public List<Map<String, Object>> selectStatic(String bizOrgCode, String type) {
List<Map<String,Object>> listMap; List<Map<String,Object>> listMap = new ArrayList<>();
if("1601".equals(type)) { if ("1601".equals(type)) {
listMap = this.baseMapper.selectStaticFire(bizOrgCode); listMap = this.baseMapper.selectStaticFire(bizOrgCode);
} else { } else if ("1602".equals(type)) {
listMap = this.baseMapper.selectStaticYw(bizOrgCode); listMap = this.baseMapper.selectStaticYw(bizOrgCode);
} else if ("1601,1602".equals(type)) { // 查询“驻站消防”数据
Map<String, Integer> tempMap = new HashMap<>();
int total = 0;
List<Map<String, Object>> listMap1 = this.baseMapper.selectStaticFire(bizOrgCode);
List<Map<String, Object>> listMap2 = this.baseMapper.selectStaticYw(bizOrgCode);
for (Map<String, Object> map : listMap1) {
String postName = map.get("postName").toString();
int num = Integer.parseInt(map.get("num").toString());
tempMap.put(postName, tempMap.getOrDefault(postName, 0) + num);
total += num;
}
for (Map<String, Object> map : listMap2) {
String postName = map.get("postName").toString();
int num = Integer.parseInt(map.get("num").toString());
tempMap.put(postName, tempMap.getOrDefault(postName, 0) + num);
total += num;
}
// 结果转换
for (Map.Entry<String, Integer> entry : tempMap.entrySet()) {
int finalTotal = total;
Map<String, Object> item = new HashMap<String, Object>() {{
this.put("postName", entry.getKey());
this.put("num", entry.getValue());
float percent = ((float) (entry.getValue() * 100) / finalTotal);
this.put("percent", percent);
}};
listMap.add(item);
}
} }
return listMap; return listMap;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment