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

# Conflicts:
#	src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java
This commit is contained in:
钱涛 2023-10-08 14:21:25 +08:00
commit 26bbc9c0ee
32 changed files with 723 additions and 272 deletions

View File

@ -0,0 +1,4 @@
genPdf=1
hasSign=1
toPdfToolPath=H:\\tools\\wkhtmltox\\bin\\wkhtmltopdf.exe
genPath=D:\\

View File

@ -52,6 +52,7 @@ import dm.jdbc.util.IdGenerator;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import weaver.hrm.User; import weaver.hrm.User;
@ -630,7 +631,7 @@ public class SIAccountBiz extends Service {
needArchivesPerson.stream().forEach(e -> { needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = otherPerson.get(e); InsuranceSchemeDetailPO po = otherPerson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -700,7 +701,7 @@ public class SIAccountBiz extends Service {
needArchivesCom.stream().forEach(e -> { needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = otherCom.get(e); InsuranceSchemeDetailPO po = otherCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -788,7 +789,7 @@ public class SIAccountBiz extends Service {
needArchivesPerson.stream().forEach(e -> { needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = fundperson.get(e); InsuranceSchemeDetailPO po = fundperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -857,7 +858,7 @@ public class SIAccountBiz extends Service {
needArchivesCom.stream().forEach(e -> { needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = fundCom.get(e); InsuranceSchemeDetailPO po = fundCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -948,7 +949,7 @@ public class SIAccountBiz extends Service {
needArchivesPerson.forEach(e -> { needArchivesPerson.forEach(e -> {
InsuranceSchemeDetailPO po = schemeperson.get(e); InsuranceSchemeDetailPO po = schemeperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1017,7 +1018,7 @@ public class SIAccountBiz extends Service {
needArchivesCom.stream().forEach(e -> { needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = schemeCom.get(e); InsuranceSchemeDetailPO po = schemeCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1519,7 +1520,7 @@ public class SIAccountBiz extends Service {
needArchivesPerson.stream().forEach(e -> { needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = otherPerson.get(e); InsuranceSchemeDetailPO po = otherPerson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1581,7 +1582,7 @@ public class SIAccountBiz extends Service {
needArchivesCom.stream().forEach(e -> { needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = otherCom.get(e); InsuranceSchemeDetailPO po = otherCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1660,7 +1661,7 @@ public class SIAccountBiz extends Service {
needArchivesPerson.stream().forEach(e -> { needArchivesPerson.stream().forEach(e -> {
InsuranceSchemeDetailPO po = fundperson.get(e); InsuranceSchemeDetailPO po = fundperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1721,7 +1722,7 @@ public class SIAccountBiz extends Service {
needArchivesCom.stream().forEach(e -> { needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = fundCom.get(e); InsuranceSchemeDetailPO po = fundCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1804,7 +1805,7 @@ public class SIAccountBiz extends Service {
needArchivesPerson.forEach(e -> { needArchivesPerson.forEach(e -> {
InsuranceSchemeDetailPO po = schemeperson.get(e); InsuranceSchemeDetailPO po = schemeperson.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesPerson.get(String.valueOf(e))) ? "0" : archivesPerson.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1866,7 +1867,7 @@ public class SIAccountBiz extends Service {
needArchivesCom.stream().forEach(e -> { needArchivesCom.stream().forEach(e -> {
InsuranceSchemeDetailPO po = schemeCom.get(e); InsuranceSchemeDetailPO po = schemeCom.get(e);
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(StringUtils.isBlank(archivesCom.get(String.valueOf(e))) ? "0" : archivesCom.get(String.valueOf(e))); BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -1952,7 +1953,8 @@ public class SIAccountBiz extends Service {
needArchivesPerson.forEach(e -> { needArchivesPerson.forEach(e -> {
InsuranceSchemeDetailPO po = schemeperson.get(e); InsuranceSchemeDetailPO po = schemeperson.get(e);
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = new BigDecimal(archivesPerson.get(String.valueOf(e))); // BigDecimal paymentNum = new BigDecimal(archivesPerson.get(String.valueOf(e)));
BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
@ -2022,7 +2024,8 @@ public class SIAccountBiz extends Service {
needArchivesCom.forEach(e -> { needArchivesCom.forEach(e -> {
InsuranceSchemeDetailPO po = schemeCom.get(e); InsuranceSchemeDetailPO po = schemeCom.get(e);
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100")); BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
BigDecimal paymentNum = SalaryEntityUtil.string2BigDecimalDefault0(archivesCom.get(String.valueOf(e))); // BigDecimal paymentNum = SalaryEntityUtil.string2BigDecimalDefault0(archivesCom.get(String.valueOf(e)));
BigDecimal paymentNum = new BigDecimal((ObjectUtils.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost()); BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum(); Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
// BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)); // BigDecimal result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));

View File

@ -0,0 +1,15 @@
package com.engine.salary.constant;
import weaver.general.BaseBean;
public class HrmSalaryPayrollConf {
public static final BaseBean baseBean = new BaseBean();
public static final boolean GEN_PDF = "1".equals(baseBean.getPropValue("hrmSalaryPayroll", "genPdf"));
public static final boolean HAS_SIGN = "1".equals(baseBean.getPropValue("hrmSalaryPayroll", "hasSign"));
public static final String TO_PDF_TOOL_PATH = baseBean.getPropValue("hrmSalaryPayroll", "toPdfToolPath");
public static final String GEN_PATH = baseBean.getPropValue("hrmSalaryPayroll", "genPath");
}

View File

@ -70,6 +70,7 @@ public class DataCollectionEmployee {
@SalaryFormulaVar(defaultLabel = "状态编码", labelId = 98624, dataType = "string") @SalaryFormulaVar(defaultLabel = "状态编码", labelId = 98624, dataType = "string")
private String status; private String status;
private String statusName;
//工号 //工号
@SalaryFormulaVar(defaultLabel = "工号", labelId = 98622, dataType = "string") @SalaryFormulaVar(defaultLabel = "工号", labelId = 98622, dataType = "string")

View File

@ -1,9 +1,11 @@
package com.engine.salary.entity.salaryBill.bo; package com.engine.salary.entity.salaryBill.bo;
import cn.hutool.core.io.FileUtil;
import com.cloudstore.dev.api.bean.MessageBean; import com.cloudstore.dev.api.bean.MessageBean;
import com.cloudstore.dev.api.bean.MessageType; import com.cloudstore.dev.api.bean.MessageType;
import com.cloudstore.dev.api.util.Util_Message; import com.cloudstore.dev.api.util.Util_Message;
import com.engine.salary.annotation.SalaryFormulaVar; import com.engine.salary.annotation.SalaryFormulaVar;
import com.engine.salary.constant.HrmSalaryPayrollConf;
import com.engine.salary.constant.SalaryArchiveConstant; import com.engine.salary.constant.SalaryArchiveConstant;
import com.engine.salary.constant.SalaryBillConstant; import com.engine.salary.constant.SalaryBillConstant;
import com.engine.salary.constant.SalaryTemplateSalaryItemSetGroupConstant; import com.engine.salary.constant.SalaryTemplateSalaryItemSetGroupConstant;
@ -19,17 +21,24 @@ import com.engine.salary.enums.salarybill.SalaryTemplateTextContentPositionEnum;
import com.engine.salary.enums.salarybill.SalaryTemplateWhetherEnum; import com.engine.salary.enums.salarybill.SalaryTemplateWhetherEnum;
import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.pdf.HtmlToPdf;
import com.fapiao.neon.util.Base64Utils;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps; import com.google.common.collect.Maps;
import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.pdfbox.multipdf.PDFMergerUtility;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import weaver.common.MessageUtil; import weaver.common.MessageUtil;
import weaver.conn.RecordSet;
import weaver.email.EmailWorkRunnable; import weaver.email.EmailWorkRunnable;
import weaver.file.ImageFileManager;
import weaver.hrm.company.SubCompanyComInfo; import weaver.hrm.company.SubCompanyComInfo;
import weaver.hrm.resource.ResourceComInfo; import weaver.hrm.resource.ResourceComInfo;
import java.io.IOException; import java.io.*;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
@ -38,6 +47,8 @@ import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.*; import java.util.*;
import static com.engine.salary.constant.HrmSalaryPayrollConf.HAS_SIGN;
public class SalaryBillBO { public class SalaryBillBO {
private static final Logger log = LoggerFactory.getLogger(SalaryBillBO.class); private static final Logger log = LoggerFactory.getLogger(SalaryBillBO.class);
@ -255,23 +266,101 @@ public class SalaryBillBO {
} }
} }
public static void sendEmail(Map<String, Object> e, Map<String, DataCollectionEmployee> allEmployeeMap, SalaryBillSendDTO salaryBillSendParam) { public static void sendEmail(Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) {
StringBuilder emailContent = new StringBuilder(); String content = genPayrollHtmlContent(e, salaryBillSendParam);
emailContent.append("<div class='container' style='position: relative; overflow: auto;'>");
// 消息接收者 // 消息接收者
String receivers = Optional.ofNullable(e.get("email")).orElse("").toString(); String receivers = Optional.ofNullable(e.get("email")).orElse("").toString();
String title = getBillTitle(salaryBillSendParam.getSalaryTemplate().getTheme(), salaryBillSendParam.getSalaryDate(), Long.valueOf(e.get("employeeId").toString())); String title = getBillTitle(salaryBillSendParam.getSalaryTemplate().getTheme(), salaryBillSendParam.getSalaryDate(), Long.valueOf(e.get("employeeId").toString()));
SalaryBillBO.buildEmailContent(emailContent, e, salaryBillSendParam);
// 构建水印内容
buildEmailWatermarkContent(emailContent, e, salaryBillSendParam);
emailContent.append("</div>");
if (StringUtils.isNotBlank(receivers)) { if (StringUtils.isNotBlank(receivers)) {
// MessageUtil.sendEmail(receivers, title, emailContent.toString()); EmailWorkRunnable.threadModeReminder(receivers, title, content);
EmailWorkRunnable.threadModeReminder(receivers, title, emailContent.toString()); }
}
public static void genPdf(Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) {
String content = genPayrollHtmlContent(e, salaryBillSendParam);
String yyyyMM = SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate());
Long sendId = salaryBillSendParam.getSalarySend().getId();
Object id = e.getOrDefault("id", 1L);
String htmlPath = HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator + sendId + File.separator + id + ".html";
FileUtil.del(htmlPath);
File touch = FileUtil.touch(htmlPath);
FileUtil.appendUtf8String(content, touch);
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator+ sendId + File.separator + id + ".pdf";
FileUtil.del(pdfPath);
HtmlToPdf.convert(HrmSalaryPayrollConf.TO_PDF_TOOL_PATH, htmlPath, pdfPath);
}
/**
* 合并pdff
*
* @param pdfPath 最终合并的pdf
* @param filesToMerge 待合并的pdf
*/
public static void mergePdf(String pdfPath, List<String> filesToMerge) {
// 创建PDF合并工具实例
PDFMergerUtility merger = new PDFMergerUtility();
// 遍历要合并的PDF文件列表
for (String file : filesToMerge) {
if (FileUtil.isFile(file)) {
try {
merger.addSource(file); // 将每个文件添加到合并工具
} catch (FileNotFoundException e) {
log.error("PDF合并失败1", e);
}
}
}
// 设置合并后的目标文件
merger.setDestinationFileName(pdfPath);
try {
// 执行合并操作
FileUtil.del(pdfPath);
merger.mergeDocuments();
} catch (IOException e) {
log.error("PDF合并失败2", e);
} }
} }
@NotNull
private static String genPayrollHtmlContent(Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) {
StringBuilder emailContent = new StringBuilder();
emailContent.append("<meta charset=\"UTF-8\">");
emailContent.append("<div class='container' style='position: relative; overflow: auto;'>");
SalaryBillBO.buildEmailContent(emailContent, e, salaryBillSendParam);
// 构建水印内容
buildEmailWatermarkContent(emailContent, e, salaryBillSendParam);
emailContent.append("</div>");
return emailContent.toString();
}
public static byte[] readInputStream(InputStream is) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
byte[] buffer = new byte[1024];
int length = 0;
try {
while ((length = is.read(buffer)) != -1) {
baos.write(buffer, 0, length);
}
baos.flush();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
byte[] data = baos.toByteArray();
try {
is.close();
baos.close();
} catch (IOException e) {
log.error(e.getMessage(), e);
}
return data;
}
public static void sendSMS(SalaryBillSendDTO salaryBillSendParam, Long id, Long employeeId) { public static void sendSMS(SalaryBillSendDTO salaryBillSendParam, Long id, Long employeeId) {
@ -432,7 +521,7 @@ public class SalaryBillBO {
* @return * @return
*/ */
public static void buildEmailContent(StringBuilder emailContent, Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) { public static void buildEmailContent(StringBuilder emailContent, Map<String, Object> e, SalaryBillSendDTO salaryBillSendParam) {
emailContent.append("<div style='display: flex;flex-direction: column;justify-content: flex-start;align-items: center;padding: 16px;'>"); emailContent.append("<div style='display: flex;flex-direction: column;justify-content: flex-start;align-items: center;padding: 16px;background-color: #f6f6f6;width: 850px;margin: 20px auto;box-shadow: 0 0 14px 0 hsla(0,0%,84%,.5);border: 3px solid #fff;'>");
// 1.标题 // 1.标题
emailContent.append("<div style='width: 100%;min-height: 22px; line-height: 30px; font-family: PingFangSC-Medium;font-size: 22px;color: #020202;font-weight: 500;text-align: center;'>"); emailContent.append("<div style='width: 100%;min-height: 22px; line-height: 30px; font-family: PingFangSC-Medium;font-size: 22px;color: #020202;font-weight: 500;text-align: center;'>");
// emailContent.append(salaryBillSendParam.getTitle()); // emailContent.append(salaryBillSendParam.getTitle());
@ -463,6 +552,20 @@ public class SalaryBillBO {
buildMailMain(emailContent, e, salaryBillSendParam); buildMailMain(emailContent, e, salaryBillSendParam);
} }
//签章
if (HAS_SIGN) {
RecordSet rs = new RecordSet();
rs.execute("select * from DocSignature where hrmresid=" + e.getOrDefault("employeeId", "1") + " order by markid");
if (rs.next()) {
int imagefileid = rs.getInt("imagefileid");
InputStream imageInputStream = ImageFileManager.getInputStreamById(imagefileid);
byte[] data = readInputStream(imageInputStream);
String imageBase64 = "data:image/jpeg;base64," + Base64Utils.encodeToString(data);
emailContent.append("<div style='width: 100%;margin-top: 16px;text-align: right;line-height: 1.5715;font-family: PingFangSC-Regular;font-size: 12px;color: #111111;'>\n" +
" <img style='width: 140px;height: 70px;' src='" + imageBase64 + "'>" +
" </div>");
}
}
emailContent.append("</div>"); emailContent.append("</div>");
} }
@ -489,56 +592,53 @@ public class SalaryBillBO {
if (CollectionUtils.isEmpty(salaryItemSet.getItems())) { if (CollectionUtils.isEmpty(salaryItemSet.getItems())) {
continue; continue;
} }
emailContent.append("<div style='margin-bottom: 16px;'>"); emailContent.append(" <div style='margin-bottom: 16px;background-color: #fff;padding: 10px;'>");
if (!salaryItemSet.getGroupId().equals(SalaryTemplateSalaryItemSetGroupConstant.NO_TYPE_GROUP_ID)) { if (!salaryItemSet.getGroupId().equals(SalaryTemplateSalaryItemSetGroupConstant.NO_TYPE_GROUP_ID)) {
emailContent.append("<div style='padding: 0 16px;width: 100%;font-family: PingFangSC-Regular;font-size: 18px;box-sizing: border-box;'>"); emailContent.append("<div style='line-height: 2.5715;width: 100%;font-family: PingFangSC-Regular;font-size: 14px;box-sizing: border-box;color: #000;font-weight: bold;'>");
// 4.1.薪资项目组名 // 4.1.薪资项目组名
emailContent.append(salaryItemSet.getGroupName()); emailContent.append(salaryItemSet.getGroupName());
emailContent.append("</div>"); emailContent.append("</div>");
} }
emailContent.append("<div style='margin-top: 16px;width: 100%;display: flex;flex-direction: column;align-items: flex-start;box-sizing: border-box;'>"); emailContent.append("<table style='table-layout:fixed;border-collapse:collapse;width:100%;border:1px solid rgba(0,0,0,.06);background-color: #fff;'>");
for (int i = 0; i < salaryItemSet.getItems().size(); i++) { emailContent.append("<tbody>");
SalaryTemplateSalaryItemListDTO salaryItem = salaryItemSet.getItems().get(i); List<SalaryTemplateSalaryItemListDTO> items = salaryItemSet.getItems();
// 员工基本信息 List<List<SalaryTemplateSalaryItemListDTO>> itemsPartition = Lists.partition(items, 3);
if (salaryItemSet.getGroupId().equals(SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID) && salaryBillSendParam.getEmployeeInformation() != null) { itemsPartition.forEach(itemPartition -> {
Optional<SalaryTemplateSalaryItemListDTO> optionalEmpItem = salaryBillSendParam.getEmployeeInformation().getItems().stream().filter(f -> f.getId().equals(salaryItem.getId())).findFirst(); emailContent.append("<tr>");
// 4.2.员工信息 for (int i = 0; i < itemPartition.size(); i++) {
emailContent.append("<div style='border: 1px solid #e5e5e5;border-bottom: none;width: 100%;display: flex;justify-content: flex-start;align-items: center;box-sizing: border-box;"); SalaryTemplateSalaryItemListDTO salaryItem = itemPartition.get(i);
emailContent.append(i == (salaryItemSet.getItems().size() - 1) ? "border-bottom: 1px solid #e5e5e5;" : ""); // 员工基本信息
emailContent.append("'>"); if (salaryItemSet.getGroupId().equals(SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID) && salaryBillSendParam.getEmployeeInformation() != null) {
emailContent.append("<div style='min-height: 60px;padding: 0 16px;flex: 2;background: #fbfbfb;border-right: 1px solid #e5e5e5;display: flex;align-items: center;justify-content: left;' title={name}>"); Optional<SalaryTemplateSalaryItemListDTO> optionalEmpItem = salaryBillSendParam.getEmployeeInformation().getItems().stream().filter(f -> f.getId().equals(salaryItem.getId())).findFirst();
emailContent.append("<span class='text'>"); // 4.2.员工信息
emailContent.append((optionalEmpItem.isPresent() ? optionalEmpItem.get().getName() : "")); emailContent.append("<th style=\"background-color:#fafafa;padding:16px 24px;color:#000000d9;font-weight:400;font-size:12px;line-height:1.5715;text-align:start;border:1px solid rgba(0,0,0,.06);min-width:100px;max-width:100px\">");
emailContent.append("</span>"); emailContent.append((optionalEmpItem.isPresent() ? optionalEmpItem.get().getName() : ""));
emailContent.append("</div>"); emailContent.append("</th>");
emailContent.append("<div style='min-height: 60px;flex: 8;padding-left: 16px;background: #ffffff;display: flex;align-items: center;justify-content: left;'>");
emailContent.append((optionalEmpItem.isPresent() ? optionalEmpItem.get().getSalaryItemValue() : "")); emailContent.append("<td style=\"padding: 16px 24px;display: table-cell;flex: 1;color: #000000d9;font-size: 12px;line-height: 1.5715;word-break: break-word;overflow-wrap: break-word;border-collapse: collapse;border: 1px solid rgba(0,0,0,.06);\">");
emailContent.append("</div>"); emailContent.append((optionalEmpItem.isPresent() ? optionalEmpItem.get().getSalaryItemValue() : ""));
emailContent.append("</div>"); emailContent.append("</td>");
} else { } else {
for (Object keyName : e.keySet()) { for (Object keyName : e.keySet()) {
if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) { if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) {
boolean isHide = (isHideNull && e.get(keyName.toString()) != null) || (isHideZero && "0.00".equals(e.get(keyName.toString()))); boolean isHide = (isHideNull && e.get(keyName.toString()) != null) || (isHideZero && "0.00".equals(e.get(keyName.toString())));
// 4.2.薪资项目 // 4.2.薪资项目
emailContent.append("<div style='border: 1px solid #e5e5e5;border-bottom: none;width: 100%;display: flex;justify-content: flex-start;align-items: center;box-sizing: border-box;"); emailContent.append("<th style=\"background-color:#fafafa;padding:16px 24px;color:#000000d9;font-weight:400;font-size:12px;line-height:1.5715;text-align:start;border:1px solid rgba(0,0,0,.06);min-width:100px;max-width:100px\">");
emailContent.append(i == (salaryItemSet.getItems().size() - 1) ? "border-bottom: 1px solid #e5e5e5;" : ""); emailContent.append(salaryItem.getName());
emailContent.append((isHide ? "display: none" : "")); emailContent.append("</th>");
emailContent.append("'>");
emailContent.append("<div style='min-height: 60px;padding: 0 16px;flex: 2;background: #fbfbfb;border-right: 1px solid #e5e5e5;display: flex;align-items: center;justify-content: left;' title={name}>"); emailContent.append("<td style=\"padding: 16px 24px;display: table-cell;flex: 1;color: #000000d9;font-size: 12px;line-height: 1.5715;word-break: break-word;overflow-wrap: break-word;border-collapse: collapse;border: 1px solid rgba(0,0,0,.06);\">");
emailContent.append("<span class='text'>"); emailContent.append(e.get(keyName.toString()));
emailContent.append(salaryItem.getName()); emailContent.append("</td>");
emailContent.append("</span>"); break;
emailContent.append("</div>"); }
emailContent.append("<div style='min-height: 60px;flex: 8;padding-left: 16px;background: #ffffff;display: flex;align-items: center;justify-content: left;'>");
emailContent.append(e.get(keyName.toString()));
emailContent.append("</div>");
emailContent.append("</div>");
break;
} }
} }
} }
} emailContent.append("</tr>");
emailContent.append("</div>"); });
emailContent.append("</tbody>");
emailContent.append("</table>");
emailContent.append("</div>"); emailContent.append("</div>");
} }
emailContent.append("</div>"); emailContent.append("</div>");
@ -586,29 +686,36 @@ public class SalaryBillBO {
emailContent.append("</div>"); emailContent.append("</div>");
emailContent.append("</div>"); emailContent.append("</div>");
for (int i = 0; i < salaryItemSet.getItems().size(); i++) { emailContent.append("<table style='table-layout:fixed;border-collapse:collapse;width:100%;border:1px solid rgba(0,0,0,.06);background-color: #fff;'>");
SalaryTemplateSalaryItemListDTO salaryItem = salaryItemSet.getItems().get(i); emailContent.append("<tbody>");
for (Object keyName : e.keySet()) { List<SalaryTemplateSalaryItemListDTO> items = salaryItemSet.getItems();
if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) { List<List<SalaryTemplateSalaryItemListDTO>> itemsPartition = Lists.partition(items, 3);
boolean isHide = (isHideNull && e.get(keyName.toString()) != null) || (isHideZero && "0.00".equals(e.get(keyName.toString()))); itemsPartition.forEach(itemPartition -> {
// 4.2.薪资项目 emailContent.append("<tr>");
emailContent.append("<div style='border: 1px solid #e5e5e5;border-bottom: none;width: 100%;display: flex;justify-content: flex-start;align-items: center;box-sizing: border-box;"); for (int i = 0; i < itemPartition.size(); i++) {
emailContent.append(i == (salaryItemSet.getItems().size() - 1) && salaryBillSendParam.getSalaryTemplate().getTextContentPosition() == SalaryTemplateTextContentPositionEnum.BEFORE.getValue() ? "border-bottom: 1px solid #e5e5e5;" : ""); SalaryTemplateSalaryItemListDTO salaryItem = itemPartition.get(i);
emailContent.append((isHide ? "display: none" : "")); for (Object keyName : e.keySet()) {
emailContent.append("'>"); if ((salaryItem.getId() + SalaryArchiveConstant.DYNAMIC_SUFFIX).equals(keyName.toString())) {
emailContent.append("<div style='min-height: 60px;padding: 0 16px;flex: 2;background: #fbfbfb;border-right: 1px solid #e5e5e5;display: flex;align-items: center;justify-content: left;' title={name}>"); boolean isHide = (isHideNull && e.get(keyName.toString()) != null) || (isHideZero && "0.00".equals(e.get(keyName.toString())));
emailContent.append("<span class='text'>"); // 4.2.薪资项目
emailContent.append(salaryItem.getName()); emailContent.append("<th style=\"background-color:#fafafa;padding:16px 24px;color:#000000d9;font-weight:400;font-size:12px;line-height:1.5715;text-align:start;border:1px solid rgba(0,0,0,.06);min-width:100px;max-width:100px\">");
emailContent.append("</span>"); emailContent.append(salaryItem.getName());
emailContent.append("</div>"); emailContent.append("</th>");
emailContent.append("<div style='min-height: 60px;flex: 8;padding-left: 16px;background: #ffffff;display: flex;align-items: center;justify-content: left;'>");
emailContent.append(e.get(keyName.toString())); emailContent.append("<td style=\"padding: 16px 24px;display: table-cell;flex: 1;color: #000000d9;font-size: 12px;line-height: 1.5715;word-break: break-word;overflow-wrap: break-word;border-collapse: collapse;border: 1px solid rgba(0,0,0,.06);\">");
emailContent.append("</div>"); emailContent.append(e.get(keyName.toString()));
emailContent.append("</div>"); emailContent.append("</td>");
break; break;
}
} }
} }
} emailContent.append("</tr>");
});
emailContent.append("</tbody>");
emailContent.append("</table>");
// 5.文本内容-如果在薪资项目后 // 5.文本内容-如果在薪资项目后
emailContent.append("<div style='border: 1px solid #e5e5e5;border-bottom: none;width: 100%;display: flex;justify-content: flex-start;align-items: center;box-sizing: border-box;"); emailContent.append("<div style='border: 1px solid #e5e5e5;border-bottom: none;width: 100%;display: flex;justify-content: flex-start;align-items: center;box-sizing: border-box;");
emailContent.append(salaryBillSendParam.getSalaryTemplate().getTextContentPosition() == SalaryTemplateTextContentPositionEnum.AFTER.getValue() ? "border-bottom: 1px solid #e5e5e5;" : "display: none"); emailContent.append(salaryBillSendParam.getSalaryTemplate().getTextContentPosition() == SalaryTemplateTextContentPositionEnum.AFTER.getValue() ? "border-bottom: 1px solid #e5e5e5;" : "display: none");
@ -644,7 +751,7 @@ public class SalaryBillBO {
/** /**
* 构建水印 * 构建水印
* * <p>
* 当前所拥有的变量 * 当前所拥有的变量
* "HRM_Name",当前操作者姓名 * "HRM_Name",当前操作者姓名
* "HRM_Num",当前操作者编号 * "HRM_Num",当前操作者编号
@ -715,7 +822,7 @@ public class SalaryBillBO {
List<String> wmTextFieldIds = Collections.emptyList(); List<String> wmTextFieldIds = Collections.emptyList();
// 没有水印关闭水印或者系统水印则不拼接 // 没有水印关闭水印或者系统水印则不拼接
// if (Objects.isNull(salaryBillWatermark) || !salaryBillWatermark.getWatermarkStatus() || !SalaryTemplateWatermarkTypeEnum.CUSTOM.getValue().equals(salaryBillWatermark.getWatermarkType())) { // if (Objects.isNull(salaryBillWatermark) || !salaryBillWatermark.getWatermarkStatus() || !SalaryTemplateWatermarkTypeEnum.CUSTOM.getValue().equals(salaryBillWatermark.getWatermarkType())) {
if (Objects.isNull(salaryBillWatermark) || !salaryBillWatermark.getWatermarkStatus() ) { if (Objects.isNull(salaryBillWatermark) || !salaryBillWatermark.getWatermarkStatus()) {
return wmTextFieldIds; return wmTextFieldIds;
} }
String wmClassify = salaryBillWatermark.getWmSetting().getOrDefault("wmClassify", StringUtils.EMPTY).toString(); String wmClassify = salaryBillWatermark.getWmSetting().getOrDefault("wmClassify", StringUtils.EMPTY).toString();
@ -762,7 +869,7 @@ public class SalaryBillBO {
public static String buildEmailWmContentTemplate(boolean isEnableEmail, SalaryBillWatermarkDTO watermarkSetting) { public static String buildEmailWmContentTemplate(boolean isEnableEmail, SalaryBillWatermarkDTO watermarkSetting) {
String emailWmContentTemplate = StringUtils.EMPTY; String emailWmContentTemplate = StringUtils.EMPTY;
// 没有水印关闭水印则不拼接 // 没有水印关闭水印则不拼接
if (!isEnableEmail || Objects.isNull(watermarkSetting) || !watermarkSetting.getWatermarkStatus() ) { if (!isEnableEmail || Objects.isNull(watermarkSetting) || !watermarkSetting.getWatermarkStatus()) {
return emailWmContentTemplate; return emailWmContentTemplate;
} }
String wmClassify = watermarkSetting.getWmSetting().getOrDefault("wmClassify", StringUtils.EMPTY).toString(); String wmClassify = watermarkSetting.getWmSetting().getOrDefault("wmClassify", StringUtils.EMPTY).toString();
@ -789,7 +896,7 @@ public class SalaryBillBO {
for (int i = 0; i < 20; i++) { for (int i = 0; i < 20; i++) {
emailWmContentTemp.append("<div class='row' style='width: 100%; min-height: 150px ; overflow: hidden; display: flex;justify-content: center;justify-content: center;'>"); emailWmContentTemp.append("<div class='row' style='width: 100%; min-height: 150px ; overflow: hidden; display: flex;justify-content: center;justify-content: center;'>");
for (int j = 0; j < 8; j++) { for (int j = 0; j < 8; j++) {
emailWmContentTemp.append("<div class='item' style='display: flex;flex-direction: column; align-items: center;justify-content: center; min-width: 200px; height: 150px;opacity: "+noTransparent+"; transform: rotate(-"+wmRotate+"deg);'>"); emailWmContentTemp.append("<div class='item' style='display: flex;flex-direction: column; align-items: center;justify-content: center; min-width: 200px; height: 150px;opacity: " + noTransparent + "; transform: rotate(-" + wmRotate + "deg);'>");
// 赋值 // 赋值
emailWmContentTemp.append(variable); emailWmContentTemp.append(variable);
emailWmContentTemp.append("</div>"); emailWmContentTemp.append("</div>");
@ -801,7 +908,7 @@ public class SalaryBillBO {
return emailWmContentTemp.toString(); return emailWmContentTemp.toString();
} }
public static String handleWmText(String wmText, List<String> wmTextFieldIds, DataCollectionEmployee simpleEmployee){ public static String handleWmText(String wmText, List<String> wmTextFieldIds, DataCollectionEmployee simpleEmployee) {
for (String wmTextFieldId : wmTextFieldIds) { for (String wmTextFieldId : wmTextFieldIds) {
// 当前操作者姓名 // 当前操作者姓名
if (SalaryBillConstant.HRM_Name.equals(wmTextFieldId)) { if (SalaryBillConstant.HRM_Name.equals(wmTextFieldId)) {
@ -820,10 +927,10 @@ public class SalaryBillBO {
wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_CurrentOperatorId, Objects.isNull(simpleEmployee) ? StringUtils.EMPTY : simpleEmployee.getEmployeeId().toString()); wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_CurrentOperatorId, Objects.isNull(simpleEmployee) ? StringUtils.EMPTY : simpleEmployee.getEmployeeId().toString());
// 当前操作者部门 // 当前操作者部门
} else if (SalaryBillConstant.HRM_Department.equals(wmTextFieldId)) { } else if (SalaryBillConstant.HRM_Department.equals(wmTextFieldId)) {
wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_Department, Objects.isNull(simpleEmployee) || Objects.isNull(simpleEmployee.getDepartmentName()) ? StringUtils.EMPTY : simpleEmployee.getDepartmentName()); wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_Department, Objects.isNull(simpleEmployee) || Objects.isNull(simpleEmployee.getDepartmentName()) ? StringUtils.EMPTY : simpleEmployee.getDepartmentName());
// 当前操作者分部 // 当前操作者分部
} else if (SalaryBillConstant.HRM_SecondDepartment.equals(wmTextFieldId)) { } else if (SalaryBillConstant.HRM_SecondDepartment.equals(wmTextFieldId)) {
wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_SecondDepartment, Objects.isNull(simpleEmployee) || Objects.isNull(simpleEmployee.getSubcompanyName()) ? StringUtils.EMPTY : simpleEmployee.getSubcompanyName()); wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_SecondDepartment, Objects.isNull(simpleEmployee) || Objects.isNull(simpleEmployee.getSubcompanyName()) ? StringUtils.EMPTY : simpleEmployee.getSubcompanyName());
// 当前日期 // 当前日期
} else if (SalaryBillConstant.HRM_CurrentDate.equals(wmTextFieldId)) { } else if (SalaryBillConstant.HRM_CurrentDate.equals(wmTextFieldId)) {
wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_CurrentDate, SalaryDateUtil.getFormatLocalDate(LocalDate.now())); wmText = wmText.replace(SalaryBillConstant.HRM_prefix + SalaryBillConstant.HRM_CurrentDate, SalaryDateUtil.getFormatLocalDate(LocalDate.now()));

View File

@ -32,4 +32,7 @@ public class SalaryBaseSetFormDTO {
// 工资单反馈设置 // 工资单反馈设置
private SalaryBillAckFeedbackDTO ackFeedbackSetting; private SalaryBillAckFeedbackDTO ackFeedbackSetting;
//工资单时效查看限制
private com.engine.salary.entity.salaryBill.dto.salaryBillViewingLimitSetting salaryBillViewingLimitSetting;
} }

View File

@ -0,0 +1,28 @@
package com.engine.salary.entity.salaryBill.dto;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 工资单时效查看限制
* <p>Copyright: Copyright (c) 2023</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class salaryBillViewingLimitSetting {
/**
* 查看几月内的工资单
*/
private Integer limitMonth;
}

View File

@ -37,6 +37,9 @@ public class SalaryBaseSetSaveParam {
// 工资单确认反馈设置 // 工资单确认反馈设置
private SalaryBillAckFeedbackDTO ackFeedbackSetting; private SalaryBillAckFeedbackDTO ackFeedbackSetting;
//工资单时效性
private com.engine.salary.entity.salaryBill.dto.salaryBillViewingLimitSetting salaryBillViewingLimitSetting;
public static void checkParam(SalaryBaseSetSaveParam saveParam) { public static void checkParam(SalaryBaseSetSaveParam saveParam) {
if (Objects.isNull(saveParam.getWatermarkStatus())) { if (Objects.isNull(saveParam.getWatermarkStatus())) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(220418, "是否启用水印必传")); throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(220418, "是否启用水印必传"));

View File

@ -6,8 +6,6 @@ import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import java.time.LocalDate;
import java.time.YearMonth;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
@ -30,6 +28,9 @@ public class SalaryBillQueryParam extends BaseQueryParam {
// @JsonIgnore // @JsonIgnore
private List<Date> salaryMonth; private List<Date> salaryMonth;
private Date startSalaryMonth;
// @JsonIgnore // @JsonIgnore
private Long employeeId; private Long employeeId;

View File

@ -0,0 +1,26 @@
package com.engine.salary.entity.salaryBill.param;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 工资单导出pdf参数
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class SalaryExportPdfParam {
/**
* 工资单发放Id
*/
private Long salarySendId;
/**
* 主键id
*/
private Long id;
}

View File

@ -106,6 +106,7 @@ public class SalaryAcctFormulaBO {
.telephone(simpleEmployee.getTelephone()) .telephone(simpleEmployee.getTelephone())
.sex(sexName) .sex(sexName)
.status(simpleEmployee.getStatus()) .status(simpleEmployee.getStatus())
.statusName(simpleEmployee.getStatusName())
.departmentName(simpleEmployee.getDepartmentName()) .departmentName(simpleEmployee.getDepartmentName())
.departmentId(simpleEmployee.getDepartmentId()) .departmentId(simpleEmployee.getDepartmentId())
.subcompanyName(simpleEmployee.getSubcompanyName()) .subcompanyName(simpleEmployee.getSubcompanyName())

View File

@ -62,6 +62,9 @@ public class SalaryFormulaEmployeeDTO {
//状态 //状态
private String status; private String status;
@SalaryFormulaVar(defaultLabel = "状态", labelId = 98622, dataType = "string")
private String statusName;
//工号 //工号
@SalaryFormulaVar(defaultLabel = "工号", labelId = 98622, dataType = "string") @SalaryFormulaVar(defaultLabel = "工号", labelId = 98622, dataType = "string")
private String workcode; private String workcode;

View File

@ -103,5 +103,13 @@ public enum UserStatusEnum implements BaseEnum {
.map(v -> HrmStatus.builder().id(v.value.toString()).name(v.defaultLabel).build()).collect(Collectors.toList()); .map(v -> HrmStatus.builder().id(v.value.toString()).name(v.defaultLabel).build()).collect(Collectors.toList());
} }
public static UserStatusEnum parseByValue(Integer value) {
for (UserStatusEnum statusEnum : UserStatusEnum.values()) {
if (Objects.equals(statusEnum.getValue(), value)) {
return statusEnum;
}
}
return null;
}
} }

View File

@ -17,7 +17,8 @@ public enum SalarySQLReferenceEnum implements BaseEnum<String> {
EMPLOYEE_INFO("employeeInfo", "员工基本信息", 85366), EMPLOYEE_INFO("employeeInfo", "员工基本信息", 85366),
SALARY_ACCT_EMPLOYEE("salaryAcctEmployee", "核算基本信息", 85368), SALARY_ACCT_EMPLOYEE("salaryAcctEmployee", "核算基本信息", 85368),
SALARY_CYCLE("SalaryCycle", "核算日期", 85368); SALARY_CYCLE("SalaryCycle", "核算日期", 85368),
SALARY_ITEM("salaryItem", "薪资项目", 85368);
private String value; private String value;
private String defaultLabel; private String defaultLabel;

View File

@ -604,6 +604,9 @@
AND (t1.salary_month BETWEEN #{param.salaryMonth[0]} AND #{param.salaryMonth[1]}) AND (t1.salary_month BETWEEN #{param.salaryMonth[0]} AND #{param.salaryMonth[1]})
</if> </if>
</if> </if>
<if test="param.startSalaryMonth != null">
AND t1.salary_month >= #{param.startSalaryMonth}
</if>
ORDER BY t1.id DESC ORDER BY t1.id DESC
</select> </select>

View File

@ -118,7 +118,7 @@ public interface SalaryAcctResultService {
* *
* @param salaryAcctResultPOS 薪资核算结果 * @param salaryAcctResultPOS 薪资核算结果
*/ */
void batchSave(Collection<SalaryAcctResultPO> salaryAcctResultPOS); void batchSave(List<SalaryAcctResultPO> salaryAcctResultPOS);
/** /**
* 根据薪资核算人员id删除薪资核算结果 * 根据薪资核算人员id删除薪资核算结果

View File

@ -1,6 +1,7 @@
package com.engine.salary.service; package com.engine.salary.service;
import com.engine.salary.entity.salaryBill.dto.SalaryBillAckFeedbackDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillAckFeedbackDTO;
import com.engine.salary.entity.salaryBill.dto.salaryBillViewingLimitSetting;
import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO;
import com.engine.salary.entity.salaryBill.param.SalaryBaseSetSaveParam; import com.engine.salary.entity.salaryBill.param.SalaryBaseSetSaveParam;
@ -48,4 +49,12 @@ public interface SalaryBillBaseSetService {
* @return * @return
*/ */
SalaryBillAckFeedbackDTO getDefaultAckFeedbackSetting(); SalaryBillAckFeedbackDTO getDefaultAckFeedbackSetting();
/**
* 获取工资单失效限制
* @return
*/
salaryBillViewingLimitSetting getSalaryBillViewingLimitSetting();
} }

View File

@ -1,5 +1,6 @@
package com.engine.salary.service; package com.engine.salary.service;
import com.engine.salary.entity.salaryBill.param.SalaryExportPdfParam;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam; import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import java.util.List; import java.util.List;
@ -42,6 +43,9 @@ public interface SalaryBillService {
*/ */
void feedBackSalaryBill(Long salaryInfoId); void feedBackSalaryBill(Long salaryInfoId);
String exportPdf(SalaryExportPdfParam param);
/** /**
* 工资单撤回 * 工资单撤回
* *

View File

@ -120,6 +120,9 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
case SALARY_CYCLE: case SALARY_CYCLE:
vars = convert2FormulaVar(SalarySobCycleDTO.class, referenceEnum.getValue() + ""); vars = convert2FormulaVar(SalarySobCycleDTO.class, referenceEnum.getValue() + "");
break; break;
case SALARY_ITEM:
vars = salaryItem2FormulaVar(SalaryFormulaReferenceEnum.SALARY_ITEM, extendParam);
break;
default: default:
break; break;
} }
@ -219,6 +222,8 @@ public class RemoteExcelServiceImpl extends Service implements RemoteExcelServic
convert2FormulaVar(SalaryAcctEmployeePO.class, SalarySQLReferenceEnum.SALARY_ACCT_EMPLOYEE.getValue() + "")); convert2FormulaVar(SalaryAcctEmployeePO.class, SalarySQLReferenceEnum.SALARY_ACCT_EMPLOYEE.getValue() + ""));
result.put(SalarySQLReferenceEnum.SALARY_CYCLE.getDefaultLabel(), result.put(SalarySQLReferenceEnum.SALARY_CYCLE.getDefaultLabel(),
convert2FormulaVar(SalarySobCycleDTO.class, SalarySQLReferenceEnum.SALARY_CYCLE.getValue() + "")); convert2FormulaVar(SalarySobCycleDTO.class, SalarySQLReferenceEnum.SALARY_CYCLE.getValue() + ""));
result.put(SalarySQLReferenceEnum.SALARY_ITEM.getDefaultLabel(),
salaryItem2FormulaVar(SalaryFormulaReferenceEnum.SALARY_ITEM, null));
return result; return result;
} }

View File

@ -34,6 +34,7 @@ import org.apache.commons.collections4.ListUtils;
import org.apache.commons.collections4.MapUtils; import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import org.springframework.util.StopWatch;
import weaver.general.BaseBean; import weaver.general.BaseBean;
import weaver.hrm.User; import weaver.hrm.User;
import weaver.wechat.util.Utils; import weaver.wechat.util.Utils;
@ -111,17 +112,23 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
@Override @Override
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) { public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
StopWatch sw = new StopWatch(salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+"");
Date now = new Date(); Date now = new Date();
try { try {
// 数据库字段加密用 // 数据库字段加密用
// 1查询人员信息 // 1查询人员信息
sw.start("核算耗时查询人员信息");
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
SalarySobCycleDTO salarySobCycleDTO = salaryAcctCalculateBO.getSalarySobCycleDTO(); SalarySobCycleDTO salarySobCycleDTO = salaryAcctCalculateBO.getSalarySobCycleDTO();
Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId(); Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId();
sw.stop();
// 2查询薪资档案的数据 // 2查询薪资档案的数据
sw.start("核算耗时查询薪资档案的数据");
List<SalaryArchiveDataDTO> salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId); List<SalaryArchiveDataDTO> salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
sw.stop();
// 3查询往期累计情况(查询的是上个税款所属期的的累计情况) // 3查询往期累计情况(查询的是上个税款所属期的的累计情况)
sw.start("核算耗时查询往期累计情况");
List<AddUpSituation> addUpSituationPOS; List<AddUpSituation> addUpSituationPOS;
if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) { if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) {
// 3.1如果当前税款所属期是本年度第一个税款所属期就不需要查询往期累计情况 // 3.1如果当前税款所属期是本年度第一个税款所属期就不需要查询往期累计情况
@ -129,19 +136,30 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
} else { } else {
addUpSituationPOS = getAddUpSituationService(user).getAddUpSituationList(salarySobCycleDTO.getTaxCycle().plusMonths(-1), employeeIds); addUpSituationPOS = getAddUpSituationService(user).getAddUpSituationList(salarySobCycleDTO.getTaxCycle().plusMonths(-1), employeeIds);
} }
sw.stop();
// 4查询累计专项附加扣除 // 4查询累计专项附加扣除
sw.start("核算耗时查询累计专项附加扣除");
List<AddUpDeduction> addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); List<AddUpDeduction> addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
sw.stop();
// 5查询其他免税扣除 // 5查询其他免税扣除
sw.start("核算耗时查询其他免税扣除");
List<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); List<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
sw.stop();
//6查询社保福利 //6查询社保福利
sw.start("核算耗时查询社保福利");
List<Map<String, Object>> welfareData = getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId); List<Map<String, Object>> welfareData = getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId);
sw.stop();
// 7查询考勤数据 // 7查询考勤数据
sw.start("核算耗时查询考勤数据");
List<AttendQuoteDataDTO> attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds); List<AttendQuoteDataDTO> attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds);
sw.stop();
// 8查询薪资核算人员的薪资核算结果 // 8查询薪资核算人员的薪资核算结果
sw.start("核算耗时查询薪资核算人员的薪资核算结果");
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList()); List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
sw.stop();
// 薪资回算时回算前的核算结果 (没有回算项) // 薪资回算时回算前的核算结果 (没有回算项)
sw.start("核算耗时查询薪资回算时回算前的核算结果");
Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId())); Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId()));
Map<String, String> salaryAcctResultPOMap = new HashMap<>(); Map<String, String> salaryAcctResultPOMap = new HashMap<>();
for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) { for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) {
@ -150,18 +168,24 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
//核算锁定的值 //核算锁定的值
Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS()); Map<String, SalaryAcctResultPO> salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS());
List<Long> lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds()); List<Long> lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds());
sw.stop();
// 9查询相同税款所属期内涉及合并计税的其他薪资核算结果 // 9查询相同税款所属期内涉及合并计税的其他薪资核算结果
sw.start("核算耗时查询相同税款所属期内涉及合并计税的其他薪资核算结果");
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId); Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId);
List<SalaryAcctResultPO> otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); List<SalaryAcctResultPO> otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
Map<String, List<SalaryAcctResultPO>> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId()); Map<String, List<SalaryAcctResultPO>> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId());
sw.stop();
// 9.1查询相同税款所属期内设计合并计税的其他薪资核算人员 // 9.1查询相同税款所属期内设计合并计税的其他薪资核算人员
sw.start("核算耗时查询相同税款所属期内设计合并计税的其他薪资核算人员");
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
Map<String, List<SalaryAcctEmployeePO>> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()); Map<String, List<SalaryAcctEmployeePO>> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
sw.stop();
// 10转换成公式编辑器中的变量 // 10转换成公式编辑器中的变量
sw.start("核算耗时转换成公式编辑器中的变量");
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS); CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS);
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO); Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
sw.stop();
sw.start("核算耗时数据结构准备");
// 本次薪资核算所用的薪资账套下的薪资项目 // 本次薪资核算所用的薪资账套下的薪资项目
Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId); Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId);
// 本次薪资核算所用的公式 // 本次薪资核算所用的公式
@ -172,7 +196,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
Set<Long> salarySobBackItemIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId); Set<Long> salarySobBackItemIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId);
Map<Long, SalarySobBackItemPO> salarySobBackItemMap = SalaryEntityUtil.convert2Map(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId); Map<Long, SalarySobBackItemPO> salarySobBackItemMap = SalaryEntityUtil.convert2Map(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId);
List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = Lists.newArrayList(); List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = Lists.newArrayList();
sw.stop();
// 开始核算 // 开始核算
sw.start("核算耗时核算耗时");
StringBuffer noticeMsg = new StringBuffer(); StringBuffer noticeMsg = new StringBuffer();
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) { for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId(); Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId();
@ -260,13 +286,19 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
} }
} }
} }
sw.stop();
// 保存新的薪资核算结果临时存储 // 保存新的薪资核算结果临时存储
sw.start("核算耗时保存新的薪资核算结果(临时存储)");
getSalaryAcctResultTempService(user).batchSave(salaryAcctResultTempPOS); getSalaryAcctResultTempService(user).batchSave(salaryAcctResultTempPOS);
sw.stop();
// 更新薪资核算进度 // 更新薪资核算进度
sw.start("更新薪资核算进度");
getSalaryAcctProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.ACCT_PROGRESS + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId(), getSalaryAcctProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.ACCT_PROGRESS + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId(),
salaryAcctCalculateBO.getSalaryAcctEmployeePOS().size(), salaryAcctCalculateBO.getSalaryAcctEmployeePOS().size(),
noticeMsg.toString() noticeMsg.toString()
); );
sw.stop();
log.info("核算耗时明细" + sw.prettyPrint());
// 记录子线程执行结果 // 记录子线程执行结果
salaryAcctCalculateBO.getResults().add(new SalaryAcctCalculateBO.Result(true, StringUtils.EMPTY)); salaryAcctCalculateBO.getResults().add(new SalaryAcctCalculateBO.Result(true, StringUtils.EMPTY));
} catch (Exception e) { } catch (Exception e) {

View File

@ -24,6 +24,7 @@ import com.engine.salary.entity.salarysob.po.*;
import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO; import com.engine.salary.entity.taxagent.po.TaxAgentAdminPO;
import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.enums.SalaryValueTypeEnum; import com.engine.salary.enums.SalaryValueTypeEnum;
import com.engine.salary.enums.UserStatusEnum;
import com.engine.salary.enums.salaryaccounting.LockStatusEnum; import com.engine.salary.enums.salaryaccounting.LockStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctRecordStatusEnum;
import com.engine.salary.enums.salaryaccounting.SalaryAcctResultDataSourceEnum; import com.engine.salary.enums.salaryaccounting.SalaryAcctResultDataSourceEnum;
@ -59,6 +60,7 @@ import org.apache.commons.lang3.math.NumberUtils;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.jdbc.datasource.DataSourceTransactionManager; import org.springframework.jdbc.datasource.DataSourceTransactionManager;
import org.springframework.util.StopWatch;
import weaver.hrm.User; import weaver.hrm.User;
import java.math.BigDecimal; import java.math.BigDecimal;
@ -352,13 +354,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
Map<Long, List<SalaryAcctResultPO>> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryItemId); Map<Long, List<SalaryAcctResultPO>> acctResultMap = SalaryEntityUtil.group2Map(salaryAcctResultPOS, SalaryAcctResultPO::getSalaryItemId);
salaryItemPOS.stream().filter(item -> SalaryDataTypeEnum.NUMBER.getValue().equals(item.getDataType())).forEach(item -> { salaryItemPOS.stream().filter(item -> SalaryDataTypeEnum.NUMBER.getValue().equals(item.getDataType())).forEach(item -> {
BigDecimal sum = Optional.ofNullable(acctResultMap.get(item.getId())) BigDecimal sum = Optional.ofNullable(acctResultMap.get(item.getId())).orElse(new ArrayList<>()).stream().map(SalaryAcctResultPO::getResultValue).filter(NumberUtils::isCreatable).map(BigDecimal::new).reduce(BigDecimal.ZERO, BigDecimal::add);
.orElse(new ArrayList<>())
.stream()
.map(SalaryAcctResultPO::getResultValue)
.filter(NumberUtils::isCreatable)
.map(BigDecimal::new)
.reduce(BigDecimal.ZERO, BigDecimal::add);
map.put(item.getId().toString(), SalaryAcctFormulaBO.roundResultValue(sum.toString(), item, Collections.emptyList(), Collections.emptyMap(), salaryItemIdKeySalarySobItemPOMap)); map.put(item.getId().toString(), SalaryAcctFormulaBO.roundResultValue(sum.toString(), item, Collections.emptyList(), Collections.emptyMap(), salaryItemIdKeySalarySobItemPOMap));
}); });
return map; return map;
@ -408,6 +404,12 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// 查询人员信息 // 查询人员信息
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
simpleEmployees.forEach(e->{
UserStatusEnum userStatusEnum = UserStatusEnum.parseByValue(Integer.parseInt(e.getStatus()));
if(userStatusEnum != null){
e.setStatusName(userStatusEnum.getDefaultLabel());
}
});
// 查询个税扣缴义务人 // 查询个税扣缴义务人
Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId); Set<Long> taxAgentIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getTaxAgentId);
List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds); List<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listByIds(taxAgentIds);
@ -445,8 +447,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}); });
// 转换成薪资核算结果列表 // 转换成薪资核算结果列表
return SalaryAcctResultBO.buildTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, return SalaryAcctResultBO.buildTableData(salaryItemPOS, salarySobEmpFieldPOS, simpleEmployees, salaryAcctEmployeePOS, salaryAcctResultPOS, taxAgentPOS, salaryAcctEmployeeIds4ConsolidatedTax, customParameters, customBackCalcParameters, isBackCalc);
salaryAcctEmployeeIds4ConsolidatedTax, customParameters, customBackCalcParameters, isBackCalc);
} }
@ -510,22 +511,12 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
for (SalarySobItemIncomeCategoryDTO incomeCategoryDTO : salarySobItemAggregateDTO.getIncomeCategories()) { for (SalarySobItemIncomeCategoryDTO incomeCategoryDTO : salarySobItemAggregateDTO.getIncomeCategories()) {
for (SalarySobItemGroupDTO salarySobItemGroupDTO : incomeCategoryDTO.getItemGroups()) { for (SalarySobItemGroupDTO salarySobItemGroupDTO : incomeCategoryDTO.getItemGroups()) {
for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) { for (SalarySobItemDTO salarySobItemDTO : salarySobItemGroupDTO.getItems()) {
SalaryAcctResultListColumnDTO salaryAcctResultListColumnDTO = new SalaryAcctResultListColumnDTO() SalaryAcctResultListColumnDTO salaryAcctResultListColumnDTO = new SalaryAcctResultListColumnDTO().setColumnName(salarySobItemDTO.getName()).setFormulaId(salarySobItemDTO.getFormulaId()).setFormulaContent(salarySobItemDTO.getFormulaContent()).setShowLock((!Objects.equals(salarySobItemDTO.getFormulaId(), NumberUtils.LONG_ZERO) && salarySobItemDTO.isCanEdit()) || Objects.equals(salarySobItemDTO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE));
.setColumnName(salarySobItemDTO.getName())
.setFormulaId(salarySobItemDTO.getFormulaId())
.setFormulaContent(salarySobItemDTO.getFormulaContent())
.setShowLock((!Objects.equals(salarySobItemDTO.getFormulaId(), NumberUtils.LONG_ZERO) && salarySobItemDTO.isCanEdit())
|| Objects.equals(salarySobItemDTO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE));
resultMap.put("" + salarySobItemDTO.getSalaryItemId(), salaryAcctResultListColumnDTO); resultMap.put("" + salarySobItemDTO.getSalaryItemId(), salaryAcctResultListColumnDTO);
} }
} }
for (SalarySobItemDTO salarySobItemDTO : incomeCategoryDTO.getItems()) { for (SalarySobItemDTO salarySobItemDTO : incomeCategoryDTO.getItems()) {
SalaryAcctResultListColumnDTO salaryAcctResultListColumnDTO = new SalaryAcctResultListColumnDTO() SalaryAcctResultListColumnDTO salaryAcctResultListColumnDTO = new SalaryAcctResultListColumnDTO().setColumnName(salarySobItemDTO.getName()).setFormulaId(salarySobItemDTO.getFormulaId()).setFormulaContent(salarySobItemDTO.getFormulaContent()).setShowLock((!Objects.equals(salarySobItemDTO.getFormulaId(), NumberUtils.LONG_ZERO) && salarySobItemDTO.isCanEdit()) || Objects.equals(salarySobItemDTO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE));
.setColumnName(salarySobItemDTO.getName())
.setFormulaId(salarySobItemDTO.getFormulaId())
.setFormulaContent(salarySobItemDTO.getFormulaContent())
.setShowLock((!Objects.equals(salarySobItemDTO.getFormulaId(), NumberUtils.LONG_ZERO) && salarySobItemDTO.isCanEdit())
|| Objects.equals(salarySobItemDTO.getUseInEmployeeSalary(), NumberUtils.INTEGER_ONE));
resultMap.put("" + salarySobItemDTO.getSalaryItemId(), salaryAcctResultListColumnDTO); resultMap.put("" + salarySobItemDTO.getSalaryItemId(), salaryAcctResultListColumnDTO);
} }
} }
@ -533,11 +524,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) { if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), 1)) {
List<SalarySobItemDTO> backCalcItems = salarySobItemAggregateDTO.getBackCalcItems(); List<SalarySobItemDTO> backCalcItems = salarySobItemAggregateDTO.getBackCalcItems();
for (SalarySobItemDTO backCalcItem : backCalcItems) { for (SalarySobItemDTO backCalcItem : backCalcItems) {
SalaryAcctResultListColumnDTO salaryAcctResultListColumnDTO = new SalaryAcctResultListColumnDTO() SalaryAcctResultListColumnDTO salaryAcctResultListColumnDTO = new SalaryAcctResultListColumnDTO().setColumnName(backCalcItem.getName()).setFormulaId(backCalcItem.getFormulaId()).setFormulaContent(backCalcItem.getFormulaContent()).setShowLock(true);
.setColumnName(backCalcItem.getName())
.setFormulaId(backCalcItem.getFormulaId())
.setFormulaContent(backCalcItem.getFormulaContent())
.setShowLock(true);
resultMap.put("" + backCalcItem.getSalaryItemId(), salaryAcctResultListColumnDTO); resultMap.put("" + backCalcItem.getSalaryItemId(), salaryAcctResultListColumnDTO);
} }
} }
@ -574,10 +561,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
}); });
// 编辑的列都自动锁定 // 编辑的列都自动锁定
SalaryAcctResultUpdateLockStatusParam updateLockStatusParam = SalaryAcctResultUpdateLockStatusParam.builder() SalaryAcctResultUpdateLockStatusParam updateLockStatusParam = SalaryAcctResultUpdateLockStatusParam.builder().salaryItemIds(needLockItems).salaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId()).lockStatus(LockStatusEnum.LOCK).build();
.salaryItemIds(needLockItems)
.salaryAcctRecordId(salaryAcctEmployeePO.getSalaryAcctRecordId())
.lockStatus(LockStatusEnum.LOCK).build();
getSalaryAcctResultService(user).updateLockStatusByParam(updateLockStatusParam); getSalaryAcctResultService(user).updateLockStatusByParam(updateLockStatusParam);
} }
// SalaryAcctRecordPO byId = getSalaryAcctRecordService(user).getById(salaryAcctEmployeePO.getSalaryAcctRecordId()); // SalaryAcctRecordPO byId = getSalaryAcctRecordService(user).getById(salaryAcctEmployeePO.getSalaryAcctRecordId());
@ -654,12 +638,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
@Override @Override
public void batchSave(Collection<SalaryAcctResultPO> salaryAcctResultPOS) { public void batchSave(List<SalaryAcctResultPO> salaryAcctResultPOS) {
if (CollectionUtils.isNotEmpty(salaryAcctResultPOS)) { if (CollectionUtils.isNotEmpty(salaryAcctResultPOS)) {
List<SalaryAcctResultPO> list = (List<SalaryAcctResultPO>) salaryAcctResultPOS;
// 数据加密 // 数据加密
encryptUtil.encryptList(list, SalaryAcctResultPO.class); encryptUtil.encryptList(salaryAcctResultPOS, SalaryAcctResultPO.class);
List<List<SalaryAcctResultPO>> partition = Lists.partition(list, 100); List<List<SalaryAcctResultPO>> partition = Lists.partition(salaryAcctResultPOS, 100);
partition.forEach(getSalaryAcctResultMapper()::batchInsert); partition.forEach(getSalaryAcctResultMapper()::batchInsert);
} }
@ -684,7 +667,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
@Override @Override
public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) { public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) {
StopWatch stopWatch = new StopWatch(calculateParam.getSalaryAcctRecordId() + "");
try { try {
stopWatch.start("核算总耗时数据准备");
// 1查询薪资核算记录 // 1查询薪资核算记录
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId()); SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId());
if (Objects.isNull(salaryAcctRecordPO)) { if (Objects.isNull(salaryAcctRecordPO)) {
@ -726,11 +711,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) { if (CollectionUtils.isNotEmpty(lockSalaryItemIds)) {
List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()), lockSalaryItemIds); List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIdsAndSalaryItemIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()), lockSalaryItemIds);
// List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId())); // List<SalaryAcctResultPO> acctResultPOS = listBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()));
acctResults = Optional.ofNullable(acctResultPOS) acctResults = Optional.ofNullable(acctResultPOS).orElse(new ArrayList<>()).stream().filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId())).collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
.orElse(new ArrayList<>())
.stream()
.filter(po -> lockSalaryItemIds.contains(po.getSalaryItemId()))
.collect(Collectors.toMap(po -> po.getSalaryItemId() + "_" + po.getSalaryAcctEmpId(), a -> a, (a, b) -> a));
} }
// 8查询公式详情 // 8查询公式详情
@ -756,6 +737,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) { if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空")); throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空"));
} }
stopWatch.stop();
stopWatch.start("核算完毕计时");
// 11.1初始化进度 // 11.1初始化进度
ProgressDTO initProgress = new ProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY); ProgressDTO initProgress = new ProgressDTO().setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")).setTitleLabelId(97515L).setTotalQuantity(salaryAcctEmployeePOS.size() * 2 + 1).setCalculatedQuantity(0).setProgress(BigDecimal.ZERO).setStatus(true).setMessage(StringUtils.EMPTY);
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress); getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
@ -771,26 +756,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
TaxDeclarationFunctionEnum taxDeclarationFunction = getSalarySysConfService(user).getTaxDeclaration(); TaxDeclarationFunctionEnum taxDeclarationFunction = getSalarySysConfService(user).getTaxDeclaration();
// 12.5多线程运算运算结果存放在临时表中 // 12.5多线程运算运算结果存放在临时表中
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) { for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO() SalaryAcctCalculateBO salaryAcctCalculateBO = new SalaryAcctCalculateBO().setSalaryAcctRecordPO(salaryAcctRecordPO).setSalarySobPO(salarySobPO).setSalarySobCycleDTO(salarySobCycleDTO).setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS).setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults)).setLockSalaryItemIds(lockSalaryItemIds).setSalarySobItemPOS(salarySobItemPOS).setSalaryItemIdWithPriorityList(salarySobItemsWithPriority).setExpressFormulas(expressFormulas).setSalaryItemPOS(salaryItemPOS).setSalarySobAdjustRulePOS(salarySobAdjustRulePOS).setWelfareColumns(MapUtils.emptyIfNull(welfareColumns)).setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS).setSalaryAcctEmployeePOS(acctEmployeePOS).setIssuedFieldIds(issuedFieldIds).setChildMonitor(childMonitor).setResults(calculateResults).setCalculateKey(calculateKey).setTaxDeclarationFunction(taxDeclarationFunction);
.setSalaryAcctRecordPO(salaryAcctRecordPO)
.setSalarySobPO(salarySobPO)
.setSalarySobCycleDTO(salarySobCycleDTO)
.setOtherSalaryAcctRecordPOS(otherSalaryAcctRecordPOS)
.setSalaryAcctLockResultPOS(MapUtils.emptyIfNull(acctResults))
.setLockSalaryItemIds(lockSalaryItemIds)
.setSalarySobItemPOS(salarySobItemPOS)
.setSalaryItemIdWithPriorityList(salarySobItemsWithPriority)
.setExpressFormulas(expressFormulas)
.setSalaryItemPOS(salaryItemPOS)
.setSalarySobAdjustRulePOS(salarySobAdjustRulePOS)
.setWelfareColumns(MapUtils.emptyIfNull(welfareColumns))
.setAttendQuoteFieldListDTOS(attendQuoteFieldListDTOS)
.setSalaryAcctEmployeePOS(acctEmployeePOS)
.setIssuedFieldIds(issuedFieldIds)
.setChildMonitor(childMonitor)
.setResults(calculateResults)
.setCalculateKey(calculateKey)
.setTaxDeclarationFunction(taxDeclarationFunction);
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems; List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
LocalRunnable localRunnable = new LocalRunnable() { LocalRunnable localRunnable = new LocalRunnable() {
@Override @Override
@ -802,6 +768,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
} }
// 13等待所有子线程执行完毕 // 13等待所有子线程执行完毕
childMonitor.await(); childMonitor.await();
stopWatch.stop();
stopWatch.start("核算入库计时");
// 14判断子线程执行结果 // 14判断子线程执行结果
boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus); boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus);
if (!allSuccess) { if (!allSuccess) {
@ -822,15 +792,15 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
// Thread.sleep(10); // Thread.sleep(10);
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), true); getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), true);
stopWatch.stop();
log.info(stopWatch.prettyPrint());
// 存储薪资核算数据来源日志 // 存储薪资核算数据来源日志
new Thread() { new Thread() {
public void run() { public void run() {
List<Long> exceptItemIds = new ArrayList<>(); List<Long> exceptItemIds = new ArrayList<>();
List<Long> salaryAcctEmployeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); List<Long> salaryAcctEmployeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList());
exceptItemIds.addAll(lockSalaryItemIds); exceptItemIds.addAll(lockSalaryItemIds);
exceptItemIds.addAll(salaryItemPOS.stream().filter(PO -> Objects.equals(PO.getValueType(), NumberUtils.INTEGER_ONE) && exceptItemIds.addAll(salaryItemPOS.stream().filter(PO -> Objects.equals(PO.getValueType(), NumberUtils.INTEGER_ONE) && Objects.equals(PO.getUseInEmployeeSalary(), 0)).map(SalaryItemPO::getId).collect(Collectors.toList()));
Objects.equals(PO.getUseInEmployeeSalary(), 0))
.map(SalaryItemPO::getId).collect(Collectors.toList()));
getSalaryAcctResultLogService(user).deleteBySalaryAcctEmpIdExceptItemIds(salaryAcctEmployeeIds, exceptItemIds); getSalaryAcctResultLogService(user).deleteBySalaryAcctEmpIdExceptItemIds(salaryAcctEmployeeIds, exceptItemIds);
} }
}.start(); }.start();
@ -900,31 +870,37 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
* @param calculateKey * @param calculateKey
*/ */
private void handleSalaryAcctResultTemp(SalaryAcctCalculateParam calculateParam, String calculateKey) { private void handleSalaryAcctResultTemp(SalaryAcctCalculateParam calculateParam, String calculateKey) {
// TransactionStatus status = dataSourceTransactionManager.getTransaction(new DefaultTransactionDefinition()); StopWatch sw = new StopWatch(calculateParam.getSalaryAcctRecordId() + "");
// try {
// 查询薪资核算结果的临时存储 // 查询薪资核算结果的临时存储
sw.start("处理核算数据,查询薪资核算结果的临时存储");
List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = getSalaryAcctResultTempService(user).listByCalculateKey(calculateKey); List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = getSalaryAcctResultTempService(user).listByCalculateKey(calculateKey);
sw.stop();
// 删除原来的薪资核算结果 // 删除原来的薪资核算结果
sw.start("处理核算数据,删除原来的薪资核算结果");
if (CollectionUtils.isNotEmpty(calculateParam.getIds())) { if (CollectionUtils.isNotEmpty(calculateParam.getIds())) {
getSalaryAcctResultMapper().deleteBySalaryAcctEmpIds(calculateParam.getIds()); getSalaryAcctResultMapper().deleteBySalaryAcctEmpIds(calculateParam.getIds());
} else { } else {
getSalaryAcctResultMapper().deleteBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId())); getSalaryAcctResultMapper().deleteBySalaryAcctRecordIds(Collections.singleton(calculateParam.getSalaryAcctRecordId()));
getSalaryAcctReportService(user).deleteBySalaryAcctRecordId(calculateParam.getSalaryAcctRecordId()); getSalaryAcctReportService(user).deleteBySalaryAcctRecordId(calculateParam.getSalaryAcctRecordId());
} }
sw.stop();
// 保存薪资的薪资核算结果 // 保存薪资的薪资核算结果
sw.start("处理核算数据,保存薪资的薪资核算结果");
List<SalaryAcctResultPO> salaryAcctResultPOS = SalaryAcctResultBO.convert2ResultPO(salaryAcctResultTempPOS); List<SalaryAcctResultPO> salaryAcctResultPOS = SalaryAcctResultBO.convert2ResultPO(salaryAcctResultTempPOS);
batchSave(salaryAcctResultPOS); batchSave(salaryAcctResultPOS);
//保存核算报表数据 sw.stop();
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2ReportPO(salaryAcctResultTempPOS, calculateParam.getEmps()); new Thread() {
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS); public void run() {
//保存核算报表数据
List<SalaryAcctResultReportPO> salaryAcctResultReportPOS = SalaryAcctResultReportBO.convert2ReportPO(salaryAcctResultTempPOS, calculateParam.getEmps());
getSalaryAcctReportService(user).batchSave(salaryAcctResultReportPOS);
}
}.start();
// 删除薪资核算临时存储表中的数据 // 删除薪资核算临时存储表中的数据
sw.start("处理核算数据,删除薪资核算临时存储表中的数据");
getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey); getSalaryAcctResultTempService(user).deleteByCalculateKey(calculateKey);
// // 提交事务 sw.stop();
// dataSourceTransactionManager.commit(status); log.info(sw.prettyPrint());
// } catch (Exception e) {
// dataSourceTransactionManager.rollback(status);
// throw e;
// }
} }
@Override @Override
@ -932,8 +908,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
if (CollectionUtils.isEmpty(salaryAcctRecordIds)) { if (CollectionUtils.isEmpty(salaryAcctRecordIds)) {
return Collections.emptyList(); return Collections.emptyList();
} }
return encryptUtil.decryptList(getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordIds(salaryAcctRecordIds).taxAgentIds(taxAgentIds).build()), return encryptUtil.decryptList(getSalaryAcctResultMapper().listSome(SalaryAcctResultPO.builder().salaryAcctRecordIds(salaryAcctRecordIds).taxAgentIds(taxAgentIds).build()), SalaryAcctResultPO.class);
SalaryAcctResultPO.class);
} }
@ -1013,8 +988,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctRecordId(id).deleteType(0).build(); SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctRecordId(id).deleteType(0).build();
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(build); List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultMapper().listSome(build);
// 回算前的薪资核算结果 // 回算前的薪资核算结果
salaryAcctResultPOS.forEach(salaryAcctResult -> salaryAcctResultPOS.forEach(salaryAcctResult -> salaryAcctResult.setOriginResultValue(salaryAcctResult.getResultValue()));
salaryAcctResult.setOriginResultValue(salaryAcctResult.getResultValue()));
// 批量更新 // 批量更新
batchUpdateOriginResultValue(salaryAcctResultPOS); batchUpdateOriginResultValue(salaryAcctResultPOS);
} }

View File

@ -21,17 +21,15 @@ import java.util.List;
* @version 1.0 * @version 1.0
**/ **/
public class SalaryAcctResultTempServiceImpl extends Service implements SalaryAcctResultTempService { public class SalaryAcctResultTempServiceImpl extends Service implements SalaryAcctResultTempService {
private SalaryAcctResultTempMapper getSalaryAcctResultTempMapper() {
private SalaryAcctResultTempMapper getSalaryAcctResultTempMapper(){
return MapperProxyFactory.getProxy(SalaryAcctResultTempMapper.class); return MapperProxyFactory.getProxy(SalaryAcctResultTempMapper.class);
} }
@Override @Override
public List<SalaryAcctResultTempPO> listByCalculateKey(String calculateKey) { public List<SalaryAcctResultTempPO> listByCalculateKey(String calculateKey) {
if (StringUtils.isBlank(calculateKey)){ if (StringUtils.isBlank(calculateKey)) {
return Lists.newArrayList(); return Lists.newArrayList();
} }
return getSalaryAcctResultTempMapper().listSome(SalaryAcctResultTempPO.builder().calculateKey(calculateKey).build()); return getSalaryAcctResultTempMapper().listSome(SalaryAcctResultTempPO.builder().calculateKey(calculateKey).build());
@ -43,7 +41,7 @@ public class SalaryAcctResultTempServiceImpl extends Service implements SalaryAc
public void batchSave(Collection<SalaryAcctResultTempPO> salaryAcctResultTempPOS) { public void batchSave(Collection<SalaryAcctResultTempPO> salaryAcctResultTempPOS) {
if (CollectionUtils.isNotEmpty(salaryAcctResultTempPOS)) { if (CollectionUtils.isNotEmpty(salaryAcctResultTempPOS)) {
List<List<SalaryAcctResultTempPO>> partition = Lists.partition((List<SalaryAcctResultTempPO>) salaryAcctResultTempPOS, 100); List<List<SalaryAcctResultTempPO>> partition = Lists.partition((List<SalaryAcctResultTempPO>) salaryAcctResultTempPOS, 100);
partition.forEach(p->getSalaryAcctResultTempMapper().batchInsert(p)); partition.forEach(p -> getSalaryAcctResultTempMapper().batchInsert(p));
} }
} }

View File

@ -7,6 +7,7 @@ import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryBill.bo.SalaryBillBO; import com.engine.salary.entity.salaryBill.bo.SalaryBillBO;
import com.engine.salary.entity.salaryBill.dto.SalaryBillAckFeedbackDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillAckFeedbackDTO;
import com.engine.salary.entity.salaryBill.dto.salaryBillViewingLimitSetting;
import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO;
import com.engine.salary.entity.salaryBill.param.SalaryBaseSetSaveParam; import com.engine.salary.entity.salaryBill.param.SalaryBaseSetSaveParam;
import com.engine.salary.entity.salaryBill.po.SalaryBillWatermarkPO; import com.engine.salary.entity.salaryBill.po.SalaryBillWatermarkPO;
@ -25,6 +26,7 @@ import dm.jdbc.util.IdGenerator;
import org.apache.commons.collections.CollectionUtils; import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang.math.NumberUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import weaver.general.Util;
import weaver.hrm.User; import weaver.hrm.User;
import java.util.*; import java.util.*;
@ -59,11 +61,7 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
if (Objects.isNull(watermarkPO)) { if (Objects.isNull(watermarkPO)) {
return null; return null;
} }
return SalaryBillWatermarkDTO.builder() return SalaryBillWatermarkDTO.builder().watermarkStatus(NumberUtils.INTEGER_ONE.equals(watermarkPO.getWatermarkStatus())).watermarkType(watermarkPO.getWatermarkType()).wmSetting(JsonUtil.parseMap(watermarkPO.getWatermarkSetting(), Object.class)).build();
.watermarkStatus(NumberUtils.INTEGER_ONE.equals(watermarkPO.getWatermarkStatus()))
.watermarkType(watermarkPO.getWatermarkType())
.wmSetting(JsonUtil.parseMap(watermarkPO.getWatermarkSetting(), Object.class))
.build();
} }
@Override @Override
@ -80,7 +78,7 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
if (saveParam.getWatermarkStatus()) { if (saveParam.getWatermarkStatus()) {
if (SalaryTemplateWatermarkTypeEnum.CUSTOM.equals(saveParam.getWatermark())) { if (SalaryTemplateWatermarkTypeEnum.CUSTOM.equals(saveParam.getWatermark())) {
wmSetting = JsonUtil.toJsonString(saveParam.getWmSetting()); wmSetting = JsonUtil.toJsonString(saveParam.getWmSetting());
}else{ } else {
// 系统默认水印 给一个默认的json // 系统默认水印 给一个默认的json
wmSetting = "{\"wmWidth\":100,\"wmRotate\":30,\"wmSelectedFieldIds\":[\"HRM_Name\"],\"pureWmText\":\" 当前操作者姓名 \",\"wmText\":\"<p><span style=\\\"font-size:16px;\\\">&nbsp;<span>$HRM_Name</span>&nbsp;</span></p>\",\"wmClassify\":\"text\",\"wmHeight\":100,\"wmOriginText\":\"<p><span style=\\\"font-size:16px;\\\">&nbsp;<span contenteditable=\\\"false\\\" data-id=\\\"HRM_Name\\\">当前操作者姓名</span>&nbsp;</span></p>\",\"wmNoTransparent\":15}"; wmSetting = "{\"wmWidth\":100,\"wmRotate\":30,\"wmSelectedFieldIds\":[\"HRM_Name\"],\"pureWmText\":\" 当前操作者姓名 \",\"wmText\":\"<p><span style=\\\"font-size:16px;\\\">&nbsp;<span>$HRM_Name</span>&nbsp;</span></p>\",\"wmClassify\":\"text\",\"wmHeight\":100,\"wmOriginText\":\"<p><span style=\\\"font-size:16px;\\\">&nbsp;<span contenteditable=\\\"false\\\" data-id=\\\"HRM_Name\\\">当前操作者姓名</span>&nbsp;</span></p>\",\"wmNoTransparent\":15}";
} }
@ -92,29 +90,25 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
// 将当前生效的水印信息都删除 // 将当前生效的水印信息都删除
getSalaryBillWatermarkService(user).deleteAll(); getSalaryBillWatermarkService(user).deleteAll();
// 保存最新的水印信息 // 保存最新的水印信息
getSalaryBillWatermarkService(user).insertIgnoreNull(SalaryBillWatermarkPO.builder() getSalaryBillWatermarkService(user).insertIgnoreNull(SalaryBillWatermarkPO.builder().id(IdGenerator.generate()).watermarkStatus(watermarkStatus).watermarkType(watermark).watermarkSetting(wmSetting).createTime(now).updateTime(now).creator(Long.valueOf(user.getUID())).deleteType(NumberUtils.INTEGER_ZERO).tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY).build());
.id(IdGenerator.generate())
.watermarkStatus(watermarkStatus)
.watermarkType(watermark)
.watermarkSetting(wmSetting)
.createTime(now)
.updateTime(now)
.creator(Long.valueOf(user.getUID()))
.deleteType(NumberUtils.INTEGER_ZERO)
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.build());
// 工资单确认和反馈 =========================================================== // 工资单确认和反馈 ===========================================================
SalaryBillAckFeedbackDTO ackFeedbackSetting = saveParam.getAckFeedbackSetting(); SalaryBillAckFeedbackDTO ackFeedbackSetting = saveParam.getAckFeedbackSetting();
// 1.保存确认反馈开关状态 // 1.保存确认反馈开关状态
getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getAckStatus(), SALARY_SEND_FEEDBACK, "工资单确认反馈状态", "billSend"); getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getAckStatus(), SALARY_SEND_FEEDBACK, "工资单确认反馈状态", "billSend");
if(StringUtils.equals(ackFeedbackSetting.getAckStatus(),"1")){ if (StringUtils.equals(ackFeedbackSetting.getAckStatus(), "1")) {
// 2.保存反馈地址 // 2.保存反馈地址
getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getFeedBackUrl(), SALARY_FEEDBACK_URL, "工资单反馈地址", "billSend"); getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getFeedBackUrl(), SALARY_FEEDBACK_URL, "工资单反馈地址", "billSend");
// 3.保存自动确认时间 // 3.保存自动确认时间
getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getAutoAckDays().toString(), SALARY_AUTO_ACK_DAYS, "工资单反馈自动确认", "billSend"); getSalarySysConfService(user).saveSettingByType(ackFeedbackSetting.getAutoAckDays().toString(), SALARY_AUTO_ACK_DAYS, "工资单反馈自动确认", "billSend");
} }
// 工资单时效性设置
salaryBillViewingLimitSetting salaryBillViewingLimitDTO = saveParam.getSalaryBillViewingLimitSetting();
if (salaryBillViewingLimitDTO != null) {
getSalarySysConfService(user).saveSettingByType(Util.null2String(salaryBillViewingLimitDTO.getLimitMonth()), SALARY_BILL_VIEWING_LIMIT_MONTH, "工资单时效性设置", "billSend");
}
return StringUtils.EMPTY; return StringUtils.EMPTY;
} }
@ -133,12 +127,12 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
public SalaryBillAckFeedbackDTO getDefaultAckFeedbackSetting() { public SalaryBillAckFeedbackDTO getDefaultAckFeedbackSetting() {
// 获取反馈开启状态自动确认时长反馈地址 // 获取反馈开启状态自动确认时长反馈地址
List<String> codes = Arrays.asList(SalarySysConstant.SALARY_SEND_FEEDBACK, SalarySysConstant.SALARY_AUTO_ACK_DAYS, SalarySysConstant.SALARY_FEEDBACK_URL); List<String> codes = Arrays.asList(SalarySysConstant.SALARY_SEND_FEEDBACK, SalarySysConstant.SALARY_AUTO_ACK_DAYS, SalarySysConstant.SALARY_FEEDBACK_URL);
List<SalarySysConfPO> sysConfList= getSalarySysConfService(user).getListByCodes(codes); List<SalarySysConfPO> sysConfList = getSalarySysConfService(user).getListByCodes(codes);
Map<String, String> sysConfMap = SalaryEntityUtil.convert2Map(sysConfList, SalarySysConfPO::getConfKey, SalarySysConfPO::getConfValue); Map<String, String> sysConfMap = SalaryEntityUtil.convert2Map(sysConfList, SalarySysConfPO::getConfKey, SalarySysConfPO::getConfValue);
SalaryBillAckFeedbackDTO defaultAckFeedBackDTO = SalaryBillAckFeedbackDTO.builder().build(); SalaryBillAckFeedbackDTO defaultAckFeedBackDTO = SalaryBillAckFeedbackDTO.builder().build();
String ackStatus = sysConfMap.getOrDefault(SalarySysConstant.SALARY_SEND_FEEDBACK, "0"); String ackStatus = sysConfMap.getOrDefault(SalarySysConstant.SALARY_SEND_FEEDBACK, "0");
if (StringUtils.equals(ackStatus,"0")) { if (StringUtils.equals(ackStatus, "0")) {
// 未开启工资单确认 // 未开启工资单确认
defaultAckFeedBackDTO.setAckStatus("0"); defaultAckFeedBackDTO.setAckStatus("0");
defaultAckFeedBackDTO.setAutoAckDays(0); defaultAckFeedBackDTO.setAutoAckDays(0);
@ -154,4 +148,16 @@ public class SalaryBillBaseSetServiceImpl extends Service implements SalaryBillB
defaultAckFeedBackDTO.setFeedBackUrl(feedbackUrl); defaultAckFeedBackDTO.setFeedBackUrl(feedbackUrl);
return defaultAckFeedBackDTO; return defaultAckFeedBackDTO;
} }
@Override
public salaryBillViewingLimitSetting getSalaryBillViewingLimitSetting() {
SalarySysConfPO limitMonthSetting = getSalarySysConfService(user).getOneByCode(SALARY_BILL_VIEWING_LIMIT_MONTH);
int limitMonth = 0;
if (limitMonthSetting != null && NumberUtils.isNumber(limitMonthSetting.getConfValue())) {
limitMonth = Integer.parseInt(limitMonthSetting.getConfValue());
}
return salaryBillViewingLimitSetting.builder().limitMonth(limitMonth).build();
}
} }

View File

@ -7,6 +7,7 @@ import com.engine.core.impl.Service;
import com.engine.salary.biz.SalarySendBiz; import com.engine.salary.biz.SalarySendBiz;
import com.engine.salary.biz.SalarySendInfoBiz; import com.engine.salary.biz.SalarySendInfoBiz;
import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.constant.HrmSalaryPayrollConf;
import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.progress.ProgressDTO; import com.engine.salary.entity.progress.ProgressDTO;
import com.engine.salary.entity.salaryBill.bo.SalaryBillBO; import com.engine.salary.entity.salaryBill.bo.SalaryBillBO;
@ -15,6 +16,7 @@ import com.engine.salary.entity.salaryBill.dto.SalaryBillSendDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO;
import com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO; import com.engine.salary.entity.salaryBill.dto.SalarySendInfoListDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO; import com.engine.salary.entity.salaryBill.dto.SalaryTemplateSalaryItemSetListDTO;
import com.engine.salary.entity.salaryBill.param.SalaryExportPdfParam;
import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam; import com.engine.salary.entity.salaryBill.param.SalarySendGrantParam;
import com.engine.salary.entity.salaryBill.param.SalarySendInfoQueryParam; import com.engine.salary.entity.salaryBill.param.SalarySendInfoQueryParam;
import com.engine.salary.entity.salaryBill.po.SalarySendInfoPO; import com.engine.salary.entity.salaryBill.po.SalarySendInfoPO;
@ -31,6 +33,7 @@ import com.engine.salary.mapper.salarybill.SalarySendInfoMapper;
import com.engine.salary.mapper.salarybill.SalarySendMapper; import com.engine.salary.mapper.salarybill.SalarySendMapper;
import com.engine.salary.service.*; import com.engine.salary.service.*;
import com.engine.salary.util.JsonUtil; import com.engine.salary.util.JsonUtil;
import com.engine.salary.util.SalaryDateUtil;
import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.SalaryI18nUtil;
import com.google.common.collect.Lists; import com.google.common.collect.Lists;
@ -45,12 +48,15 @@ import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.math.NumberUtils; import org.apache.commons.lang3.math.NumberUtils;
import weaver.hrm.User; import weaver.hrm.User;
import java.io.File;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.concurrent.atomic.AtomicInteger; import java.util.concurrent.atomic.AtomicInteger;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import static com.engine.salary.constant.HrmSalaryPayrollConf.GEN_PDF;
/** /**
* 工资单发放 * 工资单发放
* <p>Copyright: Copyright (c) 2022</p> * <p>Copyright: Copyright (c) 2022</p>
@ -129,7 +135,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
* 工资单发放 start * 工资单发放 start
**********************************************************************/ **********************************************************************/
@Override @Override
public Map<String, Object> grant(SalarySendGrantParam param) { public Map<String, Object> grant(SalarySendGrantParam param) {
// 1.检查和获取工资单发放 // 1.检查和获取工资单发放
SalarySendPO salarySend = checkAndGetSalarySend(param.getSalarySendId()); SalarySendPO salarySend = checkAndGetSalarySend(param.getSalarySendId());
// // 已经冻结不能操作 // // 已经冻结不能操作
@ -219,6 +225,9 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
// 3.发送消息先修改数据再发消息避免出错后无法撤回 // 3.发送消息先修改数据再发消息避免出错后无法撤回
List<Long> successIds = sendMessage(enableSendList, salaryBillSendParam); List<Long> successIds = sendMessage(enableSendList, salaryBillSendParam);
//生成pdf
genPdf(salaryBillSendParam, enableSendList);
// 4.发放 // 4.发放
grantSendInfo(successIds, salarySend, salaryTemplate, salaryBillSendParam); grantSendInfo(successIds, salarySend, salaryTemplate, salaryBillSendParam);
@ -232,8 +241,6 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
+ SalaryI18nUtil.getI18nLabel(134808, "失败条数") + "[" + (total - successCount) + "]"; + SalaryI18nUtil.getI18nLabel(134808, "失败条数") + "[" + (total - successCount) + "]";
// 发送进度完成 // 发送进度完成
getProgressService(user).finish(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), true, messsage); getProgressService(user).finish(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), true, messsage);
// log.info("工资单发送组装耗时:{}毫秒;工资单发送消息中心耗时:{}毫秒;工资单数据更改总耗时:{}毫秒;工资单发送总耗时:{}毫秒;工资单云桥图片地址:{}", l3 - l2, l4 - l3, l5 - l4, System.currentTimeMillis() - l,
// salaryBillSendParam == null ? "" : salaryBillSendParam.getPicUrl());
} catch (Exception e) { } catch (Exception e) {
log.info("发送出错:{}", e.getMessage(), e); log.info("发送出错:{}", e.getMessage(), e);
// 发送进度失败 // 发送进度失败
@ -242,6 +249,31 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
} }
} }
private void genPdf(SalaryBillSendDTO salaryBillSendParam, List<Map<String, Object>> enableSendList) {
if (GEN_PDF) {
LocalRunnable localRunnable = new LocalRunnable() {
@Override
public void execute() {
//生成工资单pdf
enableSendList.forEach(e -> {
SalaryBillBO.genPdf(e, salaryBillSendParam);
});
//合并工资单pdf
//1先获取所有工资单
Long id = salaryBillSendParam.getSalarySend().getId();
List<SalarySendInfoPO> salarySendInfos = getSalarySendInfoMapper().listSome(SalarySendInfoPO.builder().salarySendId(id).sendStatus(1).build());
//2工资单pdf转为路径
String yyyyMM = SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate());
List<String> filesToMerge = salarySendInfos.stream().map(po -> HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator + id + File.separator + po.getId() + ".pdf").collect(Collectors.toList());
String pdfPath = HrmSalaryPayrollConf.GEN_PATH + yyyyMM + File.separator + id + File.separator + id + ".pdf";
SalaryBillBO.mergePdf(pdfPath, filesToMerge);
}
};
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.OTHER, "salaryBillGenPdf", localRunnable);
}
}
/** /**
* 构建发送参数 * 构建发送参数
* *
@ -301,7 +333,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
// 工资单水印文本动态变量 // 工资单水印文本动态变量
List<String> wmTextFieldIds = SalaryBillBO.getWmTextFieldIds(domain, salaryBillWatermark); List<String> wmTextFieldIds = SalaryBillBO.getWmTextFieldIds(domain, salaryBillWatermark);
// 邮件水印模板 // 邮件水印模板
boolean isEnableEmail = salaryTemplate.getEmailStatus().equals(SalaryTemplateWhetherEnum.TRUE.getValue()); boolean isEnableEmail = salaryTemplate.getEmailStatus().equals(SalaryTemplateWhetherEnum.TRUE.getValue());
String emailWmContentTemplate = SalaryBillBO.buildEmailWmContentTemplate(isEnableEmail, salaryBillWatermark); String emailWmContentTemplate = SalaryBillBO.buildEmailWmContentTemplate(isEnableEmail, salaryBillWatermark);
return SalaryBillSendDTO.builder() return SalaryBillSendDTO.builder()
@ -406,7 +438,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
// 更新进度 // 更新进度
getProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), part.size()); getProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.SALARY_GRANT_PROGRESS + "_" + salarySend.getId(), part.size());
/** 注意只有邮件才需要加密的核算数据 */ /** 注意只有邮件才需要加密的核算数据 */
if (isEnableEmail) { if (isEnableEmail || GEN_PDF) {
List<SalaryAcctEmployeePO> acctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(Collections.singletonList(salarySend.getSalaryAccountingId()), part); List<SalaryAcctEmployeePO> acctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(Collections.singletonList(salarySend.getSalaryAccountingId()), part);
salaryAcctEmployees.addAll(acctEmployees); salaryAcctEmployees.addAll(acctEmployees);
salaryAcctResultValues.addAll(getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(SalaryEntityUtil.properties(acctEmployees, SalaryAcctEmployeePO::getId, Collectors.toList()))); salaryAcctResultValues.addAll(getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(SalaryEntityUtil.properties(acctEmployees, SalaryAcctEmployeePO::getId, Collectors.toList())));
@ -414,7 +446,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
} }
} else { } else {
/** 注意只有邮件才需要加密的核算数据 */ /** 注意只有邮件才需要加密的核算数据 */
if (isEnableEmail) { if (isEnableEmail || GEN_PDF) {
salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId()); salaryAcctEmployees = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordId(salarySend.getSalaryAccountingId());
salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singletonList(salarySend.getSalaryAccountingId())); salaryAcctResultValues = getSalaryAcctResultService(user).listBySalaryAcctRecordIds(Collections.singletonList(salarySend.getSalaryAccountingId()));
} }
@ -428,7 +460,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
@Override @Override
public void confirmSalaryBill(Long salaryInfoId) { public void confirmSalaryBill(Long salaryInfoId) {
SalarySendInfoPO sendInfoPO = getSalarySendInfoMapper().getById(salaryInfoId); SalarySendInfoPO sendInfoPO = getSalarySendInfoMapper().getById(salaryInfoId);
if(ObjectUtils.isEmpty(sendInfoPO)){ if (ObjectUtils.isEmpty(sendInfoPO)) {
throw new SalaryRunTimeException("工资单不存在或已被删除!"); throw new SalaryRunTimeException("工资单不存在或已被删除!");
} }
sendInfoPO.setBillConfirmStatus(BillConfimStatusEnum.CONFIRMED.getValue()); sendInfoPO.setBillConfirmStatus(BillConfimStatusEnum.CONFIRMED.getValue());
@ -439,7 +471,7 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
@Override @Override
public void feedBackSalaryBill(Long salaryInfoId) { public void feedBackSalaryBill(Long salaryInfoId) {
SalarySendInfoPO sendInfoPO = getSalarySendInfoMapper().getById(salaryInfoId); SalarySendInfoPO sendInfoPO = getSalarySendInfoMapper().getById(salaryInfoId);
if(ObjectUtils.isEmpty(sendInfoPO)){ if (ObjectUtils.isEmpty(sendInfoPO)) {
throw new SalaryRunTimeException("工资单不存在或已被删除!"); throw new SalaryRunTimeException("工资单不存在或已被删除!");
} }
sendInfoPO.setBillConfirmStatus(BillConfimStatusEnum.FEEDBACK.getValue()); sendInfoPO.setBillConfirmStatus(BillConfimStatusEnum.FEEDBACK.getValue());
@ -447,6 +479,20 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
getSalarySendInfoMapper().updateIgnoreNull(sendInfoPO); getSalarySendInfoMapper().updateIgnoreNull(sendInfoPO);
} }
@Override
public String exportPdf(SalaryExportPdfParam param) {
SalarySendPO salarySend = checkAndGetSalarySend(param.getSalarySendId());
String yearMonth = SalaryDateUtil.getFormatYearMonth(salarySend.getSalaryMonth());
String path = HrmSalaryPayrollConf.GEN_PATH + File.separator + yearMonth + File.separator + salarySend.getId() + File.separator + "%s" + ".pdf";
Long id = param.getId();
if (id == null) {
path = String.format(path, param.getSalarySendId());
} else {
path = String.format(path, id);
}
return path;
}
public List<Map<String, Object>> getSendInfoList(Long sendId, List<Long> ids) { public List<Map<String, Object>> getSendInfoList(Long sendId, List<Long> ids) {
SalarySendPO salarySend = getSalarySendMapper().getById(sendId); SalarySendPO salarySend = getSalarySendMapper().getById(sendId);
@ -525,10 +571,10 @@ public class SalaryBillServiceImpl extends Service implements SalaryBillService
SalaryBillBO.sendMsg(salaryBillSendParam, Long.valueOf(e.get("id").toString()), Long.valueOf(e.get("employeeId").toString())); SalaryBillBO.sendMsg(salaryBillSendParam, Long.valueOf(e.get("id").toString()), Long.valueOf(e.get("employeeId").toString()));
} }
if (sendChannels.contains(MessageChannelEnum.EMAIL)) { if (sendChannels.contains(MessageChannelEnum.EMAIL) || GEN_PDF) {
// 构建发送消息 // 构建发送消息
SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString())); SalaryBillBO.buildEmployeeInfo(salaryBillSendParam, allEmployeeMap.get(e.get("employeeId").toString()));
SalaryBillBO.sendEmail(e, allEmployeeMap, salaryBillSendParam); SalaryBillBO.sendEmail(e, salaryBillSendParam);
} }

View File

@ -148,13 +148,13 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
.sorted(new Comparator<SalaryItemPO>() { .sorted(new Comparator<SalaryItemPO>() {
@Override @Override
public int compare(SalaryItemPO o1, SalaryItemPO o2) { public int compare(SalaryItemPO o1, SalaryItemPO o2) {
if(o1.getSortedIndex() == null && o2.getSortedIndex() == null){ if (o1.getSortedIndex() == null && o2.getSortedIndex() == null) {
Integer systemType1=o1.getSystemType() == null ? 0 : o1.getSystemType(); Integer systemType1 = o1.getSystemType() == null ? 0 : o1.getSystemType();
Integer systemType2=o2.getSystemType() == null ? 0 : o2.getSystemType(); Integer systemType2 = o2.getSystemType() == null ? 0 : o2.getSystemType();
return systemType1.compareTo(systemType2); return systemType1.compareTo(systemType2);
}else{ } else {
Integer sortedIndex1=o1.getSortedIndex() == null ? 0 : o1.getSortedIndex(); Integer sortedIndex1 = o1.getSortedIndex() == null ? 0 : o1.getSortedIndex();
Integer sortedIndex2=o2.getSortedIndex() == null ? 0 : o2.getSortedIndex(); Integer sortedIndex2 = o2.getSortedIndex() == null ? 0 : o2.getSortedIndex();
return sortedIndex2.compareTo(sortedIndex1); return sortedIndex2.compareTo(sortedIndex1);
} }
} }
@ -263,35 +263,24 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
if (!StringUtils.equals(oldName, newName)) { if (!StringUtils.equals(oldName, newName)) {
//薪资项目 //薪资项目
String itemPrefix = newSalaryItemPO.getUseInEmployeeSalary() == 0 ? "salaryItem_" : "salaryArchives_";
String fieldNamePrefix = newSalaryItemPO.getUseInEmployeeSalary() == 0 ? "{薪资项目.%s}" : "{薪资档案.%s}";
String code = itemPrefix + salaryItemPO.getCode(); if (newSalaryItemPO.getUseInEmployeeSalary() == 0) {
Date now = new Date(); String itemPrefix = "salaryItem_";
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listByCode(code); String fieldNamePrefix = "{薪资项目.%s}";
formulaVars.forEach(v -> { changeName(salaryItemPO, oldName, newName, itemPrefix, fieldNamePrefix);
FormulaVar formulaVar = FormulaVar.builder() }
.id(v.getId())
.name(newName)
.fieldName(String.format(fieldNamePrefix, newName))
.updateTime(now)
.build();
getSalaryFormulaService(user).updateVar(formulaVar);
});
List<Long> formulaIds = SalaryEntityUtil.properties(formulaVars, FormulaVar::getFormulaId, Collectors.toList()); if (newSalaryItemPO.getUseInEmployeeSalary() == 1) {
List<FormulaPO> formulaPOS = getSalaryFormulaService(user).listByIds(formulaIds); //引用档案
formulaPOS.forEach(f -> { String itemPrefix = "salaryArchives_";
String formula = f.getFormula(); String fieldNamePrefix = "{薪资档案.%s}";
formula = formula.replace(String.format(fieldNamePrefix, oldName), String.format(fieldNamePrefix, newName)); changeName(salaryItemPO, oldName, newName, itemPrefix, fieldNamePrefix);
FormulaPO formulaPO = FormulaPO.builder()
.id(f.getId())
.formula(formula)
.updateTime(now)
.build();
getSalaryFormulaService(user).update(formulaPO);
});
//引用项目
itemPrefix = "salaryItem_";
fieldNamePrefix = "{薪资项目.%s}";
changeName(salaryItemPO, oldName, newName, itemPrefix, fieldNamePrefix);
}
} }
@ -307,6 +296,34 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
// salaryItemLoggerTemplate.write(loggerContext); // salaryItemLoggerTemplate.write(loggerContext);
} }
private void changeName(SalaryItemPO salaryItemPO, String oldName, String newName, String itemPrefix, String fieldNamePrefix) {
String code = itemPrefix + salaryItemPO.getCode();
Date now = new Date();
List<FormulaVar> formulaVars = getSalaryFormulaService(user).listByCode(code);
formulaVars.forEach(v -> {
FormulaVar formulaVar = FormulaVar.builder()
.id(v.getId())
.name(newName)
.fieldName(String.format(fieldNamePrefix, newName))
.updateTime(now)
.build();
getSalaryFormulaService(user).updateVar(formulaVar);
});
List<Long> formulaIds = SalaryEntityUtil.properties(formulaVars, FormulaVar::getFormulaId, Collectors.toList());
List<FormulaPO> formulaPOS = getSalaryFormulaService(user).listByIds(formulaIds);
formulaPOS.forEach(f -> {
String formula = f.getFormula();
formula = formula.replace(String.format(fieldNamePrefix, oldName), String.format(fieldNamePrefix, newName));
FormulaPO formulaPO = FormulaPO.builder()
.id(f.getId())
.formula(formula)
.updateTime(now)
.build();
getSalaryFormulaService(user).update(formulaPO);
});
}
@Override @Override
public void deleteByIds(Collection<Long> ids) { public void deleteByIds(Collection<Long> ids) {
SalaryItemServiceImpl.UsingItem usingItem = getUsingItem(); SalaryItemServiceImpl.UsingItem usingItem = getUsingItem();
@ -423,7 +440,7 @@ public class SalaryItemServiceImpl extends Service implements SalaryItemService
} }
// 获取薪资账套中薪资项目信息 // 获取薪资账套中薪资项目信息
List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(param.getSalaryItemId())); List<SalarySobItemPO> salarySobItemPOS = getSalarySobItemService(user).listBySalaryItemIds(Collections.singleton(param.getSalaryItemId()));
salarySobItemPOS = salarySobItemPOS.stream().filter( po -> param.getSalarySobIds().contains(po.getSalarySobId())).collect(Collectors.toList()); salarySobItemPOS = salarySobItemPOS.stream().filter(po -> param.getSalarySobIds().contains(po.getSalarySobId())).collect(Collectors.toList());
// 更新薪资账套中的薪资项目信息 // 更新薪资账套中的薪资项目信息
Date now = new Date(); Date now = new Date();
for (SalarySobItemPO sobItem : salarySobItemPOS) { for (SalarySobItemPO sobItem : salarySobItemPOS) {

View File

@ -80,6 +80,7 @@ import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneOffset; import java.time.ZoneOffset;
import java.util.*; import java.util.*;
@ -185,6 +186,10 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
return ServiceUtil.getService(SalaryCacheServiceImpl.class, user); return ServiceUtil.getService(SalaryCacheServiceImpl.class, user);
} }
private SalaryBillBaseSetService getSalaryBillBaseSetService(User user) {
return ServiceUtil.getService(SalaryBillBaseSetServiceImpl.class, user);
}
@Override @Override
public SalarySendPO getById(Long salarySendId) { public SalarySendPO getById(Long salarySendId) {
return mapper.getById(salarySendId); return mapper.getById(salarySendId);
@ -477,13 +482,21 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单")); throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "当前账号无法查看此工资单"));
} }
SalarySendInfoPO salarySendInfo = salarySendInfos.get(0); SalarySendInfoPO salarySendInfo = salarySendInfos.get(0);
//工资单查看时效性
Date limitMonth = getLimitMonth();
if (limitMonth != null && limitMonth.after(salarySendInfo.getSalaryMonth())) {
salaryBillViewingLimitSetting salaryBillViewingLimitSetting = getSalaryBillBaseSetService(user).getSalaryBillViewingLimitSetting();
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100511, "仅能查看" + salaryBillViewingLimitSetting.getLimitMonth() + "月内的工资单"));
}
// 获取默认模板信息 // 获取默认模板信息
SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId()); SalarySendPO salarySendPO = getSalarySendMapper().getById(salarySendInfo.getSalarySendId());
if(ObjectUtils.isEmpty(salarySendPO)){ if (ObjectUtils.isEmpty(salarySendPO)) {
throw new SalaryRunTimeException("工资单不存在"); throw new SalaryRunTimeException("工资单不存在");
} }
// 更新查看状态 // 更新查看状态
if (salarySendInfo.getBillReadStatus() == null || NumberUtils.compare(salarySendInfo.getBillReadStatus(),BillReadStatusEnum.UNREAD.getValue()) == 0) { if (salarySendInfo.getBillReadStatus() == null || NumberUtils.compare(salarySendInfo.getBillReadStatus(), BillReadStatusEnum.UNREAD.getValue()) == 0) {
salarySendInfo.setBillReadStatus(BillReadStatusEnum.READED.getValue()); salarySendInfo.setBillReadStatus(BillReadStatusEnum.READED.getValue());
salarySendInfo.setUpdateTime(new Date()); salarySendInfo.setUpdateTime(new Date());
getSalarySendInfoMapper().updateIgnoreNull(salarySendInfo); getSalarySendInfoMapper().updateIgnoreNull(salarySendInfo);
@ -612,7 +625,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
map.put("salaryTemplate", salaryTemplate); map.put("salaryTemplate", salaryTemplate);
map.put("salaryAcctResult", salaryAcctResultS); map.put("salaryAcctResult", salaryAcctResultS);
// 工资单发送人是否已确认 // 工资单发送人是否已确认
if (NumberUtils.compare(salaryTemplate.getAckFeedbackStatus(),1) == 0) { if (NumberUtils.compare(salaryTemplate.getAckFeedbackStatus(), 1) == 0) {
// 反馈后还可以确认或反馈按钮确认后2个按钮消失 // 反馈后还可以确认或反馈按钮确认后2个按钮消失
Integer confirmStatus = salarySendInfo.getBillConfirmStatus(); Integer confirmStatus = salarySendInfo.getBillConfirmStatus();
if (confirmStatus == null || confirmStatus != BillConfimStatusEnum.CONFIRMED.getValue()) { if (confirmStatus == null || confirmStatus != BillConfimStatusEnum.CONFIRMED.getValue()) {
@ -621,13 +634,23 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
map.put("confirmStatus", "1"); map.put("confirmStatus", "1");
} }
map.put("sendEmployeeId", salarySendInfo.getSendEmployeeId()); map.put("sendEmployeeId", salarySendInfo.getSendEmployeeId());
}else{ } else {
map.put("confirmStatus", "1"); map.put("confirmStatus", "1");
} }
return map; return map;
} }
private Date getLimitMonth() {
//工资单时效性
salaryBillViewingLimitSetting salaryBillViewingLimitSetting = getSalaryBillBaseSetService(user).getSalaryBillViewingLimitSetting();
if (salaryBillViewingLimitSetting.getLimitMonth() != 0) {
LocalDate localDate = LocalDate.now().plusMonths(-salaryBillViewingLimitSetting.getLimitMonth()).withDayOfMonth(1);
return SalaryDateUtil.localDateToDate(localDate);
}
return null;
}
/** /**
* 工资单水印文本型动态变量 == 处理 * 工资单水印文本型动态变量 == 处理
@ -637,7 +660,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
*/ */
private void handleSalaryWatermark(SalaryTemplatePO salaryTemplate, SalarySendInfoPO salarySendInfo, Long currentEmployeeId) { private void handleSalaryWatermark(SalaryTemplatePO salaryTemplate, SalarySendInfoPO salarySendInfo, Long currentEmployeeId) {
SalaryBillWatermarkDTO salaryBillWatermark = JsonUtil.parseObject(salaryTemplate.getSalaryWatermark(), SalaryBillWatermarkDTO.class); SalaryBillWatermarkDTO salaryBillWatermark = JsonUtil.parseObject(salaryTemplate.getSalaryWatermark(), SalaryBillWatermarkDTO.class);
if (Objects.isNull(salaryBillWatermark) || Boolean.FALSE.equals(salaryBillWatermark.getWatermarkStatus()) ) { if (Objects.isNull(salaryBillWatermark) || Boolean.FALSE.equals(salaryBillWatermark.getWatermarkStatus())) {
return; return;
} }
// 发送时已经处理好变量字段可直接获取判断 // 发送时已经处理好变量字段可直接获取判断
@ -672,27 +695,27 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
PageInfo<SalarySendInfoListDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(), PageInfo<SalarySendInfoListDTO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
page, SalarySendInfoListDTO.class); page, SalarySendInfoListDTO.class);
SalarySendPO salarySendPO = getSalarySendMapper().getById(queryParam.getSalarySendId()); SalarySendPO salarySendPO = getSalarySendMapper().getById(queryParam.getSalarySendId());
if (ObjectUtils.isEmpty(salarySendPO)){ if (ObjectUtils.isEmpty(salarySendPO)) {
throw new SalaryRunTimeException("工资单不存在或已被删除"); throw new SalaryRunTimeException("工资单不存在或已被删除");
} }
List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Collections.singletonList(salarySendPO.getSalarySobId())); List<SalaryTemplatePO> salaryTemplates = getSalaryTemplateService(user).getDefaultTemplates(Collections.singletonList(salarySendPO.getSalarySobId()));
if(CollectionUtils.isEmpty(salaryTemplates)){ if (CollectionUtils.isEmpty(salaryTemplates)) {
throw new SalaryRunTimeException("请先设置工资单模板"); throw new SalaryRunTimeException("请先设置工资单模板");
} }
Integer ackFeedbackStatus = salaryTemplates.get(0).getAckFeedbackStatus(); Integer ackFeedbackStatus = salaryTemplates.get(0).getAckFeedbackStatus();
if (ackFeedbackStatus!=null && NumberUtils.compare(ackFeedbackStatus,1) == 0) { if (ackFeedbackStatus != null && NumberUtils.compare(ackFeedbackStatus, 1) == 0) {
// 默认为空时未读未确认 // 默认为空时未读未确认
pageInfo.getList().stream().forEach(obj -> { pageInfo.getList().stream().forEach(obj -> {
SalarySendInfoListDTO dto = (SalarySendInfoListDTO) obj; SalarySendInfoListDTO dto = (SalarySendInfoListDTO) obj;
if (StringUtils.isBlank( dto.getBillReadStatus() )){ if (StringUtils.isBlank(dto.getBillReadStatus())) {
dto.setBillReadStatus(BillReadStatusEnum.UNREAD.getDefaultLabel()); dto.setBillReadStatus(BillReadStatusEnum.UNREAD.getDefaultLabel());
} else { } else {
dto.setBillReadStatus(BillReadStatusEnum.getDefaultLabelByValue( Integer.valueOf(dto.getBillReadStatus()) )); dto.setBillReadStatus(BillReadStatusEnum.getDefaultLabelByValue(Integer.valueOf(dto.getBillReadStatus())));
} }
if (StringUtils.isBlank(dto.getBillConfirmStatus())){ if (StringUtils.isBlank(dto.getBillConfirmStatus())) {
dto.setBillConfirmStatus(BillConfimStatusEnum.UNCONFIRMED.getDefaultLabel()); dto.setBillConfirmStatus(BillConfimStatusEnum.UNCONFIRMED.getDefaultLabel());
} else { } else {
dto.setBillConfirmStatus(BillConfimStatusEnum.getDefaultLabelByValue( Integer.valueOf(dto.getBillConfirmStatus()) )); dto.setBillConfirmStatus(BillConfimStatusEnum.getDefaultLabelByValue(Integer.valueOf(dto.getBillConfirmStatus())));
} }
}); });
} }
@ -720,7 +743,11 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
@Override @Override
public PageInfo<SalaryMySalaryBillListDTO> mySalaryBillListPage(SalaryBillQueryParam queryParam) { public PageInfo<SalaryMySalaryBillListDTO> mySalaryBillListPage(SalaryBillQueryParam queryParam) {
//工资单时效
queryParam.setStartSalaryMonth(getLimitMonth());
List<SalaryMySalaryBillListDTO> list = salarySendInfoMapper.mySalaryBillList(queryParam); List<SalaryMySalaryBillListDTO> list = salarySendInfoMapper.mySalaryBillList(queryParam);
PageInfo<SalaryMySalaryBillListDTO> pageInfo = new PageInfo<>(list, SalaryMySalaryBillListDTO.class); PageInfo<SalaryMySalaryBillListDTO> pageInfo = new PageInfo<>(list, SalaryMySalaryBillListDTO.class);
pageInfo.setTotal(list.size()); pageInfo.setTotal(list.size());
pageInfo.setPageNum(queryParam.getCurrent()); pageInfo.setPageNum(queryParam.getCurrent());
@ -1041,7 +1068,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
List<SalaryTemplateSalaryItemSetListDTO> salaryTemplateShowSetData = JsonUtil.parseList(salaryTemplate.getReplenishSalaryItemSetting(), List<SalaryTemplateSalaryItemSetListDTO> salaryTemplateShowSetData = JsonUtil.parseList(salaryTemplate.getReplenishSalaryItemSetting(),
SalaryTemplateSalaryItemSetListDTO.class); SalaryTemplateSalaryItemSetListDTO.class);
salaryTemplateShowSetData.stream().filter(f -> !f.getGroupId().equals(SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID)).forEach(e -> salaryTemplateShowSetData.stream().filter(f -> !f.getGroupId().equals(SalaryTemplateSalaryItemSetGroupConstant.EMPLOYEE_INFO_GROUP_ID)).forEach(e ->
salaryItems.addAll(e.getItems()) salaryItems.addAll(e.getItems())
); );
} }
return salaryItems; return salaryItems;
@ -1675,14 +1702,14 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
@Override @Override
public List<SalarySendInfoPO> listUnConfirmedSendInfo(List<Long> salarySobIds) { public List<SalarySendInfoPO> listUnConfirmedSendInfo(List<Long> salarySobIds) {
if(CollectionUtils.isEmpty(salarySobIds)) if (CollectionUtils.isEmpty(salarySobIds))
return Collections.emptyList(); return Collections.emptyList();
return getSalarySendInfoMapper().listUnConfirmedSendInfo(salarySobIds); return getSalarySendInfoMapper().listUnConfirmedSendInfo(salarySobIds);
} }
@Override @Override
public void autoConfirmSalaryBill(List<Long> needAutoSendIds) { public void autoConfirmSalaryBill(List<Long> needAutoSendIds) {
if(CollectionUtils.isEmpty(needAutoSendIds)){ if (CollectionUtils.isEmpty(needAutoSendIds)) {
return; return;
} }
List<List<Long>> partition = Lists.partition((List) needAutoSendIds, 500); List<List<Long>> partition = Lists.partition((List) needAutoSendIds, 500);
@ -1691,7 +1718,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
@Override @Override
public List<SalarySendPO> getByIds(List<Long> salarySendId) { public List<SalarySendPO> getByIds(List<Long> salarySendId) {
if(CollectionUtils.isEmpty(salarySendId)){ if (CollectionUtils.isEmpty(salarySendId)) {
return Collections.emptyList(); return Collections.emptyList();
} }
return getSalarySendMapper().getByIds(salarySendId); return getSalarySendMapper().getByIds(salarySendId);

View File

@ -90,9 +90,14 @@ public class SalarySysConstant {
* 工资单反馈自动确认 * 工资单反馈自动确认
*/ */
public static final String SALARY_AUTO_ACK_DAYS = "SALARY_AUTO_ACK_DAYS"; public static final String SALARY_AUTO_ACK_DAYS = "SALARY_AUTO_ACK_DAYS";
/** /**
* 工资单反馈地址 * 工资单反馈地址
*/ */
public static final String SALARY_FEEDBACK_URL = "SALARY_FEEDBACK_URL"; public static final String SALARY_FEEDBACK_URL = "SALARY_FEEDBACK_URL";
/**
* 工资单查询限制
*/
public static final String SALARY_BILL_VIEWING_LIMIT_MONTH = "SALARY_BILL_VIEWING_LIMIT_MONTH";
} }

View File

@ -76,6 +76,9 @@ import static java.util.concurrent.Executors.newFixedThreadPool;
**/ **/
@Slf4j @Slf4j
public class SalarySysConfServiceImpl extends Service implements SalarySysConfService { public class SalarySysConfServiceImpl extends Service implements SalarySysConfService {
private static volatile Boolean encryptStatus = null;
private EncryptUtil encryptUtil = new EncryptUtil(); private EncryptUtil encryptUtil = new EncryptUtil();
private SalarySysConfMapper getSalarySysConfMapper() { private SalarySysConfMapper getSalarySysConfMapper() {
@ -388,11 +391,15 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
@Override @Override
public boolean encryptIsOpen() { public boolean encryptIsOpen() {
SalarySysConfPO sysConfPo = getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT); if (encryptStatus == null) {
if (sysConfPo != null && sysConfPo.getConfValue().equals(OpenEnum.OFF.getValue())) { SalarySysConfPO sysConfPo = getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
return false; if (sysConfPo != null && sysConfPo.getConfValue().equals(OpenEnum.OFF.getValue())) {
encryptStatus = false;
} else {
encryptStatus = true;
}
} }
return true; return encryptStatus;
} }
@Override @Override

View File

@ -0,0 +1,57 @@
package com.engine.salary.util.pdf;
import com.engine.workflow.biz.requestForm.HtmlToPdfInterceptor;
import lombok.extern.slf4j.Slf4j;
import java.io.File;
@Slf4j
public class HtmlToPdf {
/**
* html转pdf
*
* @param toPdfTool 工具路径
* @param srcPath html路径可以是硬盘上的路径也可以是网络路径
* @param destPath pdf保存路径
* @return 转换成功返回true
*/
public static boolean convert(String toPdfTool, String srcPath, String destPath) {
File file = new File(destPath);
File parent = file.getParentFile();
//如果pdf保存路径不存在则创建路径
if (!parent.exists()) {
parent.mkdirs();
}
StringBuilder cmd = new StringBuilder();
cmd.append(toPdfTool);
cmd.append(" ");
cmd.append(" --header-line");//页眉下面的线
cmd.append(" --margin-top 3cm ");//设置页面上边距 (default 10mm)
// cmd.append(" --header-html file:///"+WebUtil.getServletContext().getRealPath("")+FileUtil.convertSystemFilePath("\\style\\pdf\\head.html"));// (添加一个HTML页眉,后面是网址)
cmd.append(" --header-spacing 5 --orientation Portrait ");// (设置页眉和内容的距离,默认0)
//cmd.append(" --footer-center (设置在中心位置的页脚内容)");//设置在中心位置的页脚内容
//cmd.append(" --footer-html file:///"+WebUtil.getServletContext().getRealPath("")+FileUtil.convertSystemFilePath("\\style\\pdf\\foter.html"));// (添加一个HTML页脚,后面是网址)
cmd.append(" --footer-line");//* 显示一条线在页脚内容上)
cmd.append(" --footer-spacing 5 ");// (设置页脚和内容的距离)
//--orientation Portrait --footer-center [page]/[topage] --footer-line
cmd.append(srcPath);
cmd.append(" ");
cmd.append(destPath);
boolean result = true;
try {
Process proc = Runtime.getRuntime().exec(cmd.toString());
HtmlToPdfInterceptor error = new HtmlToPdfInterceptor(proc.getErrorStream());
HtmlToPdfInterceptor output = new HtmlToPdfInterceptor(proc.getInputStream());
error.start();
output.start();
proc.waitFor();
} catch (Exception e) {
result = false;
e.printStackTrace();
}
return result;
}
}

View File

@ -29,8 +29,11 @@ import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType; import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response; import javax.ws.rs.core.Response;
import javax.ws.rs.core.StreamingOutput; import javax.ws.rs.core.StreamingOutput;
import java.io.IOException;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLEncoder; import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.time.LocalDate; import java.time.LocalDate;
import java.util.*; import java.util.*;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@ -521,6 +524,53 @@ public class SalaryBillController {
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build(); return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
} }
// @GET
// @Path("/exportPdf")
// @Produces({"application/pdf"})
// public Response getPDF(@Context HttpServletRequest request, @Context HttpServletResponse response) {
//
// File f = new File("D:\\gzd\\2023-02\\1695104948592.pdf");
// return Response.ok(f, "application/pdf").build();
//
// }
@GET
@Path("/exportPdf")
public Response downloadPdfFile(@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));
}
StreamingOutput fileStream = new StreamingOutput() {
@Override
public void write(java.io.OutputStream output) throws IOException, WebApplicationException {
String pdfPath = getSalarySendWrapper(user).exportPdf(salaryExportPdfParam);
java.nio.file.Path path = Paths.get(pdfPath);
byte[] data = Files.readAllBytes(path);
output.write(data);
output.flush();
}
};
String fileName = "工资单";
try {
fileName = URLEncoder.encode(fileName + ".pdf", "UTF-8");
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
return Response
.ok(fileStream, MediaType.APPLICATION_OCTET_STREAM)
.header("content-disposition", "attachment; filename =" + fileName)
.build();
}
/** /**
* 我的工资单列表 * 我的工资单列表
* *
@ -637,6 +687,7 @@ public class SalaryBillController {
/** /**
* 校验验证码 * 校验验证码
*
* @param request * @param request
* @param response * @param response
* @param param * @param param
@ -661,7 +712,7 @@ public class SalaryBillController {
@Path("/baseSet/getForm") @Path("/baseSet/getForm")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
// @ApiOperation("获取工资单基础设置表单") // @ApiOperation("获取工资单基础设置表单")
public String getBaseSetForm( @Context HttpServletRequest request, @Context HttpServletResponse response ) { public String getBaseSetForm(@Context HttpServletRequest request, @Context HttpServletResponse response) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<String, SalaryBaseSetFormDTO>(user).run(getSalaryBillBaseSetWrapper(user)::getBaseSetForm); return new ResponseResult<String, SalaryBaseSetFormDTO>(user).run(getSalaryBillBaseSetWrapper(user)::getBaseSetForm);
} }
@ -674,7 +725,7 @@ public class SalaryBillController {
@POST @POST
@Path("/baseSet/previewWaterMark") @Path("/baseSet/previewWaterMark")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
public String getBaseSetForm( @Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBaseSetSaveParam saveParam ) { public String getBaseSetForm(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBaseSetSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryBaseSetSaveParam, String>(user).run(getSalaryBillBaseSetWrapper(user)::previewWaterMark, saveParam); return new ResponseResult<SalaryBaseSetSaveParam, String>(user).run(getSalaryBillBaseSetWrapper(user)::previewWaterMark, saveParam);
} }
@ -689,7 +740,7 @@ public class SalaryBillController {
@Path("/baseSet/save") @Path("/baseSet/save")
@Produces(MediaType.APPLICATION_JSON) @Produces(MediaType.APPLICATION_JSON)
// @ApiOperation("保存工资单基础设置") // @ApiOperation("保存工资单基础设置")
public String saveBaseSet( @Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBaseSetSaveParam saveParam) { public String saveBaseSet(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody SalaryBaseSetSaveParam saveParam) {
User user = HrmUserVarify.getUser(request, response); User user = HrmUserVarify.getUser(request, response);
return new ResponseResult<SalaryBaseSetSaveParam, String>(user).run(getSalaryBillBaseSetWrapper(user)::saveBaseSet, saveParam); return new ResponseResult<SalaryBaseSetSaveParam, String>(user).run(getSalaryBillBaseSetWrapper(user)::saveBaseSet, saveParam);
} }

View File

@ -4,6 +4,7 @@ import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.salary.entity.salaryBill.dto.SalaryBaseSetFormDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBaseSetFormDTO;
import com.engine.salary.entity.salaryBill.dto.SalaryBillAckFeedbackDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillAckFeedbackDTO;
import com.engine.salary.entity.salaryBill.dto.salaryBillViewingLimitSetting;
import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO; import com.engine.salary.entity.salaryBill.dto.SalaryBillWatermarkDTO;
import com.engine.salary.entity.salaryBill.param.SalaryBaseSetSaveParam; import com.engine.salary.entity.salaryBill.param.SalaryBaseSetSaveParam;
import com.engine.salary.service.SalaryBillBaseSetService; import com.engine.salary.service.SalaryBillBaseSetService;
@ -47,6 +48,7 @@ public class SalaryBillBaseSetWrapper extends Service {
SalaryBaseSetFormDTO dto = new SalaryBaseSetFormDTO(); SalaryBaseSetFormDTO dto = new SalaryBaseSetFormDTO();
SalaryBillWatermarkDTO salaryBillWatermark = getSalaryBillBaseSetService(user).getWatermarkSetting(); SalaryBillWatermarkDTO salaryBillWatermark = getSalaryBillBaseSetService(user).getWatermarkSetting();
SalaryBillAckFeedbackDTO salaryBillAckFeedback = getSalaryBillBaseSetService(user).getDefaultAckFeedbackSetting(); SalaryBillAckFeedbackDTO salaryBillAckFeedback = getSalaryBillBaseSetService(user).getDefaultAckFeedbackSetting();
salaryBillViewingLimitSetting salaryBillViewingLimitSetting = getSalaryBillBaseSetService(user).getSalaryBillViewingLimitSetting();
if (Objects.isNull(salaryBillWatermark)) { if (Objects.isNull(salaryBillWatermark)) {
dto.setWatermarkStatus(false); dto.setWatermarkStatus(false);
@ -62,6 +64,7 @@ public class SalaryBillBaseSetWrapper extends Service {
// 工资单反馈默认设置 // 工资单反馈默认设置
dto.setAckFeedbackSetting(salaryBillAckFeedback); dto.setAckFeedbackSetting(salaryBillAckFeedback);
} }
dto.setSalaryBillViewingLimitSetting(salaryBillViewingLimitSetting);
return dto; return dto;
} }

View File

@ -14,7 +14,6 @@ import com.cloudstore.eccom.result.WeaResultMsg;
import com.engine.common.util.ServiceUtil; import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service; import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryItemConstant; import com.engine.salary.constant.SalaryItemConstant;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryBill.dto.*; import com.engine.salary.entity.salaryBill.dto.*;
import com.engine.salary.entity.salaryBill.param.*; import com.engine.salary.entity.salaryBill.param.*;
import com.engine.salary.entity.salaryBill.po.SalarySendPO; import com.engine.salary.entity.salaryBill.po.SalarySendPO;
@ -698,4 +697,8 @@ public class SalarySendWrapper extends Service implements SalarySendWrapperProxy
} }
getSalaryBillService(user).feedBackSalaryBill(salaryInfoId); getSalaryBillService(user).feedBackSalaryBill(salaryInfoId);
} }
public String exportPdf(SalaryExportPdfParam param) {
return getSalaryBillService(user).exportPdf(param);
}
} }