Merge branch 'release/2.14.1.2405.01' into release/个税版本

This commit is contained in:
钱涛 2024-05-13 14:01:22 +08:00
commit 04978dd8e6
18 changed files with 246 additions and 54 deletions

View File

View File

@ -0,0 +1,59 @@
package com.customization.salary;
import com.engine.core.cfg.annotation.ServiceDynamicProxy;
import com.engine.core.impl.aop.AbstractServiceProxy;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctRecordListDTO;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordQueryParam;
import com.engine.salary.entity.salaryacct.param.SalaryAcctRecordSaveParam;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.wrapper.SalaryAcctRecordWrapper;
import com.engine.salary.wrapper.proxy.SalaryAcctRecordWrapperProxy;
import java.util.Collection;
import java.util.Map;
/**
* 薪资核算记录
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@ServiceDynamicProxy(target = SalaryAcctRecordWrapper.class, desc = "核算记录")
public class CustomSalaryAcctRecordWrapper extends AbstractServiceProxy implements SalaryAcctRecordWrapperProxy {
@Override
@ServiceMethodDynamicProxy(desc = "拦截核算记录列表")
public PageInfo<SalaryAcctRecordListDTO> listPage(SalaryAcctRecordQueryParam queryParam) {
PageInfo<SalaryAcctRecordListDTO> salaryAcctRecordListDTOPageInfo = (PageInfo<SalaryAcctRecordListDTO>) executeMethod(queryParam);
//todo do some thing
return salaryAcctRecordListDTOPageInfo;
}
@Override
public Map<String, Object> getForm(Long id) {
return (Map<String, Object>)executeMethod(id);
}
@Override
public Long save(SalaryAcctRecordSaveParam saveParam) {
return (Long)executeMethod(saveParam);
}
@Override
public void delete(Collection<Long> ids) {
executeMethod(ids);
}
@Override
public void file(Long id) {
executeMethod(id);
}
@Override
public void reCalculate(Long id) {
executeMethod(id);
}
}

View File

@ -34,22 +34,6 @@ public class CustomSalarySendWrapper extends AbstractServiceProxy implements Sal
@Override
@ServiceMethodDynamicProxy(desc = "拦截工资单发送方法")
public Map<String, Object> grant(SalarySendGrantParam queryParam) {
Long salarySendId = queryParam.getSalarySendId();
List<Long> ids = queryParam.getIds();
if (queryParam.getSalarySendRangeIds() != null) {
//如果传了范围id则使用范围id发放
ids = getSalarySendRangeService(new User())
.getSendInfoIdsBySendId(queryParam.getSalarySendId(), queryParam.getSalarySendRangeIds(), SalarySendGrantTypeEnum.GRANT);
if (ids.isEmpty()) {// 由于查出来是空的会导致全部发放在此进行拦截
throw new SalaryRunTimeException("工资发放范围内没有匹配员工");
}
}
List<Map<String, Object>> sendInfoList = getSalaryBillService(new User()).getSendInfoList(salarySendId, ids);
//解析sendInfoList拼接短信内容
System.out.println("发送短信");
//todo do some thing
Map<String, Object> result = (Map<String, Object>) executeMethod(queryParam);

View File

@ -101,6 +101,9 @@ public class DataCollectionEmployee {
@SalaryFormulaVar(defaultLabel = "职称", labelId = 98623, dataType = "string")
private String jobcall;
@SalaryFormulaVar(defaultLabel = "职称ID", labelId = 98623, dataType = "string")
private Long jobcallId;
//生日
@SalaryFormulaVar(defaultLabel = "出生日期", labelId = 98624, dataType = "string")
private String birthday;

View File

@ -33,6 +33,7 @@ import weaver.common.MessageUtil;
import weaver.conn.RecordSet;
import weaver.email.EmailWorkRunnable;
import weaver.file.ImageFileManager;
import weaver.general.Util;
import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo;
@ -199,6 +200,7 @@ public class SalaryBillBO {
log.error("资源异常", e);
}
companyName = subCompanyComInfo.getSubCompanyname(resourceComInfo.getSubCompanyID(employeeId + ""));
companyName = Util.formatMultiLang(companyName);
}
}

View File

@ -5,8 +5,6 @@ import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.Date;
/**
@ -62,4 +60,7 @@ public class SalaryMySalaryBillListDTO {
private Date sendTime;
private Long employeeId;
}

View File

@ -113,6 +113,7 @@ public class SalaryAcctFormulaBO {
.jobtitleName(simpleEmployee.getJobtitleName())
.jobtitleId(simpleEmployee.getJobtitleId())
.jobcall(simpleEmployee.getJobcall())
.jobcallId(simpleEmployee.getJobcallId())
.companystartdate(simpleEmployee.getCompanystartdate())
.birthday(simpleEmployee.getBirthday())
.workcode(simpleEmployee.getWorkcode())

View File

@ -90,6 +90,8 @@ public class SalaryFormulaEmployeeDTO {
//职称
@SalaryFormulaVar(defaultLabel = "职称", labelId = 98623, dataType = "string")
private String jobcall;
@SalaryFormulaVar(defaultLabel = "职称ID", labelId = 98623, dataType = "string")
private Long jobcallId;
@SalaryFormulaVar(defaultLabel = "出生日期", labelId = 98624, dataType = "string")

View File

@ -52,10 +52,10 @@
e.sex as sex,
e.email as email,
e.telephone as telephone,
e.jobcall as jobcall,
e.jobcall as jobcallId,
job.name as jobcall,
e.birthday as birthday,
e.certificatenum as idNo,
c.id as jobtitleId,
e.enddate as dismissdate,
e.workyear,
e.companyworkyear
@ -63,6 +63,7 @@
left join hrmdepartment d on e.departmentid = d.id
left join hrmjobtitles c on e.jobtitle = c.id
left join HrmSubCompany sc on e.SUBCOMPANYID1=sc.id
left join hrmjobcall job on e.jobcall=job.id
where e.status not in (7) and (e.accounttype is null or e.accounttype = 0)
<if test="collection != null and collection.size()>0">
AND e.id IN

View File

@ -23,6 +23,10 @@ public interface SalaryBillService {
*/
Map<String, Object> grant(SalarySendGrantParam queryParam);
Map<String, Object> reGenPdf(SalarySendGrantParam queryParam);
/**
* 获取内容
* @param sendId
@ -46,6 +50,8 @@ public interface SalaryBillService {
String exportPdf(SalaryExportPdfParam param);
String genPdfBeforeExport(SalaryExportPdfParam salaryExportPdfParam);
/**
* 工资单撤回
*

View File

@ -798,7 +798,7 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
String cacheKey = "addUpDeduction_autoAddAll_processing";
Object objVal = Util_DataCache.getObjVal(cacheKey);
if (objVal != null) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(135788, "一键累计过于频繁,请稍后再试"));
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(135788, "一键累计过于频繁,请稍后再试 "));
}
try {
Util_DataCache.setObjVal(cacheKey, true);

View File

@ -461,7 +461,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
if (fixedNum == 0) {
fixedNum = 3;
}
for (int i = 0; i < fixedNum; i++) {
for (int i = 0; i < fixedNum && i < columnList.size(); i++) {
columnList.get(i).setFixed("left");
}
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.service.impl;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.api.formmode.mybatis.util.SqlProxyHandle;
@ -37,6 +38,7 @@ import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.pdf.HtmlToPdf;
import com.google.common.collect.Lists;
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
@ -200,6 +202,44 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
return new HashMap<>();
}
/**
* 对于已经发送的工资单重新生成pdf
* @param param
* @return
*/
@Override
public Map<String, Object> reGenPdf(SalarySendGrantParam param) {
// 1.检查和获取工资单发放
SalarySendPO salarySend = checkAndGetSalarySend(param.getSalarySendId());
// 获取默认模板
SalarySobPO salarySob = getSalarySobService(user).getById(salarySend.getSalarySobId());
List<SalaryTemplatePO> salaryTemplates = salarySob == null ? Lists.newArrayList() : getSalaryTemplateService(user).getDefaultTemplates(Arrays.asList(salarySend.getSalarySobId(), salarySob.getId()));
SalaryTemplatePO salaryTemplate = salaryTemplates.get(0);
List<Long> ids = param.getIds();
if (param.getSalarySendRangeIds() != null) {
//如果传了范围id则使用范围id发放
ids = getSalarySendRangeService(user)
.getSendInfoIdsBySendId(salarySend.getId(), param.getSalarySendRangeIds(), SalarySendGrantTypeEnum.GRANT);
if (ids.isEmpty()) {// 由于查出来是空的会导致全部发放在此进行拦截
throw new SalaryRunTimeException("工资发放范围内没有匹配员工");
}
}
try {
TaxAgentPO taxAgentPO = getTaxAgentService(user).getById(salarySob.getTaxAgentId());
// 1.构建发送参数
SalaryBillSendDTO salaryBillSendParam = buildSendParams(salarySend, taxAgentPO.getName(), 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);
//生成pdf
genPdf(salaryBillSendParam, enableSendList, true);
getProgressService(user).finish(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), true);
} catch (Exception e) {
log.info("发送出错:{}", e.getMessage(), e);
}
return new HashMap<>();
}
/**
* 处理发送
@ -221,13 +261,14 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
SalaryBillSendDTO salaryBillSendParam = buildSendParams(salarySend, taxAgentPO.getName(), salaryTemplate);
// 2.获取可发送的列表此步最耗时需要解密核算数据
List<Map<String, Object>> enableSendList = getEnableSendList(salarySend, ids, salaryBillSendParam);
List<Integer> sendStatusList = Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue());
List<Map<String, Object>> enableSendList = getEnableSendList(salarySend, ids, salaryBillSendParam, sendStatusList);
// 3.发送消息先修改数据再发消息避免出错后无法撤回
List<Long> successIds = sendMessage(enableSendList, salaryBillSendParam);
//生成pdf
genPdf(salaryBillSendParam, enableSendList);
genPdf(salaryBillSendParam, enableSendList, false);
// 4.发放
grantSendInfo(successIds, salarySend, salaryTemplate, salaryBillSendParam);
@ -250,11 +291,24 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
}
}
private void genPdf(SalaryBillSendDTO salaryBillSendParam, List<Map<String, Object>> enableSendList) {
private void genPdf(SalaryBillSendDTO salaryBillSendParam, List<Map<String, Object>> enableSendList, boolean isSync) {
if (GEN_PDF) {
if (isSync) {
genPdf(salaryBillSendParam, enableSendList);
} else {
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
genPdf(salaryBillSendParam, enableSendList);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryBillGenPdf", localRunnable);
}
}
}
private void genPdf(SalaryBillSendDTO salaryBillSendParam, List<Map<String, Object>> enableSendList) {
// 获取人员完整信息
Map<String, DataCollectionEmployee> allEmployeeMap = getEmployeeWholeInfo(enableSendList);
//生成工资单pdf
@ -274,10 +328,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator + id + File.separator + id + ".pdf";
SalaryBillBO.mergePdf(pdfPath, filesToMerge);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryBillGenPdf", localRunnable);
}
}
/**
* 构建发送参数
@ -394,12 +444,12 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
* @param ids
* @return
*/
private List<Map<String, Object>> getEnableSendList(SalarySendPO salarySend, List<Long> ids, SalaryBillSendDTO salaryBillSendParam) {
private List<Map<String, Object>> getEnableSendList(SalarySendPO salarySend, List<Long> ids, SalaryBillSendDTO salaryBillSendParam, List<Integer> sendStatus) {
SalarySendInfoQueryParam queryParam = new SalarySendInfoQueryParam();
queryParam.setSalarySendId(salarySend.getId());
// 空就是所有
queryParam.setIds(ids);
queryParam.setSendStatuss(Arrays.asList(SalarySendStatusEnum.UNSEND.getValue(), SalarySendStatusEnum.WITHDRAW.getValue()));
queryParam.setSendStatuss(sendStatus);
// 2.获取基本数据
List<SalarySendInfoListDTO> list = Lists.newArrayList();
if (CollectionUtils.isEmpty(ids)) {
@ -500,6 +550,57 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
return path;
}
@Override
public String genPdfBeforeExport(SalaryExportPdfParam param) {
// 先判断对应路径下是否存在pdf
SalarySendPO salarySend = checkAndGetSalarySend(param.getSalarySendId());
String yearMonth = SalaryDateUtil.getFormatYearMonth(salarySend.getSalaryMonth());
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + File.separator + yearMonth + File.separator + salarySend.getId() + File.separator + "%s" + ".pdf";
Long id = param.getId();
if (id == null) {
pdfPath = String.format(pdfPath, param.getSalarySendId());
} else {
pdfPath = String.format(pdfPath, id);
}
File file = new File(pdfPath);
if (file.exists()) {
return "success";
}
// 判断对应路径下是否存在html
String htmlPath = HrmSalaryPayrollConf.GEN_PATH + File.separator + yearMonth + File.separator + salarySend.getId() + File.separator + "%s" + ".html";
if (id == null) {
htmlPath = String.format(htmlPath, param.getSalarySendId());
} else {
htmlPath = String.format(htmlPath, id);
}
file = new File(htmlPath);
if (file.exists()) {
// 将html转成pdf
FileUtil.del(pdfPath);
HtmlToPdf.convert(HrmSalaryPayrollConf.TO_PDF_TOOL_PATH, htmlPath, pdfPath);
mergePdf(param, yearMonth);
return "success";
}
// 先生成html再生成pdf
SalarySendGrantParam grantParam = SalarySendGrantParam.builder().salarySendId(param.getSalarySendId()).ids(Collections.singletonList(param.getId())).build();
reGenPdf(grantParam);
return "success";
}
private void mergePdf(SalaryExportPdfParam param, String yearMonth) {
//合并工资单pdf
//1先获取所有工资单
Long salarySendId = param.getSalarySendId();
List<SalarySendInfoPO> salarySendInfos = getSalarySendInfoMapper().listSome(SalarySendInfoPO.builder().salarySendId(salarySendId).sendStatus(1).build());
//2工资单pdf转为路径
List<String> filesToMerge = salarySendInfos.stream().map(po -> HrmSalaryPayrollConf.GEN_PATH + yearMonth + File.separator + salarySendId + File.separator + po.getId() + ".pdf").collect(Collectors.toList());
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + yearMonth + File.separator + salarySendId + File.separator + salarySendId + ".pdf";
SalaryBillBO.mergePdf(pdfPath, filesToMerge);
}
public List<Map<String, Object>> getSendInfoList(Long sendId, List<Long> ids) {
SalarySendPO salarySend = getSalarySendMapper().getById(sendId);

View File

@ -426,8 +426,11 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
Set<Long> salarySobIds = SalaryEntityUtil.properties(salarySobItemList, SalarySobItemPO::getSalarySobId);
List<SalarySobPO> salarySobs = getSalarySobService(user).listByIds(salarySobIds);
// 获取能够管理的义务人
Boolean isChief = getTaxAgentService(user).isChief(Long.valueOf(user.getUID()));
if (!isChief) {
Set<Long> taxAgentIds = SalaryEntityUtil.properties(getTaxAgentService(user).listAllTaxAgentsAsAdmin(Long.valueOf(user.getUID())), TaxAgentPO::getId);
salarySobs = salarySobs.stream().filter(sob -> taxAgentIds.contains(sob.getTaxAgentId())).collect(Collectors.toList());
}
return salarySobs.stream().map(m -> {
Map<String, Object> map = new HashMap<>();
map.put("id", String.valueOf(m.getId()));

View File

@ -807,7 +807,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
queryParam.setStartSalaryMonth(getLimitMonth());
List<SalaryMySalaryBillListDTO> list = salarySendInfoMapper.mySalaryBillList(queryParam);
list.forEach(dto -> dto.setEmployeeId(Long.valueOf(user.getUID())));
PageInfo<SalaryMySalaryBillListDTO> pageInfo = new PageInfo<>(list, SalaryMySalaryBillListDTO.class);
pageInfo.setTotal(list.size());
pageInfo.setPageNum(queryParam.getCurrent());
@ -933,6 +933,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
.subcompanyName(simpleEmployee.getSubcompanyName())
.email(StringUtils.isEmpty(simpleEmployee.getEmail()) ? "" : simpleEmployee.getEmail())
.jobcall(simpleEmployee.getJobcall())
.jobcallId(simpleEmployee.getJobcallId())
.companystartdate(simpleEmployee.getCompanystartdate())
.sex("0".equals(simpleEmployee.getSex()) ? "" : "")
.mobile(StringUtils.isEmpty(simpleEmployee.getMobile()) ? "" : simpleEmployee.getMobile())

View File

@ -560,6 +560,30 @@ public class SalaryBillController {
//
// }
/**
* 下载pdf前先进行校验 生成
* @param request
* @param response
* @return
*/
@GET
@Path("/genPdfBeforeExport")
@Produces(MediaType.APPLICATION_JSON)
public String genPdfBeforeExport(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response);
SalaryExportPdfParam salaryExportPdfParam = new SalaryExportPdfParam();
String id = request.getParameter("id");
if (StringUtils.isNotBlank(id)) {
salaryExportPdfParam.setId(Long.valueOf(id));
}
String salarySendId = request.getParameter("salarySendId");
if (StringUtils.isNotBlank(salarySendId)) {
salaryExportPdfParam.setSalarySendId(Long.valueOf(salarySendId));
}
return new ResponseResult<SalaryExportPdfParam, String>(user).run(getSalarySendWrapper(user)::genPdfBeforeExport, salaryExportPdfParam);
}
@GET
@Path("/exportPdf")
public Response downloadPdfFile(@Context HttpServletRequest request, @Context HttpServletResponse response) {

View File

@ -69,7 +69,7 @@ public class SalaryComparisonResultWrapper extends Service {
if (fixedNum == 0) {
fixedNum = 3;
}
for (int i = 0; i < fixedNum; i++) {
for (int i = 0; i < fixedNum && i < weaTableColumns.size(); i++) {
weaTableColumns.get(i).setFixed("left");
}
}

View File

@ -742,4 +742,8 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
public Map<String, String> getToken(Long uid) {
return SalaryTokenUtil.GetToken( uid);
}
public String genPdfBeforeExport(SalaryExportPdfParam salaryExportPdfParam) {
return getSalaryBillService(user).genPdfBeforeExport(salaryExportPdfParam);
}
}