核算时编辑人员组织信息

This commit is contained in:
Harryxzy 2024-07-25 14:04:14 +08:00
parent 671350654a
commit bdd27bcfc6
15 changed files with 339 additions and 12 deletions

View File

@ -118,6 +118,19 @@ public class EmployBiz extends BaseBean {
}
}
public PositionInfo getPositionInfoById(Long positionId) {
if (positionId == null) {
return null;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getPositionInfoById(positionId);
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
@ -187,6 +200,20 @@ public class EmployBiz extends BaseBean {
}
}
public SubCompanyInfo getSubCompanyInfoById(Long subCompanyId) {
if (subCompanyId == null) {
return null;
}
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getSubCompanyInfoById(subCompanyId);
} finally {
sqlSession.close();
}
}
public List<DataCollectionEmployee> listAllForReport() {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
@ -206,4 +233,15 @@ public class EmployBiz extends BaseBean {
sqlSession.close();
}
}
public DeptInfo getDeptInfoById(Long departmentId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
EmployMapper mapper = sqlSession.getMapper(EmployMapper.class);
return mapper.getDeptInfoById(departmentId);
} finally {
sqlSession.close();
}
}
}

View File

@ -0,0 +1,32 @@
package com.engine.salary.entity.hrm;
import com.engine.salary.annotation.I18n;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 职称基本信息
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class JobCallInfo {
private Long id;
/**
* 名称
*/
@I18n
private String name;
}

View File

@ -479,12 +479,45 @@ public class SalaryAcctResultBO {
// 个税扣缴义务人
employeeFieldValueMap.put("taxAgentName", Optional.ofNullable(taxAgentPO).map(TaxAgentPO::getName).orElse(StringUtils.EMPTY));
Map<String, String> employeeFieldNameMap = buildEmployeeFieldName();
List<String> canEditKeys = Arrays.asList("subcompany", "department", "jobtitle", "jobcall");
List<SalaryAcctEmployeeInfoDTO> employeeInfos = salarySobEmpFields.stream()
.map(e -> SalaryAcctEmployeeInfoDTO.builder()
.fieldName(employeeFieldNameMap.getOrDefault(e.getFieldCode(), StringUtils.EMPTY))
.fieldValue(employeeFieldValueMap.getOrDefault(e.getFieldCode(), StringUtils.EMPTY))
.build())
.map(e -> {
String fieldCode = e.getFieldCode();
String fieldType = employeeFieldNameMap.getOrDefault(fieldCode + "_type", StringUtils.EMPTY);
SalaryAcctEmployeeInfoDTO dto = SalaryAcctEmployeeInfoDTO.builder()
.fieldCode(fieldCode)
.fieldName(employeeFieldNameMap.getOrDefault(fieldCode, StringUtils.EMPTY))
.fieldValue(employeeFieldValueMap.getOrDefault(fieldCode, StringUtils.EMPTY))
.fieldType(fieldType)
.canEdit(fieldType.contains("Browser") ? true : false)
.build();
String codeKey = fieldCode.replace("Id", "").replace("Name", "");
if (canEditKeys.contains(codeKey)) {
// 前端用于回写浏览框
Map<String, String> fieldValueMap = new HashMap<>();
fieldValueMap.put("id", employeeFieldValueMap.getOrDefault(codeKey + "Id", StringUtils.EMPTY));
fieldValueMap.put("name", employeeFieldValueMap.getOrDefault(codeKey + "Name", StringUtils.EMPTY));
dto.setFieldValue(fieldValueMap);
}
return dto;
})
.collect(Collectors.toList());
List<String> needRemoveFieldNames = new ArrayList<String>();
// 过滤出是浏览框类型的且人员信息中同时存在名称和id的字段
employeeInfos.stream()
.filter(e -> e.getFieldType().contains("Browser"))
.map(e -> SalaryAcctEmployeeInfoDTO.builder().fieldName(e.getFieldName().replace("ID","")).build())
.collect(Collectors.groupingBy(SalaryAcctEmployeeInfoDTO::getFieldName))
.forEach((k,v) -> {
if (v.size() > 1) {
needRemoveFieldNames.add(k+"ID");
}
});
// 移除字段
employeeInfos = employeeInfos.stream().filter(info -> !needRemoveFieldNames.contains(info.getFieldName())).collect(Collectors.toList());
// 薪资项目的值
Map<Long, String> resultValueMap = SalaryEntityUtil.convert2Map(salaryAcctResults, SalaryAcctResultPO::getSalaryItemId, SalaryAcctResultPO::getResultValue);
Map<Long, SalaryItemPO> salaryItemMap = SalaryEntityUtil.convert2Map(salaryItems, SalaryItemPO::getId);
@ -709,6 +742,7 @@ public class SalaryAcctResultBO {
}
SalaryFormulaVar annotation = declaredField.getAnnotation(SalaryFormulaVar.class);
employeeFieldNameMap.put(declaredField.getName(), SalaryI18nUtil.getI18nLabel(annotation.labelId(), annotation.defaultLabel()));
employeeFieldNameMap.put(declaredField.getName() + "_type", annotation.dataType());
}
return employeeFieldNameMap;
}

