Merge branch 'feature/v3-siAccountBalance-1208' into release/2.4.2.2212.03
This commit is contained in:
commit
d2be8e86ea
|
|
@ -400,6 +400,12 @@ public class SIAccountBiz extends Service {
|
|||
if (count % 50 == 0 || count >= ids.size()) {
|
||||
//salaryAcctProgressService.getAndAddCalculatedQty(tenantKey + billMonth, count >= ids.size() ? count % 50 : 50);
|
||||
getSalaryAcctProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.ACCT_PROGRESS + billMonth, count >= ids.size() ? count % 50 : 50);
|
||||
if (count == ids.size()) {
|
||||
getSalaryAcctProgressService(user).updateProgress(SalaryCacheKey.ACCT_PROGRESS + billMonth, BigDecimal.valueOf(0.99), false);
|
||||
} else {
|
||||
getSalaryAcctProgressService(user).updateProgress(SalaryCacheKey.ACCT_PROGRESS + billMonth, BigDecimal.valueOf(count/ids.size()).setScale(2, BigDecimal.ROUND_HALF_UP), false);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
//临时表入库前先对(可能存在的)历史数据进行删除
|
||||
|
|
@ -882,13 +888,13 @@ public class SIAccountBiz extends Service {
|
|||
socialTemp = socialTemp.add(socialPerson);
|
||||
fundTemp = fundTemp.add(fundPerson);
|
||||
otherTemp = otherTemp.add(otherPerson);
|
||||
if (!socialPersonFlag) {
|
||||
if (!socialPersonFlag && !item.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
||||
socialAccountPerson += 1;
|
||||
}
|
||||
if (!fundPersonFlag) {
|
||||
if (!fundPersonFlag && !item.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
||||
funcAccountPerson += 1;
|
||||
}
|
||||
if (!otherPersonFlag) {
|
||||
if (!otherPersonFlag && !item.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
||||
otherAccountPerson += 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1741,7 +1747,9 @@ public class SIAccountBiz extends Service {
|
|||
BigDecimal otherPaySum = new BigDecimal("0");
|
||||
for (InsuranceAccountDetailPO item : pos) {
|
||||
if (StringUtils.isNotBlank(item.getOtherSum()) && SalaryEntityUtil.string2DoubleDefault0(item.getOtherSum()) != 0.0) {
|
||||
otherNum += 1;
|
||||
if (!PaymentStatusEnum.BALANCE.getValue().equals(item.getPaymentStatus())) {
|
||||
otherNum += 1;
|
||||
}
|
||||
otherPaySum = otherPaySum.add(new BigDecimal(item.getOtherSum()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1754,7 +1762,9 @@ public class SIAccountBiz extends Service {
|
|||
BigDecimal fundPaySum = new BigDecimal("0");
|
||||
for (InsuranceAccountDetailPO item : pos) {
|
||||
if (StringUtils.isNotBlank(item.getFundSum()) && SalaryEntityUtil.string2DoubleDefault0(item.getFundSum()) != 0.0) {
|
||||
fundNum += 1;
|
||||
if (!PaymentStatusEnum.BALANCE.getValue().equals(item.getPaymentStatus())) {
|
||||
fundNum += 1;
|
||||
}
|
||||
fundPaySum = fundPaySum.add(new BigDecimal(item.getFundSum()));
|
||||
}
|
||||
}
|
||||
|
|
@ -1767,7 +1777,9 @@ public class SIAccountBiz extends Service {
|
|||
BigDecimal socialPaySum = new BigDecimal("0");
|
||||
for (InsuranceAccountDetailPO item : pos) {
|
||||
if (StringUtils.isNotBlank(item.getSocialSum()) && SalaryEntityUtil.string2DoubleDefault0(item.getSocialSum()) != 0.0 ) {
|
||||
socialNum += 1;
|
||||
if (!PaymentStatusEnum.BALANCE.getValue().equals(item.getPaymentStatus())) {
|
||||
socialNum += 1;
|
||||
}
|
||||
socialPaySum = socialPaySum.add(new BigDecimal(item.getSocialSum()));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,4 +22,6 @@ public class InsuranceAcctImportParam {
|
|||
*/
|
||||
@DataCheck(require = true,message = "imageId为空")
|
||||
String imageId;
|
||||
|
||||
private String billMonth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,9 @@ public enum ResourceFromEnum implements BaseEnum<Integer> {
|
|||
|
||||
SYSTEM(0, "系统核算", 92268),
|
||||
|
||||
Temporary(1, "临时", 92269);
|
||||
Temporary(1, "临时", 92269),
|
||||
|
||||
IMPORT(2,"导入",87622);
|
||||
|
||||
private Integer value;
|
||||
|
||||
|
|
|
|||
|
|
@ -171,4 +171,9 @@ public interface InsuranceAccountDetailMapper {
|
|||
* 获取数据(账单月份+缴纳状态+人员id+个税扣缴义务人)
|
||||
*/
|
||||
InsuranceAccountDetailPO getOneByBpep(InsuranceAccountDetailPO po);
|
||||
|
||||
/**
|
||||
* 获取补差数据(账单月份+人员id+个税扣缴义务人)
|
||||
*/
|
||||
List<InsuranceAccountDetailPO> queryBalanceList(InsuranceAccountDetailPO po);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -268,7 +268,7 @@
|
|||
<select id="selectList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
t.employee_id,t.social_sum,t.fund_sum,t.other_sum,t.fund_pay_org,t.social_pay_org,
|
||||
t.other_pay_org
|
||||
t.other_pay_org, t.payment_status
|
||||
FROM
|
||||
hrsa_bill_detail t
|
||||
WHERE t.delete_type = 0
|
||||
|
|
@ -1213,4 +1213,21 @@
|
|||
AND t.payment_organization = #{paymentOrganization}
|
||||
AND t.employee_id = #{employeeId}
|
||||
</select>
|
||||
|
||||
<select id="queryBalanceList" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
t.id,t.employee_id,t.social_per_json,t.social_com_json,
|
||||
t.fund_per_json,t.fund_com_json,t.other_per_json,
|
||||
t.other_com_json,t.social_per_sum,t.social_com_sum,
|
||||
t.fund_per_sum,t.fund_com_sum,t.other_per_sum,
|
||||
t.other_com_sum,t.per_sum,t.com_sum,t.payment_organization,
|
||||
t.total, t.social_sum, t.fund_sum, t.other_sum, t.bill_month
|
||||
FROM
|
||||
hrsa_bill_detail t
|
||||
WHERE t.delete_type = 0
|
||||
AND t.bill_month = #{billMonth}
|
||||
AND t.payment_status = 4
|
||||
AND t.payment_organization = #{paymentOrganization}
|
||||
AND t.employee_id = #{employeeId}
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -32,12 +32,19 @@ public interface FundSchemeMapper {
|
|||
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
* 根据ids获取多条
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<InsuranceArchivesFundSchemePO> getFundById(@Param("ids")List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据id获取单条
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
InsuranceArchivesFundSchemePO getOneById(@Param("id")Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param singletonList
|
||||
|
|
@ -67,4 +74,10 @@ public interface FundSchemeMapper {
|
|||
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
|
||||
|
||||
int updateById(InsuranceArchivesFundSchemePO insuranceArchivesFundSchemePO);
|
||||
|
||||
/**
|
||||
* 批量更新最后缴纳月为null
|
||||
* @param ids
|
||||
*/
|
||||
void batchUpdateEndTimeToNull(@Param("ids")List<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@
|
|||
AND payment_organization = #{param.paymentOrganization}
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取记录 -->
|
||||
<!-- 根据id获取多条记录 -->
|
||||
<select id="getFundById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
|
|
@ -82,6 +82,15 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取单条记录 -->
|
||||
<select id="getOneById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_fund_archives t
|
||||
WHERE delete_type = 0
|
||||
AND id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="batchDeleteByEmployeeIds">
|
||||
UPDATE hrsa_fund_archives
|
||||
|
|
@ -291,4 +300,17 @@
|
|||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量更新最后缴纳月为null -->
|
||||
<update id="batchUpdateEndTimeToNull">
|
||||
UPDATE hrsa_fund_archives
|
||||
SET fund_end_time = null
|
||||
WHERE delete_type = 0
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -23,12 +23,17 @@ public interface InsuranceBaseInfoMapper {
|
|||
List<InsuranceArchivesBaseInfoPO> listAll();
|
||||
|
||||
/**
|
||||
* 查询对应id记录
|
||||
* 查询对应id集合的记录
|
||||
*
|
||||
* @return 返回集合,没有返回空List
|
||||
*/
|
||||
List<InsuranceArchivesBaseInfoPO> listByIds(@Param("ids")Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 查询对应id的记录
|
||||
*/
|
||||
InsuranceArchivesBaseInfoPO getById(@Param("id")Long id);
|
||||
|
||||
/**
|
||||
* 获取当前福利档案基础信息(由当前的社保、公积金、其他福利信息表获取)
|
||||
* 当设置employeeIds时,则是通过人员id、社保、公积金、其他福利信息表获取指定人员的福利档案基础信息
|
||||
|
|
@ -81,6 +86,11 @@ public interface InsuranceBaseInfoMapper {
|
|||
*/
|
||||
List<InsuranceArchivesBaseInfoPO> getAbnormalList(@Param("param") InsuranceArchivesListParam param);
|
||||
|
||||
/**
|
||||
* 根据个税扣缴义务人和人员id获取单条数据
|
||||
*/
|
||||
InsuranceArchivesBaseInfoPO getOneByEmployeeIdAndPayOrg(@Param("paymentOrganization")Long paymentOrganization, @Param("employeeId")Long employeeId);
|
||||
|
||||
/**
|
||||
* 根据ids重置runStatus
|
||||
* @param po
|
||||
|
|
|
|||
|
|
@ -52,6 +52,14 @@
|
|||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="getById" resultMap="BaseResultMap">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_insurance_base_info t
|
||||
WHERE id = #{id}
|
||||
AND delete_type = 0
|
||||
</select>
|
||||
|
||||
<select id="getInsuranceBaseInfoListByInsuranceDetail" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
SELECT social.employee_id,
|
||||
social.id AS socialArchivesId,
|
||||
|
|
@ -206,14 +214,14 @@
|
|||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_insurance_base_info t
|
||||
LEFT JOIN( SELECT social.payment_organization, social.employee_id, social.social_end_time FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id AND t.payment_organization = social.payment_organization
|
||||
LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.fund_end_time FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id AND t.payment_organization = fund.payment_organization
|
||||
LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.other_end_time FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id AND t.payment_organization = other.payment_organization
|
||||
LEFT JOIN( SELECT social.payment_organization, social.employee_id, social.social_end_time, social.social_scheme_id FROM hrsa_social_archives social WHERE social.delete_type = 0 )social ON t.employee_id = social.employee_id AND t.payment_organization = social.payment_organization
|
||||
LEFT JOIN( SELECT fund.payment_organization, fund.employee_id, fund.fund_end_time, fund.fund_scheme_id FROM hrsa_fund_archives fund WHERE fund.delete_type = 0 )fund ON t.employee_id = fund.employee_id AND t.payment_organization = fund.payment_organization
|
||||
LEFT JOIN( SELECT other.payment_organization, other.employee_id, other.other_end_time, other.other_scheme_id FROM hrsa_other_archives other WHERE other.delete_type = 0 )other ON t.employee_id = other.employee_id AND t.payment_organization = other.payment_organization
|
||||
WHERE t.delete_type = 0
|
||||
AND t.run_status = '2'
|
||||
AND social.social_end_time is not null and social.social_end_time <![CDATA[ <> ]]> ' ' and social.social_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND fund.fund_end_time is not null and fund.fund_end_time <![CDATA[ <> ]]> ' ' and fund.fund_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND other.other_end_time is not null and other.other_end_time <![CDATA[ <> ]]> ' ' and other.other_end_time <![CDATA[ <= ]]> #{today}
|
||||
AND (social.social_scheme_id is null or (social.social_end_time is not null and social.social_end_time <![CDATA[ <> ]]> ' ' and social.social_end_time <![CDATA[ <= ]]> #{today}))
|
||||
AND (fund.fund_scheme_id is null or (fund.fund_end_time is not null and fund.fund_end_time <![CDATA[ <> ]]> ' ' and fund.fund_end_time <![CDATA[ <= ]]> #{today}))
|
||||
AND (other.other_scheme_id is null or (other.other_end_time is not null and other.other_end_time <![CDATA[ <> ]]> ' ' and other.other_end_time <![CDATA[ <= ]]> #{today}))
|
||||
</select>
|
||||
|
||||
<select id="getAbnormalList" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
|
|
@ -238,6 +246,16 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getOneByEmployeeIdAndPayOrg" resultType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_insurance_base_info t
|
||||
WHERE t.delete_type = 0
|
||||
AND employee_id = #{employeeId}
|
||||
AND payment_organization = #{paymentOrganization}
|
||||
|
||||
</select>
|
||||
|
||||
<update id="updateRunStatusByIds" parameterType="com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO">
|
||||
UPDATE hrsa_insurance_base_info
|
||||
<set>
|
||||
|
|
|
|||
|
|
@ -67,4 +67,10 @@ public interface OtherSchemeMapper {
|
|||
void batchUpdateEndTime(@Param("ids")List<Long> ids, @Param("endTime")String endTime);
|
||||
|
||||
int updateById(InsuranceArchivesOtherSchemePO insuranceArchivesOtherSchemePO);
|
||||
|
||||
/**
|
||||
* 批量更新最后缴纳月为null
|
||||
* @param ids
|
||||
*/
|
||||
void batchUpdateEndTimeToNull(@Param("ids")List<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -280,4 +280,17 @@
|
|||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量更新最后缴纳月为null -->
|
||||
<update id="batchUpdateEndTimeToNull">
|
||||
UPDATE hrsa_other_archives
|
||||
SET other_end_time = null
|
||||
WHERE delete_type = 0
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -32,12 +32,19 @@ public interface SocialSchemeMapper {
|
|||
List<InsuranceArchivesSocialSchemePO> getSocialByEmployeeIdAndPayOrg(@Param("param")InsuranceArchivesEmployeePO insuranceArchivesEmployeePO);
|
||||
|
||||
/**
|
||||
* 根据id获取
|
||||
* 根据ids获取多条
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
List<InsuranceArchivesSocialSchemePO> getSocialById(@Param("ids")List<Long> ids);
|
||||
|
||||
/**
|
||||
* 根据id获取单条
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
InsuranceArchivesSocialSchemePO getOneById(@Param("id")Long id);
|
||||
|
||||
/**
|
||||
* 批量删除
|
||||
* @param singletonList
|
||||
|
|
@ -95,4 +102,10 @@ public interface SocialSchemeMapper {
|
|||
* @return
|
||||
*/
|
||||
int updateById(InsuranceArchivesSocialSchemePO insuranceArchivesSocialSchemePO);
|
||||
|
||||
/**
|
||||
* 批量更新最后缴纳月为null
|
||||
* @param ids
|
||||
*/
|
||||
void batchUpdateEndTimeToNull(@Param("ids")List<Long> ids);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@
|
|||
AND payment_organization = #{param.paymentOrganization}
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取记录 -->
|
||||
<!-- 根据ids获取多条记录 -->
|
||||
<select id="getSocialById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
|
|
@ -79,6 +79,15 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
<!-- 根据id获取单条记录 -->
|
||||
<select id="getOneById" resultMap="BaseResultMap" >
|
||||
SELECT
|
||||
<include refid="baseColumns"/>
|
||||
FROM hrsa_social_archives t
|
||||
WHERE delete_type = 0
|
||||
AND id = #{id}
|
||||
</select>
|
||||
|
||||
<!-- 批量删除 -->
|
||||
<delete id="batchDeleteByEmployeeIds">
|
||||
UPDATE hrsa_social_archives
|
||||
|
|
@ -664,4 +673,17 @@
|
|||
</set>
|
||||
WHERE id = #{id} AND delete_type = 0
|
||||
</update>
|
||||
|
||||
<!-- 批量更新最后缴纳月为null -->
|
||||
<update id="batchUpdateEndTimeToNull">
|
||||
UPDATE hrsa_social_archives
|
||||
SET social_end_time = null
|
||||
WHERE delete_type = 0
|
||||
<if test="ids != null and ids.size()>0">
|
||||
AND id IN
|
||||
<foreach collection="ids" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</if>
|
||||
</update>
|
||||
</mapper>
|
||||
|
|
@ -56,6 +56,13 @@ public interface SIAccountService {
|
|||
*/
|
||||
Map<String,Object> listRecessionPage(InsuranceAccountDetailParam insuranceAccountDetailParam);
|
||||
|
||||
/**
|
||||
* 获取补差列表
|
||||
* @param insuranceAccountDetailParam
|
||||
* @return
|
||||
*/
|
||||
Map<String,Object> listBalancePage(InsuranceAccountDetailParam insuranceAccountDetailParam);
|
||||
|
||||
/**
|
||||
* 根据姓名获取补缴缴纳列表
|
||||
* @param insuranceAccountDetailParam
|
||||
|
|
@ -140,7 +147,6 @@ public interface SIAccountService {
|
|||
|
||||
/**
|
||||
* tab信息
|
||||
* @param billMonth
|
||||
*/
|
||||
InsuranceAccountTabDTO tabList(AccountParam build);
|
||||
|
||||
|
|
@ -260,5 +266,14 @@ public interface SIAccountService {
|
|||
*/
|
||||
void editAccount(EditAccountDetailParam param);
|
||||
|
||||
/**
|
||||
* 导出“福利核算-补差导入模板”
|
||||
*/
|
||||
XSSFWorkbook exportBalanceImportTemplate(InsuranceAcctDetailImportTemplateParam param);
|
||||
|
||||
/**
|
||||
* 将福利台账-补差模板导入的数据更新到数据库
|
||||
*/
|
||||
Map<String, Object> importBalanceInsuranceDetail(InsuranceAcctImportParam importParam);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -85,4 +85,9 @@ public interface SIArchivesService {
|
|||
* 批量增员
|
||||
*/
|
||||
Map<String, Object> stayAddToPay(Collection<Long> ids);
|
||||
|
||||
/**
|
||||
* 待减员页面的删除待办
|
||||
*/
|
||||
void cancelStayDel(InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,10 @@
|
|||
package com.engine.salary.service;
|
||||
|
||||
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
|
||||
|
||||
|
||||
public interface SIBalanceService {
|
||||
|
||||
void del(InspectAccountParam param, Long employeeId);
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,8 @@ package com.engine.salary.service;
|
|||
|
||||
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 核算进度
|
||||
* <p>Copyright: Copyright (c) 2022</p>
|
||||
|
|
@ -44,6 +46,13 @@ public interface SalaryAcctProgressService {
|
|||
*/
|
||||
void finish(String cacheKey, boolean checkStatus);
|
||||
|
||||
/**
|
||||
* 更新进度条
|
||||
*
|
||||
* @param cacheKey
|
||||
*/
|
||||
void updateProgress(String cacheKey, BigDecimal progress, boolean checkStatus);
|
||||
|
||||
/**
|
||||
* 获取进度条
|
||||
* @return
|
||||
|
|
|
|||
|
|
@ -25,18 +25,23 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
|
|||
import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesBaseInfoPO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
|
||||
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
|
||||
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
||||
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
||||
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
||||
import com.engine.salary.enums.UserStatusEnum;
|
||||
import com.engine.salary.enums.siaccount.*;
|
||||
import com.engine.salary.enums.sicategory.DeleteTypeEnum;
|
||||
import com.engine.salary.enums.sicategory.WelfareTypeEnum;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.siaccount.ExcelInsuranceDetailMapper;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper;
|
||||
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
||||
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
|
||||
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
||||
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
||||
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
||||
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
||||
|
|
@ -47,6 +52,7 @@ import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
|||
import com.engine.salary.sys.service.SalarySysConfService;
|
||||
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||
import com.engine.salary.util.SalaryDateUtil;
|
||||
import com.engine.salary.util.SalaryEntityUtil;
|
||||
import com.engine.salary.util.SalaryFormItemUtil;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.engine.salary.util.db.MapperProxyFactory;
|
||||
|
|
@ -71,6 +77,7 @@ import weaver.hrm.User;
|
|||
|
||||
import java.io.InputStream;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
|
@ -157,6 +164,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
|
||||
}
|
||||
|
||||
private SocialSchemeMapper getSocialSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
|
||||
}
|
||||
|
||||
private FundSchemeMapper getFundSchemeMapper() {
|
||||
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
|
||||
}
|
||||
|
||||
private EmployBiz employeeBiz = new EmployBiz();
|
||||
|
||||
private TaxAgentBiz taxAgentBiz = new TaxAgentBiz();
|
||||
|
|
@ -407,6 +422,62 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> listBalancePage(InsuranceAccountDetailParam queryParam) {
|
||||
Long employeeId = (long) user.getUID();
|
||||
Map<String, Object> datas = new HashMap<>();
|
||||
|
||||
// 分权逻辑
|
||||
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
|
||||
if (needAuth) {
|
||||
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
|
||||
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
||||
if (CollectionUtils.isEmpty(taxAgents)) {
|
||||
//防止普通用户查询
|
||||
queryParam.setTaxAgents(Collections.singletonList(-1L));
|
||||
} else {
|
||||
queryParam.setTaxAgents(taxAgents);
|
||||
}
|
||||
}
|
||||
|
||||
//补差列表
|
||||
queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
|
||||
|
||||
//排序配置
|
||||
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
||||
queryParam.setOrderRule(orderRule);
|
||||
|
||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
||||
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list, InsuranceAccountDetailPO.class);
|
||||
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
|
||||
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
|
||||
//数据组装
|
||||
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId);
|
||||
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
||||
pageInfos.setTotal(pageInfo.getTotal());
|
||||
pageInfos.setPageNum(queryParam.getCurrent());
|
||||
pageInfos.setPageSize(queryParam.getPageSize());
|
||||
|
||||
|
||||
//动态列组装
|
||||
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, queryParam.getPaymentStatus());
|
||||
|
||||
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, InsuranceAccountDetailPO.class);
|
||||
table.setColumns(weaTableColumn);
|
||||
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
|
||||
pageInfos.setColumns(columns);
|
||||
|
||||
|
||||
WeaResultMsg result = new WeaResultMsg(false);
|
||||
result.putAll(table.makeDataResult());
|
||||
result.success();
|
||||
|
||||
datas.put("pageInfo", pageInfos);
|
||||
//datas.put("dataKey",result.getResultMap());
|
||||
return datas;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getForm(Map<String, Object> params) {
|
||||
Map<String, Object> apidatas = new HashMap<>();
|
||||
|
|
@ -575,6 +646,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
recession.put("content", SalaryI18nUtil.getI18nLabel(92270, "退差"));
|
||||
tabList.add(recession);
|
||||
|
||||
Map<String, Object> balance = new HashMap<>();
|
||||
balance.put("id", "6");
|
||||
balance.put("content", SalaryI18nUtil.getI18nLabel(92271, "补差"));
|
||||
tabList.add(balance);
|
||||
|
||||
insuranceAccountTabDTO.setTabList(tabList);
|
||||
insuranceAccountTabDTO.setShow(isShow);
|
||||
insuranceAccountTabDTO.setBillMonth(build.getBillMonth());
|
||||
|
|
@ -897,7 +973,11 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
public List<InsuranceAccountDetailPO> queryList(String billMonth, Long taxAgentId, List<Long> employeeIds) {
|
||||
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().queryList(billMonth, taxAgentId, employeeIds);
|
||||
//退差数据不参与薪资核算
|
||||
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream().filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue()) || f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())).collect(Collectors.toList());
|
||||
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
|
||||
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())
|
||||
|| f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())
|
||||
|| f.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue()) )
|
||||
.collect(Collectors.toList());
|
||||
List<InsuranceAccountDetailPO> list = buildNewInsuranceDetailPOS(insuranceAccountDetailPOS);
|
||||
// InsuranceAccountDetailPOEncrypt.decryptInsuranceAccountDetailPOList(list);
|
||||
return list;
|
||||
|
|
@ -1334,41 +1414,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
|
||||
//刷新hrsa_bill_batch中数据统计信息
|
||||
if (updateInsuranceAccountDetailList.size() > 0) {
|
||||
ExecutorService taskExecutor = Executors.newCachedThreadPool();
|
||||
taskExecutor.execute(() -> {
|
||||
Long paymentOrganization = updateInsuranceAccountDetailList.get(0).getPaymentOrganization();
|
||||
String billMonth = updateInsuranceAccountDetailList.get(0).getBillMonth();
|
||||
if (paymentOrganization != null && billMonth != null) {
|
||||
InsuranceAccountDetailParam refreshParam =new InsuranceAccountDetailParam();
|
||||
refreshParam.setBillMonth(billMonth);
|
||||
refreshParam.setPaymentOrganization(paymentOrganization.toString());
|
||||
PageInfo<InsuranceAccountViewListDTO> pageInfos = overView(refreshParam);
|
||||
TaxAgentPO taxAgentPo = getTaxAgentMapper().getById(paymentOrganization);
|
||||
if (taxAgentPo != null) {
|
||||
List<InsuranceAccountViewListDTO> viewListDTOList = pageInfos.getList();
|
||||
viewListDTOList.stream().filter(f -> f.getPayOrg().equals(taxAgentPo.getName())).collect(Collectors.toList());
|
||||
InsuranceAccountBatchPO batchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization);
|
||||
batchPO = encryptUtil.decrypt(batchPO, InsuranceAccountBatchPO.class);
|
||||
//更新
|
||||
if (viewListDTOList.size() > 0 && batchPO != null) {
|
||||
InsuranceAccountViewListDTO viewListDTO = viewListDTOList.get(0);
|
||||
batchPO.setSocialNum(viewListDTO.getSocialNum());
|
||||
batchPO.setFundNum(viewListDTO.getFundNum());
|
||||
batchPO.setOtherNum(viewListDTO.getOtherNum());
|
||||
|
||||
batchPO.setSocialPay(viewListDTO.getSocialPaySum().replace(",", ""));
|
||||
batchPO.setFundPay(viewListDTO.getFundPaySum().replace(",", ""));
|
||||
batchPO.setOtherPay(viewListDTO.getOtherPaySum().replace(",", ""));
|
||||
|
||||
batchPO.setUpdateTime(new Date());
|
||||
batchPO = encryptUtil.encrypt(batchPO, InsuranceAccountBatchPO.class);
|
||||
getInsuranceAccountBatchMapper().updateById(batchPO);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
refreshBillBatch(updateInsuranceAccountDetailList.get(0).getPaymentOrganization(), updateInsuranceAccountDetailList.get(0).getBillMonth());
|
||||
}
|
||||
|
||||
apidatas.put("successCount", successCount);
|
||||
|
|
@ -2474,4 +2520,533 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|||
insuranceAccountDetailPO.setTotal(perSum.add(comSum).toPlainString());
|
||||
return insuranceAccountDetailPO;
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出“福利核算-补差导入”模板
|
||||
*/
|
||||
@Override
|
||||
public XSSFWorkbook exportBalanceImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
|
||||
ValidUtil.doValidator(param);
|
||||
|
||||
// 必须选择导入模板所需的薪资项目(福利项)
|
||||
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
|
||||
}
|
||||
|
||||
// 模板表头(默认必带"个税扣缴义务人"、"姓名")
|
||||
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
||||
"部门",
|
||||
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
||||
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
||||
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人")
|
||||
);
|
||||
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName");
|
||||
// 查询福利核算项目
|
||||
List<String> welfareNames = (List<String>) param.getWelfareNames();
|
||||
headerList.addAll(welfareNames);
|
||||
|
||||
// //查询当前已有的补缴数据
|
||||
// List<Map<String, Object>> resultMapList = getSupplyDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
||||
// // excel导出的数据
|
||||
// List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
|
||||
// rows.add(headerList);
|
||||
// for (Map<String, Object> map : resultMapList) {
|
||||
// List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
|
||||
// for (String dataIndex : dataIndexList) {
|
||||
// row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
|
||||
// }
|
||||
// rows.add(row);
|
||||
// }
|
||||
|
||||
List<List<Object>> rows = new ArrayList<>();
|
||||
rows.add(headerList);
|
||||
|
||||
String sheetName = "福利核算-补差导入模板";
|
||||
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将福利台账-补差模板导入的数据更新到数据库
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> importBalanceInsuranceDetail(InsuranceAcctImportParam importParam) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
// Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
||||
|
||||
Map<String, Object> apidatas = new HashMap<String, Object>();
|
||||
EmployBiz employBiz = new EmployBiz();
|
||||
|
||||
//查询对于人员信息导入筛选的全局配置
|
||||
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
||||
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
||||
//检验参数
|
||||
//excel文件id
|
||||
String imageId = Util.null2String(importParam.getImageId());
|
||||
|
||||
if (StringUtils.isBlank(imageId)) {
|
||||
throw new SalaryRunTimeException("文件不存在");
|
||||
}
|
||||
// // 获取所有个税扣缴义务人
|
||||
// List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
|
||||
// Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
|
||||
|
||||
// 获取租户下所有的人员
|
||||
List<DataCollectionEmployee> salaryEmployees = employBiz.listEmployee();
|
||||
|
||||
List<ICategoryPO> insuranceCategoryPOS = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll();
|
||||
// 失败的数量
|
||||
int failCount = 0;
|
||||
// 成功的数量
|
||||
int successCount = 0;
|
||||
InputStream fileInputStream = null;
|
||||
try {
|
||||
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(importParam.getImageId()));
|
||||
|
||||
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
||||
|
||||
// 错误提示信息
|
||||
List<Map> excelComments = Lists.newArrayList();
|
||||
// 存在错误的那行数据
|
||||
List<Map<String, Object>> errorDatas = Lists.newArrayList();
|
||||
// 表头
|
||||
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
||||
// 处理数值
|
||||
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
||||
if (CollectionUtils.isEmpty(headers)) {
|
||||
throw new SalaryRunTimeException("表头为空");
|
||||
}
|
||||
if (CollectionUtils.isEmpty(data)) {
|
||||
throw new SalaryRunTimeException("无数据");
|
||||
}
|
||||
//存储待更新的InsuranceAccountDetailPO数据
|
||||
List<InsuranceAccountDetailPO> updateInsuranceAccountDetailList = new ArrayList<>();
|
||||
|
||||
//存储待新增的InsuranceAccountDetailPO数据
|
||||
List<InsuranceAccountDetailPO> createInsuranceAccountDetailList = new ArrayList<>();
|
||||
|
||||
String billMonth = importParam.getBillMonth();
|
||||
//遍历excel表具体数据
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
|
||||
String row = "第" + (i + 2) + "行";
|
||||
|
||||
boolean isError = false;
|
||||
Map<String, Object> map = data.get(i);
|
||||
Long employeeId = 0L;
|
||||
// Long taxAgentId = 0L;
|
||||
|
||||
List<InsuranceAccountDetailPO> list = new ArrayList<>();
|
||||
|
||||
|
||||
String taxAgentName = (String) map.getOrDefault("个税扣缴义务人", "");
|
||||
|
||||
Long paymentOrganization = 0L;
|
||||
List<TaxAgentPO> taxAgentPoList = getTaxAgentMapper().listByName(taxAgentName);
|
||||
|
||||
if (taxAgentPoList.size() == 1) {
|
||||
paymentOrganization = taxAgentPoList.get(0).getId();
|
||||
} else {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
|
||||
excelComments.add(errorMessageMap);
|
||||
}
|
||||
|
||||
if (!checkBillMonth(billMonth)) {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "账单月份输入有误,请参照“2022-09”这种格式进行检查"));
|
||||
excelComments.add(errorMessageMap);
|
||||
}
|
||||
|
||||
List<Map<String, Object>> singleAccount = new ArrayList<>();
|
||||
|
||||
//遍历表头
|
||||
for (int j = 0; j < headers.size(); j++) {
|
||||
String header = headers.get(j);
|
||||
String dataKey = header;
|
||||
if (dataKey == null) {
|
||||
continue;
|
||||
}
|
||||
//组装单条数据基础数据
|
||||
Map<String, Object> cellData = new HashMap<>();
|
||||
cellData.put(dataKey, Optional.ofNullable(map.get(dataKey)).orElse("").toString());
|
||||
cellData.put("index", j);
|
||||
singleAccount.add(cellData);
|
||||
//抽取人员信息进行校验
|
||||
String name = (String) map.getOrDefault("姓名", "");
|
||||
String departmentName = (String) map.getOrDefault("部门", "");
|
||||
String mobile = (String) map.getOrDefault("手机号", "");
|
||||
String workcode = (String) map.getOrDefault("工号", "");
|
||||
|
||||
|
||||
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
|
||||
//当人员信息导入筛选的全局配置为"0"时,姓名才是必填项
|
||||
if (StringUtils.isEmpty(name) && "0".equals(confValue)) {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
|
||||
excelComments.add(errorMessageMap);
|
||||
|
||||
} else {
|
||||
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
||||
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(salaryEmployees, name, departmentName, mobile, workcode, null);
|
||||
|
||||
if (CollectionUtils.isEmpty(employeeSameIds)) {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
|
||||
excelComments.add(errorMessageMap);
|
||||
|
||||
} else if (employeeSameIds.size() > 1) {
|
||||
//存在离职和在职状态取在职状态
|
||||
employeeSameIds = employeeSameIds.stream()
|
||||
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
||||
.collect(Collectors.toList());
|
||||
if (employeeSameIds.size() != 1) {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + "员工信息不存在或者存在多个员工");
|
||||
excelComments.add(errorMessageMap);
|
||||
} else {
|
||||
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
||||
}
|
||||
} else {
|
||||
employeeId = employeeSameIds.get(0).getEmployeeId();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
if (!isError){
|
||||
|
||||
//如果福利核算信息查询不到唯一匹配数据,不支持导入
|
||||
//根据员工id、个税扣缴义务人id、账单月份查询补差数据
|
||||
list = getInsuranceAccountDetailMapper().queryBalanceList(InsuranceAccountDetailPO.builder()
|
||||
.employeeId(employeeId)
|
||||
.paymentOrganization(paymentOrganization)
|
||||
.billMonth(billMonth)
|
||||
.build());
|
||||
|
||||
if (list.isEmpty()) {
|
||||
//新增数据情况
|
||||
InsuranceAccountDetailPO createPO = buildBalanceAccountDetail(paymentOrganization, insuranceCategoryPOS, singleAccount, billMonth, employeeId, currentEmployeeId);
|
||||
if(checkBalance(createPO)) {
|
||||
createInsuranceAccountDetailList.add(createPO);
|
||||
} else {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!"));
|
||||
excelComments.add(errorMessageMap);
|
||||
}
|
||||
|
||||
} else if (list.size() > 1) {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月已存在多组补差数据,请删除数据库中多余项"));
|
||||
excelComments.add(errorMessageMap);
|
||||
} else {
|
||||
//更新数据情况
|
||||
//拼装待更新数据
|
||||
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
||||
InsuranceAccountDetailPO updatePO = handleInsuranceAccountDetail(list.get(0), map);
|
||||
if(checkBalance(updatePO)) {
|
||||
updateInsuranceAccountDetailList.add(updatePO);
|
||||
} else {
|
||||
isError = true;
|
||||
Map<String, String> errorMessageMap = Maps.newHashMap();
|
||||
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!"));
|
||||
excelComments.add(errorMessageMap);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (isError) {
|
||||
failCount++;
|
||||
errorDatas.add(map);
|
||||
} else {
|
||||
successCount++;
|
||||
}
|
||||
|
||||
}
|
||||
Long paymentOrganization = null;
|
||||
if (updateInsuranceAccountDetailList.size() > 0) {
|
||||
paymentOrganization = updateInsuranceAccountDetailList.get(0).getPaymentOrganization();
|
||||
//将待更新列表加密
|
||||
encryptUtil.encryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
||||
//更新
|
||||
for(InsuranceAccountDetailPO po : updateInsuranceAccountDetailList) {
|
||||
getSiAccountBiz(user).updateByEmployeeIdAndBillMonth(po);
|
||||
}
|
||||
}
|
||||
if (createInsuranceAccountDetailList.size() > 0) {
|
||||
paymentOrganization = createInsuranceAccountDetailList.get(0).getPaymentOrganization();
|
||||
//去除员工id+个税扣缴义务人下重复的数据
|
||||
createInsuranceAccountDetailList = createInsuranceAccountDetailList.stream()
|
||||
.collect(Collectors.collectingAndThen(Collectors.toCollection(()
|
||||
-> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
||||
//将待新增列表加密
|
||||
encryptUtil.encryptList(createInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
||||
//新增
|
||||
List<List<InsuranceAccountDetailPO>> createPartition = Lists.partition((List<InsuranceAccountDetailPO>) createInsuranceAccountDetailList, 20);
|
||||
createPartition.forEach(getInsuranceAccountDetailMapper()::batchSaveAccountDetails);
|
||||
}
|
||||
|
||||
//刷新bill_batch表中统计信息
|
||||
refreshBillBatch(paymentOrganization, importParam.getBillMonth());
|
||||
|
||||
apidatas.put("successCount", successCount);
|
||||
apidatas.put("errorCount", failCount);
|
||||
apidatas.put("errorData", excelComments);
|
||||
|
||||
} finally {
|
||||
IOUtils.closeQuietly(fileInputStream);
|
||||
}
|
||||
return apidatas;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查补差数据中的福利缴纳费用相关福利类别,是否在正常缴纳中有设置缴纳
|
||||
* @param po
|
||||
* @return
|
||||
*/
|
||||
private boolean checkBalance(InsuranceAccountDetailPO po) {
|
||||
InsuranceAccountDetailPO commonAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
|
||||
.billMonth(po.getBillMonth())
|
||||
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
|
||||
.employeeId(po.getEmployeeId())
|
||||
.paymentOrganization(po.getPaymentOrganization())
|
||||
.build());
|
||||
if (commonAccountPO != null) {
|
||||
|
||||
encryptUtil.decrypt(commonAccountPO, InsuranceAccountDetailPO.class);
|
||||
boolean commonSocialNullFlag = (StringUtils.isBlank(commonAccountPO.getSocialSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getSocialSum()));
|
||||
boolean commonFundNullFlag = (StringUtils.isBlank(commonAccountPO.getFundSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getFundSum()));
|
||||
boolean commonOtherNullFlag = (StringUtils.isBlank(commonAccountPO.getOtherSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getOtherSum()));
|
||||
|
||||
boolean balanceSocialNullFlag = (StringUtils.isBlank(po.getSocialSum()) || SalaryEntityUtil.StringEqZERO(po.getSocialSum()));
|
||||
boolean balanceFundNullFlag = (StringUtils.isBlank(po.getFundSum()) || SalaryEntityUtil.StringEqZERO(po.getFundSum()));
|
||||
boolean balanceOtherNullFlag = (StringUtils.isBlank(po.getOtherSum()) || SalaryEntityUtil.StringEqZERO(po.getOtherSum()));
|
||||
//在正常缴纳数据中未设置的福利类别(社保、公积金、其他福利),不允许在补差数据中缴纳
|
||||
if ((commonSocialNullFlag && !balanceSocialNullFlag) || (commonFundNullFlag && !balanceFundNullFlag) || (commonOtherNullFlag && !balanceOtherNullFlag)) {
|
||||
return false;
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public InsuranceAccountDetailPO buildBalanceAccountDetail(Long paymentOrganization, List<ICategoryPO> insuranceCategoryPOS,
|
||||
List<Map<String, Object>> singleAccount, String billMonth, Long employeeId, Long creator) {
|
||||
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
||||
insuranceAccountDetailPO.setId(IdGenerator.generate());
|
||||
insuranceAccountDetailPO.setEmployeeId(employeeId);
|
||||
insuranceAccountDetailPO.setBillMonth(billMonth);
|
||||
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
|
||||
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
|
||||
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.IMPORT.getValue());
|
||||
|
||||
insuranceAccountDetailPO.setCreator(creator);
|
||||
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
||||
insuranceAccountDetailPO.setCreateTime(new Date());
|
||||
insuranceAccountDetailPO.setUpdateTime(new Date());
|
||||
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
||||
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
|
||||
insuranceAccountDetailPO.setSocialPayOrg(paymentOrganization);
|
||||
insuranceAccountDetailPO.setFundPayOrg(paymentOrganization);
|
||||
insuranceAccountDetailPO.setOtherPayOrg(paymentOrganization);
|
||||
|
||||
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(employeeId, paymentOrganization);
|
||||
if (baseInfoPO != null) {
|
||||
InsuranceArchivesSocialSchemePO socialSchemePO = getSocialSchemeMapper().getOneById(baseInfoPO.getSocialArchivesId());
|
||||
|
||||
InsuranceArchivesFundSchemePO fundSchemePO = getFundSchemeMapper().getOneById(baseInfoPO.getFundArchivesId());
|
||||
if (socialSchemePO != null) {
|
||||
insuranceAccountDetailPO.setSocialAccount(socialSchemePO.getSocialAccount());
|
||||
}
|
||||
if (fundSchemePO != null) {
|
||||
insuranceAccountDetailPO.setFundAccount(fundSchemePO.getFundAccount());
|
||||
insuranceAccountDetailPO.setSupplementFundAccount(fundSchemePO.getSupplementFundAccount());
|
||||
}
|
||||
}
|
||||
|
||||
//获取改员工社保档案
|
||||
accountBalanceSocial(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
|
||||
accountBalanceFund(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
|
||||
// 其他福利档案
|
||||
accountBalanceOther(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
|
||||
account((insuranceAccountDetailPO));
|
||||
if (insuranceAccountDetailPO.getOtherSchemeId() == null) {
|
||||
insuranceAccountDetailPO.setOtherSchemeId(0L);
|
||||
}
|
||||
if (insuranceAccountDetailPO.getSocialSchemeId() == null) {
|
||||
insuranceAccountDetailPO.setSocialSchemeId(0L);
|
||||
}
|
||||
if (insuranceAccountDetailPO.getFundSchemeId() == null) {
|
||||
insuranceAccountDetailPO.setFundSchemeId(0L);
|
||||
}
|
||||
return insuranceAccountDetailPO;
|
||||
}
|
||||
|
||||
public InsuranceAccountDetailPO accountBalanceSocial(List<Map<String, Object>> singleAccount, InsuranceAccountDetailPO insuranceAccountDetailPO,
|
||||
List<ICategoryPO> insuranceCategoryPOS, Long employeeId) {
|
||||
//社保-个人
|
||||
List<ICategoryPO> socialCategory = insuranceCategoryPOS.stream().filter(po -> po.getWelfareType().equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
List<BigDecimal> socialPer = new ArrayList<>();
|
||||
Map<String, String> socialPerJsonMap = new HashMap<>();
|
||||
for (int i = 0; i < singleAccount.size(); i++) {
|
||||
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
||||
Optional<ICategoryPO> personalOptional = socialCategory.stream()
|
||||
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"))).findFirst();
|
||||
if (personalOptional.isPresent() && StringUtils
|
||||
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人")))) {
|
||||
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"));
|
||||
perNumString = perNumString.replace(",", "");
|
||||
BigDecimal result = new BigDecimal(perNumString);
|
||||
socialPerJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
||||
socialPer.add(result);
|
||||
}
|
||||
}
|
||||
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
|
||||
BigDecimal socialPerSum = new BigDecimal("0");
|
||||
for (BigDecimal bigDecimal : socialPer) {
|
||||
socialPerSum = socialPerSum.add(bigDecimal);
|
||||
}
|
||||
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
||||
|
||||
//社保-单位
|
||||
List<BigDecimal> socialCom = new ArrayList<>();
|
||||
Map<String, String> sociaComJsonMap = new HashMap<>();
|
||||
for (int i = 0; i < singleAccount.size(); i++) {
|
||||
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
||||
Optional<ICategoryPO> personalOptional = socialCategory.stream()
|
||||
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"))).findFirst();
|
||||
if (personalOptional.isPresent() && StringUtils
|
||||
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位")))) {
|
||||
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"));
|
||||
perNumString = perNumString.replace(",", "");
|
||||
BigDecimal result = new BigDecimal(perNumString);
|
||||
sociaComJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
||||
socialCom.add(result);
|
||||
}
|
||||
}
|
||||
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(sociaComJsonMap));
|
||||
BigDecimal socialComSum = new BigDecimal("0");
|
||||
for (BigDecimal decimal : socialCom) {
|
||||
socialComSum = socialComSum.add(decimal);
|
||||
}
|
||||
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
||||
return insuranceAccountDetailPO;
|
||||
}
|
||||
|
||||
public InsuranceAccountDetailPO accountBalanceFund(List<Map<String, Object>> singleAccount, InsuranceAccountDetailPO insuranceAccountDetailPO,
|
||||
List<ICategoryPO> insuranceCategoryPOS, Long employeeId) {
|
||||
//公积金-个人
|
||||
List<ICategoryPO> fundCategory = insuranceCategoryPOS.stream().filter(po -> po.getWelfareType().equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
List<BigDecimal> fundPer = new ArrayList<>();
|
||||
Map<String, String> fundPerJsonMap = new HashMap<>();
|
||||
for (int i = 0; i < singleAccount.size(); i++) {
|
||||
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
||||
Optional<ICategoryPO> personalOptional = fundCategory.stream()
|
||||
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"))).findFirst();
|
||||
if (personalOptional.isPresent() && StringUtils
|
||||
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人")))) {
|
||||
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"));
|
||||
perNumString = perNumString.replace(",", "");
|
||||
BigDecimal result = new BigDecimal(perNumString);
|
||||
fundPerJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
||||
fundPer.add(result);
|
||||
}
|
||||
}
|
||||
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap));
|
||||
BigDecimal funPerSum = new BigDecimal("0");
|
||||
for (BigDecimal bigDecimal : fundPer) {
|
||||
funPerSum = funPerSum.add(bigDecimal);
|
||||
}
|
||||
insuranceAccountDetailPO.setFundPerSum(funPerSum.toPlainString());
|
||||
|
||||
//公积金-单位
|
||||
List<BigDecimal> fundComList = new ArrayList<>();
|
||||
Map<String, String> fundComJsonMap = new HashMap<>();
|
||||
for (int i = 0; i < singleAccount.size(); i++) {
|
||||
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
||||
Optional<ICategoryPO> personalOptional = fundCategory.stream()
|
||||
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"))).findFirst();
|
||||
if (personalOptional.isPresent() && StringUtils
|
||||
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位")))) {
|
||||
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"));
|
||||
perNumString = perNumString.replace(",", "");
|
||||
BigDecimal result = new BigDecimal(perNumString);
|
||||
fundComJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
||||
fundComList.add(result);
|
||||
}
|
||||
}
|
||||
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComJsonMap));
|
||||
BigDecimal fundComSum = new BigDecimal("0");
|
||||
for (BigDecimal bigDecimal : fundComList) {
|
||||
fundComSum = fundComSum.add(bigDecimal);
|
||||
}
|
||||
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
|
||||
return insuranceAccountDetailPO;
|
||||
}
|
||||
|
||||
public InsuranceAccountDetailPO accountBalanceOther(List<Map<String, Object>> singleAccount, InsuranceAccountDetailPO insuranceAccountDetailPO,
|
||||
List<ICategoryPO> insuranceCategoryPOS, Long employeeId) {
|
||||
List<ICategoryPO> otherCategory = insuranceCategoryPOS.stream().filter(po -> po.getWelfareType().equals(WelfareTypeEnum.OTHER.getValue()))
|
||||
.collect(Collectors.toList());
|
||||
// 其他福利-个人
|
||||
List<BigDecimal> otherPer = new ArrayList<>();
|
||||
Map<String, String> otherPerJsonMap = new HashMap<>();
|
||||
for (int i = 0; i < singleAccount.size(); i++) {
|
||||
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
||||
Optional<ICategoryPO> personalOptional = otherCategory.stream()
|
||||
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"))).findFirst();
|
||||
if (personalOptional.isPresent() && StringUtils
|
||||
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人")))) {
|
||||
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"));
|
||||
perNumString = perNumString.replace(",", "");
|
||||
BigDecimal result = new BigDecimal(perNumString);
|
||||
otherPerJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
||||
otherPer.add(result);
|
||||
}
|
||||
}
|
||||
insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerJsonMap));
|
||||
BigDecimal otherPerSum = new BigDecimal("0");
|
||||
for (BigDecimal bigDecimal : otherPer) {
|
||||
otherPerSum = otherPerSum.add(bigDecimal);
|
||||
}
|
||||
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
|
||||
|
||||
// 其他福利-单位
|
||||
List<BigDecimal> otherComList = new ArrayList<>();
|
||||
Map<String, String> otherComJsonMap = new HashMap<>();
|
||||
for (int i = 0; i < singleAccount.size(); i++) {
|
||||
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
||||
Optional<ICategoryPO> personalOptional = otherCategory.stream()
|
||||
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"))).findFirst();
|
||||
if (personalOptional.isPresent() && StringUtils
|
||||
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位")))) {
|
||||
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"));
|
||||
perNumString = perNumString.replace(",", "");
|
||||
BigDecimal result = new BigDecimal(perNumString);
|
||||
otherComJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
||||
otherComList.add(result);
|
||||
}
|
||||
}
|
||||
insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComJsonMap));
|
||||
BigDecimal otherComSum = new BigDecimal("0");
|
||||
for (BigDecimal bigDecimal : otherComList) {
|
||||
otherComSum = otherComSum.add(bigDecimal);
|
||||
}
|
||||
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
|
||||
return insuranceAccountDetailPO;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -605,6 +605,15 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
|
||||
List<Long> stayAddIds = new ArrayList<>();
|
||||
List<Long> stayDelIds = new ArrayList<>();
|
||||
List<TaxAgentEmployeeDTO> taxAgentManageRangeEmployees = getTaxAgentService(user).listTaxAgentAndEmployee((long) user.getUID());
|
||||
|
||||
List<InsuranceArchivesBaseInfoPO> oldStayAddList = pos.stream().filter(f -> f.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_ADD.getValue())).collect(Collectors.toList());
|
||||
|
||||
boolean isNotExist = oldStayAddList.stream().anyMatch(te -> taxAgentManageRangeEmployees.stream().noneMatch(p -> p.getEmployeeId() != null && p.getEmployeeId().equals(te.getEmployeeId()) && p.getTaxAgentId().equals(te.getPaymentOrganization())));
|
||||
|
||||
if (isNotExist) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(116196, "不在当前个税扣缴义人的人员范围中,不可取消停缴"));
|
||||
}
|
||||
|
||||
for(InsuranceArchivesBaseInfoPO po : pos) {
|
||||
if (po.getRunStatus().equals(EmployeeStatusEnum.STOP_PAYMENT_FROM_ADD.getValue())) {
|
||||
|
|
@ -668,7 +677,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
socialList = getSocialSchemeMapper().getSocialById(socialIds);
|
||||
//筛选可减员的社保档案相关信息
|
||||
|
||||
toStopSocialIds = socialList.stream().filter(f->f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0 && (f.getSocialEndTime().compareTo(todayMonth)) <= 0)
|
||||
toStopSocialIds = socialList.stream().filter(f-> f.getSocialSchemeId() == null || (f.getSocialEndTime() != null && f.getSocialEndTime().length() > 0 && (f.getSocialEndTime().compareTo(todayMonth)) <= 0))
|
||||
.map(InsuranceArchivesSocialSchemePO::getId).collect(Collectors.toList());
|
||||
//
|
||||
List<Long> finalToStopSocialIds = toStopSocialIds;
|
||||
|
|
@ -678,7 +687,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
if (fundIds.size() > 0) {
|
||||
fundList = getFundSchemeMapper().getFundById(fundIds);
|
||||
|
||||
toStopFundIds = fundList.stream().filter(f->f.getFundEndTime() != null && f.getFundEndTime().length() > 0 && (f.getFundEndTime().compareTo(todayMonth)) <= 0)
|
||||
toStopFundIds = fundList.stream().filter(f->f.getFundSchemeId() == null || (f.getFundEndTime() != null && f.getFundEndTime().length() > 0 && (f.getFundEndTime().compareTo(todayMonth)) <= 0))
|
||||
.map(InsuranceArchivesFundSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopFundIds = toStopFundIds;
|
||||
noStopBaseInfoIds = (List<Long>) CollectionUtils.union(noStopBaseInfoIds, baseInfoPOList.stream().filter(f -> !finalToStopFundIds.contains(f.getFundArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
|
@ -687,7 +696,7 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
if (otherIds.size() > 0) {
|
||||
otherList = getOtherSchemeMapper().getOtherById(otherIds);
|
||||
|
||||
toStopOtherIds= otherList.stream().filter(f->f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0 && (f.getOtherEndTime().compareTo(todayMonth)) <= 0)
|
||||
toStopOtherIds= otherList.stream().filter(f->f.getOtherSchemeId() == null || (f.getOtherEndTime() != null && f.getOtherEndTime().length() > 0 && (f.getOtherEndTime().compareTo(todayMonth)) <= 0))
|
||||
.map(InsuranceArchivesOtherSchemePO::getId).collect(Collectors.toList());
|
||||
List<Long> finalToStopOtherIds = toStopOtherIds;
|
||||
noStopBaseInfoIds = (List<Long>) CollectionUtils.union(noStopBaseInfoIds, baseInfoPOList.stream().filter(f -> !finalToStopOtherIds.contains(f.getOtherArchivesId())).map(InsuranceArchivesBaseInfoPO::getId).collect(Collectors.toList()));
|
||||
|
|
@ -944,5 +953,51 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 待减员页面的删除待办
|
||||
*/
|
||||
@Override
|
||||
public void cancelStayDel(InsuranceArchivesBaseInfoPO insuranceArchivesBaseInfoPO) {
|
||||
|
||||
if (insuranceArchivesBaseInfoPO.getIds() == null || StringUtils.isBlank(insuranceArchivesBaseInfoPO.getRunStatus())) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
|
||||
}
|
||||
|
||||
if (insuranceArchivesBaseInfoPO.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())) {
|
||||
List<List<Long>> baseInfoIdsPartition = Lists.partition((List<Long>) insuranceArchivesBaseInfoPO.getIds(), 100);
|
||||
List<InsuranceArchivesBaseInfoPO> nowList = new ArrayList<>();
|
||||
baseInfoIdsPartition.forEach(part -> {
|
||||
nowList.addAll(getInsuranceBaseInfoMapper().listByIds(part));
|
||||
});
|
||||
//置空社保、公积金、其他福利档案的最后缴纳月信息,并将福利档案基础信息表的状态置为“正在缴纳”
|
||||
if (nowList.size() > 0) {
|
||||
List<Long> socialIds = nowList.stream()
|
||||
.map(InsuranceArchivesBaseInfoPO::getSocialArchivesId).collect(Collectors.toList());
|
||||
List<Long> fundIds = nowList.stream()
|
||||
.map(InsuranceArchivesBaseInfoPO::getFundArchivesId).collect(Collectors.toList());
|
||||
List<Long> otherIds = nowList.stream()
|
||||
.map(InsuranceArchivesBaseInfoPO::getOtherArchivesId).collect(Collectors.toList());
|
||||
|
||||
List<List<Long>> socialIdsPartition = Lists.partition(socialIds, 100);
|
||||
socialIdsPartition.forEach(getSocialSchemeMapper()::batchUpdateEndTimeToNull);
|
||||
|
||||
List<List<Long>> fundIdsPartition = Lists.partition(fundIds, 100);
|
||||
fundIdsPartition.forEach(getFundSchemeMapper()::batchUpdateEndTimeToNull);
|
||||
|
||||
List<List<Long>> otherIdsPartition = Lists.partition(otherIds, 100);
|
||||
otherIdsPartition.forEach(getOtherSchemeMapper()::batchUpdateEndTimeToNull);
|
||||
|
||||
baseInfoIdsPartition.forEach(part -> {
|
||||
getInsuranceBaseInfoMapper().updateRunStatusByIds(InsuranceArchivesBaseInfoPO.builder()
|
||||
.ids(part)
|
||||
.runStatus(EmployeeStatusEnum.PAYING.getValue())
|
||||
.build());
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,49 @@
|
|||
package com.engine.salary.service.impl;
|
||||
|
||||
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
||||
import com.engine.common.util.ServiceUtil;
|
||||
import com.engine.core.impl.Service;
|
||||
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
|
||||
import com.engine.salary.exception.SalaryRunTimeException;
|
||||
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
|
||||
import com.engine.salary.service.SIAccountService;
|
||||
import com.engine.salary.service.SIBalanceService;
|
||||
import com.engine.salary.util.SalaryI18nUtil;
|
||||
import com.google.common.collect.Lists;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import weaver.hrm.User;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* @Author: sy
|
||||
* @Description: 福利台账-补差实现类
|
||||
* @Date: 2022/12/8
|
||||
**/
|
||||
public class SIBalanceServiceImpl extends Service implements SIBalanceService {
|
||||
|
||||
private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
|
||||
return SqlProxyHandle.getProxy(InsuranceAccountDetailMapper.class);
|
||||
}
|
||||
|
||||
private SIAccountService getSIAccountService(User user) {
|
||||
return ServiceUtil.getService(SIAccountServiceImpl.class, user);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void del(InspectAccountParam param, Long employeeId) {
|
||||
|
||||
//入参判断
|
||||
if (CollectionUtils.isEmpty(param.getIds()) || param.getPaymentOrganization() == null || param.getBillMonth() == null) {
|
||||
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
|
||||
}
|
||||
|
||||
//根据id删除
|
||||
List<List<Long>> partition = Lists.partition((List<Long>) param.getIds(), 100);
|
||||
partition.forEach(getInsuranceAccountDetailMapper()::batchDelAccountDetailsByIds);
|
||||
|
||||
//刷新bill_batch表中统计信息
|
||||
getSIAccountService(user).refreshBillBatch(param.getPaymentOrganization(), param.getBillMonth());
|
||||
}
|
||||
}
|
||||
|
|
@ -69,6 +69,22 @@ public class SalaryAcctProgressServiceImpl extends Service implements SalaryAcct
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateProgress(String cacheKey, BigDecimal progress, boolean checkStatus) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
if (StringUtils.isNotEmpty(resultStr)) {
|
||||
SalaryAcctProgressDTO salaryAcctProgress = JsonUtil.parseObject(resultStr, SalaryAcctProgressDTO.class);
|
||||
if (salaryAcctProgress == null || !salaryAcctProgress.isStatus()) {
|
||||
return;
|
||||
}
|
||||
salaryAcctProgress.setTitle("核算中");
|
||||
salaryAcctProgress.setCalculatedQuantity(salaryAcctProgress.getTotalQuantity());
|
||||
salaryAcctProgress.setProgress(progress);
|
||||
salaryAcctProgress.setCheckStatus(checkStatus);
|
||||
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(salaryAcctProgress));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public SalaryAcctProgressDTO getProgress(String cacheKey) {
|
||||
String resultStr = (String) Util_DataCache.getObjVal(cacheKey);
|
||||
|
|
|
|||
|
|
@ -786,4 +786,96 @@ public class SIAccountController {
|
|||
}
|
||||
|
||||
// **********************************调差 end*********************************/
|
||||
|
||||
// **********************************补差 start*********************************/
|
||||
/**
|
||||
* 福利台账-补差福利项列表
|
||||
*/
|
||||
@GET
|
||||
@Path("/getBalanceWelfareList")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String getBalanceWelfareList(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<String,List<InsuranceAcctDetailImportFieldDTO>>(user).run(getSalaryFormulaWrapper(user)::balanceWelfareList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出“福利核算-补差导入”模板
|
||||
*/
|
||||
@GET
|
||||
@Path("/welfare/balanceimporttemplate/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportBalanceImportTemplate(@Context HttpServletRequest request, @Context HttpServletResponse response) {
|
||||
try {
|
||||
InsuranceAcctDetailImportTemplateParam param = new InsuranceAcctDetailImportTemplateParam();
|
||||
|
||||
param.setPaymentOrganization(Long.valueOf(request.getParameter("paymentOrganization")));
|
||||
param.setBillMonth(request.getParameter("billMonth"));
|
||||
String welfareNames = request.getParameter("welfareNames");
|
||||
if (StringUtils.isNotBlank(welfareNames)) {
|
||||
param.setWelfareNames(Arrays.stream(welfareNames.split(",")).map(String::valueOf).collect(Collectors.toList()));
|
||||
}
|
||||
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getService(user).exportBalanceImportTemplate(param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "福利台账-补差导入模板" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
} catch (Exception e) {
|
||||
log.error("福利台账-补差导入模板导出异常", e);
|
||||
throw e;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 将通过“福利台账-补差导入”模板导入的数据更新到hrsa_bill_detail表中
|
||||
*/
|
||||
@POST
|
||||
@Path("/welfare/importBalanceInsuranceDetail")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String importBalanceInsuranceDetail(@Context HttpServletRequest request, @Context HttpServletResponse response, @RequestBody InsuranceAcctImportParam insuranceAcctImportParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<InsuranceAcctImportParam, Map<String, Object>>(user).run(getService(user)::importBalanceInsuranceDetail, insuranceAcctImportParam);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除补差
|
||||
*/
|
||||
@POST
|
||||
@Path("/delBalance")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String delBalance(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@RequestBody InspectAccountParam param) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<InspectAccountParam, String>(user).run(getSIAccountWrapper(user)::delBalance, param);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取补差列表
|
||||
*
|
||||
* @param request
|
||||
* @param response
|
||||
* @param insuranceAccountDetailParam
|
||||
* @return
|
||||
*/
|
||||
@POST
|
||||
@Path("/detail/balance/list")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String listBalancePage(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@RequestBody InsuranceAccountDetailParam insuranceAccountDetailParam) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<InsuranceAccountDetailParam, Map<String, Object>>(user).run(getService(user)::listBalancePage, insuranceAccountDetailParam);
|
||||
}
|
||||
// **********************************补差 end*********************************/
|
||||
}
|
||||
|
|
|
|||
|
|
@ -148,8 +148,18 @@ public class SIArchivesController {
|
|||
}
|
||||
|
||||
/**
|
||||
* 删除待办
|
||||
* 入参runStatus来区分待增员和待减员页面的删除待办
|
||||
* 待减员页面的删除待办
|
||||
*/
|
||||
@POST
|
||||
@Path("/cancelStayDel")
|
||||
@Produces(MediaType.APPLICATION_JSON)
|
||||
public String cancelStayDel(@Context HttpServletRequest request, @Context HttpServletResponse response,@RequestBody InsuranceArchivesBaseInfoPO po) {
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
return new ResponseResult<InsuranceArchivesBaseInfoPO, String>(user).run(getService(user)::cancelStayDel, po);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待增员页面的删除待办
|
||||
*/
|
||||
@POST
|
||||
@Path("/updateRunStatus")
|
||||
|
|
|
|||
|
|
@ -181,6 +181,33 @@ public class SIExportController {
|
|||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 福利台账-补差核算数据导出
|
||||
*/
|
||||
@GET
|
||||
@Path("/balance/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
public Response exportBalance(@Context HttpServletRequest request, @Context HttpServletResponse response,
|
||||
@QueryParam("billMonth") String billMonth, @QueryParam("paymentOrganization") String paymentOrganization) {
|
||||
InsuranceExportParam param = InsuranceExportParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization).build();
|
||||
User user = HrmUserVarify.getUser(request, response);
|
||||
XSSFWorkbook workbook = getSIExportWrapper(user).exportAccount(PaymentStatusEnum.BALANCE.getValue(),param);
|
||||
String time = LocalDate.now().toString();
|
||||
String fileName = "补差核算报表" + time;
|
||||
try {
|
||||
fileName = URLEncoder.encode(fileName + ".xlsx", "UTF-8");
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
StreamingOutput output = outputStream -> {
|
||||
workbook.write(outputStream);
|
||||
outputStream.flush();
|
||||
};
|
||||
response.setContentType("application/octet-stream");
|
||||
return Response.ok(output).header("Content-disposition", "attachment;filename=" + fileName).header("Cache-Control", "no-cache").build();
|
||||
}
|
||||
|
||||
@GET
|
||||
@Path("/overView/export")
|
||||
@Produces(MediaType.APPLICATION_OCTET_STREAM)
|
||||
|
|
|
|||
|
|
@ -7,9 +7,12 @@ import com.engine.salary.entity.hrm.dto.HrmInfoDTO;
|
|||
import com.engine.salary.entity.hrm.param.HrmQueryParam;
|
||||
import com.engine.salary.entity.siaccount.dto.InsuranceCompensationDTO;
|
||||
import com.engine.salary.entity.siaccount.param.CompensationParam;
|
||||
import com.engine.salary.entity.siaccount.param.InspectAccountParam;
|
||||
import com.engine.salary.entity.siaccount.param.RecessionParam;
|
||||
import com.engine.salary.service.SIBalanceService;
|
||||
import com.engine.salary.service.SICompensationService;
|
||||
import com.engine.salary.service.SIRecessionService;
|
||||
import com.engine.salary.service.impl.SIBalanceServiceImpl;
|
||||
import com.engine.salary.service.impl.SICompensationServiceImpl;
|
||||
import com.engine.salary.service.impl.SIRecessionServiceImpl;
|
||||
import com.engine.salary.util.page.PageInfo;
|
||||
|
|
@ -34,6 +37,10 @@ public class SIAccountWrapper extends Service {
|
|||
return (SICompensationService) ServiceUtil.getService(SICompensationServiceImpl.class, user);
|
||||
}
|
||||
|
||||
private SIBalanceService getSIBalanceService(User user) {
|
||||
return (SIBalanceService) ServiceUtil.getService(SIBalanceServiceImpl.class, user);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增退差数据
|
||||
* @param param 退差请求体
|
||||
|
|
@ -114,4 +121,13 @@ public class SIAccountWrapper extends Service {
|
|||
public Map<String, Object> compensationList(InsuranceCompensationDTO param) {
|
||||
return getSICompensationService(user).compensationList(param.getBillMonth(), param.getPaymentOrganization());
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除补差数据
|
||||
* @param param 表数据id集合、账单月、个税扣缴义务人
|
||||
*/
|
||||
public void delBalance(InspectAccountParam param) {
|
||||
long currentEmployeeId = user.getUID();
|
||||
getSIBalanceService(user).del(param, currentEmployeeId);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,6 +22,7 @@ import weaver.hrm.User;
|
|||
import weaver.servicefiles.DataSourceXML;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 薪资项目
|
||||
|
|
@ -108,4 +109,14 @@ public class SalaryFormulaWrapper extends Service {
|
|||
|
||||
return welfareList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取福利台账的补差-福利类项目
|
||||
*/
|
||||
public List<InsuranceAcctDetailImportFieldDTO> balanceWelfareList() {
|
||||
|
||||
List<InsuranceAcctDetailImportFieldDTO> welfareList = welfareList();
|
||||
welfareList = welfareList.stream().filter(f -> !f.getSalaryItemName().contains("合计")).collect(Collectors.toList());
|
||||
return welfareList;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue