generated from dxfeng/secondev-chapanda-feishu
refactor(organization): 重构组织信息相关接口及数据模型
- 新增 DepartmentData 和 PositionData 类作为接口返回数据模型 - 更新 OrganizationInfoController 中的方法,增加分页参数 - 重构 OrganizationInfoServiceImpl 中的数据处理逻辑,使用新数据模型
This commit is contained in:
parent
d806b7a809
commit
15d33efb51
|
|
@ -27,31 +27,43 @@ public class OrganizationInfoController {
|
|||
|
||||
@GetMapping("/getDepartmentInfo")
|
||||
public Object getDepartmentInfo(@RequestParam(name = "code", required = false) String code,
|
||||
@RequestParam(name = "oId", required = false) String oId) {
|
||||
@RequestParam(name = "oId", required = false) String oId,
|
||||
@RequestParam(name = "current", required = false) Integer current,
|
||||
@RequestParam(name = "pageSize", required = false) Integer pageSize) {
|
||||
log.error("code=={},oId=={}", code, oId);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
params.put("oId", oId);
|
||||
params.put("current", current);
|
||||
params.put("pageSize", pageSize);
|
||||
return organizationInfoService.getDepartmentInfo(params);
|
||||
}
|
||||
|
||||
@GetMapping("/getPositionInfo")
|
||||
public Object getPositionInfo(@RequestParam(name = "code", required = false) String code,
|
||||
@RequestParam(name = "oId", required = false) String oId) {
|
||||
@RequestParam(name = "oId", required = false) String oId,
|
||||
@RequestParam(name = "current", required = false) Integer current,
|
||||
@RequestParam(name = "pageSize", required = false) Integer pageSize) {
|
||||
log.error("code=={},oId=={}", code, oId);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
params.put("oId", oId);
|
||||
params.put("current", current);
|
||||
params.put("pageSize", pageSize);
|
||||
return organizationInfoService.getPositionInfo(params);
|
||||
}
|
||||
|
||||
@GetMapping("/getEmployeeInfo")
|
||||
public Object getEmployeeInfo(@RequestParam(name = "code", required = false) String code,
|
||||
@RequestParam(name = "oId", required = false) String oId) {
|
||||
@RequestParam(name = "oId", required = false) String oId,
|
||||
@RequestParam(name = "current", required = false) Integer current,
|
||||
@RequestParam(name = "pageSize", required = false) Integer pageSize) {
|
||||
log.error("code=={},oId=={}", code, oId);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
params.put("oId", oId);
|
||||
params.put("current", current);
|
||||
params.put("pageSize", pageSize);
|
||||
return organizationInfoService.getEmployeeInfo(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,24 @@
|
|||
package com.weaver.seconddev.organization.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class DepartmentData {
|
||||
private String oId;
|
||||
private String code;
|
||||
private String name;
|
||||
private String pathCode;
|
||||
private String pathName;
|
||||
private String poId;
|
||||
private String sqcj;
|
||||
private Long dataRank;
|
||||
private Integer status;
|
||||
private String bmfzrgh;
|
||||
private String hrbpxm;
|
||||
private String hrbpgh;
|
||||
}
|
||||
|
|
@ -0,0 +1,17 @@
|
|||
package com.weaver.seconddev.organization.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/23
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class PositionData {
|
||||
private String oId;
|
||||
private String code;
|
||||
private String name;
|
||||
private String oDeptId;
|
||||
private String isCanceled;
|
||||
}
|
||||
|
|
@ -9,10 +9,7 @@ import com.weaver.common.hrm.cache.HrmDepartmentComInfo;
|
|||
import com.weaver.common.hrm.dao.HrmCommonEmployeeDao;
|
||||
import com.weaver.common.hrm.manage.HrmComInfoCacheHandler;
|
||||
import com.weaver.seconddev.organization.entity.param.OrgSearchCondition;
|
||||
import com.weaver.seconddev.organization.entity.po.Area;
|
||||
import com.weaver.seconddev.organization.entity.po.AreaExtends;
|
||||
import com.weaver.seconddev.organization.entity.po.EmployeeData;
|
||||
import com.weaver.seconddev.organization.entity.po.HrmOffSpace;
|
||||
import com.weaver.seconddev.organization.entity.po.*;
|
||||
import com.weaver.seconddev.organization.mapper.CityMapper;
|
||||
import com.weaver.seconddev.organization.mapper.OrganizationInfoMapper;
|
||||
import com.weaver.seconddev.organization.service.OrganizationInfoService;
|
||||
|
|
@ -82,12 +79,12 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
List<FormdataTemplateDetails> templateDetails = ebuilderBaseMapper.getFormdataTemplateDetails(param, formField.getDataTemplateId());
|
||||
Map<String, String> sqcjMap = templateDetails.stream().collect(Collectors.toMap(FormdataTemplateDetails::getValueKey, FormdataTemplateDetails::getName));
|
||||
|
||||
List<Map<String, Object>> orgList = new ArrayList<>();
|
||||
List<DepartmentData> orgList = new ArrayList<>();
|
||||
for (Map<String, Object> map : departmentList) {
|
||||
Map<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("oId", map.get("oid"));
|
||||
newMap.put("poId", map.get("poid"));
|
||||
newMap.put("sqcj", sqcjMap.get(Util.null2String(map.get("sqcj"))));
|
||||
DepartmentData departmentData = new DepartmentData();
|
||||
departmentData.setOId(Convert.toStr(map.get("oid"),""));
|
||||
departmentData.setPoId(Convert.toStr(map.get("poid"),""));
|
||||
departmentData.setSqcj(sqcjMap.get(Util.null2String(map.get("sqcj"))));
|
||||
|
||||
String jobNum = "";
|
||||
String bmfzr = Util.null2String(map.get("bmfzr"));
|
||||
|
|
@ -97,7 +94,7 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
jobNum = byId.getJobNum();
|
||||
}
|
||||
}
|
||||
newMap.put("bmfzr", jobNum);
|
||||
departmentData.setBmfzrgh(jobNum);
|
||||
|
||||
String hrbp = Util.null2String(map.get("hrbp"));
|
||||
String hrbpxm = "";
|
||||
|
|
@ -109,25 +106,25 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
hrbpgh = byId.getJobNum();
|
||||
}
|
||||
}
|
||||
newMap.put("hrbpxm", hrbpxm);
|
||||
newMap.put("hrbpgh", hrbpgh);
|
||||
departmentData.setHrbpxm(hrbpxm);
|
||||
departmentData.setHrbpgh(hrbpgh);
|
||||
|
||||
Long departmentid = Convert.toLong(map.get("id"));
|
||||
HrmDepartmentComInfo department = hrmComInfoCacheHandler.getCacheById(HrmDepartmentComInfo.class, departmentid);
|
||||
|
||||
newMap.put("code", department.getCode());
|
||||
newMap.put("name", department.getName());
|
||||
newMap.put("dataRank", department.getDatarank());
|
||||
newMap.put("status", department.getStatus());
|
||||
departmentData.setCode(department.getCode());
|
||||
departmentData.setName(department.getName());
|
||||
departmentData.setDataRank(department.getDatarank());
|
||||
departmentData.setStatus(department.getStatus());
|
||||
List<HrmDepartmentComInfo> allDepartmentList = new ArrayList<>();
|
||||
getParentDeptList(department, allDepartmentList);
|
||||
|
||||
String pathCode = allDepartmentList.stream().map(HrmDepartmentComInfo::getCode).collect(Collectors.joining("/"));
|
||||
String pathName = allDepartmentList.stream().map(HrmDepartmentComInfo::getName).collect(Collectors.joining("/"));
|
||||
|
||||
newMap.put("pathCode", pathCode);
|
||||
newMap.put("pathName", pathName);
|
||||
orgList.add(newMap);
|
||||
departmentData.setPathCode(pathCode);
|
||||
departmentData.setPathName(pathName);
|
||||
orgList.add(departmentData);
|
||||
}
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
returnMap.put("data", orgList);
|
||||
|
|
@ -151,17 +148,17 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
param.setCurrent(current);
|
||||
List<Map<String, Object>> positionList = organizationInfoMapper.getPositionList(param);
|
||||
int total = organizationInfoMapper.getPositionListSize(param);
|
||||
List<Map<String, Object>> orgList = new ArrayList<>();
|
||||
List<PositionData> orgList = new ArrayList<>();
|
||||
|
||||
for (Map<String, Object> map : positionList) {
|
||||
Map<String, Object> newMap = new HashMap<>();
|
||||
newMap.put("oId", map.get("oid"));
|
||||
newMap.put("code", map.get("positionCode"));
|
||||
newMap.put("name", map.get("positionName"));
|
||||
newMap.put("odeptid", map.get("odeptid"));
|
||||
newMap.put("is_canceled", map.get("is_canceled"));
|
||||
PositionData positionData = new PositionData();
|
||||
positionData.setOId(Convert.toStr(map.get("oid"),""));
|
||||
positionData.setCode(Convert.toStr(map.get("positionCode"),""));
|
||||
positionData.setName(Convert.toStr(map.get("positionName"),""));
|
||||
positionData.setODeptId(Convert.toStr(map.get("odeptid"),""));
|
||||
positionData.setIsCanceled(Convert.toStr(map.get("is_canceled"),""));
|
||||
|
||||
orgList.add(newMap);
|
||||
orgList.add(positionData);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue