Commit c1c90ad7 by shiwenbo

修改获取部门接口

parent d8c00855
...@@ -23,7 +23,9 @@ import com.beecode.bap.staff.Staff; ...@@ -23,7 +23,9 @@ import com.beecode.bap.staff.Staff;
import com.beecode.bap.staff.service.StaffService; import com.beecode.bap.staff.service.StaffService;
import com.beecode.bap.staff.util.StaffUtil; import com.beecode.bap.staff.util.StaffUtil;
import com.beecode.bcp.type.KObject; import com.beecode.bcp.type.KObject;
import com.beecode.bcp.type.json.JSONObjectUtils;
import com.beecode.inz.basis.team.pojo.ResponseObj; import com.beecode.inz.basis.team.pojo.ResponseObj;
import com.beecode.nlib.utils.StringUtils;
import com.xyst.dinas.biz.enumeration.PlanningCycleEnum; import com.xyst.dinas.biz.enumeration.PlanningCycleEnum;
import com.xyst.dinas.biz.service.PlanningCycleService; import com.xyst.dinas.biz.service.PlanningCycleService;
...@@ -47,7 +49,7 @@ public class DinasCommonController { ...@@ -47,7 +49,7 @@ public class DinasCommonController {
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "/dinasBiz/department/queryDepartmentById", method = RequestMethod.POST) @RequestMapping(value = "/dinasBiz/department/queryDepartmentById", method = RequestMethod.POST)
public List<KObject> queryDepartmentById(@RequestBody String body) { public List<Map<String, Object>> queryDepartmentById(@RequestBody String body) {
JSONObject param = new JSONObject(body); JSONObject param = new JSONObject(body);
List<KObject> list = new ArrayList<KObject>(); List<KObject> list = new ArrayList<KObject>();
if(param.isNull("id")) { if(param.isNull("id")) {
...@@ -62,10 +64,24 @@ public class DinasCommonController { ...@@ -62,10 +64,24 @@ public class DinasCommonController {
list.add(rootLevel); list.add(rootLevel);
list.add(regionalLevel); list.add(regionalLevel);
} }
Map<UUID, String> deptTitlePath = departmentService.getTitlePath(list);
List<Map<String, Object>> result = deptAddTitlePathProperty(list, deptTitlePath);
return list; return result;
} }
private List<Map<String, Object>> deptAddTitlePathProperty(List<KObject> depts, Map<UUID, String> deptTitlePath) {
List<Map<String, Object>> result = new ArrayList<Map<String, Object>>();
depts.forEach(dept -> {
Map<String, Object> deptMap = JSONObjectUtils.toMap(JSONObjectUtils.toJson(dept));
UUID deptId = dept.getUuid("id");
String deptPath = deptTitlePath.get(deptId);
deptMap.put("titlePath", StringUtils.isEmpty(deptPath) ? "" : deptPath);
result.add(deptMap);
});
return result;
}
/** /**
* @Description: 根据部门id查询该部门及其子部门的职员列表(包括该部门自身) * @Description: 根据部门id查询该部门及其子部门的职员列表(包括该部门自身)
* @param id * @param 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