Commit cf55039f authored by gaodongdong's avatar gaodongdong

修改bug

parent bd456242
......@@ -35,11 +35,12 @@ public interface IOrgUsrService {
* @param NAMEMethodName
* @param PARENTIDMethodName
* @param OrgTypeMethodName
* @param KeyMethodName
* @return
* @throws Exception
*/
List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception;
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception;
/**
* 获取子数据集合
......@@ -55,7 +56,7 @@ public interface IOrgUsrService {
* @throws Exception
*/
List<OrgMenuVo> getSub(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy,
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception;
String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception;
/**
* 组装融合调度单位人员信息
......
......@@ -14,26 +14,28 @@ import java.util.List;
@Accessors(chain = true)
@ApiModel(value="OrgMenuVo", description="树菜单")
public class OrgMenuVo {
public Long key;
public String key;
public String title;
public Long id;
public Long parentId;
public boolean leaf = true;
public List<OrgMenuVo> children;
public String bizOrgType;
public OrgMenuVo(Long key, String title, Long parentId, String bizOrgType, boolean leaf) {
public OrgMenuVo(String key, String title, Long parentId, String bizOrgType, boolean leaf, Long id) {
super();
this.key = key;
this.title = title;
this.parentId = parentId;
this.bizOrgType = bizOrgType;
this.leaf = leaf;
this.id= id;
}
public OrgMenuVo(Long key, String title, Long parentId, String bizOrgType) {
public OrgMenuVo(String key, String title, Long parentId, String bizOrgType, Long id) {
this.key = key;
this.id = id;
this.title = title;
this.parentId = parentId;
this.children = children;
this.bizOrgType = bizOrgType;
}
......
......@@ -29,20 +29,21 @@
cb_org_usr u LEFT JOIN
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.parent_id = #{parentId}
AND u.biz_org_type = #{bizOrgType}
AND U.is_delete = 0
where
u.biz_org_type = #{bizOrgType}
AND u.is_delete = 0
<if test="bizOrgName != null">
AND u.biz_org_name = #{bizOrgName}
</if>
<if test="bizOrgCode != null and bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
)a where a.sequenceNbr is not null
<if test="bizOrgName != null">
AND u.bizOrgName = #{bizOrgName}
</if>
<if test="bizOrgCode != null">
AND u.bizOrgName = #{bizOrgCode}
</if>
<if test="fieldsValue != null">
<foreach collection="fieldsValue.keys" item="item"> AND a.${item} = #{fieldsValue[${item}]} </foreach>
</if>
......@@ -63,20 +64,20 @@
cb_org_usr u LEFT JOIN
jc_alert_form_value v on u.sequence_nbr = v.alert_called_id
LEFT JOIN jc_alert_form f ON f.sequence_nbr = v.alert_form_id
where u.parent_id = #{parentId}
AND u.biz_org_type = #{bizOrgType}
AND U.is_delete = 0
where
u.biz_org_type = #{bizOrgType}
AND u.is_delete = 0
<if test="bizOrgName != null">
AND u.biz_org_name = #{bizOrgName}
</if>
<if test="bizOrgCode != null and bizOrgCode != '-1'">
AND u.biz_org_code like concat(#{bizOrgCode}, '%')
</if>
GROUP BY
u.sequence_nbr ,
u.biz_org_name ,
u.biz_org_code
)a where a.sequenceNbr is not null
<if test="bizOrgName != null">
AND u.bizOrgName = #{bizOrgName}
</if>
<if test="bizOrgCode != null">
AND u.bizOrgName = #{bizOrgCode}
</if>
<if test="fieldsValue != null">
<foreach collection="fieldsValue.keys" item="item" > AND a.${item} = #{fieldsValue[${item}]} </foreach>
</if>
......@@ -114,6 +115,7 @@
SELECT
sequence_nbr,
biz_org_name,
biz_org_code,
biz_org_type,
parent_id
FROM
......
......@@ -140,7 +140,7 @@ public class OrgUsrController extends BaseController {
@RequestMapping(value = "/companyTree", method = RequestMethod.GET)
@ApiOperation(httpMethod = "GET", value = "获取单位部门树", notes = "获取单位部门树")
public ResponseModel< List<OrgMenuVo>>selectCompanyTree() throws Exception {
List<OrgMenuVo> menus = iOrgUsrService.getTree(null, iOrgUsrService.selectCompanyDepartmentMsg(), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType");
List<OrgMenuVo> menus = iOrgUsrService.getTree(null, iOrgUsrService.selectCompanyDepartmentMsg(), OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType", "getBizOrgCode");
return ResponseHelper.buildResponse(menus);
}
......
......@@ -69,7 +69,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
}
@Override
public List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception {
public List<OrgMenuVo> getTree(Long topId, Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception {
List<OrgMenuVo> resultList = new ArrayList<>();
Class<?> clazz = Class.forName(packageURL);
Method IDMethodNameme = null;
......@@ -91,6 +91,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName);
Method KeyMethodNameme = clazz.getDeclaredMethod(KeyMethodName);
//获取顶层元素集合
Long parentId;
for (Object ob : entityList) {
......@@ -100,20 +101,20 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
parentId = PARENTIDMethodNameme.invoke(entity) != null ? Long.valueOf(String.valueOf(PARENTIDMethodNameme.invoke(entity))) : null;
if (parentId == null || topId == parentId) {
OrgMenuVo menu = new OrgMenuVo(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false);
OrgMenuVo menu = new OrgMenuVo(String.valueOf(KeyMethodNameme.invoke(entity)), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false, Long.parseLong(IDMethodNameme.invoke(entity).toString()));
resultList.add(menu);
}
}
//获取每个顶层元素的子数据集合
for (OrgMenuVo entity : resultList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName));
entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName, KeyMethodName));
}
return resultList;
}
@SuppressWarnings("unchecked")
@Override
public List<OrgMenuVo> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName) throws Exception {
public List<OrgMenuVo> getSub(Long topId, @SuppressWarnings("rawtypes") Collection entityList, String packageURL, String IDMethodName, int IDHierarchy, String NAMEMethodName, String PARENTIDMethodName, String OrgTypeMethodName, String KeyMethodName) throws Exception {
List<OrgMenuVo> childList = new ArrayList<>();
@SuppressWarnings("rawtypes")
Class clazz = Class.forName(packageURL);
......@@ -135,7 +136,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
Method OrgTypeMethodNameme = clazz.getDeclaredMethod(OrgTypeMethodName);
Method NAMEMethodNameme = clazz.getDeclaredMethod(NAMEMethodName);
Method PARENTIDMethodNameme = clazz.getDeclaredMethod(PARENTIDMethodName);
Method KeyMethodNameme = clazz.getDeclaredMethod(KeyMethodName);
Long parentId;
//子集的直接子对象
for (Object ob : entityList) {
......@@ -145,12 +146,12 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (parentId == null) {
if (topId == parentId) {
OrgMenuVo menu = new OrgMenuVo(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)));
OrgMenuVo menu = new OrgMenuVo(String.valueOf(KeyMethodNameme.invoke(entity)), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false, Long.parseLong(IDMethodNameme.invoke(entity).toString()));
childList.add(menu);
}
} else {
if (topId.longValue() == parentId.longValue()) {
OrgMenuVo menu = new OrgMenuVo(Long.valueOf(String.valueOf(IDMethodNameme.invoke(entity))), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)));
OrgMenuVo menu = new OrgMenuVo(String.valueOf(KeyMethodNameme.invoke(entity)), String.valueOf(NAMEMethodNameme.invoke(entity)), parentId, String.valueOf(OrgTypeMethodNameme.invoke(entity)), false, Long.parseLong(IDMethodNameme.invoke(entity).toString()));
childList.add(menu);
}
}
......@@ -159,7 +160,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
//子集的间接子对象
for (OrgMenuVo entity : childList) {
entity.setChildren(getSub(entity.getKey(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName));
entity.setChildren(getSub(entity.getId(), entityList, packageURL, IDMethodName, IDHierarchy, NAMEMethodName, PARENTIDMethodName, OrgTypeMethodName, KeyMethodName));
if (entity.getChildren() != null) {
entity.setLeaf(false);
}
......@@ -261,11 +262,11 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
if (!ObjectUtils.isEmpty(req.get("bizOrgName"))) {
map.put("bizOrgName", req.get("bizOrgName"));
}
map.put("parentId", req.get("parentId"));
map.put("bizOrgCode", req.get("bizOrgCode"));
req.remove("bizOrgName");
req.remove("pageSize");
req.remove("pageNum");
req.remove("parentId");
req.remove("bizOrgCode");
map.put("fieldsValue", req);
map.put("fields", alertFormServiceImpl.queryListByFormId(OrgPersonEnum.人员.getCode()));
pageBean.setTotal(this.baseMapper.selectPersonListCount(map));
......@@ -584,7 +585,7 @@ public class OrgUsrServiceImpl extends BaseService<OrgUsrDto, OrgUsr, OrgUsrMapp
columnMap.put("is_delete", CommonConstant.IS_DELETE_00);
columnMap.put("biz_org_type", CommonConstant.BIZ_ORG_TYPE_PERSON);
Collection<OrgUsr> list = listByMap(columnMap);
return getTree(null, list, OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType");
return getTree(null, list, OrgUsr.class.getName(), "getSequenceNbr", 2, "getBizOrgName", "getParentId", "getBizOrgType", "getBizOrgCode");
}
......
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