View File

@ -23,5 +23,14 @@ public class SalaryAcctEmployeeInfoDTO {
private String fieldName;
//字段值
private String fieldValue;
private Object fieldValue;
// code
private String fieldCode;
// 用于编辑时前端渲染对应输入选择框
private String fieldType;
// 是否可编辑
private boolean canEdit;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.salaryacct.param;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctEmployeeInfoDTO;
import com.engine.salary.util.valid.DataCheck;
import lombok.AllArgsConstructor;
import lombok.Builder;
@ -30,6 +31,9 @@ public class SalaryAcctResultSaveParam {
@DataCheck(require = true,message = "薪资项目的值的集合不能为空")
private Collection<SalaryAcctResultDetailItemParam> items;
// 员工基础信息
private Collection<SalaryAcctEmployeeInfoDTO> employeeInfos;
@Data
@Builder
@NoArgsConstructor

View File

@ -31,22 +31,22 @@ public class SalaryFormulaEmployeeDTO {
private String username;
//部门
@SalaryFormulaVar(defaultLabel = "部门", labelId = 86185, dataType = "string")
@SalaryFormulaVar(defaultLabel = "部门", labelId = 86185, dataType = "departmentBrowser")
private String departmentName;
@SalaryFormulaVar(defaultLabel = "部门ID", labelId = 86185, dataType = "string")
@SalaryFormulaVar(defaultLabel = "部门ID", labelId = 86185, dataType = "departmentBrowser")
private Long departmentId;
//分部
@SalaryFormulaVar(defaultLabel = "分部", labelId = 82465, dataType = "string")
@SalaryFormulaVar(defaultLabel = "分部", labelId = 82465, dataType = "subcompanyBrowser")
private String subcompanyName;
//岗位
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "string")
@SalaryFormulaVar(defaultLabel = "岗位", labelId = 90633, dataType = "jobtitleBrowser")
private String jobtitleName;
@SalaryFormulaVar(defaultLabel = "岗位ID", labelId = 90633, dataType = "string")
@SalaryFormulaVar(defaultLabel = "岗位ID", labelId = 90633, dataType = "jobtitleBrowser")
private Long jobtitleId;
@SalaryFormulaVar(defaultLabel = "入职日期", labelId = 86319, dataType = "string")
@ -88,9 +88,9 @@ public class SalaryFormulaEmployeeDTO {
//职称
@SalaryFormulaVar(defaultLabel = "职称", labelId = 98623, dataType = "string")
@SalaryFormulaVar(defaultLabel = "职称", labelId = 98623, dataType = "jobcallBrowser")
private String jobcall;
@SalaryFormulaVar(defaultLabel = "职称ID", labelId = 98623, dataType = "string")
@SalaryFormulaVar(defaultLabel = "职称ID", labelId = 98623, dataType = "jobcallBrowser")
private Long jobcallId;

View File

@ -2,6 +2,7 @@ package com.engine.salary.mapper.datacollection;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.hrm.dto.HrmInfoDTO;
@ -81,6 +82,13 @@ public interface EmployMapper {
*/
List<PositionInfo> listPositionInfo(@Param("collection") List<Long> ids);
/**
* 所以岗位id 获取岗位信息
* @param id
* @return
*/
PositionInfo getPositionInfoById(@Param("positionId") Long id);
/**
* 所以部门
* @param departmentIds
@ -104,6 +112,13 @@ public interface EmployMapper {
*/
List<SubCompanyInfo> getSubCompanyInfoList(@Param("subDepartmentIds") List<Long> subDepartmentIds);
/**
* 根据分部id获取分部信息
* @param subDepartmentId
* @return
*/
SubCompanyInfo getSubCompanyInfoById(@Param("subDepartmentId")Long subDepartmentId);
/**
* 虚拟分部
* @param virtualSubCompanyIds
@ -158,4 +173,6 @@ public interface EmployMapper {
* @return
*/
List<DataCollectionEmployee> listBySubCompanyOrDepartment(@Param("subCompanyIds") List<Long> subCompanyIds, @Param("departmentIds") List<Long> departmentIds);
JobCallInfo getJobCallInfoById(@Param("jobCallId") Long jobCallId);
}

View File

@ -107,6 +107,13 @@
</if>
</select>
<select id="getPositionInfoById" resultType="com.engine.salary.entity.hrm.PositionInfo">
select t.id,
t.jobtitlename as name
from hrmjobtitles t
where t.id = #{positionId}
</select>
<select id="listByParams" resultType="com.engine.salary.entity.datacollection.DataCollectionEmployee">
select e.id as employeeId,
e.lastname as username,
@ -363,6 +370,13 @@
</if>
</select>
<select id="getSubCompanyInfoById" resultType="com.engine.salary.entity.hrm.SubCompanyInfo">
select d.subcompanyname as name,
d.id as id
from hrmsubcompany d
where d.id = #{subDepartmentId}
</select>
<select id="getVirtualSubCompanyInfoList" resultType="com.engine.salary.entity.hrm.SubCompanyInfo">
select d.subcompanyname as name,
d.id as id
@ -594,4 +608,11 @@
</foreach>
</if>
</select>
<select id="getJobCallInfoById" resultType="com.engine.salary.entity.hrm.JobCallInfo">
select job.id,
job.jobtitlename as name
from hrmjobcall job
where job.id = #{jobCallId}
</select>
</mapper>

View File

@ -122,4 +122,6 @@ public interface SalaryAcctEmployeeMapper {
void lockByAcctEmpIds(@Param("lockStatus") Integer lockStatus, @Param("acctEmpIds") Set<Long> acctEmpIds);
void lockByRecordId(@Param("lockStatus") Integer lockStatus, @Param("recordId") Long recordId);
void updateIgnoreNull(@Param("salaryAcctEmployeePO")SalaryAcctEmployeePO salaryAcctEmployeePO);
}

View File

@ -1366,4 +1366,80 @@
AND salary_acct_record_id = #{recordId}
</update>
<update id="updateIgnoreNull" parameterType="com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO">
UPDATE hrsa_salary_acct_emp
<set>
<if test="salaryAcctRecordId != null" >
salary_acct_record_id=#{salaryAcctRecordId},
</if>
<if test="salarySobId != null" >
salary_sob_id=#{salarySobId},
</if>
<if test="employeeId != null" >
employee_id=#{employeeId},
</if>
<if test="taxAgentId != null" >
tax_agent_id=#{taxAgentId},
</if>
<if test="salaryMonth != null" >
salary_month=#{salaryMonth},
</if>
<if test="creator != null" >
creator=#{creator},
</if>
<if test="createTime != null" >
create_time=#{createTime},
</if>
<if test="updateTime != null" >
update_time=#{updateTime},
</if>
<if test="deleteType != null" >
delete_type=#{deleteType},
</if>
<if test="tenantKey != null" >
tenant_key=#{tenantKey},
</if>
<if test="employeeType != null" >
employee_type=#{employeeType},
</if>
<if test="incomeCategory != null" >
income_category=#{incomeCategory},
</if>
<if test="lockStatus != null" >
lock_status=#{lockStatus},
</if>
<if test="subcompanyName != null" >
subcompany_name=#{subcompanyName},
</if>
<if test="subcompanyId != null" >
subcompany_id=#{subcompanyId},
</if>
<if test="departmentName != null" >
department_name=#{departmentName},
</if>
<if test="departmentId != null" >
department_id=#{departmentId},
</if>
<if test="jobtitleName != null" >
jobtitle_name=#{jobtitleName},
</if>
<if test="jobtitleId != null" >
jobtitle_id=#{jobtitleId},
</if>
<if test="jobcall != null" >
jobcall=#{jobcall},
</if>
<if test="jobcallId != null" >
jobcall_id=#{jobcallId},
</if>
<if test="status != null" >
status=#{status},
</if>
<if test="lockTime != null" >
lock_time=#{lockTime},
</if>
</set>
WHERE id = #{id} AND delete_type = 0
</update>
</mapper>

View File

@ -262,4 +262,9 @@ public interface SalaryAcctEmployeeService {
*/
void lockEmp(SalaryAcctResultUpdateLockStatusParam updateParam);
/**
* 更新
* @param salaryAcctEmployeePO
*/
void updateIgnoreNull(SalaryAcctEmployeePO salaryAcctEmployeePO);
}

View File

@ -2,6 +2,7 @@ package com.engine.salary.service;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
@ -102,14 +103,20 @@ public interface SalaryEmployeeService {
List<DeptInfo> getDeptInfoList(List<Long> departmentIds);
DeptInfo getDeptInfoById(Long departmentId);
List<DeptInfo> getVirtualDeptInfoList(List<Long> virtualDepartmentIds);
List<SubCompanyInfo> getSubCompanyInfoList(List<Long> subDepartmentIds);
SubCompanyInfo getSubCompanyInfoById(Long subDepartmentId);
List<SubCompanyInfo> getVirtualSubCompanyInfoList(List<Long> virtualSubDepartmentIds);
List<PositionInfo> listPositionInfo(List<Long> positionIds);
PositionInfo getPositionInfoById(Long positionId);
List<DataCollectionEmployee> listEmployee();
List<DataCollectionEmployee> listByParams(List<SalarySobRangeEmpQueryParam> includeQueryParams);
@ -167,4 +174,11 @@ public interface SalaryEmployeeService {
* @return
*/
List<DataCollectionEmployee> listBySubCompanyOrDepartment(List<Long> subCompanyIds, List<Long> departmentIds);
/**
* 根据职称id获取职称信息
* @param jobCallId
* @return
*/
JobCallInfo getJobCallInfoById(Long jobCallId);
}

View File

@ -785,4 +785,8 @@ public class SalaryAcctEmployeeServiceImpl extends Service implements SalaryAcct
}
}
@Override
public void updateIgnoreNull(SalaryAcctEmployeePO salaryAcctEmployeePO) {
getSalaryAcctEmployeeMapper().updateIgnoreNull(salaryAcctEmployeePO);
}
}

View File

@ -11,6 +11,10 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.datacollection.dto.AttendQuoteFieldListDTO;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.report.bo.SalaryAcctResultReportBO;
import com.engine.salary.entity.report.po.SalaryAcctResultReportPO;
@ -591,6 +595,46 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (Objects.isNull(salaryAcctEmployeePO)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(98831, "薪资核算人员不存在或已被删除"));
}
// 更新员工基本信息值
saveParam.getEmployeeInfos().stream().forEach(info -> {
if (info.getFieldValue() != null && StringUtils.isNotBlank(info.getFieldValue().toString())) {
if (info.getFieldCode().equals("departmentName") || info.getFieldCode().equals("departmentId")) {
// 修改部门信息
DeptInfo deptInfo = getSalaryEmployeeService(user).getDeptInfoById(NumberUtils.isCreatable(info.getFieldValue().toString())
? Long.valueOf(info.getFieldValue().toString()) : 0L);
if (Objects.nonNull(deptInfo)) {
salaryAcctEmployeePO.setDepartmentName(deptInfo.getName());
salaryAcctEmployeePO.setDepartmentId(deptInfo.getId());
}
} else if (info.getFieldCode().equals("subcompanyName") || info.getFieldCode().equals("subcompanyId")) {
// 修改分部信息
SubCompanyInfo subCompanyInfo = getSalaryEmployeeService(user).getSubCompanyInfoById(NumberUtils.isCreatable(info.getFieldValue().toString())
? Long.valueOf(info.getFieldValue().toString()) : 0L);
if (Objects.nonNull(subCompanyInfo)) {
salaryAcctEmployeePO.setSubcompanyName(subCompanyInfo.getName());
salaryAcctEmployeePO.setSubcompanyId(subCompanyInfo.getId());
}
} else if (info.getFieldCode().equals("jobtitleName") || info.getFieldCode().equals("jobtitleId")) {
// 修改岗位信息
PositionInfo positionInfo = getSalaryEmployeeService(user).getPositionInfoById(NumberUtils.isCreatable(info.getFieldValue().toString())
? Long.valueOf(info.getFieldValue().toString()) : 0L);
if (Objects.nonNull(positionInfo)) {
salaryAcctEmployeePO.setJobtitleName(positionInfo.getName());
salaryAcctEmployeePO.setJobtitleId(positionInfo.getId());
}
} else if (info.getFieldCode().equals("jobcall") || info.getFieldCode().equals("jobcallId")) {
// 修改职称信息
JobCallInfo jobCallInfo = getSalaryEmployeeService(user).getJobCallInfoById(NumberUtils.isCreatable(info.getFieldValue().toString())
? Long.valueOf(info.getFieldValue().toString()) : 0L);
if (Objects.nonNull(jobCallInfo)) {
salaryAcctEmployeePO.setJobcall(jobCallInfo.getName());
salaryAcctEmployeePO.setJobcallId(jobCallInfo.getId());
}
}
}
});
getSalaryAcctEmployeeService(user).updateIgnoreNull(salaryAcctEmployeePO);
// 查询原来的薪资核算结果
List<SalaryAcctResultPO> salaryAcctResultPOSOld = getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctEmpId(saveParam.getSalaryAcctEmpId()).build());
// 解密

