generated from dxfeng/secondev-chapanda-feishu
refactor(organization): 重构组织信息获取接口
- 新增 EmployeeData 类封装员工信息 -重构 getEmployeeList 方法,使用 EmployeeData 替代 Map 存储员工数据 - 新增 OutOrganizationInfoController 控制器处理外部组织信息请求
This commit is contained in:
parent
d7fae2b8c5
commit
d806b7a809
|
|
@ -0,0 +1,18 @@
|
||||||
|
package com.weaver.seconddev.organization.controller;
|
||||||
|
|
||||||
|
import com.weaver.common.authority.annotation.WeaPermission;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:dxfeng
|
||||||
|
* @createTime: 2025/07/22
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/sapi/secondev/org/info")
|
||||||
|
@WeaPermission(publicPermission = true)
|
||||||
|
public class OutOrganizationInfoController extends OrganizationInfoController{
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,161 @@
|
||||||
|
package com.weaver.seconddev.organization.entity.po;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang.StringUtils;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author:dxfeng
|
||||||
|
* @createTime: 2025/07/22
|
||||||
|
* @version: 1.0
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class EmployeeData {
|
||||||
|
private String oId;
|
||||||
|
private String jobNum;
|
||||||
|
private String userName;
|
||||||
|
private String sex;
|
||||||
|
private String qh;
|
||||||
|
private String mobile;
|
||||||
|
private String zjlx;
|
||||||
|
private String idNo;
|
||||||
|
private String firstWorkDate;
|
||||||
|
private String birthday;
|
||||||
|
private String gryx;
|
||||||
|
private String email;
|
||||||
|
private String frgs;
|
||||||
|
private String alias;
|
||||||
|
private String residencePlace;
|
||||||
|
private String hireDate;
|
||||||
|
private String dimissionDate;
|
||||||
|
private String odeptid;
|
||||||
|
private String deptCode;
|
||||||
|
private String deptName;
|
||||||
|
private String opositionid;
|
||||||
|
private String yyzxcode;
|
||||||
|
private String yyzxname;
|
||||||
|
private String qyname;
|
||||||
|
private String location;
|
||||||
|
private String locationcode;
|
||||||
|
private String cbzxname;
|
||||||
|
private String cbzxcode;
|
||||||
|
private String superiorgh;
|
||||||
|
private String other_superiorgh;
|
||||||
|
private String company_year;
|
||||||
|
private String jjrcode;
|
||||||
|
private String jjrname;
|
||||||
|
private String personnel_status;
|
||||||
|
private String sfqdjyxy;
|
||||||
|
private String sfktxyxt;
|
||||||
|
|
||||||
|
public String getoId() {
|
||||||
|
return StringUtils.isBlank(oId) ? "" : oId;
|
||||||
|
}
|
||||||
|
public String getJobNum() {
|
||||||
|
return StringUtils.isBlank(jobNum) ? "" : jobNum;
|
||||||
|
}
|
||||||
|
public String getUserName() {
|
||||||
|
return StringUtils.isBlank(userName) ? "" : userName;
|
||||||
|
}
|
||||||
|
public String getSex() {
|
||||||
|
return StringUtils.isBlank(sex) ? "" : sex;
|
||||||
|
}
|
||||||
|
public String getQh() {
|
||||||
|
return StringUtils.isBlank(qh) ? "" : qh;
|
||||||
|
}
|
||||||
|
public String getMobile() {
|
||||||
|
return StringUtils.isBlank(mobile) ? "" : mobile;
|
||||||
|
}
|
||||||
|
public String getZjlx() {
|
||||||
|
return StringUtils.isBlank(zjlx) ? "" : zjlx;
|
||||||
|
}
|
||||||
|
public String getIdNo() {
|
||||||
|
return StringUtils.isBlank(idNo) ? "" : idNo;
|
||||||
|
}
|
||||||
|
public String getFirstWorkDate() {
|
||||||
|
return StringUtils.isBlank(firstWorkDate) ? "" : firstWorkDate;
|
||||||
|
}
|
||||||
|
public String getBirthday() {
|
||||||
|
return StringUtils.isBlank(birthday) ? "" : birthday;
|
||||||
|
}
|
||||||
|
public String getGryx() {
|
||||||
|
return StringUtils.isBlank(gryx) ? "" : gryx;
|
||||||
|
}
|
||||||
|
public String getEmail() {
|
||||||
|
return StringUtils.isBlank(email) ? "" : email;
|
||||||
|
}
|
||||||
|
public String getFrgs() {
|
||||||
|
return StringUtils.isBlank(frgs) ? "" : frgs;
|
||||||
|
}
|
||||||
|
public String getAlias() {
|
||||||
|
return StringUtils.isBlank(alias) ? "" : alias;
|
||||||
|
}
|
||||||
|
public String getResidencePlace() {
|
||||||
|
return StringUtils.isBlank(residencePlace) ? "" : residencePlace;
|
||||||
|
}
|
||||||
|
public String getHireDate() {
|
||||||
|
return StringUtils.isBlank(hireDate) ? "" : hireDate;
|
||||||
|
}
|
||||||
|
public String getDimissionDate() {
|
||||||
|
return StringUtils.isBlank(dimissionDate) ? "" : dimissionDate;
|
||||||
|
}
|
||||||
|
public String getOdeptid() {
|
||||||
|
return StringUtils.isBlank(odeptid) ? "" : odeptid;
|
||||||
|
}
|
||||||
|
public String getDeptCode() {
|
||||||
|
return StringUtils.isBlank(deptCode) ? "" : deptCode;
|
||||||
|
}
|
||||||
|
public String getDeptName() {
|
||||||
|
return StringUtils.isBlank(deptName) ? "" : deptName;
|
||||||
|
}
|
||||||
|
public String getOpositionid() {
|
||||||
|
return StringUtils.isBlank(opositionid) ? "" : opositionid;
|
||||||
|
}
|
||||||
|
public String getYyzxcode() {
|
||||||
|
return StringUtils.isBlank(yyzxcode) ? "" : yyzxcode;
|
||||||
|
}
|
||||||
|
public String getYyzxname() {
|
||||||
|
return StringUtils.isBlank(yyzxname) ? "" : yyzxname;
|
||||||
|
}
|
||||||
|
public String getQyname() {
|
||||||
|
return StringUtils.isBlank(qyname) ? "" : qyname;
|
||||||
|
}
|
||||||
|
public String getLocation() {
|
||||||
|
return StringUtils.isBlank(location) ? "" : location;
|
||||||
|
}
|
||||||
|
public String getLocationcode() {
|
||||||
|
return StringUtils.isBlank(locationcode) ? "" : locationcode;
|
||||||
|
}
|
||||||
|
public String getCbzxname() {
|
||||||
|
return StringUtils.isBlank(cbzxname) ? "" : cbzxname;
|
||||||
|
}
|
||||||
|
public String getCbzxcode() {
|
||||||
|
return StringUtils.isBlank(cbzxcode) ? "" : cbzxcode;
|
||||||
|
}
|
||||||
|
public String getSuperiorgh() {
|
||||||
|
return StringUtils.isBlank(superiorgh) ? "" : superiorgh;
|
||||||
|
}
|
||||||
|
public String getOther_superiorgh() {
|
||||||
|
return StringUtils.isBlank(other_superiorgh) ? "" : other_superiorgh;
|
||||||
|
}
|
||||||
|
public String getCompany_year() {
|
||||||
|
return StringUtils.isBlank(company_year) ? "" : company_year;
|
||||||
|
}
|
||||||
|
public String getJjrcode() {
|
||||||
|
return StringUtils.isBlank(jjrcode) ? "" : jjrcode;
|
||||||
|
}
|
||||||
|
public String getJjrname() {
|
||||||
|
return StringUtils.isBlank(jjrname) ? "" : jjrname;
|
||||||
|
}
|
||||||
|
public String getPersonnel_status() {
|
||||||
|
return StringUtils.isBlank(personnel_status) ? "" : personnel_status;
|
||||||
|
}
|
||||||
|
public String getSfqdjyxy() {
|
||||||
|
return StringUtils.isBlank(sfqdjyxy) ? "" : sfqdjyxy;
|
||||||
|
}
|
||||||
|
public String getSfktxyxt() {
|
||||||
|
return StringUtils.isBlank(sfktxyxt) ? "" : sfktxyxt;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -11,6 +11,7 @@ import com.weaver.common.hrm.manage.HrmComInfoCacheHandler;
|
||||||
import com.weaver.seconddev.organization.entity.param.OrgSearchCondition;
|
import com.weaver.seconddev.organization.entity.param.OrgSearchCondition;
|
||||||
import com.weaver.seconddev.organization.entity.po.Area;
|
import com.weaver.seconddev.organization.entity.po.Area;
|
||||||
import com.weaver.seconddev.organization.entity.po.AreaExtends;
|
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.HrmOffSpace;
|
||||||
import com.weaver.seconddev.organization.mapper.CityMapper;
|
import com.weaver.seconddev.organization.mapper.CityMapper;
|
||||||
import com.weaver.seconddev.organization.mapper.OrganizationInfoMapper;
|
import com.weaver.seconddev.organization.mapper.OrganizationInfoMapper;
|
||||||
|
|
@ -195,91 +196,79 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
||||||
Map<String, String> gzdssyyzxMap = templateDetails.stream().collect(Collectors.toMap(FormdataTemplateDetails::getValueKey, FormdataTemplateDetails::getName));
|
Map<String, String> gzdssyyzxMap = templateDetails.stream().collect(Collectors.toMap(FormdataTemplateDetails::getValueKey, FormdataTemplateDetails::getName));
|
||||||
Map<String, String> bzssqyMap = bzssqyDetails.stream().collect(Collectors.toMap(FormdataTemplateDetails::getValueKey, FormdataTemplateDetails::getName));
|
Map<String, String> bzssqyMap = bzssqyDetails.stream().collect(Collectors.toMap(FormdataTemplateDetails::getValueKey, FormdataTemplateDetails::getName));
|
||||||
|
|
||||||
|
|
||||||
List<Map<String, Object>> employeeList = organizationInfoMapper.getEmployeeList(param);
|
List<Map<String, Object>> employeeList = organizationInfoMapper.getEmployeeList(param);
|
||||||
int total = organizationInfoMapper.getEmployeeListSize(param);
|
int total = organizationInfoMapper.getEmployeeListSize(param);
|
||||||
List<Map<String, Object>> orgList = new ArrayList<>();
|
List<Map<String, Object>> orgList = new ArrayList<>();
|
||||||
|
List<EmployeeData> dataList = new ArrayList<>();
|
||||||
for (Map<String, Object> map : employeeList) {
|
for (Map<String, Object> map : employeeList) {
|
||||||
Map<String, Object> dataMap = new HashMap<>();
|
EmployeeData employeeData = new EmployeeData();
|
||||||
dataMap.put("oId", map.get("oid"));
|
employeeData.setOId(Convert.toStr(map.get("oid"),""));
|
||||||
dataMap.put("jobNum", map.get("job_num"));
|
employeeData.setJobNum(Convert.toStr(map.get("job_num"),""));
|
||||||
dataMap.put("userName", map.get("username"));
|
employeeData.setUserName(Convert.toStr(map.get("username"),""));
|
||||||
dataMap.put("sex", map.get("sex"));
|
employeeData.setSex(Convert.toStr(map.get("sex"),""));
|
||||||
dataMap.put("qh", map.get("qh"));
|
employeeData.setQh(Convert.toStr(map.get("qh"),""));
|
||||||
dataMap.put("mobile", map.get("mobile"));
|
employeeData.setMobile(Convert.toStr(map.get("mobile"),""));
|
||||||
dataMap.put(" zjlx", map.get(" zjlx"));
|
employeeData.setZjlx(Convert.toStr(map.get(" zjlx"),""));
|
||||||
dataMap.put(" idNo", map.get(" id_no"));
|
employeeData.setIdNo(Convert.toStr(map.get(" id_no"),""));
|
||||||
dataMap.put("firstWorkDate", map.get(" first_work_date"));
|
employeeData.setFirstWorkDate(Convert.toStr(map.get(" first_work_date"),""));
|
||||||
dataMap.put("birthday", map.get(" birthday"));
|
employeeData.setBirthday(Convert.toStr(map.get(" birthday"),""));
|
||||||
dataMap.put("gryx", map.get("gryx"));
|
employeeData.setGryx(Convert.toStr(map.get("gryx"),""));
|
||||||
dataMap.put("email", map.get("email"));
|
employeeData.setEmail(Convert.toStr(map.get("email"),""));
|
||||||
dataMap.put("frgs", map.get("frgs"));
|
employeeData.setFrgs(Convert.toStr(map.get("frgs"),""));
|
||||||
dataMap.put("alias", map.get("alias"));
|
employeeData.setAlias(Convert.toStr(map.get("alias"),""));
|
||||||
dataMap.put("residencePlace", map.get("residence_place"));
|
employeeData.setResidencePlace(Convert.toStr(map.get("residence_place"),""));
|
||||||
dataMap.put("hireDate", map.get("hiredate"));
|
employeeData.setHireDate(Convert.toStr(map.get("hiredate"),""));
|
||||||
dataMap.put("dimissionDate", map.get("dimissiondate"));
|
employeeData.setDimissionDate(Convert.toStr(map.get("dimissiondate"),""));
|
||||||
dataMap.put("odeptid", map.get("odeptid"));
|
employeeData.setOdeptid(Convert.toStr(map.get("odeptid"),""));
|
||||||
Long departmentId = Convert.toLong(map.get("department"));
|
Long departmentId = Convert.toLong(map.get("department"));
|
||||||
HrmDepartmentComInfo department = hrmComInfoCacheHandler.getCacheById(HrmDepartmentComInfo.class, departmentId);
|
HrmDepartmentComInfo department = hrmComInfoCacheHandler.getCacheById(HrmDepartmentComInfo.class, departmentId);
|
||||||
if (null != department) {
|
if (null != department) {
|
||||||
dataMap.put("deptCode", department.getCode());
|
employeeData.setDeptCode(department.getCode());
|
||||||
dataMap.put("deptName", department.getName());
|
employeeData.setDeptName(department.getName());
|
||||||
} else {
|
|
||||||
dataMap.put("deptCode", "");
|
|
||||||
dataMap.put("deptName", "");
|
|
||||||
}
|
}
|
||||||
dataMap.put("opositionid", map.get("opositionid"));
|
employeeData.setOpositionid(Convert.toStr(map.get("opositionid"),""));
|
||||||
// 内容转换
|
// 内容转换
|
||||||
String gzdssyyzx = Util.null2String(map.get("gzdssyyzx"));
|
String gzdssyyzx = Util.null2String(map.get("gzdssyyzx"));
|
||||||
dataMap.put("yyzxcode", gzdssyyzx);
|
employeeData.setYyzxcode(gzdssyyzx);
|
||||||
dataMap.put("yyzxname", gzdssyyzxMap.get(gzdssyyzx));
|
employeeData.setYyzxname(gzdssyyzxMap.get(gzdssyyzx));
|
||||||
|
|
||||||
String bzssqy = Util.null2String(map.get("bzssqy"));
|
String bzssqy = Util.null2String(map.get("bzssqy"));
|
||||||
dataMap.put("qyname", bzssqyMap.get(bzssqy));
|
employeeData.setQyname(bzssqyMap.get(bzssqy));
|
||||||
|
|
||||||
Long locationId = Convert.toLong(map.get("location"));
|
Long locationId = Convert.toLong(map.get("location"));
|
||||||
HrmOffSpace location = cityMapper.getSpaceInfoById(param, locationId);
|
HrmOffSpace location = cityMapper.getSpaceInfoById(param, locationId);
|
||||||
log.error("location:{}", location);
|
log.error("location:{}", location);
|
||||||
if (null != location) {
|
if (null != location) {
|
||||||
dataMap.put("location", getFullAreaPath(param, location.getCity()));
|
employeeData.setLocation(getFullAreaPath(param, location.getCity()));
|
||||||
dataMap.put("locationcode", getAreaCode(param, location.getCity()));
|
employeeData.setLocationcode(getAreaCode(param, location.getCity()));
|
||||||
} else {
|
|
||||||
dataMap.put("location", "");
|
|
||||||
dataMap.put("locationcode", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Long cbzx = Convert.toLong(map.get("cbzx"));
|
Long cbzx = Convert.toLong(map.get("cbzx"));
|
||||||
PortalPO costCenter = organizationInfoMapper.getCostCenter(param, cbzx);
|
PortalPO costCenter = organizationInfoMapper.getCostCenter(param, cbzx);
|
||||||
if (null != costCenter) {
|
if (null != costCenter) {
|
||||||
dataMap.put("cbzxname", costCenter.getName());
|
employeeData.setCbzxname(costCenter.getName());
|
||||||
dataMap.put("cbzxcode", costCenter.getValue());
|
employeeData.setCbzxcode(costCenter.getValue());
|
||||||
} else {
|
|
||||||
dataMap.put("cbzxname", "");
|
|
||||||
dataMap.put("cbzxcode", "");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dataMap.put("superiorgh",getEmployeeJobNum(Convert.toStr(map.get("superior"))));
|
employeeData.setSuperiorgh(getEmployeeJobNum(Convert.toStr(map.get("superior"))));
|
||||||
dataMap.put("other_superiorgh",getEmployeeJobNum(Convert.toStr(map.get("other_superior"))));
|
employeeData.setOther_superiorgh(getEmployeeJobNum(Convert.toStr(map.get("other_superior"))));
|
||||||
dataMap.put("company_year",map.get("sl"));
|
employeeData.setCompany_year(Convert.toStr(map.get("sl"),""));
|
||||||
|
|
||||||
Long jjr = Convert.toLong(map.get("jjr"));
|
Long jjr = Convert.toLong(map.get("jjr"));
|
||||||
SimpleEmployee jjrEmployee = hrmCommonEmployeeDao.getById(jjr);
|
SimpleEmployee jjrEmployee = hrmCommonEmployeeDao.getById(jjr);
|
||||||
if(null!=jjrEmployee){
|
if(null!=jjrEmployee){
|
||||||
dataMap.put("jjrcode",jjrEmployee.getJobNum());
|
employeeData.setJjrcode(jjrEmployee.getJobNum());
|
||||||
dataMap.put("jjrname",jjrEmployee.getUsername());
|
employeeData.setJjrname(jjrEmployee.getUsername());
|
||||||
}else{
|
|
||||||
dataMap.put("jjrcode", "");
|
|
||||||
dataMap.put("jjrname", "");
|
|
||||||
}
|
}
|
||||||
dataMap.put("personnel_status", map.get("personnel_status"));
|
employeeData.setPersonnel_status(Convert.toStr(map.get("personnel_status")));
|
||||||
dataMap.put("sfqdjyxy", map.get("sfqdjyxy"));
|
employeeData.setSfqdjyxy(Convert.toStr(map.get("sfqdjyxy")));
|
||||||
dataMap.put("sfktxyxt", map.get("sfktxyxt"));
|
employeeData.setSfktxyxt(Convert.toStr(map.get("sfktxyxt")));
|
||||||
orgList.add(dataMap);
|
dataList.add(employeeData);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Map<String, Object> returnMap = new HashMap<>();
|
Map<String, Object> returnMap = new HashMap<>();
|
||||||
returnMap.put("data", orgList);
|
returnMap.put("data", dataList);
|
||||||
returnMap.put("current", current);
|
returnMap.put("current", current);
|
||||||
returnMap.put("total", total);
|
returnMap.put("total", total);
|
||||||
return WeaResult.success(returnMap);
|
return WeaResult.success(returnMap);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue