diff --git a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java index c6469f75d..bf47e7e0e 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java @@ -112,23 +112,23 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc @Override public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List 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 employeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); List simpleEmployees = getSalaryEmployeeService(user).getEmployeeByIdsAll(employeeIds); SalarySobCycleDTO salarySobCycleDTO = salaryAcctCalculateBO.getSalarySobCycleDTO(); Long taxAgentId = salaryAcctCalculateBO.getSalarySobPO().getTaxAgentId(); sw.stop(); // 2、查询薪资档案的数据 - sw.start("核算耗时查询薪资档案的数据"); + sw.start("查询薪资档案的数据"); List salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId); sw.stop(); // 3、查询往期累计情况(查询的是上个税款所属期的的累计情况) - sw.start("核算耗时查询往期累计情况"); + sw.start("查询往期累计情况"); List 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 addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); sw.stop(); // 5、查询其他免税扣除 - sw.start("核算耗时查询其他免税扣除"); + sw.start("查询其他免税扣除"); List otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); sw.stop(); //6、查询社保福利 - sw.start("核算耗时查询社保福利"); + sw.start("查询社保福利"); List> welfareData = getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId); sw.stop(); // 7、查询考勤数据 - sw.start("核算耗时查询考勤数据"); + sw.start("查询考勤数据"); List attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds); sw.stop(); // 8、查询薪资核算人员的薪资核算结果 - sw.start("核算耗时查询薪资核算人员的薪资核算结果"); + sw.start("查询薪资核算人员的薪资核算结果"); List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); sw.stop(); // 薪资回算时回算前的核算结果 (没有回算项) - sw.start("核算耗时查询薪资回算时回算前的核算结果"); + sw.start("查询薪资回算时回算前的核算结果"); Map> collect = salaryAcctResultPOS.stream().collect(Collectors.groupingBy(k -> k.getEmployeeId() + "-" + k.getTaxAgentId() + "-" + k.getSalaryItemId())); Map salaryAcctResultPOMap = new HashMap<>(); for (Map.Entry> et : collect.entrySet()) { @@ -170,22 +170,22 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc List lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds()); sw.stop(); // 9、查询相同税款所属期内涉及合并计税的其他薪资核算结果 - sw.start("核算耗时查询相同税款所属期内涉及合并计税的其他薪资核算结果"); + sw.start("查询相同税款所属期内涉及合并计税的其他薪资核算结果"); Set otherSalaryAcctRecordIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getOtherSalaryAcctRecordPOS(), SalaryAcctRecordPO::getId); List otherSalaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); Map> otherSalaryAcctResultPOMap = SalaryEntityUtil.group2Map(otherSalaryAcctResultPOS, e -> e.getEmployeeId() + "_" + e.getTaxAgentId()); sw.stop(); // 9.1、查询相同税款所属期内设计合并计税的其他薪资核算人员 - sw.start("核算耗时查询相同税款所属期内设计合并计税的其他薪资核算人员"); + sw.start("查询相同税款所属期内设计合并计税的其他薪资核算人员"); List otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); Map> 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> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO); sw.stop(); - sw.start("核算耗时数据结构准备"); + sw.start("数据结构准备"); // 本次薪资核算所用的薪资账套下的薪资项目 Map salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId); // 本次薪资核算所用的公式 @@ -198,7 +198,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc List salaryAcctResultTempPOS = Lists.newArrayList(); sw.stop(); // 开始核算 - sw.start("核算耗时核算耗时"); + sw.start("核算耗时"); StringBuffer noticeMsg = new StringBuffer(); for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) { Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId(); @@ -290,7 +290,7 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc } sw.stop(); // 保存新的薪资核算结果(临时存储) - sw.start("核算耗时保存新的薪资核算结果(临时存储)"); + sw.start("保存新的薪资核算结果(临时存储)"); getSalaryAcctResultTempService(user).batchSave(salaryAcctResultTempPOS); sw.stop(); // 更新薪资核算进度 @@ -300,7 +300,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) { diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java index e63fcfaaf..e3bf9a3e5 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -721,9 +721,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)) { @@ -791,7 +791,7 @@ 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); @@ -841,7 +841,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe childMonitor.await(); stopWatch.stop(); - stopWatch.start("核算入库计时"); + stopWatch.start("数据写入耗时"); // 14、判断子线程执行结果 boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus);