Commit 256e3bfb authored by 张森's avatar 张森

装备API优化

parent 0eb3f67d
......@@ -79,4 +79,7 @@ public class EquipTypeImgAmountVO {
@ApiModelProperty(value = "日常运维")
private String equip;
@ApiModelProperty(value = "系统IDs")
private String systemId;
}
package com.yeejoin.equipmanage.service.impl;
import cn.hutool.core.collection.CollUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
......@@ -1000,11 +1001,31 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
}
IPage<EquipTypeImgAmountVO> list = fireFightingSystemMapper
.getColaCategoryAmountEquList(equipTypeAmountPage.getPage(), hierarchy, codeHead, equipTypeAmountPage);
ArrayList<String> systemIds = new ArrayList<>();
list.getRecords().forEach(x -> {
if (!x.getEqtype().startsWith("4") && StringUtil.isNotEmpty(x.getAmount())) {
x.setAmount(x.getAmount().split("\\.")[0]);
}
if (StringUtil.isNotEmpty(x.getSystemId())) {
List<String> systemId = Arrays.asList(x.getSystemId().split(","));
systemIds.addAll(systemId);
}
});
if (CollUtil.isNotEmpty(systemIds)) {
LambdaQueryWrapper<FireFightingSystemEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.in(FireFightingSystemEntity::getId, systemIds);
List<FireFightingSystemEntity> fireSystemList = fireFightingSystemMapper.selectList(wrapper);
Map<String, String> systemNameMap = fireSystemList.stream().collect(Collectors.toMap(t -> t.getId().toString(), FireFightingSystemEntity::getName));
list.getRecords().parallelStream().forEach(item -> {
if (StringUtil.isNotEmpty(item.getSystemId())) {
ArrayList<String> systemNames = new ArrayList<>();
List<String> systemIdList = Arrays.asList(item.getSystemId().split(","));
systemIdList.parallelStream().forEach(id -> systemNames.add(systemNameMap.getOrDefault(id, "")));
String join = String.join(",", systemNames);
item.setSystemName(join);
}
});
}
return list;
}
......
......@@ -2071,7 +2071,7 @@
<select id="getColaCategoryAmountEquList" resultMap="CategoryAmountList">
select * from (
SELECT
wles.id,
wles.qr_code,
......@@ -2083,8 +2083,7 @@
concat_ws('-',wlws.full_name,wled.area) as full_name,
wlws.name as belongBuildName,
wlun.NAME unitName,
(SELECT GROUP_CONCAT(fem.name) FROM `f_fire_fighting_system` fem WHERE find_in_set(fem.id,wles.system_id))
as systemName,
wles.system_id as systemId,
wlsd.amount,
wlsd.id as stockDetailId,
'equipment' as type,
......@@ -2165,13 +2164,12 @@
<if test="equipTypeAmountPage.iotCode!=null and equipTypeAmountPage.iotCode!=''">
AND wles.iot_code LIKE CONCAT('%',#{equipTypeAmountPage.iotCode},'%')
</if>
)s1 WHERE 1=1
<if test="equipTypeAmountPage.warehouseStructureName!=null and equipTypeAmountPage.warehouseStructureName!=''">
AND s1.full_name LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
AND concat_ws('-',wlws.full_name,wled.area) LIKE CONCAT('%',#{equipTypeAmountPage.warehouseStructureName},'%')
</if>
<if test="equipTypeAmountPage.bizOrgCode!=null and equipTypeAmountPage.bizOrgCode!=''">
AND s1.bizOrgCode LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
AND wles.biz_org_code LIKE CONCAT(#{equipTypeAmountPage.bizOrgCode},'%')
</if>
order by createDate DESC
</select>
......
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