Commit 37db670d authored by KeYong's avatar KeYong

更新

parent 0896769b
...@@ -26,6 +26,7 @@ public class OrgMenuDto { ...@@ -26,6 +26,7 @@ public class OrgMenuDto {
private String bizOrgType; private String bizOrgType;
private String bizOrgCode; private String bizOrgCode;
private Integer num; private Integer num;
private String code;
public Boolean getLeaf() { public Boolean getLeaf() {
return ObjectUtils.isEmpty(children); return ObjectUtils.isEmpty(children);
...@@ -61,6 +62,16 @@ public class OrgMenuDto { ...@@ -61,6 +62,16 @@ public class OrgMenuDto {
this.leaf = leaf; this.leaf = leaf;
} }
public OrgMenuDto(Long key, String title, Long parentId, boolean leaf, String bizOrgCode, String code) {
super();
this.key = key;
this.title = title;
this.parentId = parentId;
this.leaf = leaf;
this.bizOrgCode = bizOrgCode;
this.code = code;
}
public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType) { public OrgMenuDto(Long key, String title, Long parentId, String bizOrgType) {
this.key = key; this.key = key;
this.title = title; this.title = title;
......
...@@ -2514,11 +2514,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2514,11 +2514,12 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public List<OrgMenuDto> getSystemEquipTree(String systemCode) { public List<OrgMenuDto> getSystemEquipTree(String systemCode) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, "COMPANY", "dl"); // 此卡片在站端使用,由于远程调用jcs耗时,所以暂注释掉
String bizOrgCode = feignClientResult.getResult().get(0).getBizOrgCode(); // FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, "COMPANY", "dl");
// String bizOrgCode = feignClientResult.getResult().get(0).getBizOrgCode();
List<OrgMenuDto> resList = new ArrayList<>(); List<OrgMenuDto> resList = new ArrayList<>();
List<Map<String, Object>> list = fireFightingSystemMapper.getEquipmentAndEquipSpeTree(bizOrgCode, systemCode); List<Map<String, Object>> list = fireFightingSystemMapper.getEquipmentAndEquipSpeTree(null, systemCode);
List<OrgMenuDto> childrenRes = systemAndEquipmentTree(list); List<OrgMenuDto> childrenRes = systemAndEquipmentTreeNew(list);
OrgMenuDto dto = new OrgMenuDto(); OrgMenuDto dto = new OrgMenuDto();
FireFightingSystemEntity entity = fireFightingSystemMapper.selectOne(new QueryWrapper<FireFightingSystemEntity>().eq("code", systemCode)); FireFightingSystemEntity entity = fireFightingSystemMapper.selectOne(new QueryWrapper<FireFightingSystemEntity>().eq("code", systemCode));
dto.setKey(entity.getId()); dto.setKey(entity.getId());
...@@ -2533,6 +2534,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2533,6 +2534,8 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
if (0 < list.size()) { if (0 < list.size()) {
childrenRes = childrenRes.stream().map(x -> { childrenRes = childrenRes.stream().map(x -> {
x.setParentId(entity.getId()); x.setParentId(entity.getId());
x.setIsLeaf(true);
x.setLeaf(true);
x.setNum(x.getChildren().size() > 0 ? x.getChildren().size() : 0); x.setNum(x.getChildren().size() > 0 ? x.getChildren().size() : 0);
return x; return x;
}).collect(Collectors.toList()); }).collect(Collectors.toList());
...@@ -2544,9 +2547,40 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste ...@@ -2544,9 +2547,40 @@ public class FireFightingSystemServiceImpl extends ServiceImpl<FireFightingSyste
@Override @Override
public Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, String systemCode, String equipmentCode) { public Page<Map<String, Object>> getEquipmentsBySystemInfo(Page page, String systemCode, String equipmentCode) {
FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, "COMPANY", "dl"); // FeignClientResult<List<OrgUsrDto>> feignClientResult = jcsFeignClient.getCompanyDeptListWithAuth(authKey, "COMPANY", "dl");
String bizOrgCode = feignClientResult.getResult().get(0).getBizOrgCode(); // String bizOrgCode = feignClientResult.getResult().get(0).getBizOrgCode();
return fireFightingSystemMapper.getEquipmentsBySystemInfo(page, null, systemCode, equipmentCode); return fireFightingSystemMapper.getEquipmentsBySystemInfo(page, null, systemCode, equipmentCode);
} }
public static List<OrgMenuDto> systemAndEquipmentTreeNew(List<Map<String,Object>> list) {
List<OrgMenuDto> menuList = list.stream()
.map(o -> new OrgMenuDto(Long.parseLong(o.get("id").toString()), o.get("name").toString(),
ObjectUtils.isEmpty(o.get("parentId")) ? 0L : Long.parseLong(o.get("parentId").toString()),
false, o.get("bizOrgCode").toString(), ObjectUtils.isEmpty(o.get("code")) ? "": o.get("code").toString()))
.collect(Collectors.toList());
List<OrgMenuDto> result = new ArrayList<>();
Map<Long, OrgMenuDto> map = new HashMap<>(menuList.size());
menuList.forEach(e -> map.put(e.getKey(), e));
Set<? extends Map.Entry<Long, ? extends OrgMenuDto>> entries = map.entrySet();
// 此处多线程,会value 出现null 的情况
// entries.parallelStream().forEach(entry -> {
entries.forEach(entry -> {
OrgMenuDto value = entry.getValue();
if (value != null) {
OrgMenuDto treeDto = map.get(value.getParentId());
if (treeDto != null) {
List<OrgMenuDto> children = treeDto.getChildren();
if (children == null) {
children = new ArrayList<>();
treeDto.setChildren(children);
}
children.add(value);
} else {
result.add(value);
}
}
});
return result;
}
} }
...@@ -5987,19 +5987,20 @@ ...@@ -5987,19 +5987,20 @@
JOIN wl_equipment_detail AS det ON wes.equipment_detail_id = det.id JOIN wl_equipment_detail AS det ON wes.equipment_detail_id = det.id
JOIN wl_equipment AS wle ON wle.id = det.equipment_id JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET(fs.id, wes.system_id) LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET(fs.id, wes.system_id)
WHERE <where>
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
wes.biz_org_code like concat(#{bizOrgCode}, '%') wes.biz_org_code like concat(#{bizOrgCode}, '%')
</if> </if>
<if test="systemCode != null and systemCode != ''"> <if test="systemCode != null and systemCode != ''">
AND fs.`code` = #{systemCode} AND fs.`code` = #{systemCode}
</if> </if>
</where>
) UNION ) UNION
( (
SELECT SELECT
wes.id, wes.id,
wes.`name`, wes.`name`,
wes.`code`, wle.`code`,
0, 0,
wle.id AS parentId, wle.id AS parentId,
wes.biz_org_code bizOrgCode wes.biz_org_code bizOrgCode
...@@ -6008,13 +6009,14 @@ ...@@ -6008,13 +6009,14 @@
LEFT JOIN wl_equipment_detail AS det ON wes.equipment_detail_id = det.id LEFT JOIN wl_equipment_detail AS det ON wes.equipment_detail_id = det.id
LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id LEFT JOIN wl_equipment AS wle ON wle.id = det.equipment_id
LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET(fs.id, wes.system_id) LEFT JOIN f_fire_fighting_system fs ON FIND_IN_SET(fs.id, wes.system_id)
WHERE <where>
<if test="bizOrgCode!=null and bizOrgCode!=''"> <if test="bizOrgCode!=null and bizOrgCode!=''">
wes.biz_org_code like concat(#{bizOrgCode}, '%') wes.biz_org_code like concat(#{bizOrgCode}, '%')
</if> </if>
<if test="systemCode != null and systemCode != ''"> <if test="systemCode != null and systemCode != ''">
AND fs.`code` = #{systemCode} AND fs.`code` = #{systemCode}
</if> </if>
</where>
) )
)a )a
JOIN mysql.help_topic b ON b.help_topic_id &lt; ( JOIN mysql.help_topic b ON b.help_topic_id &lt; (
...@@ -6036,7 +6038,7 @@ ...@@ -6036,7 +6038,7 @@
'正常' '正常'
ELSE '异常' ELSE '异常'
END AS equipStatus, END AS equipStatus,
detail.standard IFNULL(detail.standard, '') AS standard
FROM FROM
wl_equipment_specific spec wl_equipment_specific spec
JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id JOIN wl_equipment_detail detail ON spec.equipment_detail_id = detail.id
......
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