Merge branch 'release/2.14.1.2405.01' into release/个税版本
This commit is contained in:
commit
3dc8f6d57c
|
|
@ -1,5 +1,5 @@
|
|||
log=false
|
||||
defaultCloseNonStandard149=true
|
||||
AESEncryptScrect=990EB004A1C862721C1513AE90038C9E
|
||||
version=2.13.1.2404.02
|
||||
version=2.14.1.2405.01
|
||||
openFormulaForcedEditing=false
|
||||
|
|
@ -32,3 +32,14 @@ update hrsa_other_archives set delete_type=3 WHERE employee_id = ? and payment_
|
|||
|
||||
-- 删除薪资档案
|
||||
update hrsa_salary_archive set delete_type=3 where employee_id = ? and tax_agent_id=?
|
||||
|
||||
|
||||
update hrsa_salary_archive set delete_type=3;
|
||||
update hrsa_insurance_base_info set delete_type=3;
|
||||
update hrsa_social_archives set delete_type=3;
|
||||
update hrsa_fund_archives set delete_type=3;
|
||||
update hrsa_other_archives set delete_type=3;
|
||||
update hrsa_tax_agent_emp set delete_type=3;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -8,3 +8,14 @@ left join hrsa_salary_acct_result result on record.id = result.salary_acct_recor
|
|||
left join hrsa_salary_item item on result.salary_item_id = item.id and item.delete_type = 0
|
||||
left join hrsa_tax_agent agent on agent.id=sob.tax_agent_id and agent.delete_type=0
|
||||
left join hrmresource e on e.id= result.employee_id
|
||||
|
||||
|
||||
# 获取档案信息
|
||||
|
||||
select i.item_value from hrsa_salary_archive_item i
|
||||
left join hrsa_salary_archive a on a.id = i.salary_archive_id
|
||||
left join hrsa_salary_item c on c.id=i.salary_item_id
|
||||
left join hrsa_tax_agent t on a.tax_agent_id=t.id
|
||||
where a.delete_type=0 and i.delete_type=0 and t.delete_type=0 and c.delete_type=0
|
||||
and a.employee_id=$main.ygid$ and t.name='$main.dzqgskjywr$'
|
||||
and effective_time <= now() and c.name='基本工资' order by effective_time desc
|
||||
|
|
@ -374,7 +374,7 @@ public class SalaryBillBO {
|
|||
.replace("{薪资所属月}", SalaryDateUtil.getFormatYearMonth(salaryBillSendParam.getSalaryDate()));
|
||||
|
||||
for (SalaryTemplateSalaryItemListDTO item : salaryBillSendParam.getEmployeeInformation().getItems()) {
|
||||
content = content.replace("{" + item.getName() + "}", item.getSalaryItemValue());
|
||||
content = content.replace("{" + item.getName() + "}", Util.null2String(item.getSalaryItemValue()));
|
||||
}
|
||||
|
||||
for (SalaryTemplateSalaryItemSetListDTO salaryTemplateSalaryItemSetListDTO : salaryBillSendParam.getSalaryItemSetList()) {
|
||||
|
|
|
|||
|
|
@ -7,11 +7,14 @@ import com.engine.salary.entity.salaryformula.po.FormulaVar;
|
|||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.google.common.collect.Maps;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
|
@ -91,10 +94,9 @@ public class ExpressFormulaBO {
|
|||
* @param formulaVarValueMap 公式变量的值
|
||||
* @return
|
||||
*/
|
||||
public static List<FormulaVar> buildFormulaVar4Accounting(ExpressFormula expressFormula, Map<String, String> formulaVarValueMap) {
|
||||
List<FormulaVar> formulaVars = Collections.emptyList();
|
||||
formulaVars = expressFormula.getParameters();
|
||||
for (FormulaVar formulaVar : formulaVars) {
|
||||
public static List<FormulaVar> buildFormulaVar4Accounting(ExpressFormula expressFormula, Map<String, String> formulaVarValueMap) throws JsonProcessingException {
|
||||
List<FormulaVar> formulaVars = new ArrayList<>();
|
||||
for (FormulaVar formulaVar : expressFormula.getParameters()) {
|
||||
// 公式变量的值
|
||||
String formulaVarValue = formulaVarValueMap.getOrDefault(formulaVar.getFieldId(), StringUtils.EMPTY);
|
||||
// 如果公式的返回值类型为number,公式中的变量的值如果为空,公式运行的时候会报错,所以需要替换成0
|
||||
|
|
@ -103,7 +105,11 @@ public class ExpressFormulaBO {
|
|||
} else if (StringUtils.isEmpty(formulaVarValue) && "string".equals(formulaVar.getFieldType())) {
|
||||
formulaVarValue = "";
|
||||
}
|
||||
formulaVar.setContent(formulaVarValue);
|
||||
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
FormulaVar copyVar = objectMapper.readValue(objectMapper.writeValueAsString(formulaVar), FormulaVar.class);
|
||||
copyVar.setContent(formulaVarValue);
|
||||
formulaVars.add(copyVar);
|
||||
}
|
||||
return formulaVars;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import com.engine.salary.entity.salaryformula.dto.SalaryFormulaEmployeeDTO;
|
|||
import com.engine.salary.entity.salaryitem.po.SalaryItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobBackItemPO;
|
||||
import com.engine.salary.entity.salarysob.po.SalarySobItemPO;
|
||||
import com.engine.salary.enums.SalaryRoundingModeEnum;
|
||||
import com.engine.salary.enums.salaryitem.SalaryDataTypeEnum;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
|
|
@ -14,8 +13,10 @@ import org.apache.commons.collections.CollectionUtils;
|
|||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.util.*;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* 薪资核算公式变量
|
||||
|
|
@ -32,8 +33,8 @@ public class SalaryAcctFormulaBO {
|
|||
*
|
||||
* @param value
|
||||
* @param salaryItem
|
||||
* @param salarySobBackItems 薪资账套回算项目List
|
||||
* @param salarySobBackItemMap 薪资账套回算项目Map
|
||||
* @param salarySobBackItems 薪资账套回算项目List
|
||||
* @param salarySobBackItemMap 薪资账套回算项目Map
|
||||
* @param salaryItemIdKeySalarySobItemPOMap 薪资账套下薪资项目Map
|
||||
* @return
|
||||
*/
|
||||
|
|
@ -55,33 +56,13 @@ public class SalaryAcctFormulaBO {
|
|||
.orElse(salaryItem.getRoundingMode());
|
||||
Integer salaryItemPattern = Optional.ofNullable(salaryItemIdKeySalarySobItemPOMap.get(salaryItem.getId())).map(SalarySobItemPO::getPattern)
|
||||
.orElse(salaryItem.getPattern());
|
||||
if(CollectionUtils.isNotEmpty(salarySobBackItems) && salarySobBackItemMap.containsKey(salaryItem.getId())){
|
||||
if (CollectionUtils.isNotEmpty(salarySobBackItems) && salarySobBackItemMap.containsKey(salaryItem.getId())) {
|
||||
// 薪资项目是回算项目
|
||||
salaryItemRoundingMode = salarySobBackItemMap.get(salaryItem.getId()).getRoundingMode();
|
||||
salaryItemPattern = salarySobBackItemMap.get(salaryItem.getId()).getPattern();
|
||||
}
|
||||
BigDecimal bigDecimalValue = SalaryEntityUtil.empty2Zero(value);
|
||||
RoundingMode roundingMode = RoundingMode.HALF_UP;
|
||||
if (Objects.equals(salaryItemRoundingMode, SalaryRoundingModeEnum.ROUND_UP.getValue())) {
|
||||
roundingMode = RoundingMode.UP;
|
||||
}
|
||||
if (Objects.equals(salaryItemRoundingMode, SalaryRoundingModeEnum.ROUND_DOWN.getValue())) {
|
||||
roundingMode = RoundingMode.DOWN;
|
||||
}
|
||||
//见分取角(只取保留小数后一位向上舍入)
|
||||
if (Objects.equals(salaryItemRoundingMode, SalaryRoundingModeEnum.CEILING.getValue())) {
|
||||
bigDecimalValue = bigDecimalValue.setScale(salaryItemPattern + 1, RoundingMode.FLOOR);
|
||||
roundingMode = RoundingMode.UP;
|
||||
}
|
||||
//向上取偶
|
||||
if (Objects.equals(salaryItemRoundingMode, SalaryRoundingModeEnum.UP_EVEN.getValue())) {
|
||||
bigDecimalValue = bigDecimalValue.setScale(0, RoundingMode.UP);
|
||||
int number = bigDecimalValue.intValue();
|
||||
if (number % 2 != 0) {
|
||||
bigDecimalValue = bigDecimalValue.add(BigDecimal.valueOf(1));
|
||||
}
|
||||
}
|
||||
return bigDecimalValue.setScale(salaryItemPattern, roundingMode).toPlainString();
|
||||
return SalaryEntityUtil.carryRule(salaryItemPattern, salaryItemRoundingMode, bigDecimalValue).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -315,7 +315,7 @@ public class SalaryAcctManager extends Service {
|
|||
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("SUPPLEMENT_ACCT_PROGRESS_" + salaryAcctRecordId, initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 5000);
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 100);
|
||||
// 12.1、监控子线程的任务执行
|
||||
CountDownLatch childMonitor = new CountDownLatch(partition.size());
|
||||
// 12.2、记录子线程的执行结果
|
||||
|
|
@ -353,7 +353,7 @@ public class SalaryAcctManager extends Service {
|
|||
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
|
||||
}
|
||||
};
|
||||
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculateV2", localRunnable);
|
||||
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculate", localRunnable);
|
||||
}
|
||||
// 13、等待所有子线程执行完毕
|
||||
childMonitor.await();
|
||||
|
|
|
|||
|
|
@ -112,23 +112,23 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
|
||||
@Override
|
||||
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
|
||||
StopWatch sw = new StopWatch(salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+"");
|
||||
StopWatch sw = new StopWatch("核算耗时明细,id:"+salaryAcctCalculateBO.getSalaryAcctRecordPO().getId()+"");
|
||||
Date now = new Date();
|
||||
try {
|
||||
// 数据库字段加密用
|
||||
// 1、查询人员信息
|
||||
sw.start("核算耗时查询人员信息");
|
||||
sw.start("查询人员信息");
|
||||
List<Long> employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList());
|
||||
List<DataCollectionEmployee> simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds);
|
||||
SalarySobCycleDTO salarySobCycleDTO = salaryAcctCalculateBO.getSalarySobCycleDTO();
|
||||
Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId();
|
||||
sw.stop();
|
||||
// 2、查询薪资档案的数据
|
||||
sw.start("核算耗时查询薪资档案的数据");
|
||||
sw.start("查询薪资档案的数据");
|
||||
List<SalaryArchiveDataDTO> salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId);
|
||||
sw.stop();
|
||||
// 3、查询往期累计情况(查询的是上个税款所属期的的累计情况)
|
||||
sw.start("核算耗时查询往期累计情况");
|
||||
sw.start("查询往期累计情况");
|
||||
List<AddUpSituation> addUpSituationPOS;
|
||||
if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) {
|
||||
// 3.1、如果当前税款所属期是本年度第一个税款所属期,就不需要查询往期累计情况
|
||||
|
|
@ -138,28 +138,28 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
}
|
||||
sw.stop();
|
||||
// 4、查询累计专项附加扣除
|
||||
sw.start("核算耗时查询累计专项附加扣除");
|
||||
sw.start("查询累计专项附加扣除");
|
||||
List<AddUpDeduction> addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
|
||||
sw.stop();
|
||||
// 5、查询其他免税扣除
|
||||
sw.start("核算耗时查询其他免税扣除");
|
||||
sw.start("查询其他免税扣除");
|
||||
List<OtherDeductionPO> otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId);
|
||||
sw.stop();
|
||||
//6、查询社保福利
|
||||
sw.start("核算耗时查询社保福利");
|
||||
sw.start("查询社保福利");
|
||||
List<Map<String, Object>> welfareData = getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId);
|
||||
sw.stop();
|
||||
// 7、查询考勤数据
|
||||
sw.start("核算耗时查询考勤数据");
|
||||
sw.start("查询考勤数据");
|
||||
List<AttendQuoteDataDTO> attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds);
|
||||
sw.stop();
|
||||
// 8、查询薪资核算人员的薪资核算结果
|
||||
sw.start("核算耗时查询薪资核算人员的薪资核算结果");
|
||||
sw.start("查询薪资核算人员的薪资核算结果");
|
||||
List<Long> salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList());
|
||||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
sw.stop();
|
||||
// 薪资回算时回算前的核算结果 (没有回算项)
|
||||
sw.start("核算耗时查询薪资回算时回算前的核算结果");
|
||||
sw.start("查询薪资回算时回算前的核算结果");
|
||||
Map<String, List<SalaryAcctResultPO>> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId()));
|
||||
Map<String, String> salaryAcctResultPOMap = new HashMap<>();
|
||||
for (Map.Entry<String, List<SalaryAcctResultPO>> et : collect.entrySet()) {
|
||||
|
|
@ -170,22 +170,22 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
List<Long> lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds());
|
||||
sw.stop();
|
||||
// 9、查询相同税款所属期内涉及合并计税的其他薪资核算结果
|
||||
sw.start("核算耗时查询相同税款所属期内涉及合并计税的其他薪资核算结果");
|
||||
sw.start("查询相同税款所属期内涉及合并计税的其他薪资核算结果");
|
||||
Set<Long> otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId);
|
||||
List<SalaryAcctResultPO> otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
|
||||
Map<String, List<SalaryAcctResultPO>> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId());
|
||||
sw.stop();
|
||||
// 9.1、查询相同税款所属期内设计合并计税的其他薪资核算人员
|
||||
sw.start("核算耗时查询相同税款所属期内设计合并计税的其他薪资核算人员");
|
||||
sw.start("查询相同税款所属期内设计合并计税的其他薪资核算人员");
|
||||
List<SalaryAcctEmployeePO> otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds);
|
||||
Map<String, List<SalaryAcctEmployeePO>> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId());
|
||||
sw.stop();
|
||||
// 10、转换成公式编辑器中的变量
|
||||
sw.start("核算耗时转换成公式编辑器中的变量");
|
||||
sw.start("转换成公式编辑器中的变量");
|
||||
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS);
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
|
||||
sw.stop();
|
||||
sw.start("核算耗时数据结构准备");
|
||||
sw.start("数据结构准备");
|
||||
// 本次薪资核算所用的薪资账套下的薪资项目
|
||||
Map<Long, SalarySobItemPO> salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId);
|
||||
// 本次薪资核算所用的公式
|
||||
|
|
@ -198,7 +198,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
List<SalaryAcctResultTempPO> salaryAcctResultTempPOS = Lists.newArrayList();
|
||||
sw.stop();
|
||||
// 开始核算
|
||||
sw.start("核算耗时核算耗时");
|
||||
sw.start("核算耗时");
|
||||
StringBuffer noticeMsg = new StringBuffer();
|
||||
for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) {
|
||||
Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId();
|
||||
|
|
@ -288,7 +288,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
}
|
||||
sw.stop();
|
||||
// 保存新的薪资核算结果(临时存储)
|
||||
sw.start("核算耗时保存新的薪资核算结果(临时存储)");
|
||||
sw.start("保存新的薪资核算结果(临时存储)");
|
||||
getSalaryAcctResultTempService(user).batchSave(salaryAcctResultTempPOS);
|
||||
sw.stop();
|
||||
// 更新薪资核算进度
|
||||
|
|
@ -298,7 +298,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
noticeMsg.toString()
|
||||
);
|
||||
sw.stop();
|
||||
log.info("核算耗时明细" + sw.prettyPrint());
|
||||
log.info(sw.prettyPrint());
|
||||
// 记录子线程执行结果
|
||||
salaryAcctCalculateBO.getResults().add(new SalaryAcctCalculateBO.Result(true, StringUtils.EMPTY));
|
||||
} catch (Exception e) {
|
||||
|
|
|
|||
|
|
@ -728,9 +728,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
|
||||
@Override
|
||||
public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) {
|
||||
StopWatch stopWatch = new StopWatch(calculateParam.getSalaryAcctRecordId() + "");
|
||||
StopWatch stopWatch = new StopWatch("总核算耗时,id:"+calculateParam.getSalaryAcctRecordId());
|
||||
try {
|
||||
stopWatch.start("核算总耗时数据准备");
|
||||
stopWatch.start("数据准备");
|
||||
// 1、查询薪资核算记录
|
||||
SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId());
|
||||
if (Objects.isNull(salaryAcctRecordPO)) {
|
||||
|
|
@ -800,13 +800,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
}
|
||||
|
||||
stopWatch.stop();
|
||||
stopWatch.start("核算完毕计时");
|
||||
stopWatch.start("核算耗时");
|
||||
|
||||
// 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);
|
||||
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), initProgress);
|
||||
// 12、对薪资核算人员进行拆分
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 5000);
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, 100);
|
||||
// 12.1、监控子线程的任务执行
|
||||
CountDownLatch childMonitor = new CountDownLatch(partition.size());
|
||||
// 12.2、记录子线程的执行结果
|
||||
|
|
@ -817,7 +817,26 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
TaxDeclarationFunctionEnum taxDeclarationFunction = getSalarySysConfService(user).getTaxDeclaration();
|
||||
// 12.5、多线程运算,运算结果存放在临时表中
|
||||
for (List<SalaryAcctEmployeePO> acctEmployeePOS : partition) {
|
||||
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);
|
||||
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);
|
||||
List<SalarySobBackItemPO> finalSalarySobBackItems = salarySobBackItems;
|
||||
LocalRunnable localRunnable = new LocalRunnable() {
|
||||
@Override
|
||||
|
|
@ -825,13 +844,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
getSalaryAcctCalculateService(user).calculate(salaryAcctCalculateBO, simpleEmployee, finalSalarySobBackItems);
|
||||
}
|
||||
};
|
||||
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculateV2", localRunnable);
|
||||
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.HRM, "salaryAcctCalculate", localRunnable);
|
||||
}
|
||||
// 13、等待所有子线程执行完毕
|
||||
childMonitor.await();
|
||||
|
||||
stopWatch.stop();
|
||||
stopWatch.start("核算入库计时");
|
||||
stopWatch.start("数据写入耗时");
|
||||
|
||||
// 14、判断子线程执行结果
|
||||
boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus);
|
||||
|
|
|
|||
|
|
@ -75,6 +75,7 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import weaver.common.MessageUtil;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
import weaver.hrm.company.SubCompanyComInfo;
|
||||
import weaver.hrm.resource.ResourceComInfo;
|
||||
|
|
@ -957,7 +958,7 @@ public class SalarySendServiceImpl extends Service implements SalarySendService
|
|||
try {
|
||||
Method method = salaryFormulaEmployeeDTO.getClass().getMethod(getter);
|
||||
Object invoke = method.invoke(salaryFormulaEmployeeDTO);
|
||||
e.setSalaryItemValue(invoke.toString());
|
||||
e.setSalaryItemValue(Util.null2String(invoke));
|
||||
} catch (NoSuchMethodException | IllegalAccessException | InvocationTargetException ex) {
|
||||
log.error("no such method", e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,10 @@ package com.engine.salary.util.pdf;
|
|||
import com.engine.workflow.biz.requestForm.HtmlToPdfInterceptor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
@Slf4j
|
||||
public class HtmlToPdf {
|
||||
|
|
@ -11,9 +14,9 @@ public class HtmlToPdf {
|
|||
/**
|
||||
* html转pdf
|
||||
*
|
||||
* @param toPdfTool 工具路径
|
||||
* @param srcPath html路径,可以是硬盘上的路径,也可以是网络路径
|
||||
* @param destPath pdf保存路径
|
||||
* @param toPdfTool 工具路径
|
||||
* @param srcPath html路径,可以是硬盘上的路径,也可以是网络路径
|
||||
* @param destPath pdf保存路径
|
||||
* @return 转换成功返回true
|
||||
*/
|
||||
public static boolean convert(String toPdfTool, String srcPath, String destPath) {
|
||||
|
|
@ -45,8 +48,26 @@ public class HtmlToPdf {
|
|||
HtmlToPdfInterceptor output = new HtmlToPdfInterceptor(proc.getInputStream());
|
||||
error.start();
|
||||
output.start();
|
||||
proc.waitFor();
|
||||
|
||||
BufferedInputStream err = new BufferedInputStream(proc.getErrorStream());
|
||||
BufferedReader errBr = new BufferedReader(new InputStreamReader(err));
|
||||
String lineStr = "";
|
||||
while ((lineStr = errBr.readLine()) != null) {
|
||||
//检查命令是否执行失败。
|
||||
log.info("pdf转换执行中! {}", lineStr);
|
||||
}
|
||||
if (proc.waitFor() != 0) {
|
||||
//p.exitValue()==0表示正常结束,1:非正常结束
|
||||
if (proc.exitValue() == 1) {
|
||||
log.error("pdf转换命令执行失败!");
|
||||
}
|
||||
}
|
||||
} catch (InterruptedException e) {
|
||||
log.error("pdf转换出错!", e);
|
||||
e.printStackTrace();
|
||||
result = false;
|
||||
} catch (Exception e) {
|
||||
log.error("pdf转换出错!", e);
|
||||
result = false;
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue