Commit 37db670d authored by KeYong's avatar KeYong

更新

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