diff --git a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java index 018702a7a..e61e15346 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctCalculateServiceImpl.java @@ -34,6 +34,7 @@ import org.apache.commons.collections4.ListUtils; import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; +import org.springframework.util.StopWatch; import weaver.general.BaseBean; import weaver.hrm.User; import weaver.wechat.util.Utils; @@ -111,17 +112,23 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc @Override public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List salarySobBackItems) { + StopWatch sw = new StopWatch(); Date now = new Date(); try { // 数据库字段加密用 // 1、查询人员信息 + 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("核算耗时查询薪资档案的数据"); List salaryArchiveData = getSalaryArchiveService(user).getSalaryArchiveData(salarySobCycleDTO.getSalaryCycle(), employeeIds, taxAgentId); + sw.stop(); // 3、查询往期累计情况(查询的是上个税款所属期的的累计情况) + sw.start("核算耗时查询往期累计情况"); List addUpSituationPOS; if (salarySobCycleDTO.getTaxCycle().getMonth() == Month.JANUARY) { // 3.1、如果当前税款所属期是本年度第一个税款所属期,就不需要查询往期累计情况 @@ -129,19 +136,30 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc } else { addUpSituationPOS = getAddUpSituationService(user).getAddUpSituationList(salarySobCycleDTO.getTaxCycle().plusMonths(-1), employeeIds); } + sw.stop(); // 4、查询累计专项附加扣除 + sw.start("核算耗时查询累计专项附加扣除"); List addUpDeductionPOS = getAddUpDeductionService(user).getAddUpDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); + sw.stop(); // 5、查询其他免税扣除 + sw.start("核算耗时查询其他免税扣除"); List otherDeductionPOS = getOtherDeductionService(user).getOtherDeductionList(salarySobCycleDTO.getTaxCycle(), employeeIds, taxAgentId); + sw.stop(); //6、查询社保福利 + sw.start("核算耗时查询社保福利"); List> welfareData = getSIAccountService(user).welfareData(salarySobCycleDTO.getSocialSecurityCycle().toString(), employeeIds, taxAgentId); + sw.stop(); // 7、查询考勤数据 + sw.start("核算耗时查询考勤数据"); List attendQuoteDataDTOS = getAttendQuoteDataService(user).getAttendQuoteData(salarySobCycleDTO.getSalaryMonth(), salarySobCycleDTO.getSalarySobId(), employeeIds); + sw.stop(); // 8、查询薪资核算人员的薪资核算结果 + sw.start("核算耗时查询薪资核算人员的薪资核算结果"); List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctCalculateBO.getSalaryAcctEmployeePOS(), SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); - + sw.stop(); // 薪资回算时回算前的核算结果 (没有回算项) + 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()) { @@ -150,18 +168,24 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc //核算锁定的值 Map salaryAcctLockResultPOS = MapUtils.emptyIfNull(salaryAcctCalculateBO.getSalaryAcctLockResultPOS()); List lockSalaryItemIds = ListUtils.emptyIfNull(salaryAcctCalculateBO.getLockSalaryItemIds()); + sw.stop(); // 9、查询相同税款所属期内涉及合并计税的其他薪资核算结果 + 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("核算耗时查询相同税款所属期内设计合并计税的其他薪资核算人员"); List otherSalaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listBySalaryAcctRecordIdsAndEmployeeIds(otherSalaryAcctRecordIds, employeeIds); Map> otherSalaryAcctEmployeePOMap = SalaryEntityUtil.group2Map(otherSalaryAcctEmployeePOS, salaryAcctEmployeePO -> salaryAcctEmployeePO.getEmployeeId() + "_" + salaryAcctEmployeePO.getTaxAgentId()); - + sw.stop(); // 10、转换成公式编辑器中的变量 + sw.start("核算耗时转换成公式编辑器中的变量"); CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS); Map> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO); - + sw.stop(); + sw.start("核算耗时数据结构准备"); // 本次薪资核算所用的薪资账套下的薪资项目 Map salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobItemPOS(), SalarySobItemPO::getSalaryItemId); // 本次薪资核算所用的公式 @@ -172,7 +196,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc Set salarySobBackItemIds = SalaryEntityUtil.properties(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId); Map salarySobBackItemMap = SalaryEntityUtil.convert2Map(salarySobBackItems, SalarySobBackItemPO::getSalaryItemId); List salaryAcctResultTempPOS = Lists.newArrayList(); + sw.stop(); // 开始核算 + sw.start("核算耗时核算耗时"); StringBuffer noticeMsg = new StringBuffer(); for (SalaryAcctEmployeePO salaryAcctEmployeePO : salaryAcctCalculateBO.getSalaryAcctEmployeePOS()) { Long salaryAcctEmployeePOId = salaryAcctEmployeePO.getId(); @@ -262,13 +288,19 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc } } } + sw.stop(); // 保存新的薪资核算结果(临时存储) + sw.start("核算耗时保存新的薪资核算结果(临时存储)"); getSalaryAcctResultTempService(user).batchSave(salaryAcctResultTempPOS); + sw.stop(); // 更新薪资核算进度 + sw.start("更新薪资核算进度"); getSalaryAcctProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.ACCT_PROGRESS + salaryAcctCalculateBO.getSalaryAcctRecordPO().getId(), salaryAcctCalculateBO.getSalaryAcctEmployeePOS().size(), noticeMsg.toString() ); + sw.stop(); + 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 717cfc917..1674d2b0b 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultServiceImpl.java @@ -55,6 +55,7 @@ import org.apache.commons.collections4.MapUtils; import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.math.NumberUtils; import org.springframework.jdbc.datasource.DataSourceTransactionManager; +import org.springframework.util.StopWatch; import weaver.hrm.User; import java.math.BigDecimal; @@ -331,7 +332,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List salarySobItemPOS = getSalarySobItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId()); Map salaryItemIdKeySalarySobItemPOMap = SalaryEntityUtil.convert2Map(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); Set salaryItemIds = SalaryEntityUtil.properties(salarySobItemPOS, SalarySobItemPO::getSalaryItemId); - if(Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)){ + if (Objects.equals(salaryAcctRecordPO.getBackCalcStatus(), NumberUtils.INTEGER_ONE)) { // 是回算,获取回算项 List salarySobBackItemPOS = getSalarySobBackItemService(user).listBySalarySobId(salaryAcctRecordPO.getSalarySobId()); salaryItemIds.addAll(salarySobBackItemPOS.stream().map(SalarySobBackItemPO::getSalaryItemId).collect(Collectors.toList())); @@ -339,7 +340,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds); // 查询薪资核算结果 - List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList()); + List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); Map map = new HashMap<>(); @@ -396,7 +397,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe } List salaryItemPOS = getSalaryItemService(user).listByIds(salaryItemIds); // 查询薪资核算结果 - List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList()); + List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); // 查询人员信息 List employeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getEmployeeId, Collectors.toList()); @@ -477,7 +478,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe salaryAcctEmployeePOS = getSalaryAcctEmployeeService(user).listByRecordIdsAndEmpIdAndTaxAgentId(salaryAcctRecordIds, salaryAcctEmployeePO.getEmployeeId(), salaryAcctEmployeePO.getTaxAgentId()); } // 查询薪资核算人员的薪资核算结果 - List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId,Collectors.toList()); + List salaryAcctEmployeeIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getId, Collectors.toList()); List salaryAcctResultPOS = listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds); // 查询薪资核算人员所有合并计税的薪资核算记录所用的账套 Set salarySobIds = SalaryEntityUtil.properties(salaryAcctEmployeePOS, SalaryAcctEmployeePO::getSalarySobId); @@ -555,13 +556,13 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // 保存参数转换成薪资核算结果po List salaryAcctResultPOS = SalaryAcctResultBO.convert2PO(salaryAcctResultPOSOld, saveParam, salaryAcctEmployeePO, (long) user.getUID()); SalarySysConfPO autoLock = getSalarySysConfService(user).getOneByCode(SalarySysConstant.EDIT_IMPORT_AUTO_LOCK); - if(autoLock != null && StringUtils.equals(autoLock.getConfValue(),"1")){ + if (autoLock != null && StringUtils.equals(autoLock.getConfValue(), "1")) { // 对比核算结果提取修改了哪些薪资项目 Set needLockItems = new HashSet<>(); Map oldResutMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOSOld, SalaryAcctResultPO::getSalaryItemId); salaryAcctResultPOS.stream().forEach(PO -> { String oldValue = Optional.ofNullable(oldResutMap.get(PO.getSalaryItemId())).map(SalaryAcctResultPO::getResultValue).orElse(""); - if(!StringUtils.equals(oldValue,PO.getResultValue())){ + if (!StringUtils.equals(oldValue, PO.getResultValue())) { needLockItems.add(PO.getSalaryItemId()); } }); @@ -601,7 +602,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // 存储薪资核算结果数据来源日志 salaryAcctResultPOS = getSalaryAcctRecordService(user).listBySalaryAcctEmpId(saveParam.getSalaryAcctEmpId()); - saveSalaryAcctResultLog(salaryAcctResultPOSOld,salaryAcctResultPOS); + saveSalaryAcctResultLog(salaryAcctResultPOSOld, salaryAcctResultPOS); // 查询操作日志的targetName // String targetName = getSalaryAcctRecordService(user).getLogTargetNameById(salaryAcctEmployeePO.getSalaryAcctRecordId()); @@ -623,6 +624,7 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe /** * 存储薪资核算结果数据来源日志 + * * @param salaryAcctResultPOSOld * @param salaryAcctResultPOS */ @@ -631,11 +633,11 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List editItems = new ArrayList<>(); Map oldResutMap = SalaryEntityUtil.convert2Map(salaryAcctResultPOSOld, SalaryAcctResultPO::getSalaryItemId); salaryAcctResultPOS.stream().forEach(PO -> { - if(oldResutMap.get(PO.getSalaryItemId()) == null){ + if (oldResutMap.get(PO.getSalaryItemId()) == null) { editItems.add(PO); - }else{ + } else { String oldValue = oldResutMap.get(PO.getSalaryItemId()).getResultValue(); - if(!StringUtils.equals(oldValue,PO.getResultValue())){ + if (!StringUtils.equals(oldValue, PO.getResultValue())) { editItems.add(PO); } } @@ -676,7 +678,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public void calculate(SalaryAcctCalculateParam calculateParam, DataCollectionEmployee simpleEmployee) { + StopWatch stopWatch = new StopWatch(); try { + stopWatch.start("核算总耗时数据准备"); // 1、查询薪资核算记录 SalaryAcctRecordPO salaryAcctRecordPO = getSalaryAcctRecordService(user).getById(calculateParam.getSalaryAcctRecordId()); if (Objects.isNull(salaryAcctRecordPO)) { @@ -746,6 +750,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe if (CollectionUtils.isEmpty(salaryAcctEmployeePOS)) { throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(103378, "薪资核算人员不能为空")); } + + stopWatch.stop(); + 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); @@ -792,6 +800,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe } // 13、等待所有子线程执行完毕 childMonitor.await(); + + stopWatch.stop(); + stopWatch.start("核算入库计时"); + // 14、判断子线程执行结果 boolean allSuccess = calculateResults.stream().allMatch(SalaryAcctCalculateBO.Result::isStatus); if (!allSuccess) { @@ -812,6 +824,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // Thread.sleep(10); getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + calculateParam.getSalaryAcctRecordId(), true); + stopWatch.stop(); + log.info(stopWatch.prettyPrint()); // 存储薪资核算数据来源日志 new Thread() { public void run() { @@ -819,8 +833,8 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe List salaryAcctEmployeeIds = salaryAcctEmployeePOS.stream().map(SalaryAcctEmployeePO::getId).collect(Collectors.toList()); exceptItemIds.addAll(lockSalaryItemIds); 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); } }.start(); @@ -940,9 +954,9 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe // } Set salaryItemIds; - if(CollectionUtils.isNotEmpty(updateParam.getSalaryItemIds())){ + if (CollectionUtils.isNotEmpty(updateParam.getSalaryItemIds())) { salaryItemIds = updateParam.getSalaryItemIds(); - }else{ + } else { salaryItemIds = Collections.singleton(updateParam.getSalaryItemId()); } if (updateParam.getLockStatus() == LockStatusEnum.LOCK) { @@ -981,10 +995,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public List listByAcctEmployeeIdsAndSalaryItemIds(List salaryAcctEmployeeIds, Collection salaryItemIds) { - if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){ + if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) { return Collections.emptyList(); } - List> partition = Lists.partition((List)salaryAcctEmployeeIds, 200); + List> partition = Lists.partition((List) salaryAcctEmployeeIds, 200); List result = new ArrayList<>(); partition.forEach(empIds -> { SalaryAcctResultPO build = SalaryAcctResultPO.builder().salaryAcctEmpIds(empIds).salaryItemIds(salaryItemIds).build(); @@ -1007,10 +1021,10 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe @Override public List listAcctEmpIdByAcctEmpId(List salaryAcctEmployeeIds) { - if(CollectionUtils.isEmpty(salaryAcctEmployeeIds)){ + if (CollectionUtils.isEmpty(salaryAcctEmployeeIds)) { return Collections.emptyList(); } - List> partition = Lists.partition((List)salaryAcctEmployeeIds, 1000); + List> partition = Lists.partition((List) salaryAcctEmployeeIds, 1000); List result = new ArrayList<>(); partition.forEach(empIds -> { result.addAll(getSalaryAcctResultMapper().getAcctEmpIsExist(empIds)); @@ -1047,15 +1061,15 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe public Boolean checkAuth(Long salaryAcctRecordId) { // 获取该核算记录的个税扣缴义务 SalaryAcctRecordPO recordPO = getSalaryAcctRecordService(user).getById(salaryAcctRecordId); - if(Objects.isNull(recordPO)) { + if (Objects.isNull(recordPO)) { return false; } SalarySobPO salarySobPO = getSalarySobService(user).getById(recordPO.getSalarySobId()); Long taxAgentId = salarySobPO.getTaxAgentId(); List adminTaxAgentList = getTaxAgentAdminService(user).listByEmployeeId(Long.valueOf(user.getUID())); Optional canOperate = adminTaxAgentList.stream().filter(po -> NumberUtils.compare(taxAgentId, po.getTaxAgentId()) == 0).findFirst(); - if(!canOperate.isPresent()){ - return false; + if (!canOperate.isPresent()) { + return false; } return true; } diff --git a/src/com/engine/salary/service/impl/SalaryAcctResultTempServiceImpl.java b/src/com/engine/salary/service/impl/SalaryAcctResultTempServiceImpl.java index da0c96c09..0509e5a35 100644 --- a/src/com/engine/salary/service/impl/SalaryAcctResultTempServiceImpl.java +++ b/src/com/engine/salary/service/impl/SalaryAcctResultTempServiceImpl.java @@ -8,6 +8,7 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.google.common.collect.Lists; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; +import weaver.conn.RecordSet; import java.util.Collection; import java.util.List; @@ -21,17 +22,17 @@ import java.util.List; * @version 1.0 **/ public class SalaryAcctResultTempServiceImpl extends Service implements SalaryAcctResultTempService { + boolean isSqlserver = "sqlserver".equalsIgnoreCase(new RecordSet().getDBType()); - private SalaryAcctResultTempMapper getSalaryAcctResultTempMapper(){ + private SalaryAcctResultTempMapper getSalaryAcctResultTempMapper() { return MapperProxyFactory.getProxy(SalaryAcctResultTempMapper.class); } - - + @Override public List listByCalculateKey(String calculateKey) { - if (StringUtils.isBlank(calculateKey)){ + if (StringUtils.isBlank(calculateKey)) { return Lists.newArrayList(); } return getSalaryAcctResultTempMapper().listSome(SalaryAcctResultTempPO.builder().calculateKey(calculateKey).build()); @@ -42,8 +43,12 @@ public class SalaryAcctResultTempServiceImpl extends Service implements SalaryAc @Override public void batchSave(Collection salaryAcctResultTempPOS) { if (CollectionUtils.isNotEmpty(salaryAcctResultTempPOS)) { - List> partition = Lists.partition((List) salaryAcctResultTempPOS, 100); - partition.forEach(p->getSalaryAcctResultTempMapper().batchInsert(p)); + if (isSqlserver) { + List> partition = Lists.partition((List) salaryAcctResultTempPOS, 100); + partition.forEach(p -> getSalaryAcctResultTempMapper().batchInsert(p)); + } else { + getSalaryAcctResultTempMapper().batchInsert(salaryAcctResultTempPOS); + } } }