View File

@ -9,6 +9,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.SalarySobExtRangePO;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.hrm.DeptInfo;
import com.engine.salary.entity.hrm.JobCallInfo;
import com.engine.salary.entity.hrm.PositionInfo;
import com.engine.salary.entity.hrm.SubCompanyInfo;
import com.engine.salary.entity.hrm.dto.EmployeeInfoExpandDTO;
@ -288,6 +289,14 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
return SalaryI18nUtil.i18nList(employBiz.getDeptInfoList(departmentIds));
}
@Override
public DeptInfo getDeptInfoById(Long departmentId) {
if (departmentId == null) {
return null;
}
return SalaryI18nUtil.i18n(employBiz.getDeptInfoById(departmentId));
}
@Override
public List<DeptInfo> getVirtualDeptInfoList(List<Long> virtualDepartmentIds) {
if (CollectionUtils.isEmpty(virtualDepartmentIds)) {
@ -302,6 +311,11 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
return SalaryI18nUtil.i18nList(employBiz.getSubCompanyInfoList(subDepartmentIds));
}
@Override
public SubCompanyInfo getSubCompanyInfoById(Long subDepartmentId) {
return SalaryI18nUtil.i18n(employBiz.getSubCompanyInfoById(subDepartmentId));
}
@Override
public List<SubCompanyInfo> getVirtualSubCompanyInfoList(List<Long> virtualSubDepartmentIds) {
if (CollectionUtils.isEmpty(virtualSubDepartmentIds)) {
@ -316,6 +330,11 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
return SalaryI18nUtil.i18nList(employBiz.listPositionInfo(positionIds));
}
@Override
public PositionInfo getPositionInfoById(Long positionId) {
return SalaryI18nUtil.i18n(employBiz.getPositionInfoById(positionId));
}
@Override
public List<DataCollectionEmployee> listEmployee() {
List<DataCollectionEmployee> result = employBiz.listEmployee();
@ -514,4 +533,12 @@ public class SalaryEmployeeServiceImpl extends Service implements SalaryEmployee
}
return SalaryI18nUtil.i18nList(employeeList);
}
@Override
public JobCallInfo getJobCallInfoById(Long jobCallId) {
if (jobCallId == null) {
return null;
}
return SalaryI18nUtil.i18n(getEmployMapper().getJobCallInfoById(jobCallId));
}
}