Commit fad02218 authored by chenzhao's avatar chenzhao

修改bug

parent b3445951
......@@ -104,6 +104,63 @@ public class TreeParser {
return resultList;
}
public static List<Menu> getTreeTeam(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, List<FirefightersTreeDto> list,String treeCode) throws Exception {
List<Menu> resultList = new ArrayList<>();
@SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL);
Method IDMethodNameme = null;
switch (IDHierarchy) {
case 1:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break;
case 2:
IDMethodNameme = clazz.getSuperclass().getDeclaredMethod(IDMethodName);
break;
case 3:
IDMethodNameme = clazz.getSuperclass().getSuperclass().getDeclaredMethod(IDMethodName);
break;
default:
IDMethodNameme = clazz.getDeclaredMethod(IDMethodName);
break;
}
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
//获取顶层元素集合
Long parentId;
for (Object ob : entityList) {
Object entity = clazz.cast(ob);
parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null;
if (parentId == null ) {//陈浩2021-12-01修改 topId == parentId 的判断
String codeString = String.valueOf(IDMethodNameme.invoke(entity));
Integer num = 0;
if (list != null && list.size() > 0) {
for (FirefightersTreeDto map : list) {
if (null != map.getJobTitleCode() && map.getJobTitleCode().equals(codeString)) {
num = Integer.valueOf((String) map.getNum());
break;
}
}
;
}
Menu menu = new Menu(Long.valueOf(codeString), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, num);
resultList.add(menu);
}
}
//获取每个顶层元素的子数据集合
for (Menu entity : resultList) {
entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, list,treeCode));
}
return resultList;
}
/**
* 获取子数据集合
*/
......
......@@ -29,6 +29,7 @@ import com.yeejoin.amos.boot.module.common.api.service.IFireTeamService;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.typroject.tyboot.core.foundation.context.RequestContext;
import org.typroject.tyboot.core.foundation.exception.BaseException;
......@@ -65,6 +66,9 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
@Autowired
private RedisUtils redisUtils;
@Value("${fire-rescue}")
private String fireRescueId;
/**
* 获取监控大队列表
......@@ -494,16 +498,20 @@ public class FireTeamServiceImpl extends BaseService<FireTeamDto, FireTeam, Fire
LambdaQueryWrapper<FireTeam> queryWrapper = new LambdaQueryWrapper<FireTeam>();
queryWrapper.eq(FireTeam::getTypeCode, code);
queryWrapper.eq(FireTeam::getIsDelete, false);
queryWrapper.eq(FireTeam::getCompanyName, "消防救援保障部");
// queryWrapper.eq(FireTeam::getCompanyName, "消防急救保障部");
// 消防救援保障部为保证灵活性以及防止名字变更 通过id查询 ID在配置文件中配置
queryWrapper.eq(FireTeam::getCompany,fireRescueId);
LambdaQueryWrapper<FireTeam> queryWrapper1 = new LambdaQueryWrapper<FireTeam>();
queryWrapper1.eq(FireTeam::getIsDelete, false);
queryWrapper1.eq(FireTeam::getCompanyName, "消防救援保障部");
// queryWrapper1.eq(FireTeam::getCompanyName, "消防急救保障部");
queryWrapper1.eq(FireTeam::getCompany,fireRescueId);
queryWrapper1.isNull(FireTeam::getParent);
queryWrapper1.eq(FireTeam::getTypeCode,code);
FireTeam parentFireTeam = this.baseMapper.selectOne(queryWrapper1);
if (parentFireTeam == null) {
return null;
}
return TreeParser.getTree(parentFireTeam.getSequenceNbr(), this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
return TreeParser.getTreeTeam(parentFireTeam.getSequenceNbr(), this.baseMapper.selectList(queryWrapper), FireTeam.class.getName(), "getSequenceNbr", 2, "getName", "getParent",
null,null);
// TODO Auto-generated method stub
}
......
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