工资单跨扣缴义务人发放
This commit is contained in:
parent
5ccee97429
commit
4b0eee4798
|
|
@ -119,53 +119,34 @@ public class SalaryBillBO {
|
|||
/**
|
||||
* 构建工资单中的人员信息
|
||||
*
|
||||
* @param simpleEmployee
|
||||
*/
|
||||
public static void buildEmployeeInfo(SalaryBillSendDTO salaryBillSendParam, DataCollectionEmployee simpleEmployee) {
|
||||
public static void buildEmployeeInfo(SalaryBillSendDTO salaryBillSendParam, Map<String, Object> empInfo) {
|
||||
|
||||
SalaryTemplateSalaryItemSetListDTO employeeInformation = salaryBillSendParam.getEmployeeInformation();
|
||||
Map<String, String> employeeField = salaryBillSendParam.getEmployeeField();
|
||||
|
||||
if (employeeInformation == null || simpleEmployee == null) {
|
||||
if (employeeInformation == null || empInfo == null) {
|
||||
return;
|
||||
}
|
||||
if (CollectionUtils.isNotEmpty(employeeInformation.getItems())) {
|
||||
//获取员工信息的字段名和中文描述的map关系
|
||||
SalaryFormulaEmployeeDTO salaryFormulaEmployeeDTO = SalaryFormulaEmployeeDTO.builder()
|
||||
.employeeId(simpleEmployee.getEmployeeId())
|
||||
.taxAgentName(salaryBillSendParam.getTaxAgentName())
|
||||
.departmentName(simpleEmployee.getDepartmentName())
|
||||
.companystartdate(simpleEmployee.getCompanystartdate())
|
||||
.email(StringUtils.isEmpty(simpleEmployee.getEmail()) ? "" : simpleEmployee.getEmail())
|
||||
.sex(simpleEmployee.getSex() == null ? "" : simpleEmployee.getSex())
|
||||
.mobile(StringUtils.isEmpty(simpleEmployee.getMobile()) ? "" : simpleEmployee.getMobile()).jobtitleName(simpleEmployee.getJobtitleName())
|
||||
.status(StringUtils.isEmpty(simpleEmployee.getStatus()) ? "" : simpleEmployee.getStatus())
|
||||
.telephone(StringUtils.isEmpty(simpleEmployee.getTelephone()) ? "" : simpleEmployee.getTelephone())
|
||||
.username(StringUtils.isEmpty(simpleEmployee.getUsername()) ? "" : simpleEmployee.getUsername())
|
||||
.workcode(simpleEmployee.getWorkcode())
|
||||
.idNo(simpleEmployee.getIdNo())
|
||||
.statusName(simpleEmployee.getStatusName())
|
||||
.employeeId((long) empInfo.getOrDefault("employeeId", 0L))
|
||||
.taxAgentName(Util.null2String(empInfo.get("taxAgentName")))
|
||||
.departmentName(Util.null2String(empInfo.get("departmentName")))
|
||||
.companystartdate(Util.null2String(empInfo.get("companystartdate")))
|
||||
.email(Util.null2String(empInfo.get("email")))
|
||||
.sex(Util.null2String(empInfo.get("sex")))
|
||||
.mobile(Util.null2String(empInfo.get("mobile")))
|
||||
.jobtitleName(Util.null2String(empInfo.get("jobtitleName")))
|
||||
.status(Util.null2String(empInfo.get("status")))
|
||||
.telephone(Util.null2String(empInfo.get("telephone")))
|
||||
.username(Util.null2String(empInfo.get("username")))
|
||||
.workcode(Util.null2String(empInfo.get("workcode")))
|
||||
.idNo(Util.null2String(empInfo.get("idNo")))
|
||||
.statusName(Util.null2String(empInfo.get("statusName")))
|
||||
.build();
|
||||
List<SalaryTemplateSalaryItemListDTO> items = employeeInformation.getItems();
|
||||
// 1.SalaryAcctResultBO.buildEmployeeFieldName()的取法
|
||||
// Set<Map.Entry<String, String>> entries = employeeField.entrySet();
|
||||
// for (SalaryTemplateSalaryItemListDTO e : items) {
|
||||
// Optional<Map.Entry<String, String>> entry = entries.stream().filter(f -> Objects.equals(e.getName(), f.getValue())).findFirst();
|
||||
// if (entry.isPresent()) {
|
||||
// String key = entry.get().getKey();
|
||||
// if (StringUtils.isNotBlank(key)) {
|
||||
// String getter = "get" + key.substring(0, 1).toUpperCase() + key.substring(1);
|
||||
// try {
|
||||
// Method method = salaryFormulaEmployeeDTO.getClass().getMethod(getter);
|
||||
// Object invoke = method.invoke(salaryFormulaEmployeeDTO);
|
||||
// e.setSalaryItemValue((String) invoke);
|
||||
// } catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
|
||||
// log.error("no such method", e);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// 2.SalaryBillBO.buildEmployeeFieldName()
|
||||
for (SalaryTemplateSalaryItemListDTO e : items) {
|
||||
String employeeFieldName = employeeField.get(e.getName());
|
||||
if (!StringUtils.isEmpty(employeeFieldName)) {
|
||||
|
|
@ -262,7 +243,7 @@ public class SalaryBillBO {
|
|||
}
|
||||
Util_Message.store(messageBean);
|
||||
} catch (IOException e) {
|
||||
log.error("消息发送失败",e);
|
||||
log.error("消息发送失败", e);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ public class SalaryBillSendDTO {
|
|||
private String picUrl;
|
||||
|
||||
//扣缴义务人名称
|
||||
private String taxAgentName;
|
||||
// private String taxAgentName;
|
||||
|
||||
//工资单模板-薪资项目设置
|
||||
private List<SalaryTemplateSalaryItemSetListDTO> salaryItemSetList;
|
||||
|
|
|
|||
|
|
@ -58,11 +58,10 @@ public interface SalaryBillService {
|
|||
/**
|
||||
* 构建发放参数
|
||||
* @param salarySend
|
||||
* @param taxAgentName
|
||||
* @param salaryTemplate
|
||||
* @return
|
||||
*/
|
||||
SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, String taxAgentName, SalaryTemplatePO salaryTemplate);
|
||||
SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, SalaryTemplatePO salaryTemplate);
|
||||
|
||||
/**
|
||||
* 工资单撤回
|
||||
|
|
|
|||
|
|
@ -6,13 +6,12 @@ import com.alibaba.fastjson.JSONArray;
|
|||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.biz.SalarySendBiz;
|
||||
import com.engine.salary.biz.SalarySendInfoBiz;
|
||||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.salary.constant.HrmSalaryPayrollConf;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.progress.ProgressDTO;
|
||||
import com.engine.salary.entity.salaryBill.bo.SalaryBillBO;
|
||||
import com.engine.salary.entity.salaryBill.bo.SalaryTemplateBO;
|
||||
|
|
@ -26,7 +25,6 @@ import com.engine.salary.entity.salaryBill.po.SalaryTemplatePO;
|
|||
import com.engine.salary.entity.salaryacct.po.SalaryAcctEmployeePO;
|
||||
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobPO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.OperateTypeEnum;
|
||||
import com.engine.salary.enums.salarybill.*;
|
||||
import com.engine.salary.enums.salarysend.SalarySendGrantTypeEnum;
|
||||
|
|
@ -46,7 +44,6 @@ import com.weaver.util.threadPool.entity.LocalRunnable;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.beanutils.BeanUtils;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.hrm.User;
|
||||
|
|
@ -225,9 +222,8 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
}
|
||||
}
|
||||
try {
|
||||
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySob.getTaxAgentId());
|
||||
// 1.构建发送参数
|
||||
SalaryBillSendDTO salaryBillSendParam = buildSendParams(salarySend, taxAgentPO.getName(), salaryTemplate);
|
||||
SalaryBillSendDTO salaryBillSendParam = buildSendParams(salarySend, salaryTemplate);
|
||||
// 2.获取可发送的列表,此步最耗时,需要解密核算数据
|
||||
List<Integer> sendStatusList = Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue(), SalarySendStatusEnum.ALREADYSEND.getValue());
|
||||
List<Map<String, Object>> enableSendList = getEnableSendList(salarySend, ids, salaryBillSendParam, sendStatusList);
|
||||
|
|
@ -255,10 +251,8 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
private void handleGrant(SalarySendPO salarySend, List<Long> ids, SalarySobPO salarySob, SalaryTemplatePO salaryTemplate) {
|
||||
try {
|
||||
|
||||
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySob.getTaxAgentId());
|
||||
|
||||
// 1.构建发送参数
|
||||
SalaryBillSendDTO salaryBillSendParam = buildSendParams(salarySend, taxAgentPO.getName(), salaryTemplate);
|
||||
SalaryBillSendDTO salaryBillSendParam = buildSendParams(salarySend, salaryTemplate);
|
||||
|
||||
// 2.获取可发送的列表,此步最耗时,需要解密核算数据
|
||||
List<Integer> sendStatusList = Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue());
|
||||
|
|
@ -309,12 +303,10 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
}
|
||||
|
||||
private void genPdf(SalaryBillSendDTO salaryBillSendParam, List<Map<String, Object>> enableSendList) {
|
||||
// 获取人员完整信息
|
||||
Map<String, DataCollectionEmployee> allEmployeeMap = getEmployeeWholeInfo(enableSendList);
|
||||
//生成工资单pdf
|
||||
enableSendList.forEach(e -> {
|
||||
// 构建人员信息
|
||||
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString()));
|
||||
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, e);
|
||||
SalaryBillBO.genPdf(e, salaryBillSendParam);
|
||||
});
|
||||
|
||||
|
|
@ -333,11 +325,10 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
* 构建发送参数
|
||||
*
|
||||
* @param salarySend
|
||||
* @param taxAgentName
|
||||
* @param salaryTemplate
|
||||
* @return
|
||||
*/
|
||||
public SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, String taxAgentName, SalaryTemplatePO salaryTemplate) {
|
||||
public SalaryBillSendDTO buildSendParams(SalarySendPO salarySend, SalaryTemplatePO salaryTemplate) {
|
||||
// 发送通道
|
||||
Set<MessageChannelEnum> sendChannels = SalaryBillBO.buildSendChannels(salaryTemplate);
|
||||
if (CollectionUtils.isEmpty(sendChannels)) {
|
||||
|
|
@ -408,8 +399,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
.backgroundBase64(backgroundBase64)
|
||||
// 云桥工资单消息图
|
||||
.picUrl(picUrl)
|
||||
// 扣缴义务人名称
|
||||
.taxAgentName(taxAgentName)
|
||||
// 工资单模板-薪资项目设置
|
||||
.salaryItemSetList(salaryItemSetList)
|
||||
// 工资单模板-员工基本信息
|
||||
|
|
@ -462,11 +451,10 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
}
|
||||
}
|
||||
|
||||
// // 是否是合并计税
|
||||
// boolean isMerge = this.getSalarySendService(user).isMergeBySalarySend(salarySend);
|
||||
List<SalaryAcctEmployeePO> salaryAcctEmployeeList = this.getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
|
||||
List<Long> acctEmployeeIds = salaryAcctEmployeeList.stream().map(SalaryAcctEmployeePO::getEmployeeId).distinct().collect(Collectors.toList());
|
||||
list = list.stream().filter(f -> acctEmployeeIds.contains(f.getEmployeeId())).collect(Collectors.toList());
|
||||
SalaryI18nUtil.i18nList(list);
|
||||
|
||||
List<Long> employeeIds = list.stream().map(SalarySendInfoListDTO::getEmployeeId).collect(Collectors.toList());
|
||||
|
||||
|
|
@ -666,9 +654,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
|
||||
Set<MessageChannelEnum> sendChannels = salaryBillSendParam.getSendChannels();
|
||||
|
||||
// 获取人员完整信息
|
||||
Map<String, DataCollectionEmployee> allEmployeeMap = this.getEmployeeWholeInfo(enableSendList);
|
||||
|
||||
List<SalarySendInfoPO> sendInfoUpdateList = Lists.newArrayList();
|
||||
AtomicInteger index = new AtomicInteger(0);
|
||||
AtomicInteger part = new AtomicInteger(0);
|
||||
|
|
@ -681,7 +666,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
|
||||
if (sendChannels.contains(MessageChannelEnum.EMAIL) || sendChannels.contains(MessageChannelEnum.SMS)) {
|
||||
// 构建人员信息
|
||||
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString()));
|
||||
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, e);
|
||||
|
||||
//发送邮件
|
||||
if (sendChannels.contains(MessageChannelEnum.EMAIL)) {
|
||||
|
|
@ -715,20 +700,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
|
|||
return sendInfoUpdateList.stream().map(SalarySendInfoPO::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取人员完整信息
|
||||
*
|
||||
* @param enableSendList
|
||||
* @return
|
||||
*/
|
||||
private Map<String, DataCollectionEmployee> getEmployeeWholeInfo(List<Map<String, Object>> enableSendList) {
|
||||
|
||||
List<Long> ids = enableSendList.stream().map(e -> Long.valueOf(e.get("employeeId").toString())).collect(Collectors.toList());
|
||||
|
||||
// 获取所有人员信息
|
||||
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(ids);
|
||||
return SalaryEntityUtil.convert2Map(simpleEmployees, e -> e.getEmployeeId() + "");
|
||||
}
|
||||
// /** 工资单发放 end **********************************************************************/
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1036,7 +1036,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
return listMaps;
|
||||
}
|
||||
// 所有个税扣缴义务人
|
||||
// Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(getTaxAgentService(user).listAll(), TaxAgentPO::getId, TaxAgentPO::getName);
|
||||
Map<Long, String> taxAgentMap = SalaryEntityUtil.convert2Map(getTaxAgentService(user).listAll(), TaxAgentPO::getId, TaxAgentPO::getName);
|
||||
// 按人员分组核算数据
|
||||
// Map<Long, List<SalaryAcctEmployeePO>> relationSalaryAcctEmployeeMap = SalaryEntityUtil.group2Map(salaryAcctEmployees, SalaryAcctEmployeePO::getEmployeeId);
|
||||
Map<String, SalaryAcctEmployeePO> salaryAcctEmployeeMap = SalaryEntityUtil.convert2Map(salaryAcctEmployees, salaryAcctEmployee -> salaryAcctEmployee.getEmployeeId() + "-" + salaryAcctEmployee.getTaxAgentId());
|
||||
|
|
@ -1058,42 +1058,42 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
Map<Long, DataCollectionEmployee> finalEmpSubComMap = empComMap;
|
||||
boolean finalIsOrigin = isOrigin;
|
||||
list.forEach(e -> {
|
||||
|
||||
SalaryAcctEmployeePO salaryAcctEmployee = salaryAcctEmployeeMap.getOrDefault(e.getEmployeeId() + "-" + e.getTaxAgentId(), new SalaryAcctEmployeePO());
|
||||
DataCollectionEmployee hrmDepartmentComInfo = finalEmpSubComMap.getOrDefault(e.getEmployeeId(), new DataCollectionEmployee());
|
||||
Map<String, Object> map = new LinkedHashMap<>();
|
||||
map.put("id", e.getId() + "");
|
||||
DataCollectionEmployee hrmDepartmentComInfo = finalEmpSubComMap.get(e.getEmployeeId());
|
||||
if (hrmDepartmentComInfo != null) {
|
||||
map.put("subCompanyName", hrmDepartmentComInfo.getSubcompanyName());
|
||||
} else {
|
||||
map.put("subCompanyName", "");
|
||||
}
|
||||
if (hrmDepartmentComInfo != null) {
|
||||
map.put("department", e.getDepartment());
|
||||
}
|
||||
map.put("employeeId", e.getEmployeeId() + "");
|
||||
map.put("username", e.getUsername());
|
||||
map.put("id", e.getId());
|
||||
map.put("employeeId", e.getEmployeeId());
|
||||
map.put("taxAgentName", taxAgentMap.getOrDefault(salaryAcctEmployee.getTaxAgentId(), ""));
|
||||
map.put("taxAgentId", salaryAcctEmployee.getTaxAgentId());
|
||||
map.put("username", hrmDepartmentComInfo.getUsername());
|
||||
|
||||
map.put("departmentName", salaryAcctEmployee.getDepartmentName());
|
||||
map.put("departmentId", salaryAcctEmployee.getDepartmentId());
|
||||
|
||||
map.put("subcompanyName", salaryAcctEmployee.getSubcompanyName());
|
||||
map.put("subcompanyId", salaryAcctEmployee.getSubcompanyId());
|
||||
map.put("jobtitleName", salaryAcctEmployee.getJobtitleName());
|
||||
map.put("jobtitleId", salaryAcctEmployee.getJobtitleId());
|
||||
map.put("companystartdate", hrmDepartmentComInfo.getCompanystartdate());
|
||||
map.put("mobile", e.getMobile());
|
||||
map.put("jobNum", e.getJobNum());
|
||||
map.put("email", e.getEmail());
|
||||
map.put("dissmissdate", hrmDepartmentComInfo.getDismissdate());
|
||||
map.put("status", salaryAcctEmployee.getStatus());
|
||||
map.put("statusName", UserStatusEnum.getDefaultLabelByValue(Integer.valueOf(salaryAcctEmployee.getStatus())));
|
||||
map.put("workcode", hrmDepartmentComInfo.getWorkcode());
|
||||
map.put("sex", "0".equals(hrmDepartmentComInfo.getSex()) ? "男" : "女");
|
||||
map.put("idNo", hrmDepartmentComInfo.getIdNo());
|
||||
map.put("email", hrmDepartmentComInfo.getEmail());
|
||||
map.put("telephone", hrmDepartmentComInfo.getTelephone());
|
||||
map.put("jobcall", hrmDepartmentComInfo.getJobcall());
|
||||
map.put("jobcallId", hrmDepartmentComInfo.getJobcallId());
|
||||
map.put("birthday", hrmDepartmentComInfo.getBirthday());
|
||||
|
||||
// map.put("employeeType", SalarySendEmployeeTypeEnum.getNameByValue(e.getEmployeeType()));
|
||||
// 单个人的核算数据
|
||||
List<SalaryAcctResultPO> resultValues = Lists.newArrayList();
|
||||
// 个税扣缴义务人
|
||||
// if (incomeCategorys.size() > 1) {
|
||||
// List<SalaryAcctEmployeePO> acctEmployees = relationSalaryAcctEmployeeMap.getOrDefault(e.getEmployeeId(), Collections.emptyList());
|
||||
// for (SalaryAcctEmployeePO salaryAcctEmployee : acctEmployees) {
|
||||
// if (singleEmpAcctMap.containsKey(salaryAcctEmployee.getId())) {
|
||||
// resultValues.add(singleEmpAcctMap.get(salaryAcctEmployee.getId()));
|
||||
// }
|
||||
// }
|
||||
// } else {
|
||||
// SalaryAcctEmployeePO salaryAcctEmployee = salaryAcctEmployeeMap.get(e.getEmployeeId() + "-" + e.getTaxAgent());
|
||||
// if (salaryAcctEmployee != null && singleEmpAcctMap.containsKey(salaryAcctEmployee.getId())) {
|
||||
// resultValues.add(singleEmpAcctMap.get(salaryAcctEmployee.getId()));
|
||||
// }
|
||||
// }
|
||||
|
||||
SalaryAcctEmployeePO salaryAcctEmployee = salaryAcctEmployeeMap.get(e.getEmployeeId() + "-" + e.getTaxAgentId());
|
||||
if (salaryAcctEmployee != null && singleEmpAcctMap.containsKey(salaryAcctEmployee.getId())) {
|
||||
if (singleEmpAcctMap.containsKey(salaryAcctEmployee.getId())) {
|
||||
resultValues.addAll(singleEmpAcctMap.get(salaryAcctEmployee.getId()));
|
||||
}
|
||||
// 薪资项目
|
||||
|
|
@ -1862,7 +1862,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
if (CollectionUtils.isEmpty(salaryTemplates)) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100518, "没有默认模板,无法发送"));
|
||||
}
|
||||
SalaryBillSendDTO salaryBillSendDTO = getSalaryBillService(user).buildSendParams(salarySendPO, taxAgentPO.getName(), salaryTemplates.get(0));
|
||||
SalaryBillSendDTO salaryBillSendDTO = getSalaryBillService(user).buildSendParams(salarySendPO, salaryTemplates.get(0));
|
||||
|
||||
SalaryTemplatePO salaryTemplate = salaryBillSendDTO.getSalaryTemplate();
|
||||
if (salaryTemplate == null) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue