Merge remote-tracking branch 'origin/release/2.9.3.2308.01' into release/2.9.3.2308.01

This commit is contained in:
Harryxzy 2023-08-03 09:27:05 +08:00
commit ebd2e8651f
20 changed files with 450 additions and 42 deletions

View File

@ -662,11 +662,10 @@ public class SIArchivesBiz {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542533, "其他福利最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
// List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeId(Collections.singletonList(param.getEmployeeId()));
List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
List<Long> otherIds = new ArrayList();
otherIds.add(param.getId());
List<InsuranceArchivesOtherSchemePO> oldOtherInfoList = otherSchemeMapper.getOtherById(otherIds);
if (oldOtherInfoList.size() == 1) {
InsuranceArchivesOtherSchemePO oldOtherInfo = oldOtherInfoList.get(0);
InsuranceArchivesOtherSchemePO updateOtherInfo =
@ -694,7 +693,48 @@ public class SIArchivesBiz {
otherSchemeMapper.updateById(updateOtherInfo);
sqlSession.commit();
} else {
throw new SalaryRunTimeException("该员工已关联的其他福利档案不存在或存在多条,请处理后再重复当前操作!");
otherSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesOtherSchemePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
//新建社保档案并关联主表
InsuranceArchivesOtherSchemePO insertOtherInfo = InsuranceArchivesOtherSchemePO.builder()
.otherSchemeId(param.getOtherSchemeId())
.otherStartTime(StringUtils.isNotBlank(param.getOtherStartTime()) ? param.getOtherStartTime() : null)
.underTake(param.getUnderTake())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.welfareType(paramReq.getWelfareType().getValue())
.otherEndTime(StringUtils.isNotBlank(param.getOtherEndTime()) ? param.getOtherEndTime() : null)
.employeeId(param.getEmployeeId())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.createTime(new Date())
.updateTime(new Date())
.nonPayment(param.getNonPayment())
.creator(employeeId)
.paymentOrganization(param.getPaymentOrganization())
.otherPaymentBaseString(paramReq.getPaymentForm())
.build();
//校验福利基数是否符合上下限要求
if (!checkWelBaseLimit(insertOtherInfo.getOtherSchemeId(),insertOtherInfo.getOtherPaymentBaseString())) {
throw new SalaryRunTimeException("其他福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!");
}
encryptUtil.encrypt(insertOtherInfo, InsuranceArchivesOtherSchemePO.class);
otherSchemeMapper.insert(insertOtherInfo);
sqlSession.commit();
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null) {
List<InsuranceArchivesOtherSchemePO> otherInfos = otherSchemeMapper.getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
baseInfoPO.setOtherArchivesId(otherInfos.get(0).getId());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));
}
}
} finally {
@ -720,11 +760,10 @@ public class SIArchivesBiz {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542531, "公积金最后缴纳时间格式错误,正确格式为YYYY-MM或者yyyy-MM-dd"));
}
// List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeId(Collections.singletonList(param.getEmployeeId()));
List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
List<Long> fundIds = new ArrayList();
fundIds.add(param.getId());
List<InsuranceArchivesFundSchemePO> oldFundInfoList = fundSchemeMapper.getFundById(fundIds);
if (oldFundInfoList.size() == 1) {
InsuranceArchivesFundSchemePO oldFundInfo = oldFundInfoList.get(0);
InsuranceArchivesFundSchemePO updateFundInfo = InsuranceArchivesFundSchemePO.builder()
@ -754,7 +793,49 @@ public class SIArchivesBiz {
sqlSession.commit();
} else {
throw new SalaryRunTimeException("该员工已关联的公积金档案不存在或存在多条,请处理后再重复当前操作!");
fundSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesFundSchemePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
//新建社保档案并关联主表
InsuranceArchivesFundSchemePO insertFundInfo = InsuranceArchivesFundSchemePO.builder()
.fundSchemeId(param.getFundSchemeId())
.fundAccount(param.getFundAccount())
.fundEndTime(StringUtils.isNotBlank(param.getFundEndTime()) ? param.getFundEndTime() : null)
.fundStartTime(StringUtils.isNotBlank(param.getFundStartTime()) ? param.getFundStartTime() : null)
.fundPaymentBaseString(paramReq.getPaymentForm())
.supplementFundAccount(param.getSupplementFundAccount())
.creator(employeeId)
.nonPayment(param.getNonPayment())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.underTake(param.getUnderTake())
.paymentOrganization(param.getPaymentOrganization())
.createTime(new Date())
.updateTime(new Date())
.welfareType(paramReq.getWelfareType().getValue())
.employeeId(param.getEmployeeId())
.build();
//校验福利基数是否符合上下限要求
if (!checkWelBaseLimit(insertFundInfo.getFundSchemeId(),insertFundInfo.getFundPaymentBaseString())) {
throw new SalaryRunTimeException("公积金福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!");
}
encryptUtil.encrypt(insertFundInfo, InsuranceArchivesFundSchemePO.class);
fundSchemeMapper.insert(insertFundInfo);
sqlSession.commit();
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null) {
List<InsuranceArchivesFundSchemePO> fundInfos = fundSchemeMapper.getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
baseInfoPO.setFundArchivesId(fundInfos.get(0).getId());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));
}
}
} finally {
@ -787,11 +868,9 @@ public class SIArchivesBiz {
// socialSchemeMapper.batchDeleteByEmployeeIds(Collections.singletonList(param.getEmployeeId()));
//查询已有数据
// List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(param.getEmployeeId()));
List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
List<Long> socialIds = new ArrayList();
socialIds.add(param.getId());
List<InsuranceArchivesSocialSchemePO> oldSocialInfoList = socialSchemeMapper.getSocialById(socialIds);
//组装新数据
if (oldSocialInfoList.size() == 1) {
InsuranceArchivesSocialSchemePO oldSocialInfo = oldSocialInfoList.get(0);
@ -823,7 +902,49 @@ public class SIArchivesBiz {
sqlSession.commit();
} else {
throw new SalaryRunTimeException("该员工已关联的社保档案不存在或存在多条,请处理后再重复当前操作!");
socialSchemeMapper.deleteByEmployeeIdAndPayOrg(InsuranceArchivesSocialSchemePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
//新建社保档案并关联主表
InsuranceArchivesSocialSchemePO insertSocialInfo =
InsuranceArchivesSocialSchemePO.builder()
.welfareType(paramReq.getWelfareType().getValue())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.socialPaymentBaseString(paramReq.getPaymentForm())
.socialSchemeId(param.getSocialSchemeId())
.socialEndTime(StringUtils.isNotBlank(param.getSocialEndTime()) ? param.getSocialEndTime() : null)
.socialStartTime(StringUtils.isNotBlank(param.getSocialStartTime()) ? param.getSocialStartTime() : null)
.creator(employeeId)
.nonPayment(param.getNonPayment())
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
.employeeId(param.getEmployeeId())
.createTime(new Date())
.updateTime(new Date())
.underTake(param.getUnderTake())
.socialAccount(param.getSchemeAccount())
.paymentOrganization(param.getPaymentOrganization())
.build();
//校验福利基数是否符合上下限要求
if (!checkWelBaseLimit(insertSocialInfo.getSocialSchemeId(),insertSocialInfo.getSocialPaymentBaseString())) {
throw new SalaryRunTimeException("社保福利明细中的基数更新内容不符合相关基数上下限要求,请检查后重试!");
}
encryptUtil.encrypt(insertSocialInfo, InsuranceArchivesSocialSchemePO.class);
socialSchemeMapper.insert(insertSocialInfo);
sqlSession.commit();
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(param.getPaymentOrganization(), param.getEmployeeId());
if(baseInfoPO != null) {
List<InsuranceArchivesSocialSchemePO> socialInfos = socialSchemeMapper.getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
.employeeId(param.getEmployeeId())
.paymentOrganization(param.getPaymentOrganization())
.build());
baseInfoPO.setSocialArchivesId(socialInfos.get(0).getId());
getInsuranceBaseInfoMapper().updateById(baseInfoPO);
} else {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "档案不存在!"));
}
}
} finally {
@ -1078,7 +1199,7 @@ public class SIArchivesBiz {
list.add(new WeaTableColumn("150px", "工号", "jobNum"));
list.add(new WeaTableColumn("150px", "入职日期", "companystartdate"));
list.add(new WeaTableColumn("150px", "合同到期日期", "dismissdate"));
// list.add(new WeaTableColumn("150px", "合同到期日期", "dismissdate"));
list.add(new WeaTableColumn("150px", "社保方案名称", "socialName"));
titleMap.get(WelfareTypeEnum.SOCIAL_SECURITY.getValue()).forEach((k, v) -> list.add(new WeaTableColumn("150px", v, k)));

View File

@ -66,6 +66,6 @@ public class SalaryAccEmployeeListDTO {
private String hireDate;
//离职日期
@TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate")
// @TableTitle(title = "离职日期", dataIndex = "dismissDate", key = "dismissDate")
private String dismissDate;
}

View File

@ -82,7 +82,7 @@ public class SalaryArchiveBO {
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "起始发薪日期"), "payStartDate"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "最后发薪日期"), "payEndDate"));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "入职日期"), "companystartdate").setDisplay(WeaBoolAttr.FALSE));
columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "离职日期"), "dismissdate").setDisplay(WeaBoolAttr.FALSE));
// columns.add(new WeaTableColumn("100px", SalaryI18nUtil.getI18nLabel(86187, "离职日期"), "dismissdate").setDisplay(WeaBoolAttr.FALSE));
for (SalaryItemPO salaryItem : salaryItems) {
columns.add(new WeaTableColumn("100px", salaryItem.getName(), salaryItem.getId() + SalaryItemConstant.DYNAMIC_SUFFIX));
}

View File

@ -129,7 +129,7 @@ public class InsuranceComparisonResultBO {
*/
public static List<Map<String, Object>> buildComparisonTableData(List<AccountExportPO> accountExportPOS, List<ExcelAccountExportPO> excelAccountExportPOS, Map<Long, String> schemeIdNameMap) {
Map<String, List<ExcelAccountExportPO>> excelResultMap = SalaryEntityUtil.group2Map(excelAccountExportPOS, ExcelAccountExportPO::getWorkcode);
Map<Long, List<ExcelAccountExportPO>> excelResultMap = SalaryEntityUtil.group2Map(excelAccountExportPOS, ExcelAccountExportPO::getEmployeeId);
// Map<String, List<AccountExportPO>> acctResultMap = SalaryEntityUtil.group2Map(accountExportPOS, AccountExportPO::getWorkcode);
List<TaxAgentPO> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
@ -172,7 +172,7 @@ public class InsuranceComparisonResultBO {
map.put("otherSchemeName", schemeIdNameMap.get(accountExportPO.getOtherSchemeId()));
//线下值
List<ExcelAccountExportPO> excelResultValueList = excelResultMap.get(accountExportPO.getWorkcode());
List<ExcelAccountExportPO> excelResultValueList = excelResultMap.get(accountExportPO.getEmployeeId());
ExcelAccountExportPO excelAccountExportPO = new ExcelAccountExportPO();
if (excelResultValueList != null && excelResultValueList.size() == 1) {
excelAccountExportPO = excelResultValueList.get(0);

View File

@ -85,4 +85,10 @@ public interface FundSchemeMapper {
* @param fundArchiveDelIds
*/
void deleteByIds(@Param("ids")List<Long> fundArchiveDelIds);
/**
* 新增
* @param insuranceArchivesFundSchemePO
*/
void insert(InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO);
}

View File

@ -327,4 +327,45 @@
</foreach>
</if>
</update>
<insert id="insert" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO">
INSERT INTO hrsa_fund_archives(
fund_scheme_id,
fund_account,
fund_end_time,
fund_start_time,
fund_payment_base_string,
supplement_fund_account,
create_time,
creator,
non_payment,
delete_type,
tenant_key,
under_take,
payment_organization,
update_time,
welfare_type,
employee_id)
VALUES
(
#{fundSchemeId},
#{fundAccount},
#{fundEndTime},
#{fundStartTime},
#{fundPaymentBaseString},
#{supplementFundAccount},
#{createTime},
#{creator},
#{nonPayment},
#{deleteType},
#{tenantKey},
#{underTake},
#{paymentOrganization},
#{updateTime},
#{welfareType},
#{employeeId}
)
</insert>
</mapper>

View File

@ -113,4 +113,11 @@ public interface InsuranceBaseInfoMapper {
* @param archiveDelIds
*/
void deleteByIds(@Param("ids")List<Long> archiveDelIds);
/**
* 根据id更新
*
* @param po
*/
void updateById(InsuranceArchivesBaseInfoPO po);
}

View File

@ -318,4 +318,23 @@
</foreach>
</update>
<update id="updateById" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
UPDATE hrsa_insurance_base_info
<set>
<if test="null != employeeId and '' != employeeId">employee_id = #{employeeId},</if>
<if test="null != paymentOrganization and '' != paymentOrganization">payment_organization = #{paymentOrganization},</if>
<if test="null != socialArchivesId and '' != socialArchivesId">social_archives_id = #{socialArchivesId},</if>
<if test="null != fundArchivesId and '' != fundArchivesId">fund_archives_id = #{fundArchivesId},</if>
<if test="null != otherArchivesId and '' != otherArchivesId">other_archives_id = #{otherArchivesId},</if>
<if test="null != runStatus and '' != runStatus">run_status = #{runStatus},</if>
<if test="null != createTime">create_time = #{createTime},</if>
<if test="null != updateTime">update_time = #{updateTime},</if>
<if test="null != creator and '' != creator">creator = #{creator},</if>
<if test="null != deleteType and '' != deleteType">delete_type = #{deleteType},</if>
<if test="null != tenantKey and '' != tenantKey">tenant_key = #{tenantKey},</if>
</set>
WHERE id = #{id}
</update>
</mapper>

View File

@ -77,4 +77,10 @@ public interface OtherSchemeMapper {
* @param otherArchiveDelIds
*/
void deleteByIds(@Param("ids") List<Long> otherArchiveDelIds);
/**
* 新增
* @param insuranceArchivesOtherSchemePO
*/
void insert(InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO);
}

View File

@ -305,4 +305,39 @@
</foreach>
</if>
</update>
<insert id="insert" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO">
INSERT INTO hrsa_other_archives(
other_scheme_id,
other_start_time,
under_take,
tenant_key,
welfare_type,
other_end_time,
employee_id,
delete_type,
update_time,
create_time,
non_payment,
creator,
payment_organization,
other_payment_base_string)
VALUES
(
#{otherSchemeId},
#{otherStartTime},
#{underTake},
#{tenantKey},
#{welfareType},
#{otherEndTime},
#{employeeId},
#{deleteType},
#{updateTime},
#{createTime},
#{nonPayment},
#{creator},
#{paymentOrganization},
#{otherPaymentBaseString}
)
</insert>
</mapper>

View File

@ -113,4 +113,10 @@ public interface SocialSchemeMapper {
* @param socialArchiveDelIds
*/
void deleteByIds(@Param("ids")List<Long> socialArchiveDelIds);
/**
* 新增
* @param insuranceArchivesSocialSchemePO
*/
void insert(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);
}

View File

@ -709,4 +709,42 @@
</foreach>
</if>
</update>
<insert id="insert" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO">
INSERT INTO hrsa_social_archives(
welfare_type,
delete_type,
social_payment_base_string,
social_scheme_id,
create_time,
social_end_time,
social_start_time,
creator,
non_payment,
tenant_key,
employee_id,
update_time,
under_take,
social_account,
payment_organization)
VALUES
(
#{welfareType},
#{deleteType},
#{socialPaymentBaseString},
#{socialSchemeId},
#{createTime},
#{socialEndTime},
#{socialStartTime},
#{creator},
#{nonPayment},
#{tenantKey},
#{employeeId},
#{updateTime},
#{underTake},
#{socialAccount},
#{paymentOrganization}
)
</insert>
</mapper>

View File

@ -70,6 +70,12 @@ public interface ICategoryMapper {
*/
void updateNameById(ICategoryPO iCategoryPO);
/**
* 根据id更新福利名称和缴费对象
* @param iCategoryPO
*/
void updateNameAndPayScopeById(ICategoryPO iCategoryPO);
/**
* 根据类型查询福利类型
*
@ -91,4 +97,10 @@ public interface ICategoryMapper {
* @return
*/
List<ICategoryListDTO> listCustomInsurance(@Param("welfareType") Integer welfareType);
/**
* 根据id删除自定义福利项
* @param iCategoryPO
*/
void deleteCustomCategoryById(ICategoryPO iCategoryPO);
}

View File

@ -178,6 +178,17 @@
WHERE id = #{id} AND data_type = 0
</update>
<!--更新自定义福利名称和缴费对象-->
<update id="updateNameAndPayScopeById">
UPDATE hrsa_insurance_category
<set>
update_time=#{updateTime},
insurance_name=#{insuranceName},
payment_scope=#{paymentScope},
</set>
WHERE id = #{id} AND data_type = 0
</update>
<!--更新自定义福利名称-->
<select id="listCustomInsurance" resultType="com.engine.salary.entity.sicategory.dto.ICategoryListDTO">
select
@ -199,5 +210,14 @@
</if>
</select>
<!--根据id删除自定义福利项-->
<update id="deleteCustomCategoryById" parameterType="com.engine.salary.entity.sicategory.po.ICategoryPO">
UPDATE hrsa_insurance_category
<set>
update_time=#{updateTime},
delete_type = 1
</set>
WHERE id = #{id} AND delete_type = 0 AND data_type = 0
</update>
</mapper>

View File

@ -58,4 +58,11 @@ public interface SICategoryService {
* @date 2022/10/14 14:50
*/
Map<String, Object> updateCategoryName(ICategoryFormDTO iCategoryFormDTO);
/***
* @description 修改自定义福利 名称缴费对象
*/
Map<String, Object> updateCategoryNameAndPayScope(ICategoryFormDTO iCategoryFormDTO);
Map<String, Object> deleteCustomCategory(ICategoryFormDTO iCategoryFormDTO);
}

View File

@ -66,7 +66,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ
if (CollectionUtils.isEmpty(list)) {
return result;
}
List<Long> employeeIds = list.stream().map(item -> item.getEmployeeId()).collect(Collectors.toList());
List<Long> employeeIds = list.stream().map(item -> item.getEmployeeId()).distinct().collect(Collectors.toList());
List<DataCollectionEmployee> employeeByIds = new ArrayList<>();
List<List<Long>> partition = Lists.partition(employeeIds, 1000);
for (List<Long> longs : partition) {

View File

@ -2381,7 +2381,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
getExcelInsuranceDetailMapper().batchDelByIds(idList);
}
//新增
getExcelInsuranceDetailMapper().batchSave(addCompareList);
List<List<ExcelInsuranceDetailPO>> partition = Lists.partition((List<ExcelInsuranceDetailPO>) addCompareList, 20);
partition.forEach(getExcelInsuranceDetailMapper()::batchSave);
// getExcelInsuranceDetailMapper().batchSave(addCompareList);
apidatas.put("successCount", successCount);
apidatas.put("errorCount", failCount);

View File

@ -1,10 +1,13 @@
package com.engine.salary.service.impl;
import com.engine.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.cmd.sicategory.SICategoryGetFormCmd;
import com.engine.salary.cmd.sicategory.SICategoryInsertCmd;
import com.engine.salary.cmd.sicategory.SICategoryUpdateCmd;
import com.engine.salary.cmd.sicategory.SICategoryUpdateStatusByIdCmd;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.sicategory.dto.ICategoryDTO;
import com.engine.salary.entity.sicategory.dto.ICategoryFormDTO;
import com.engine.salary.entity.sicategory.dto.ICategoryListDTO;
@ -14,16 +17,20 @@ import com.engine.salary.enums.sicategory.DataTypeEnum;
import com.engine.salary.enums.sicategory.PaymentScopeEnum;
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
import com.engine.salary.exception.SalaryRunTimeException;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.sicategory.ICategoryMapper;
import com.engine.salary.service.RecordsBuildService;
import com.engine.salary.service.SICategoryService;
import com.engine.salary.util.SalaryEntityUtil;
import com.engine.salary.util.SalaryEnumUtil;
import com.engine.salary.util.SalaryI18nUtil;
import com.engine.salary.util.db.MapperProxyFactory;
import com.engine.salary.util.page.PageInfo;
import com.engine.salary.util.page.SalaryPageUtil;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.hrm.User;
import java.util.*;
import java.util.stream.Collectors;
@ -40,6 +47,15 @@ public class SICategoryServiceImpl extends Service implements SICategoryService
return MapperProxyFactory.getProxy(ICategoryMapper.class);
}
private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class);
}
public RecordsBuildService getRecordsBuildService(User user) {
return ServiceUtil.getService(RecordsBuildServiceImpl.class, user);
}
private EncryptUtil encryptUtil = new EncryptUtil();
@Override
public Map<String, Object> getForm(Map<String, Object> params) {
@ -136,6 +152,78 @@ public class SICategoryServiceImpl extends Service implements SICategoryService
return null;
}
@Override
public Map<String, Object> updateCategoryNameAndPayScope(ICategoryFormDTO iCategoryFormDTO) {
ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue());
if(categoryPO == null){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "自定义福利不存在"));
}
// 判断是否启用
Integer isUse = categoryPO.getIsUse();
if(isUse == 1){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "编辑失败,请先关闭启用按钮!"));
}
// 判断福利名称是否重复
List<ICategoryPO> iCategoryPOS = getICategoryMapper().listByName(iCategoryFormDTO.getInsuranceName());
iCategoryPOS = iCategoryPOS.stream().filter(f -> !f.getId().equals(iCategoryFormDTO.getId())).collect(Collectors.toList());
if(CollectionUtils.isNotEmpty(iCategoryPOS)){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "福利名称不能重复"));
}
ICategoryPO iCategoryPO = ICategoryPO.builder().id(iCategoryFormDTO.getId()).insuranceName(iCategoryFormDTO.getInsuranceName())
.paymentScope(SalaryEnumUtil.enumArrToString(iCategoryFormDTO.getPaymentScope()))
.updateTime(new Date())
.build();
getICategoryMapper().updateNameAndPayScopeById(iCategoryPO);
return null;
}
@Override
public Map<String, Object> deleteCustomCategory(ICategoryFormDTO iCategoryFormDTO) {
ICategoryPO categoryPO = getICategoryMapper().getByIdAndDataType(iCategoryFormDTO.getId(), DataTypeEnum.CUSTOM.getValue());
if(categoryPO == null){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "自定义福利不存在"));
}
// 判断是否启用
Integer isUse = categoryPO.getIsUse();
if(isUse == 1){
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "删除失败,请先关闭启用按钮!"));
}
// 判断自定义福利项是否存在核算数据
//获取所有福利核算数据
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().listAll();
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
//数据组装
List<Map<String, Object>> records = getRecordsBuildService(user).buildCommonRecords(insuranceAccountDetailPOS, null);
String welfareTypeName = "";
switch (categoryPO.getWelfareType()) {
case 1:
welfareTypeName = "social";
break;
case 2:
welfareTypeName = "fund";
break;
case 3:
welfareTypeName = "other";
break;
default:
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(542456, "福利类型不在"));
}
String welfareNameStart = categoryPO.getId() + welfareTypeName;
//校验福利项是否存在核算记录
records.forEach(f -> {
if (!Objects.isNull(f.get(welfareNameStart + "Per"))
|| !Objects.isNull(f.get(welfareNameStart + "Com"))
|| !Objects.isNull(f.get(welfareNameStart + "Base"))) {
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "删除失败,已存在福利核算记录"));
}
});
//删除自定义福利项
categoryPO.setUpdateTime(new Date());
getICategoryMapper().deleteCustomCategoryById(categoryPO);
return null;
}
private ICategoryDTO convertICategoryPO2DTO(ICategoryPO iCategoryPO){
return ICategoryDTO.builder().id(iCategoryPO.getId()).insuranceName(iCategoryPO.getInsuranceName())
.welfareType(iCategoryPO.getWelfareType())

View File

@ -154,8 +154,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86186, "工号"),
SalaryI18nUtil.getI18nLabel(91075, "员工状态"),
SalaryI18nUtil.getI18nLabel(91075, "入职日期"),
SalaryI18nUtil.getI18nLabel(91075, "离职日期")
SalaryI18nUtil.getI18nLabel(91075, "入职日期")
// SalaryI18nUtil.getI18nLabel(91075, "离职日期")
};
List<Object> headerList = new ArrayList<>(Arrays.asList(header));
// 查询薪资核算人员
@ -187,8 +187,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86186, "工号"),
SalaryI18nUtil.getI18nLabel(91075, "员工状态"),
SalaryI18nUtil.getI18nLabel(91075, "入职日期"),
SalaryI18nUtil.getI18nLabel(91075, "离职日期")
SalaryI18nUtil.getI18nLabel(91075, "入职日期")
// SalaryI18nUtil.getI18nLabel(91075, "离职日期")
};
List<Object> headerList = new ArrayList<>(Arrays.asList(header));
// 查询薪资核算人员环比上月减少
@ -219,8 +219,8 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
SalaryI18nUtil.getI18nLabel(86186, "工号"),
SalaryI18nUtil.getI18nLabel(91075, "员工状态"),
SalaryI18nUtil.getI18nLabel(91075, "入职日期"),
SalaryI18nUtil.getI18nLabel(91075, "离职日期")
SalaryI18nUtil.getI18nLabel(91075, "入职日期")
// SalaryI18nUtil.getI18nLabel(91075, "离职日期")
};
List<Object> headerList = new ArrayList<>(Arrays.asList(header));
// 查询薪资核算人员环比上月增加
@ -263,7 +263,7 @@ public class SalaryAcctExcelServiceImpl extends Service implements SalaryAcctExc
row.add(dto.getJobNum());
row.add(dto.getStatus());
row.add(dto.getHireDate());
row.add(dto.getDismissDate());
// row.add(dto.getDismissDate());
rows.add(row);
}
return rows;

View File

@ -110,7 +110,8 @@ public class SICategoryController {
public String updateCustomCategoryName(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody ICategoryFormDTO iCategoryFormDTO) {
User user = HrmUserVarify.getUser(request, response);
Map<String, Object> map = ParamUtil.request2Map(request);
return new ResponseResult< ICategoryFormDTO, Map<String, Object>>(user).run(getService(user)::updateCategoryName, iCategoryFormDTO);
// return new ResponseResult< ICategoryFormDTO, Map<String, Object>>(user).run(getService(user)::updateCategoryName, iCategoryFormDTO);
return new ResponseResult< ICategoryFormDTO, Map<String, Object>>(user).run(getService(user)::updateCategoryNameAndPayScope, iCategoryFormDTO);
}
@ -126,20 +127,18 @@ public class SICategoryController {
/**
* 该接口暂时没用删除福利类型对档案和台账核算都有很大的影响暂时还没考虑好怎么做
* 删除福利类型
*
* @param request
* @param response
* @return
* 删除自定义福利项
* 必要条件
* 1-福利项未启用
* 2-福利核算数据中不能存在该福利项的核算数据
*/
@POST
@Path("/deleteCustomCategory")
@Produces(MediaType.APPLICATION_JSON)
public String deleteSoftById(@Context HttpServletRequest request, @Context HttpServletResponse response) {
public String deleteCustomCategory(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody ICategoryFormDTO iCategoryFormDTO) {
User user = HrmUserVarify.getUser(request, response);
return null;
//return ResponseResult.run(getService(user)::delete, map);
return new ResponseResult< ICategoryFormDTO, Map<String, Object>>(user).run(getService(user)::deleteCustomCategory, iCategoryFormDTO);
}