联特 分段计算
This commit is contained in:
parent
b37610dd13
commit
4776645a3d
|
|
@ -1,6 +1,7 @@
|
|||
package com.engine.salary.entity.salaryacct.bo;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.engine.kq.service.KQGroupService;
|
||||
import com.engine.salary.annotation.SalaryFormulaVar;
|
||||
import com.engine.salary.common.LocalDateRange;
|
||||
import com.engine.salary.constant.SalaryFormulaFieldConstant;
|
||||
|
|
@ -24,21 +25,26 @@ import com.engine.salary.enums.UserStatusEnum;
|
|||
import com.engine.salary.enums.salaryformula.SalaryFormulaReferenceEnum;
|
||||
import com.engine.salary.enums.salaryformula.SalarySQLReferenceEnum;
|
||||
import com.engine.salary.enums.salarysob.SalarySobAdjustRuleTypeEnum;
|
||||
import com.engine.salary.mapper.SQLMapper;
|
||||
import com.engine.salary.util.JsonUtil;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
import com.google.common.collect.Lists;
|
||||
import com.google.common.collect.Maps;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.commons.lang3.math.NumberUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.general.Util;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -134,12 +140,12 @@ public class CalculateFormulaVarBO {
|
|||
* @param salaryAcctCalculateBO 核算参数
|
||||
* @return
|
||||
*/
|
||||
public Map<String, List<FormulaVarValue>> convert2FormulaVar(SalaryAcctCalculateBO salaryAcctCalculateBO) {
|
||||
public Map<String, List<FormulaVarValue>> convert2FormulaVar(SalaryAcctCalculateBO salaryAcctCalculateBO, KQGroupService kqGroupService) {
|
||||
Map<String, List<FormulaVarValue>> resultMap = Maps.newHashMapWithExpectedSize(salaryAcctCalculateBO.getSalaryAcctEmployeePOS().size());
|
||||
// 处理薪资核算结果
|
||||
handleSalaryAcctResult(salaryAcctCalculateBO, resultMap);
|
||||
// 处理薪资档案
|
||||
handleSalaryArchiveData(salaryAcctCalculateBO, resultMap);
|
||||
handleSalaryArchiveData(salaryAcctCalculateBO, resultMap, kqGroupService);
|
||||
// 处理浮动薪资档案
|
||||
handleVariableArchiveData(salaryAcctCalculateBO, resultMap);
|
||||
// 处理往期累计情况
|
||||
|
|
@ -267,7 +273,7 @@ public class CalculateFormulaVarBO {
|
|||
* @param salaryAcctCalculateBO 薪资核算参数
|
||||
* @param resultMap 返回结果集
|
||||
*/
|
||||
private void handleSalaryArchiveData(SalaryAcctCalculateBO salaryAcctCalculateBO, Map<String, List<FormulaVarValue>> resultMap) {
|
||||
private void handleSalaryArchiveData(SalaryAcctCalculateBO salaryAcctCalculateBO, Map<String, List<FormulaVarValue>> resultMap, KQGroupService kqGroupService) {
|
||||
// 调薪计薪规则
|
||||
Map<Long, SalarySobAdjustRulePO> salarySobAdjustRulePOMap = SalaryEntityUtil.convert2Map(salaryAcctCalculateBO.getSalarySobAdjustRulePOS(),
|
||||
SalarySobAdjustRulePO::getSalaryItemId);
|
||||
|
|
@ -276,7 +282,7 @@ public class CalculateFormulaVarBO {
|
|||
String key = salaryArchiveDataDTO.getEmployeeId() + "_" + salaryArchiveTaxAgentDataDTO.getTaxAgentId();
|
||||
List<FormulaVarValue> formulaVarValues = resultMap.computeIfAbsent(key, k -> Lists.newArrayList());
|
||||
// 将薪资档案的值转换成公式中的变量,填充到返回结果集中
|
||||
formulaVarValues.addAll(handleSalaryArchiveItemVal(salaryAcctCalculateBO, salaryArchiveTaxAgentDataDTO.getSalaryItemValues(), salarySobAdjustRulePOMap));
|
||||
formulaVarValues.addAll(handleSalaryArchiveItemVal(salaryAcctCalculateBO, salaryArchiveTaxAgentDataDTO.getSalaryItemValues(), salarySobAdjustRulePOMap, kqGroupService, salaryArchiveDataDTO.getEmployeeId()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -312,7 +318,9 @@ public class CalculateFormulaVarBO {
|
|||
*/
|
||||
private List<FormulaVarValue> handleSalaryArchiveItemVal(SalaryAcctCalculateBO salaryAcctCalculateBO,
|
||||
List<SalaryArchiveItemDataDTO> salaryArchiveItemDataList,
|
||||
Map<Long, SalarySobAdjustRulePO> salarySobAdjustRulePOMap) {
|
||||
Map<Long, SalarySobAdjustRulePO> salarySobAdjustRulePOMap,
|
||||
KQGroupService kqGroupService,
|
||||
Long employeeId) {
|
||||
// 薪资周期
|
||||
LocalDateRange salaryCycle = salaryAcctCalculateBO.getSalarySobCycleDTO().getSalaryCycle();
|
||||
// key:薪资项目的id、value:薪资项目的code
|
||||
|
|
@ -331,18 +339,18 @@ public class CalculateFormulaVarBO {
|
|||
SalarySobAdjustRulePO salaryAdjustmentRulePO = salarySobAdjustRulePOMap.get(entry.getKey());
|
||||
if (entry.getValue().size() > 2) {
|
||||
// 如果薪资项目在薪资周期内经历了多次调薪,则默认分段计薪
|
||||
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.PARTITION, entry.getValue());
|
||||
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.PARTITION, entry.getValue(), kqGroupService, employeeId);
|
||||
} else if (salaryAdjustmentRulePO == null || entry.getValue().size() < 2) {
|
||||
// 如果薪资项目没有设置调薪计薪规则,默认取薪资周期内薪资档案中最新的值
|
||||
// 如果薪资项目在薪资周期内没有调薪,默认取薪资周期内薪资档案中最新的值
|
||||
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.USE_AFTER_ADJUSTMENT, entry.getValue());
|
||||
value = calculateBySalarySobAdjustRule(salaryCycle, SalarySobAdjustRuleTypeEnum.USE_AFTER_ADJUSTMENT, entry.getValue(), kqGroupService, employeeId);
|
||||
} else {
|
||||
// 如果薪资项目在薪资周期内只有一次调薪,则根据调薪计薪规则处理
|
||||
SalarySobAdjustRuleTypeEnum adjustRuleTypeEnum = salaryAdjustmentRulePO.getDayOfMonth() < SalaryDateUtil.dateToLocalDate(entry.getValue().get(0).getEffectiveDateRange().getEndDate()).getDayOfMonth()
|
||||
? SalarySobAdjustRuleTypeEnum.parseByValue(salaryAdjustmentRulePO.getAfterAdjustmentType())
|
||||
: SalarySobAdjustRuleTypeEnum.parseByValue(salaryAdjustmentRulePO.getBeforeAdjustmentType());
|
||||
// 根据调薪计薪规则处理薪资档案的调薪
|
||||
value = calculateBySalarySobAdjustRule(salaryCycle, adjustRuleTypeEnum, entry.getValue());
|
||||
value = calculateBySalarySobAdjustRule(salaryCycle, adjustRuleTypeEnum, entry.getValue(), kqGroupService, employeeId);
|
||||
}
|
||||
String fieldId = SalaryFormulaReferenceEnum.SALARY_ARCHIVES.getValue()
|
||||
+ SalaryFormulaFieldConstant.FIELD_ID_SEPARATOR
|
||||
|
|
@ -361,7 +369,9 @@ public class CalculateFormulaVarBO {
|
|||
*/
|
||||
private String calculateBySalarySobAdjustRule(LocalDateRange salaryCycle,
|
||||
SalarySobAdjustRuleTypeEnum adjustRuleTypeEnum,
|
||||
List<SalaryArchiveItemDataDTO> salaryArchiveItemDataDTOS) {
|
||||
List<SalaryArchiveItemDataDTO> salaryArchiveItemDataDTOS,
|
||||
KQGroupService kqGroupService,
|
||||
Long employeeId) {
|
||||
if (Objects.isNull(adjustRuleTypeEnum)) {
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
|
|
@ -377,17 +387,46 @@ public class CalculateFormulaVarBO {
|
|||
case PARTITION:
|
||||
// 可能存在多次调薪
|
||||
// = (第一段的值*第一段的自然日+第二段的值*第二段的自然日+……)/薪资所属月自然日
|
||||
BigDecimal valueSum = BigDecimal.ZERO;
|
||||
for (int i = 0; i < salaryArchiveItemDataDTOS.size(); i++) {
|
||||
SalaryArchiveItemDataDTO dataDTO = salaryArchiveItemDataDTOS.get(i);
|
||||
BigDecimal dayDiff = new BigDecimal(SalaryDateUtil.dateToLocalDate(dataDTO.getEffectiveDateRange().getFromDate()).until(SalaryDateUtil.dateToLocalDate(dataDTO.getEffectiveDateRange().getEndDate()), ChronoUnit.DAYS));
|
||||
// 最后一段日期范围需要加一
|
||||
if (Objects.equals(i, salaryArchiveItemDataDTOS.size() - 1)) {
|
||||
dayDiff = dayDiff.add(BigDecimal.ONE);
|
||||
}
|
||||
valueSum = valueSum.add(SalaryEntityUtil.empty2Zero(dataDTO.getValue()).multiply(dayDiff));
|
||||
// BigDecimal valueSum = BigDecimal.ZERO;
|
||||
BigDecimal firstValue = BigDecimal.ZERO;
|
||||
BigDecimal baseValue = new BigDecimal("21.75");
|
||||
// 调薪补差金额
|
||||
BigDecimal needAddValue = new BigDecimal(0);
|
||||
if (CollectionUtils.isNotEmpty(salaryArchiveItemDataDTOS)) {
|
||||
firstValue = SalaryEntityUtil.empty2Zero(salaryArchiveItemDataDTOS.get(0).getValue());
|
||||
}
|
||||
value = valueSum.divide(new BigDecimal(SalaryDateUtil.dateToLocalDate(salaryCycle.getFromDate()).until(SalaryDateUtil.dateToLocalDate(salaryCycle.getEndDate()), ChronoUnit.DAYS)).add(BigDecimal.ONE), 2, RoundingMode.HALF_UP).toPlainString();
|
||||
BaseBean baseBean = new BaseBean();
|
||||
baseBean.writeLog("ltsize"+salaryArchiveItemDataDTOS.size());
|
||||
for (int i = 1; i < salaryArchiveItemDataDTOS.size(); i++) {
|
||||
// 科蓝柏二开:调薪前工资+(调薪后工资-调薪前工资)/21.75*(调薪后的应出勤天数+调薪后的法定节假日天数)
|
||||
SalaryArchiveItemDataDTO dataDTO = salaryArchiveItemDataDTOS.get(i);
|
||||
// 获取应出勤日期+法定节假日
|
||||
Double ycq = new Double(0);
|
||||
String fdjjr = "0";
|
||||
if (Objects.equals(i, salaryArchiveItemDataDTOS.size() - 1)) {
|
||||
ycq = getKQYcq(dataDTO.getEffectiveDateRange().getFromDate(), dataDTO.getEffectiveDateRange().getEndDate(), employeeId);
|
||||
fdjjr = getFdjjr(SalaryDateUtil.getFormatDate(dataDTO.getEffectiveDateRange().getFromDate()), SalaryDateUtil.getFormatDate(dataDTO.getEffectiveDateRange().getEndDate()), employeeId.toString(), kqGroupService);
|
||||
} else {
|
||||
// 不是最后一个,需要往前挪1天
|
||||
Date endDate = SalaryDateUtil.localDateToDate(SalaryDateUtil.dateToLocalDate(dataDTO.getEffectiveDateRange().getEndDate()).minusDays(1));
|
||||
ycq = getKQYcq(dataDTO.getEffectiveDateRange().getFromDate(), endDate, employeeId);
|
||||
fdjjr = getFdjjr(SalaryDateUtil.getFormatDate(dataDTO.getEffectiveDateRange().getFromDate()), SalaryDateUtil.getFormatDate(endDate), employeeId.toString(), kqGroupService);
|
||||
}
|
||||
baseBean.writeLog("lt-ycq" +ycq);
|
||||
double days = ycq + (NumberUtils.isCreatable(fdjjr) ? Double.valueOf(fdjjr) : 0);
|
||||
needAddValue = needAddValue.add(SalaryEntityUtil.empty2Zero(dataDTO.getValue()).subtract(firstValue).divide(baseValue, 15, RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(days)));
|
||||
|
||||
//
|
||||
// BigDecimal dayDiff = new BigDecimal(SalaryDateUtil.dateToLocalDate(dataDTO.getEffectiveDateRange().getFromDate()).until(SalaryDateUtil.dateToLocalDate(dataDTO.getEffectiveDateRange().getEndDate()), ChronoUnit.DAYS));
|
||||
// // 最后一段日期范围需要加一
|
||||
// if (Objects.equals(i, salaryArchiveItemDataDTOS.size() - 1)) {
|
||||
// dayDiff = dayDiff.add(BigDecimal.ONE);
|
||||
// }
|
||||
// valueSum = valueSum.add(SalaryEntityUtil.empty2Zero(dataDTO.getValue()).multiply(dayDiff));
|
||||
}
|
||||
// value = valueSum.divide(new BigDecimal(SalaryDateUtil.dateToLocalDate(salaryCycle.getFromDate()).until(SalaryDateUtil.dateToLocalDate(salaryCycle.getEndDate()), ChronoUnit.DAYS)).add(BigDecimal.ONE), 2, RoundingMode.HALF_UP).toPlainString();
|
||||
baseBean.writeLog("lt-ycq" +needAddValue);
|
||||
value = firstValue.add(needAddValue).toPlainString();
|
||||
break;
|
||||
case USE_BEFORE_ADJUSTMENT:
|
||||
// = 调薪前工资
|
||||
|
|
@ -404,6 +443,86 @@ public class CalculateFormulaVarBO {
|
|||
return value;
|
||||
}
|
||||
|
||||
private SQLMapper getSQLMapper() {
|
||||
return MapperProxyFactory.getProxy(SQLMapper.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取应出勤时数
|
||||
* @param fromDate
|
||||
* @param endDate
|
||||
* @param userId
|
||||
*/
|
||||
private Double getKQYcq(Date fromDate, Date endDate, Long userId) {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
double ycq = 0.00;
|
||||
String sql = "SELECT sum(workdays) as a,sum(attendancemins) FROM kq_format_total WHERE workdays is not null and resourceid = "+userId+" and kqdate >= '" +SalaryDateUtil.getFormatDate(fromDate)+"' and kqdate <= '"+ SalaryDateUtil.getFormatDate(endDate)+"'";
|
||||
baseBean.writeLog("lt-1" + sql);
|
||||
List<Map> list = getSQLMapper().runSQL(sql);
|
||||
baseBean.writeLog("lt-list" +list);
|
||||
if (CollectionUtils.isNotEmpty(list)) {
|
||||
Object value = list.get(0).get("a");
|
||||
if (value != null) {
|
||||
baseBean.writeLog("lt-value" +value);
|
||||
ycq = NumberUtils.isCreatable(value.toString()) ? Double.valueOf(value.toString()) : Double.valueOf("0");
|
||||
}
|
||||
}
|
||||
return ycq;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取法定节假日天数
|
||||
*/
|
||||
public String getFdjjr(String fromDate, String toDate, String userId, KQGroupService kqGroupService) {
|
||||
BaseBean baseBean = new BaseBean();
|
||||
if (StringUtils.isEmpty(userId) || StringUtils.isEmpty(fromDate) || StringUtils.isEmpty(toDate)) {
|
||||
baseBean.writeLog("userId or fromDate or toDate is null!" + fromDate + toDate + userId);
|
||||
return "0";
|
||||
}
|
||||
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("viewScope", 3);
|
||||
params.put("resourceId", userId);
|
||||
params.put("groupType", 0);
|
||||
params.put("pageSize", 10);
|
||||
params.put("pageIndex", 1);
|
||||
User tmpUser = new User();
|
||||
tmpUser.setUid(1);
|
||||
tmpUser.setLoginid("sysadmin");
|
||||
|
||||
//获取当前人员的生效考勤组
|
||||
String activeGroupId = null;
|
||||
List<Map<String, Object>> dataSource = null;
|
||||
Map<String, Object> groupInfo = kqGroupService.getGroupMemberList(params, tmpUser);
|
||||
if (groupInfo != null && groupInfo.size() > 0) {
|
||||
if (groupInfo.get("dataSource") != null) {
|
||||
dataSource = (List<Map<String, Object>>) groupInfo.get("dataSource");
|
||||
if (dataSource != null && dataSource.size() > 0) {
|
||||
Map<String, Object> dataMap = dataSource.get(0);
|
||||
activeGroupId = dataMap.get("activeGroupId") + "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (activeGroupId == null && activeGroupId.length() > 0) {
|
||||
baseBean.writeLog("activeGroupId is null:" + params + dataSource);
|
||||
return "0";
|
||||
}
|
||||
|
||||
// 计算公共假期
|
||||
RecordSet rs = new RecordSet();
|
||||
String sql ="select count(1) from kq_HolidaySet where changeType =1 and holidayDate>= '"+ fromDate + "' and holidayDate<= '"+toDate+"' and groupId = "+ activeGroupId;
|
||||
rs.execute(sql);
|
||||
int jq =0;
|
||||
if(rs.next()){
|
||||
jq = rs.getInt(1);
|
||||
}
|
||||
if(jq == -1) {
|
||||
jq = 0;
|
||||
}
|
||||
return String.valueOf(jq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理累计情况(工资、薪金)
|
||||
*
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.engine.salary.service.impl;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.kq.service.KQGroupService;
|
||||
import com.engine.kq.service.impl.KQGroupServiceImpl;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.push.dto.PushRecordDTO;
|
||||
|
|
@ -103,6 +105,13 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
return ServiceUtil.getService(SalaryAcctResultServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private KQGroupService getKQGroupService() {
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
user.setLoginid("sysadmin");
|
||||
return (KQGroupService) ServiceUtil.getService(KQGroupServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<PushSettingDTO> settingList(PushSettingQueryParam param) {
|
||||
List<PushSettingPO> pushSettingPOS = getPushSettingMapper().listAll();
|
||||
|
|
@ -290,7 +299,8 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
|
||||
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), salaryAcctResultPOS, new ArrayList<>(),new ArrayList<>());
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
|
||||
KQGroupService kqGroupService = getKQGroupService();
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO, kqGroupService);
|
||||
|
||||
|
||||
List<PushSettingPO> pushSettingPOS = getPushSettingMapper().listSome(PushSettingPO.builder().able(1).build());
|
||||
|
|
@ -404,7 +414,8 @@ public class PushServiceImpl extends Service implements PushService {
|
|||
List<SalaryAcctResultPO> salaryAcctResultPOS = getSalaryAcctResultService(user).listBySalaryAcctEmployeeIds(salaryAcctEmployeeIds);
|
||||
|
||||
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), new ArrayList<>(), salaryAcctResultPOS, new ArrayList<>(), new ArrayList<>());
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
|
||||
KQGroupService kqGroupService = getKQGroupService();
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO, kqGroupService);
|
||||
|
||||
List<PushSettingPO> pushSettingPOS = getPushSettingMapper().listSome(PushSettingPO.builder().able(1).build());
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,8 @@ package com.engine.salary.service.impl;
|
|||
import cn.hutool.core.util.StrUtil;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.kq.service.KQGroupService;
|
||||
import com.engine.kq.service.impl.KQGroupServiceImpl;
|
||||
import com.engine.salary.cache.SalaryCacheKey;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.salary.constant.SalaryFormulaFieldConstant;
|
||||
|
|
@ -114,6 +116,13 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
return ServiceUtil.getService(VariableArchiveServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private KQGroupService getKQGroupService() {
|
||||
User user = new User();
|
||||
user.setUid(1);
|
||||
user.setLoginid("sysadmin");
|
||||
return (KQGroupService) ServiceUtil.getService(KQGroupServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void calculate(SalaryAcctCalculateBO salaryAcctCalculateBO, DataCollectionEmployee simpleEmployee, List<SalarySobBackItemPO> salarySobBackItems) {
|
||||
log.info("开始核算V3 {}", salaryAcctCalculateBO);
|
||||
|
|
@ -196,8 +205,9 @@ public class SalaryAcctCalculateServiceImpl extends Service implements SalaryAcc
|
|||
sw.stop();
|
||||
// 10、转换成公式编辑器中的变量
|
||||
sw.start("转换成公式编辑器中的变量");
|
||||
KQGroupService kqGroupService = getKQGroupService();
|
||||
CalculateFormulaVarBO calculateFormulaVarBO = new CalculateFormulaVarBO(simpleEmployees, salaryArchiveData, addUpSituationPOS, addUpDeductionPOS, otherDeductionPOS, welfareData, attendQuoteDataDTOS, salaryAcctResultPOS, variableArchiveList,lastMonthResultPOS);
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO);
|
||||
Map<String, List<CalculateFormulaVarBO.FormulaVarValue>> formulaVarMap = calculateFormulaVarBO.convert2FormulaVar(salaryAcctCalculateBO, kqGroupService);
|
||||
sw.stop();
|
||||
sw.start("数据结构准备");
|
||||
// 本次薪资核算所用的薪资账套下的薪资项目
|
||||
|
|
|
|||
|
|
@ -2,7 +2,6 @@ package com.engine.salary.service.impl;
|
|||
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.taxagent.dto.TaxAgentManageRangeEmployeeListDTO;
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentImportParam;
|
||||
import com.engine.salary.entity.taxagent.param.TaxAgentRangeDownloadTemplateParam;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
|
|
@ -11,9 +10,11 @@ import com.engine.salary.service.TaxAgentService;
|
|||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.excel.ExcelComment;
|
||||
import com.engine.salary.util.excel.ExcelParseHelper;
|
||||
import com.engine.salary.util.excel.ExcelSupport;
|
||||
import com.engine.salary.util.excel.ExcelUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.lang3.Validate;
|
||||
import org.apache.poi.ss.usermodel.Sheet;
|
||||
import org.apache.poi.util.IOUtils;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import weaver.file.ImageFileManager;
|
||||
|
|
@ -26,6 +27,8 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
|
||||
|
||||
/**
|
||||
* @author Harryxzy
|
||||
* @date 2023/01/05 15:11
|
||||
|
|
@ -62,8 +65,11 @@ public class TaxAgentExcelServiceImpl extends Service implements TaxAgentExcelSe
|
|||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
|
||||
List<TaxAgentManageRangeEmployeeListDTO> taxAgentManageRangeEmployees = ExcelParseHelper.parse2Map(fileInputStream, TaxAgentManageRangeEmployeeListDTO.class, 0, 1, 6, "TaxAgentEmployee.xlsx");
|
||||
apidatas.put("preview", taxAgentManageRangeEmployees);
|
||||
// List<TaxAgentManageRangeEmployeeListDTO> taxAgentManageRangeEmployees = ExcelParseHelper.parse2Map(fileInputStream, TaxAgentManageRangeEmployeeListDTO.class, 0, 1, 6, "TaxAgentEmployee.xlsx");
|
||||
// apidatas.put("preview", taxAgentManageRangeEmployees);
|
||||
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
||||
apidatas.put("headers", ExcelSupport.getSheetHeader(sheet, 0));
|
||||
apidatas.put("list", ExcelParseHelper.parse2List(sheet, 1, 0));
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue