generated from dxfeng/secondev-chapanda-feishu
feat(organization): 添加员工信息查询功能
- 新增员工信息查询接口和相关服务实现 - 添加城市和区域信息相关实体类和 mapper - 实现员工列表查询、员工详细信息获取等功能 - 优化数据处理逻辑,增加数据转换和格式化
This commit is contained in:
parent
e2178f6fcd
commit
d7fae2b8c5
|
|
@ -44,4 +44,14 @@ public class OrganizationInfoController {
|
|||
params.put("oId", oId);
|
||||
return organizationInfoService.getPositionInfo(params);
|
||||
}
|
||||
|
||||
@GetMapping("/getEmployeeInfo")
|
||||
public Object getEmployeeInfo(@RequestParam(name = "code", required = false) String code,
|
||||
@RequestParam(name = "oId", required = false) String oId) {
|
||||
log.error("code=={},oId=={}", code, oId);
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("code", code);
|
||||
params.put("oId", oId);
|
||||
return organizationInfoService.getEmployeeInfo(params);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,21 @@
|
|||
package com.weaver.seconddev.organization.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/22
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class Area {
|
||||
private Long id;
|
||||
private Long dataId;
|
||||
private Long parentId;
|
||||
private String name;
|
||||
private String fullName;
|
||||
private Long countryId;
|
||||
private Long provinceId;
|
||||
private Long cityId;
|
||||
private Long districtId;
|
||||
}
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
package com.weaver.seconddev.organization.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/22
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class AreaExtends {
|
||||
private Long id;
|
||||
private Long dataId;
|
||||
private String adCode;
|
||||
private String cityCode;
|
||||
private String airportCode;
|
||||
private String zipCode;
|
||||
}
|
||||
|
|
@ -0,0 +1,19 @@
|
|||
package com.weaver.seconddev.organization.entity.po;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/22
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Data
|
||||
public class HrmOffSpace {
|
||||
private Long id;
|
||||
private String shortName;
|
||||
private String fullName;
|
||||
private Long city;
|
||||
private String province;
|
||||
private String nation;
|
||||
private Long dataId;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
package com.weaver.seconddev.organization.mapper;
|
||||
|
||||
import com.weaver.seconddev.organization.entity.po.Area;
|
||||
import com.weaver.seconddev.organization.entity.po.AreaExtends;
|
||||
import com.weaver.seconddev.organization.entity.po.HrmOffSpace;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
* @createTime: 2025/07/21
|
||||
* @version: 1.0
|
||||
*/
|
||||
@Mapper
|
||||
public interface CityMapper {
|
||||
|
||||
HrmOffSpace getSpaceInfoById(@Param("param") BaseParam param, @Param("id") Long id);
|
||||
|
||||
Area getAreaInfoById(@Param("param") BaseParam param, @Param("id") Long id);
|
||||
|
||||
AreaExtends getAreaExtendsInfoById(@Param("param") BaseParam param, @Param("id") Long id);
|
||||
}
|
||||
|
|
@ -1,8 +1,10 @@
|
|||
package com.weaver.seconddev.organization.mapper;
|
||||
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
import org.apache.ibatis.annotations.MapKey;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -35,6 +37,7 @@ public interface OrganizationInfoMapper {
|
|||
|
||||
/**
|
||||
* 统计部门列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -78,4 +81,32 @@ public interface OrganizationInfoMapper {
|
|||
* @return
|
||||
*/
|
||||
int getPositionListSize(BaseParam param);
|
||||
|
||||
|
||||
/**
|
||||
* 获取员工列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
@MapKey("id")
|
||||
List<Map<String, Object>> getEmployeeList(BaseParam param);
|
||||
|
||||
/**
|
||||
* 统计员工列表
|
||||
*
|
||||
* @param param
|
||||
* @return
|
||||
*/
|
||||
int getEmployeeListSize(BaseParam param);
|
||||
|
||||
/**
|
||||
* 获取成本中心数据
|
||||
*
|
||||
* @param param
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
PortalPO getCostCenter(@Param("param") BaseParam param, @Param("id") Long id);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -9,8 +9,14 @@ 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.HrmOffSpace;
|
||||
import com.weaver.seconddev.organization.mapper.CityMapper;
|
||||
import com.weaver.seconddev.organization.mapper.OrganizationInfoMapper;
|
||||
import com.weaver.seconddev.organization.service.OrganizationInfoService;
|
||||
import com.weaver.seconddev.portal.entity.param.BaseParam;
|
||||
import com.weaver.seconddev.portal.entity.po.PortalPO;
|
||||
import com.weaver.seconddev.portal.mapper.EbuilderBaseMapper;
|
||||
import com.weaver.seconddev.portal.mapper.EteamsBaseMapper;
|
||||
import com.weaver.teams.domain.user.SimpleEmployee;
|
||||
|
|
@ -34,12 +40,6 @@ import java.util.stream.Collectors;
|
|||
@Service
|
||||
public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
||||
|
||||
//@Autowired
|
||||
//DepartMentService departMentService;
|
||||
//
|
||||
//@Autowired
|
||||
//HrmCommonDepartmentDao hrmCommonDepartmentDao;
|
||||
|
||||
@Autowired
|
||||
HrmCommonEmployeeDao hrmCommonEmployeeDao;
|
||||
|
||||
|
|
@ -55,6 +55,8 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
@Autowired
|
||||
HrmComInfoCacheHandler hrmComInfoCacheHandler;
|
||||
|
||||
@Autowired
|
||||
CityMapper cityMapper;
|
||||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getDepartmentInfo(Map<String, Object> params) {
|
||||
|
|
@ -171,7 +173,116 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
|
||||
@Override
|
||||
public WeaResult<Map<String, Object>> getEmployeeInfo(Map<String, Object> params) {
|
||||
return null;
|
||||
|
||||
OrgSearchCondition param = new OrgSearchCondition();
|
||||
String code = Util.null2String(params.get("code"));
|
||||
String oId = Util.null2String(params.get("oId"));
|
||||
int pageSize = Convert.toInt(params.get("pageSize"), 10);
|
||||
int current = Convert.toInt(params.get("current"), 1);
|
||||
|
||||
param.setCode(code);
|
||||
param.setOId(oId);
|
||||
param.setPageSize(pageSize);
|
||||
param.setCurrent(current);
|
||||
|
||||
long formId = ebuilderBaseMapper.getFormIdByTableName(param, "uf_jcl_employee_information");
|
||||
FormField formField = ebuilderBaseMapper.getFormFieldByFieldName(param, formId, "gzdssyyzx");
|
||||
FormField bzssqyField = ebuilderBaseMapper.getFormFieldByFieldName(param, formId, "bzssqy");
|
||||
|
||||
List<FormdataTemplateDetails> templateDetails = ebuilderBaseMapper.getFormdataTemplateDetails(param, formField.getDataTemplateId());
|
||||
List<FormdataTemplateDetails> bzssqyDetails = ebuilderBaseMapper.getFormdataTemplateDetails(param, bzssqyField.getDataTemplateId());
|
||||
|
||||
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));
|
||||
|
||||
|
||||
List<Map<String, Object>> employeeList = organizationInfoMapper.getEmployeeList(param);
|
||||
int total = organizationInfoMapper.getEmployeeListSize(param);
|
||||
List<Map<String, Object>> orgList = new ArrayList<>();
|
||||
for (Map<String, Object> map : employeeList) {
|
||||
Map<String, Object> dataMap = new HashMap<>();
|
||||
dataMap.put("oId", map.get("oid"));
|
||||
dataMap.put("jobNum", map.get("job_num"));
|
||||
dataMap.put("userName", map.get("username"));
|
||||
dataMap.put("sex", map.get("sex"));
|
||||
dataMap.put("qh", map.get("qh"));
|
||||
dataMap.put("mobile", map.get("mobile"));
|
||||
dataMap.put(" zjlx", map.get(" zjlx"));
|
||||
dataMap.put(" idNo", map.get(" id_no"));
|
||||
dataMap.put("firstWorkDate", map.get(" first_work_date"));
|
||||
dataMap.put("birthday", map.get(" birthday"));
|
||||
dataMap.put("gryx", map.get("gryx"));
|
||||
dataMap.put("email", map.get("email"));
|
||||
dataMap.put("frgs", map.get("frgs"));
|
||||
dataMap.put("alias", map.get("alias"));
|
||||
dataMap.put("residencePlace", map.get("residence_place"));
|
||||
dataMap.put("hireDate", map.get("hiredate"));
|
||||
dataMap.put("dimissionDate", map.get("dimissiondate"));
|
||||
dataMap.put("odeptid", map.get("odeptid"));
|
||||
Long departmentId = Convert.toLong(map.get("department"));
|
||||
HrmDepartmentComInfo department = hrmComInfoCacheHandler.getCacheById(HrmDepartmentComInfo.class, departmentId);
|
||||
if (null != department) {
|
||||
dataMap.put("deptCode", department.getCode());
|
||||
dataMap.put("deptName", department.getName());
|
||||
} else {
|
||||
dataMap.put("deptCode", "");
|
||||
dataMap.put("deptName", "");
|
||||
}
|
||||
dataMap.put("opositionid", map.get("opositionid"));
|
||||
// 内容转换
|
||||
String gzdssyyzx = Util.null2String(map.get("gzdssyyzx"));
|
||||
dataMap.put("yyzxcode", gzdssyyzx);
|
||||
dataMap.put("yyzxname", gzdssyyzxMap.get(gzdssyyzx));
|
||||
|
||||
String bzssqy = Util.null2String(map.get("bzssqy"));
|
||||
dataMap.put("qyname", bzssqyMap.get(bzssqy));
|
||||
|
||||
Long locationId = Convert.toLong(map.get("location"));
|
||||
HrmOffSpace location = cityMapper.getSpaceInfoById(param, locationId);
|
||||
log.error("location:{}", location);
|
||||
if (null != location) {
|
||||
dataMap.put("location", getFullAreaPath(param, location.getCity()));
|
||||
dataMap.put("locationcode", getAreaCode(param, location.getCity()));
|
||||
} else {
|
||||
dataMap.put("location", "");
|
||||
dataMap.put("locationcode", "");
|
||||
}
|
||||
|
||||
Long cbzx = Convert.toLong(map.get("cbzx"));
|
||||
PortalPO costCenter = organizationInfoMapper.getCostCenter(param, cbzx);
|
||||
if (null != costCenter) {
|
||||
dataMap.put("cbzxname", costCenter.getName());
|
||||
dataMap.put("cbzxcode", costCenter.getValue());
|
||||
} else {
|
||||
dataMap.put("cbzxname", "");
|
||||
dataMap.put("cbzxcode", "");
|
||||
}
|
||||
|
||||
dataMap.put("superiorgh",getEmployeeJobNum(Convert.toStr(map.get("superior"))));
|
||||
dataMap.put("other_superiorgh",getEmployeeJobNum(Convert.toStr(map.get("other_superior"))));
|
||||
dataMap.put("company_year",map.get("sl"));
|
||||
|
||||
Long jjr = Convert.toLong(map.get("jjr"));
|
||||
SimpleEmployee jjrEmployee = hrmCommonEmployeeDao.getById(jjr);
|
||||
if(null!=jjrEmployee){
|
||||
dataMap.put("jjrcode",jjrEmployee.getJobNum());
|
||||
dataMap.put("jjrname",jjrEmployee.getUsername());
|
||||
}else{
|
||||
dataMap.put("jjrcode", "");
|
||||
dataMap.put("jjrname", "");
|
||||
}
|
||||
dataMap.put("personnel_status", map.get("personnel_status"));
|
||||
dataMap.put("sfqdjyxy", map.get("sfqdjyxy"));
|
||||
dataMap.put("sfktxyxt", map.get("sfktxyxt"));
|
||||
orgList.add(dataMap);
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> returnMap = new HashMap<>();
|
||||
returnMap.put("data", orgList);
|
||||
returnMap.put("current", current);
|
||||
returnMap.put("total", total);
|
||||
return WeaResult.success(returnMap);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -192,4 +303,95 @@ public class OrganizationInfoServiceImpl implements OrganizationInfoService {
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* 行政区划全路径名称
|
||||
*
|
||||
* @param cityId
|
||||
* @return
|
||||
*/
|
||||
public String getFullAreaPath(BaseParam param, Long cityId) {
|
||||
Area area = cityMapper.getAreaInfoById(param, cityId);
|
||||
log.error("area:{}", area);
|
||||
if (null == area) {
|
||||
return "";
|
||||
}
|
||||
return getFullAreaPath(param, area);
|
||||
}
|
||||
|
||||
public String getAreaCode(BaseParam param, Long cityId) {
|
||||
Area area = cityMapper.getAreaInfoById(param, cityId);
|
||||
log.error("area:{}", area);
|
||||
if (null == area) {
|
||||
return "";
|
||||
}
|
||||
return getAreaCode(param, area);
|
||||
}
|
||||
|
||||
/**
|
||||
* 行政区划全路径名称
|
||||
*
|
||||
* @param area
|
||||
* @return
|
||||
*/
|
||||
public String getFullAreaPath(BaseParam param, Area area) {
|
||||
Area country = cityMapper.getAreaInfoById(param, area.getCountryId());
|
||||
log.error("country:{}", country);
|
||||
Area province = cityMapper.getAreaInfoById(param, area.getProvinceId());
|
||||
log.error("province:{}", province);
|
||||
Area city = cityMapper.getAreaInfoById(param, area.getCityId());
|
||||
log.error("city:{}", city);
|
||||
Area district = cityMapper.getAreaInfoById(param, area.getDistrictId());
|
||||
log.error("district:{}", district);
|
||||
List<String> pathList = new ArrayList<>();
|
||||
if (null != country) {
|
||||
pathList.add(country.getName());
|
||||
}
|
||||
if (null != province) {
|
||||
pathList.add(province.getName());
|
||||
}
|
||||
if (null != city) {
|
||||
pathList.add(city.getName());
|
||||
}
|
||||
if (null != district) {
|
||||
pathList.add(district.getName());
|
||||
}
|
||||
return StringUtils.join(pathList, "/");
|
||||
}
|
||||
|
||||
/**
|
||||
* 行政区划代码
|
||||
*
|
||||
* @param area
|
||||
* @return
|
||||
*/
|
||||
public String getAreaCode(BaseParam param, Area area) {
|
||||
AreaExtends areaExtendsInfoById = cityMapper.getAreaExtendsInfoById(param, area.getId());
|
||||
log.error("areaExtendsInfoById:{}", areaExtendsInfoById);
|
||||
if (null != areaExtendsInfoById) {
|
||||
return areaExtendsInfoById.getAdCode();
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取员工工号
|
||||
*
|
||||
* @param empId
|
||||
* @return
|
||||
*/
|
||||
private String getEmployeeJobNum(String empId) {
|
||||
if (StringUtils.isBlank(empId)) {
|
||||
return "";
|
||||
}
|
||||
List<String> jobNumList = new ArrayList<>();
|
||||
String[] split = empId.split(",");
|
||||
for (String empIdStr : split) {
|
||||
SimpleEmployee employee = hrmCommonEmployeeDao.getById(Convert.toLong(empIdStr));
|
||||
if (null != employee) {
|
||||
jobNumList.add(employee.getJobNum());
|
||||
}
|
||||
}
|
||||
return StringUtils.join(jobNumList, ",");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.weaver.seconddev.organization.mapper.CityMapper">
|
||||
|
||||
<select id="getSpaceInfoById" resultType="com.weaver.seconddev.organization.entity.po.HrmOffSpace">
|
||||
select t1.id, t1.short_name, t1.full_name, t1.city, t1.province, t1.nation, t1.data_id
|
||||
from ${param.eteams}.hrm_offspace t1
|
||||
where t1.delete_type = 0 and t1.tenant_key = #{param.tenantKey}
|
||||
and t1.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getAreaInfoById" resultType="com.weaver.seconddev.organization.entity.po.Area">
|
||||
select t1.id, t1.data_id, t1.parent_id, t1.name, t1.full_name, t1.country_id, t1.province_id, t1.city_id, t1.district_id
|
||||
from ${param.eteams}.administrative_area t1
|
||||
where t1.delete_type = 0
|
||||
and t1.id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="getAreaExtendsInfoById" resultType="com.weaver.seconddev.organization.entity.po.AreaExtends">
|
||||
select t1.id, t1.data_id, t1.ad_code, t1.city_code, t1.airport_code, t1.zip_code
|
||||
from ${param.eteams}.area_extends t1
|
||||
where t1.delete_type = 0
|
||||
and t1.id = #{id}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
|
@ -109,5 +109,40 @@
|
|||
AND t2.oid = #{oId}
|
||||
</if>
|
||||
</select>
|
||||
<select id="getEmployeeList" resultType="java.util.Map">
|
||||
select t1.oid, t1.job_num , t1.username , t1.sex, t1.qh, t1.mobile, t1.zjlx, t1.id_no,
|
||||
t1.first_work_date, t1.birthday, t1.gryx, t1.email, t1.frgs, t1.alias, t1.residence_place, t1.hiredate,
|
||||
t1.dimissiondate, t1.odeptid, t1.department, t1.opositionid, t1.gzdssyyzx, t1.bzssqy, t1.location,
|
||||
t1.locationcode, t1.cbzx, t1.superior, t1.other_superior, t1.sl, t1.jjr, t1.personnel_status, t1.sfqdjyxy, t1.sfktxyxt
|
||||
from ${e10_common}.uf_jcl_employee_information t1
|
||||
where t1.tenant_key = #{tenantKey} and t1.delete_type = 0
|
||||
<if test="code != null and code != ''">
|
||||
AND t1.job_num = #{code}
|
||||
</if>
|
||||
<if test="oId != null and oId != ''">
|
||||
AND t1.oid = #{oId}
|
||||
</if>
|
||||
<!--分页-->
|
||||
limit #{offset},#{pageSize}
|
||||
</select>
|
||||
<select id="getEmployeeListSize" resultType="java.lang.Integer">
|
||||
select
|
||||
count(t1.id)
|
||||
from ${e10_common}.uf_jcl_employee_information t1
|
||||
where t1.tenant_key = #{tenantKey} and t1.delete_type = 0
|
||||
<if test="code != null and code != ''">
|
||||
AND t1.job_num = #{code}
|
||||
</if>
|
||||
<if test="oId != null and oId != ''">
|
||||
AND t1.oid = #{oId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getCostCenter" resultType="com.weaver.seconddev.portal.entity.po.PortalPO">
|
||||
select t1.id as id, t1.bh as value, t1.mc as name
|
||||
from ${param.e10_common}.uf_cos_center t1
|
||||
where t1.tenant_key = #{param.tenantKey} and t1.delete_type = 0
|
||||
and t1.id = #{id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
|
|
|||
Loading…
Reference in New Issue