Merge branch 'release/2.15.1.2407.01' into release/个税版本
# Conflicts: # resource/wiki/扩展功能/hrmSalaryCustom.properties
This commit is contained in:
commit
39d31d8377
|
|
@ -1,3 +1,4 @@
|
|||
formulaRunOvertimeThreshold=10
|
||||
personNumberInOneThread = 100
|
||||
flowNoticeMessageType=2022060951
|
||||
salaryDateFormat=yyyy-MM
|
||||
salaryDateFormat=yyyy-MM
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ public class RehireAction implements Action {
|
|||
Long taxAgentId = taxAgentPOS.get(0).getId();
|
||||
Long employeeId = Long.valueOf(empIdStr);
|
||||
List<SalaryArchivePO> salaryArchivePOS = getSalaryArchiveService(user).listSome(SalaryArchivePO.builder().taxAgentId(taxAgentId).employeeId(employeeId).build());
|
||||
if (CollectionUtils.isEmpty(salaryArchivePOS)){
|
||||
if (CollectionUtils.isEmpty(salaryArchivePOS) || salaryArchivePOS.get(0).getRunStatus().equals(SalaryArchiveStatusEnum.PENDING.getValue())){
|
||||
// 直接走定薪action生成档案
|
||||
InitSalaryAction initSalaryAction = new InitSalaryAction();
|
||||
return initSalaryAction.doSalaryArchiveInit(requestInfo, salaryFieldMap);
|
||||
|
|
|
|||
|
|
@ -59,8 +59,8 @@ public class SalaryAcctConsolidatedTaxBO {
|
|||
|| TaxDeclarationDataIndexConstant.ADD_UP_SPE_ADDI_DEDUCTION.equals(salaryItem.getCode())) {
|
||||
return salaryAcctResults.stream()
|
||||
.filter(e -> Objects.equals(e.getSalaryItemId(), salaryItem.getId()))
|
||||
.map(SalaryAcctResultPO::getResultValue)
|
||||
.findFirst()
|
||||
.map(SalaryAcctResultPO::getResultValue)
|
||||
.orElse("");
|
||||
}
|
||||
// 当前累计收入 = 累计值 + 本次收入 + 上几次收入
|
||||
|
|
|
|||
|
|
@ -41,4 +41,14 @@ public class InsuranceSchemeReqParam {
|
|||
private WelfareTypeEnum welfareTypeEnum;
|
||||
|
||||
private List<Long> ids;
|
||||
|
||||
/**
|
||||
* 是否修改档案数据为上限或下限
|
||||
*/
|
||||
private Boolean changeData;
|
||||
|
||||
/**
|
||||
* 校验是否有档案不满足上下限
|
||||
*/
|
||||
private Boolean validate;
|
||||
}
|
||||
|
|
@ -106,4 +106,6 @@ public interface FundSchemeMapper {
|
|||
* @param endTime
|
||||
*/
|
||||
void updateEndTime(@Param("id")Long id, @Param("endTime")String endTime);
|
||||
|
||||
List<InsuranceArchivesFundSchemePO> listBySchemeId(@Param("fundSchemeId")Long id, @Param("runStatuses")List<String> runStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -275,6 +275,22 @@
|
|||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listBySchemeId"
|
||||
resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_fund_archives t
|
||||
left join hrsa_insurance_base_info i on i.fund_archives_id = t.id
|
||||
WHERE t.delete_type = 0
|
||||
AND fund_scheme_id = #{fundSchemeId}
|
||||
<if test="runStatuses != null and runStatuses.size()>0">
|
||||
AND i.run_status IN
|
||||
<foreach collection="runStatuses" open="(" item="runStatus" separator="," close=")">
|
||||
#{runStatus}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
update hrsa_fund_archives
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
|
|
|
|||
|
|
@ -105,4 +105,6 @@ public interface OtherSchemeMapper {
|
|||
* @param endTime
|
||||
*/
|
||||
void updateEndTime(@Param("id")Long id, @Param("endTime")String endTime);
|
||||
|
||||
List<InsuranceArchivesOtherSchemePO> listBySchemeId(@Param("schemeId") Long schemeId, @Param("runStatuses") List<String> runStatuses);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -258,6 +258,22 @@
|
|||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listBySchemeId"
|
||||
resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_other_archives t
|
||||
left join hrsa_insurance_base_info i on i.other_archives_id = t.id
|
||||
WHERE t.delete_type = 0
|
||||
AND other_scheme_id = #{schemeId}
|
||||
<if test="runStatuses != null and runStatuses.size()>0">
|
||||
AND i.run_status IN
|
||||
<foreach collection="runStatuses" open="(" item="runStatus" separator="," close=")">
|
||||
#{runStatus}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
update hrsa_other_archives
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
|
|
|
|||
|
|
@ -136,4 +136,6 @@ public interface SocialSchemeMapper {
|
|||
* @param endTime
|
||||
*/
|
||||
void updateEndTime(@Param("id")Long id, @Param("endTime")String endTime);
|
||||
|
||||
List<InsuranceArchivesSocialSchemePO> listBySchemeId(@Param("schemeId")Long schemeId, @Param("runStatuses")List<String> runStatus);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -919,6 +919,22 @@
|
|||
WHERE delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="listBySchemeId"
|
||||
resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_social_archives t
|
||||
left join hrsa_insurance_base_info i on i.social_archives_id = t.id
|
||||
WHERE t.delete_type = 0
|
||||
AND t.social_scheme_id = #{schemeId}
|
||||
<if test="runStatuses != null and runStatuses.size()>0">
|
||||
AND i.run_status IN
|
||||
<foreach collection="runStatuses" open="(" item="runStatus" separator="," close=")">
|
||||
#{runStatus}
|
||||
</foreach>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<update id="batchUpdate" parameterType="java.util.List">
|
||||
update hrsa_social_archives
|
||||
<trim prefix="set" suffixOverrides=",">
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ public interface SISchemeService {
|
|||
|
||||
Map<String, Object> insertScheme(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> update(Map<String, Object> params);
|
||||
String update(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> delete(Map<String, Object> params);
|
||||
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ import com.cloudstore.eccom.pc.table.WeaTableColumn;
|
|||
import com.cloudstore.eccom.result.WeaResultMsg;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.component.SalaryWeaTable;
|
||||
import com.engine.salary.config.SalaryElogConfig;
|
||||
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
||||
import com.engine.hrmelog.entity.dto.LoggerContext;
|
||||
import com.engine.salary.encrypt.EncryptUtil;
|
||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||
import com.engine.salary.entity.siarchives.param.InsuranceArchivesListParam;
|
||||
|
|
@ -84,6 +84,7 @@ import java.io.InputStream;
|
|||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.function.Function;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
|
@ -211,13 +212,12 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> update(Map<String, Object> params) {
|
||||
public String update(Map<String, Object> params) {
|
||||
// return commandExecutor.execute(new SISchemeUpdateCmd(params, user));
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>(16);
|
||||
InsuranceSchemeReqParam insuranceSchemeReqParam = (InsuranceSchemeReqParam) params.get("insuranceSchemeReqParam");
|
||||
// siSchemeBiz.update(insuranceSchemeReqParam, (long) user.getUID());
|
||||
update(insuranceSchemeReqParam, (long) user.getUID());
|
||||
return apidatas;
|
||||
return update(insuranceSchemeReqParam, (long) user.getUID());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
@ -2484,7 +2484,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
* @param updateParam
|
||||
* @param employeeId
|
||||
*/
|
||||
public void update(InsuranceSchemeReqParam updateParam, long employeeId) {
|
||||
public String update(InsuranceSchemeReqParam updateParam, long employeeId) {
|
||||
//查询是否存在福利方案
|
||||
InsuranceSchemePO insuranceSchemePO = getById(updateParam.getInsuranceScheme().getId());
|
||||
if (Objects.isNull(insuranceSchemePO)) {
|
||||
|
|
@ -2521,12 +2521,29 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
//记录主表操作日志
|
||||
loggerContext.setNewValues(insuranceSchemePO1);
|
||||
SalaryElogConfig.siSchemeLoggerTemplate.write(loggerContext);
|
||||
// 查询原本的福利明细信息
|
||||
List<InsuranceSchemeDetailPO> oldInsuranceSchemeDetails = getInsuranceSchemeDetailMapper().queryInsuranceSchemeDetailList(updateParam.getInsuranceScheme().getId(), IsPaymentEnum.YES.getValue());
|
||||
// 本次福利明细
|
||||
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = InsuranceSchemeBO.convertToInsuranceSchemeDetailPoList(updateParam.getInsuranceSchemeDetailList(), employeeId, insuranceSchemePO.getId());
|
||||
|
||||
StringBuilder baseLimitStrBuilder = new StringBuilder();
|
||||
if (updateParam.getValidate() || updateParam.getChangeData()) {
|
||||
// 查询本次修改了哪些类型的上下限
|
||||
List<InsuranceSchemeDetailPO> schemeDetailChangeLimitList = getChanceLimitSchemeDetailList(oldInsuranceSchemeDetails, insuranceSchemeDetailPOS);
|
||||
// 对于不满足上下限的基数进行自动调整
|
||||
autoAdjustBaseByLimit(updateParam, schemeDetailChangeLimitList, insuranceSchemePO, baseLimitStrBuilder);
|
||||
if (updateParam.getValidate() && StringUtils.isNotBlank(baseLimitStrBuilder.toString())) {
|
||||
// 是校验且存在校验不通过的档案,返回前端确认
|
||||
return baseLimitStrBuilder.toString();
|
||||
}
|
||||
}
|
||||
|
||||
//更新福利方案明细表 先删后插
|
||||
getInsuranceSchemeDetailMapper().batchDeleteByPrimaryIds(Collections.singleton(updateParam.getInsuranceScheme().getId()));
|
||||
//更新明细表
|
||||
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = InsuranceSchemeBO.convertToInsuranceSchemeDetailPoList(updateParam.getInsuranceSchemeDetailList(), employeeId, insuranceSchemePO.getId());
|
||||
encryptUtil.encryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
|
||||
insuranceSchemeDetailPOS.forEach(getInsuranceSchemeDetailMapper()::insert);
|
||||
|
||||
//记录明细表操作日志
|
||||
encryptUtil.decryptList(insuranceSchemeDetailPOS, InsuranceSchemeDetailPO.class);
|
||||
LoggerContext<InsuranceSchemeDetailPO> insuranceSchemeDetailContext = new LoggerContext<>();
|
||||
|
|
@ -2538,7 +2555,224 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
|
|||
insuranceSchemeDetailContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利方案明细"));
|
||||
insuranceSchemeDetailPOS.forEach(insuranceSchemeDetailContext::setNewValues);
|
||||
SalaryElogConfig.siSchemeLoggerTemplate.write(insuranceSchemeDetailContext);
|
||||
return "success";
|
||||
}
|
||||
|
||||
/**
|
||||
* 对于不满足上下限的基数进行自动调整
|
||||
* @param schemeDetailChangeLimitList
|
||||
* @param insuranceSchemePO
|
||||
*/
|
||||
private void autoAdjustBaseByLimit(InsuranceSchemeReqParam updateParam, List<InsuranceSchemeDetailPO> schemeDetailChangeLimitList, InsuranceSchemePO insuranceSchemePO, StringBuilder baseLimitStrBuilder) {
|
||||
Map<Integer, List<InsuranceSchemeDetailPO>> insuranceSchemeDetailMap = SalaryEntityUtil.group2Map(schemeDetailChangeLimitList, InsuranceSchemeDetailPO::getPaymentScope);
|
||||
List<InsuranceSchemeDetailPO> personChangeDeatilList = insuranceSchemeDetailMap.getOrDefault(PaymentScopeEnum.SCOPE_PERSON.getValue(), Collections.emptyList());
|
||||
List<InsuranceSchemeDetailPO> companyChangeDetailList = insuranceSchemeDetailMap.getOrDefault(PaymentScopeEnum.SCOPE_COMPANY.getValue(), Collections.emptyList());
|
||||
List<String> runStatus = Arrays.asList(EmployeeStatusEnum.STAY_DEL.getValue(), EmployeeStatusEnum.PAYING.getValue(), EmployeeStatusEnum.STAY_DEL.getValue());
|
||||
// 获取该方案下的社保福利档案
|
||||
Integer welfareType = insuranceSchemePO.getWelfareType();
|
||||
if (welfareType.equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue())) {
|
||||
List<InsuranceArchivesSocialSchemePO> needUpdateSocialArchiveList = new ArrayList<>();
|
||||
List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePOS = getSocialSchemeMapper().listBySchemeId(insuranceSchemePO.getId(), runStatus);
|
||||
encryptUtil.decryptList(insuranceArchivesSocialSchemePOS, InsuranceArchivesSocialSchemePO.class);
|
||||
// 获取人员信息
|
||||
List<Long> empIds = insuranceArchivesSocialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(empIds);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
||||
// 社保
|
||||
insuranceArchivesSocialSchemePOS.forEach(archive -> {
|
||||
Boolean[] changeFlag = {false};
|
||||
// 个人调整
|
||||
String socialPaymentBaseString = archive.getSocialPaymentBaseString();
|
||||
if (CollectionUtils.isNotEmpty(personChangeDeatilList)) {
|
||||
socialPaymentBaseString = adaptWelBaseLimit(socialPaymentBaseString, personChangeDeatilList, changeFlag);
|
||||
}
|
||||
// 公司调整
|
||||
String socialPaymentComBaseString = archive.getSocialPaymentComBaseString();
|
||||
if (CollectionUtils.isNotEmpty(companyChangeDetailList)) {
|
||||
socialPaymentComBaseString = adaptWelBaseLimit(socialPaymentComBaseString, companyChangeDetailList, changeFlag);
|
||||
}
|
||||
if (changeFlag[0]) {
|
||||
DataCollectionEmployee employee = employeeMap.get(archive.getEmployeeId());
|
||||
baseLimitStrBuilder.append(employee == null ? archive.getEmployeeId() : employee.getUsername() + "\n");
|
||||
archive.setSocialPaymentBaseString(socialPaymentBaseString);
|
||||
archive.setSocialPaymentComBaseString(socialPaymentComBaseString);
|
||||
needUpdateSocialArchiveList.add(archive);
|
||||
if (updateParam.getChangeData() && CollectionUtils.isNotEmpty(needUpdateSocialArchiveList)) {
|
||||
// 更新
|
||||
encryptUtil.encrypt(archive, InsuranceArchivesSocialSchemePO.class);
|
||||
getSocialSchemeMapper().updateById(archive);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (welfareType.equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue())) {
|
||||
List<InsuranceArchivesFundSchemePO> needUpdateFundArchiveList = new ArrayList<>();
|
||||
List<InsuranceArchivesFundSchemePO> insuranceArchivesFundSchemePOS = getFundSchemeMapper().listBySchemeId(insuranceSchemePO.getId(), runStatus);
|
||||
encryptUtil.decryptList(insuranceArchivesFundSchemePOS, InsuranceArchivesFundSchemePO.class);
|
||||
// 获取人员信息
|
||||
List<Long> empIds = insuranceArchivesFundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(empIds);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
||||
// 公积金
|
||||
insuranceArchivesFundSchemePOS.forEach(archive -> {
|
||||
Boolean[] changeFlag = {false};
|
||||
// 个人调整
|
||||
String fundPaymentBaseString = archive.getFundPaymentBaseString();
|
||||
if (CollectionUtils.isNotEmpty(personChangeDeatilList)) {
|
||||
fundPaymentBaseString = adaptWelBaseLimit(fundPaymentBaseString, personChangeDeatilList, changeFlag);
|
||||
}
|
||||
// 公司调整
|
||||
String fundPaymentComBaseString = archive.getFundPaymentComBaseString();
|
||||
if (CollectionUtils.isNotEmpty(companyChangeDetailList)) {
|
||||
fundPaymentComBaseString = adaptWelBaseLimit(fundPaymentComBaseString, companyChangeDetailList, changeFlag);
|
||||
}
|
||||
if (changeFlag[0]) {
|
||||
DataCollectionEmployee employee = employeeMap.get(archive.getEmployeeId());
|
||||
baseLimitStrBuilder.append(employee == null ? archive.getEmployeeId() : employee.getUsername() + "\n");
|
||||
archive.setFundPaymentBaseString(fundPaymentBaseString);
|
||||
archive.setFundPaymentComBaseString(fundPaymentComBaseString);
|
||||
needUpdateFundArchiveList.add(archive);
|
||||
if (updateParam.getChangeData() && CollectionUtils.isNotEmpty(needUpdateFundArchiveList)) {
|
||||
// 更新
|
||||
encryptUtil.encrypt(archive, InsuranceArchivesFundSchemePO.class);
|
||||
getFundSchemeMapper().updateById(archive);
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if (welfareType.equals(WelfareTypeEnum.OTHER.getValue())) {
|
||||
List<InsuranceArchivesOtherSchemePO> insuranceArchivesOtherSchemePOS = getOtherSchemeMapper().listBySchemeId(insuranceSchemePO.getId(), runStatus);
|
||||
encryptUtil.decryptList(insuranceArchivesOtherSchemePOS, InsuranceArchivesOtherSchemePO.class);
|
||||
List<InsuranceArchivesOtherSchemePO> needUpdateOtherArchiveList = new ArrayList<>();
|
||||
// 获取人员信息
|
||||
List<Long> empIds = insuranceArchivesOtherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList());
|
||||
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(empIds);
|
||||
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
||||
// 企业年金或其他福利
|
||||
insuranceArchivesOtherSchemePOS.forEach(archive -> {
|
||||
Boolean[] changeFlag = {false};
|
||||
// 个人调整
|
||||
String otherPaymentBaseString = archive.getOtherPaymentBaseString();
|
||||
if (CollectionUtils.isNotEmpty(personChangeDeatilList)) {
|
||||
otherPaymentBaseString = adaptWelBaseLimit(otherPaymentBaseString, personChangeDeatilList, changeFlag);
|
||||
}
|
||||
// 公司调整的
|
||||
String otherPaymentComBaseString = archive.getOtherPaymentComBaseString();
|
||||
if (CollectionUtils.isNotEmpty(companyChangeDetailList)) {
|
||||
otherPaymentComBaseString = adaptWelBaseLimit(otherPaymentComBaseString, companyChangeDetailList, changeFlag);
|
||||
}
|
||||
if (changeFlag[0]) {
|
||||
DataCollectionEmployee employee = employeeMap.get(archive.getEmployeeId());
|
||||
baseLimitStrBuilder.append(employee == null ? archive.getEmployeeId() : employee.getUsername() + "\n");
|
||||
archive.setOtherPaymentBaseString(otherPaymentBaseString);
|
||||
archive.setOtherPaymentComBaseString(otherPaymentComBaseString);
|
||||
needUpdateOtherArchiveList.add(archive);
|
||||
if (updateParam.getChangeData() && CollectionUtils.isNotEmpty(needUpdateOtherArchiveList)) {
|
||||
// 更新
|
||||
encryptUtil.encrypt(archive, InsuranceArchivesOtherSchemePO.class);
|
||||
getOtherSchemeMapper().updateById(archive);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public String adaptWelBaseLimit(String paymentBaseString, List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOList, Boolean[] changeFlag) {
|
||||
|
||||
if (paymentBaseString == null) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> paymentBaseJson = JSON.parseObject(paymentBaseString, new HashMap<String, String>().getClass());
|
||||
if (paymentBaseJson == null) {
|
||||
return null;
|
||||
}
|
||||
Map<Long, InsuranceSchemeDetailPO> insuranceSchemeDetailPOMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOList, InsuranceSchemeDetailPO::getInsuranceId);
|
||||
List<String> insuranceIdList = insuranceSchemeDetailPOList.stream().map(po -> po.getInsuranceId().toString()).collect(Collectors.toList());
|
||||
|
||||
Set<String> paymentInsuranceIdList = paymentBaseJson.keySet();
|
||||
List<String> needAddInsuranceIds = insuranceIdList.stream().filter(insuranceId -> !paymentInsuranceIdList.contains(insuranceId)).collect(Collectors.toList());
|
||||
needAddInsuranceIds.stream().forEach(insuranceId -> {
|
||||
paymentBaseJson.put(insuranceId, "0.00");
|
||||
});
|
||||
|
||||
for (Map.Entry<String, String> entry : paymentBaseJson.entrySet()) {
|
||||
|
||||
//判断福利值是否为空/数字
|
||||
if (entry.getValue() == null || entry.getValue().length() == 0) {
|
||||
continue;
|
||||
} else if (!isNumeric(entry.getValue())) {
|
||||
log.info("福利值非数字!");
|
||||
continue;
|
||||
// throw new SalaryRunTimeException("福利值非数字");
|
||||
}
|
||||
|
||||
if (!insuranceIdList.contains(entry.getKey())) {
|
||||
// 没有修改上下限
|
||||
continue;
|
||||
}
|
||||
InsuranceSchemeDetailPO insuranceSchemeDetailPO = insuranceSchemeDetailPOMap.get(Long.valueOf(entry.getKey()));
|
||||
if (insuranceSchemeDetailPO != null) {
|
||||
|
||||
encryptUtil.decrypt(insuranceSchemeDetailPO, InsuranceSchemeDetailPO.class);
|
||||
String lowerLimit = "0.000".equals(insuranceSchemeDetailPO.getLowerLimit()) ? null : insuranceSchemeDetailPO.getLowerLimit();
|
||||
String upperLimit = "0.000".equals(insuranceSchemeDetailPO.getUpperLimit()) ? null : insuranceSchemeDetailPO.getUpperLimit();
|
||||
if (lowerLimit != null && lowerLimit.length() > 0 && Double.parseDouble(entry.getValue()) < Double.parseDouble(lowerLimit)) {
|
||||
//数值低于对应福利明细下限
|
||||
entry.setValue(lowerLimit);
|
||||
changeFlag[0] = true;
|
||||
}
|
||||
if (upperLimit != null && upperLimit.length() > 0 && Double.parseDouble(entry.getValue()) > Double.parseDouble(upperLimit)) {
|
||||
//数值高于对应福利明细上限
|
||||
entry.setValue(upperLimit);
|
||||
changeFlag[0] = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return JSON.toJSONString(paymentBaseJson);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断字符串是否为整数或者小数或者负数
|
||||
*/
|
||||
public static boolean isNumeric(String str){
|
||||
|
||||
Pattern pattern = Pattern.compile("^-?\\d+(\\.\\d+)?$");
|
||||
Matcher isNum = pattern.matcher(str);
|
||||
if (!isNum.matches()) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取修改了哪些明细项的上限和下限
|
||||
* @param oldInsuranceSchemeDetails
|
||||
* @param newInsuranceSchemeDetails
|
||||
* @return
|
||||
*/
|
||||
private List<InsuranceSchemeDetailPO> getChanceLimitSchemeDetailList(List<InsuranceSchemeDetailPO> oldInsuranceSchemeDetails, List<InsuranceSchemeDetailPO> newInsuranceSchemeDetails) {
|
||||
List<InsuranceSchemeDetailPO> schemeDetailChangeLimitList = new ArrayList<>();
|
||||
// key: 福利项id-缴纳范围
|
||||
Map<String, InsuranceSchemeDetailPO> oldInsuranceSchemeDetailMap = SalaryEntityUtil.convert2Map(oldInsuranceSchemeDetails, d -> d.getInsuranceId() + "-" + d.getPaymentScope());
|
||||
newInsuranceSchemeDetails.stream()
|
||||
.filter(detail -> detail.getIsPayment().equals(NumberUtils.INTEGER_ONE))
|
||||
.forEach(detail -> {
|
||||
boolean changeFlag = false;
|
||||
InsuranceSchemeDetailPO oldInsuranceSchemeDetailPO = oldInsuranceSchemeDetailMap.get(detail.getInsuranceId() + "-" + detail.getPaymentScope());
|
||||
if (oldInsuranceSchemeDetailPO == null) {
|
||||
changeFlag = true;
|
||||
} else {
|
||||
if (!oldInsuranceSchemeDetailPO.getUpperLimit().equals(detail.getUpperLimit())) {
|
||||
changeFlag = true;
|
||||
}
|
||||
if (!oldInsuranceSchemeDetailPO.getLowerLimit().equals(detail.getLowerLimit())) {
|
||||
changeFlag = true;
|
||||
}
|
||||
}
|
||||
if (changeFlag) {
|
||||
schemeDetailChangeLimitList.add(detail);
|
||||
}
|
||||
});
|
||||
return schemeDetailChangeLimitList;
|
||||
}
|
||||
|
||||
public int checkBeforeDeleteSocialscheme(Map<String, Object> params) {
|
||||
|
|
|
|||
|
|
@ -74,6 +74,7 @@ import org.jetbrains.annotations.NotNull;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.jdbc.datasource.DataSourceTransactionManager;
|
||||
import org.springframework.util.StopWatch;
|
||||
import weaver.general.BaseBean;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
|
@ -873,7 +874,12 @@ public class SalaryAcctResultServiceImpl extends Service implements SalaryAcctRe
|
|||
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, 100);
|
||||
String personNumberInOneThread = new BaseBean().getPropValue("hrmSalaryCustom", "personNumberInOneThread");
|
||||
int size= 100;
|
||||
if(StringUtils.isNotBlank(personNumberInOneThread)){
|
||||
size = Integer.parseInt(personNumberInOneThread);
|
||||
}
|
||||
List<List<SalaryAcctEmployeePO>> partition = Lists.partition(salaryAcctEmployeePOS, size);
|
||||
// 12.1、监控子线程的任务执行
|
||||
CountDownLatch childMonitor = new CountDownLatch(partition.size());
|
||||
// 12.2、记录子线程的执行结果
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class SISchemeController {
|
|||
User user = HrmUserVarify.getUser(request, response);
|
||||
Map<String, Object> map = ParamUtil.request2Map(request);
|
||||
map.put("insuranceSchemeReqParam", insuranceSchemeReqParam);
|
||||
return new ResponseResult<Map<String, Object>, Map<String, Object>>(user).run(getService(user)::update, map);
|
||||
return new ResponseResult<Map<String, Object>,String>(user).run(getService(user)::update, map);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
Loading…
Reference in New Issue