diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 52b76d7dc..16828b51e 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -5,6 +5,7 @@ import com.alibaba.fastjson.TypeReference; import com.api.formmode.mybatis.util.SqlProxyHandle; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; +import com.engine.salary.cache.SalaryCacheKey; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.encrypt.AESEncryptUtil; import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt; @@ -16,10 +17,7 @@ import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO; import com.engine.salary.entity.siaccount.dto.SIAccountUtilDTO; import com.engine.salary.entity.siaccount.param.*; -import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO; -import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; -import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailTempPO; -import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; +import com.engine.salary.entity.siaccount.po.*; import com.engine.salary.entity.siarchives.po.*; import com.engine.salary.entity.sicategory.po.ICategoryPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; @@ -33,8 +31,10 @@ import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; import com.engine.salary.mapper.taxagent.TaxAgentMapper; +import com.engine.salary.service.SalaryAcctProgressService; import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.impl.SalaryAcctProgressServiceImpl; import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.sys.entity.vo.OrderRuleVO; @@ -53,6 +53,7 @@ import com.wbi.util.StringUtil; import dm.jdbc.util.IdGenerator; import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang.math.NumberUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.BeanUtils; import weaver.hrm.User; @@ -109,6 +110,14 @@ public class SIAccountBiz extends Service { return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private InsuranceCompensationMapper getInsuranceCompensationMapper() { + return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class); + } + + private SalaryAcctProgressService getSalaryAcctProgressService(User user) { + return (SalaryAcctProgressService) ServiceUtil.getService(SalaryAcctProgressServiceImpl.class, user); + } + public PageInfo listPage(InsuranceAccountBatchParam queryParam) { SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getInsuranceAccountBatchMapper().list(queryParam); @@ -221,10 +230,20 @@ public class SIAccountBiz extends Service { public void accounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { //薪资核算进度暂未实现 -// SalaryAcctProgressDTO salaryAcctProgressDTO = salaryAcctProgressService.getProgress(tenantKey + param.getBillMonth(), employeeId, tenantKey); -// if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) { -// return; -// } + SalaryAcctProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth()); + if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) { + return; + } + // 初始化进度 + SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO() + .setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")) + .setTitleLabelId(97515L) + .setTotalQuantity(NumberUtils.INTEGER_ONE) + .setCalculatedQuantity(NumberUtils.INTEGER_ZERO) + .setProgress(BigDecimal.ZERO) + .setStatus(true) + .setMessage(StringUtils.EMPTY); + getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), initProgress); doAccounting(param, employeeId, tenantKey, currentUserName); } @@ -290,11 +309,23 @@ public class SIAccountBiz extends Service { } if (CollectionUtils.isEmpty(ids)) { //salaryAcctProgressService.fail(tenantKey + param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 100468, "无需要核算的人员")); + getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 100468, "无需要核算的人员")); return; } - SalaryAcctProgressDTO salaryAcctProgressDTO = new SalaryAcctProgressDTO(SalaryI18nUtil.getI18nLabel(97515, "核算中"), 97515L, ids.size(), 0, - BigDecimal.ZERO, true, "", true); +// SalaryAcctProgressDTO salaryAcctProgressDTO = new SalaryAcctProgressDTO(SalaryI18nUtil.getI18nLabel(97515, "核算中"), 97515L, ids.size(), 0, +// BigDecimal.ZERO, true, "", true); //salaryAcctProgressService.initProgress(tenantKey + param.getBillMonth(), salaryAcctProgressDTO, employeeId, tenantKey); + + // 初始化进度 + SalaryAcctProgressDTO initProgress = new SalaryAcctProgressDTO() + .setTitle(SalaryI18nUtil.getI18nLabel(97515, "核算中")) + .setTitleLabelId(97515L) + .setTotalQuantity(ids.size()) + .setCalculatedQuantity(NumberUtils.INTEGER_ZERO) + .setProgress(BigDecimal.ZERO) + .setStatus(true) + .setMessage(StringUtils.EMPTY); + getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), initProgress); /* List> partition = Lists.partition(ids, 100); CountDownLatch countDownLatch = new CountDownLatch(partition.size()); BlockingDeque results = new LinkedBlockingDeque<>(partition.size());*/ @@ -309,7 +340,12 @@ public class SIAccountBiz extends Service { /* if (allSuccess) {*/ handleData(ids, param, employeeId, tenantKey, currentUserName); /*}*/ - MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).batchDelAccountTempDetails(ids, param.getBillMonth()); + List> partition = Lists.partition((List) ids, 100); + partition.forEach(part -> { + MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).batchDelByEmpIdsAndMonthAndPayOrg(part, param.getBillMonth(), param.getPaymentOrganization()); + }); + + getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), true); } catch (Exception e) { log.error("account run fail", e); List list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization())); @@ -323,6 +359,7 @@ public class SIAccountBiz extends Service { //薪资核算进度暂未实现 //salaryAcctProgressService.del(tenantKey + param.getBillMonth(), employeeId, tenantKey); //logger.error("welfare account error:{}", e.getMessage(), e); + getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), e.getMessage()); } } @@ -364,8 +401,15 @@ public class SIAccountBiz extends Service { count++; 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); } } + //临时表入库前先对(可能存在的)历史数据进行删除 + List> partition = Lists.partition((List) ids, 100); + partition.forEach(part -> { + MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization); + }); + //临时表数据入库 if (CollectionUtils.isNotEmpty(list)) { InsuranceAccountDetailTempPOEncrypt.encryptInsuranceAccountDetailTempPOList(list); List> lists = splitList(list, 40); @@ -411,8 +455,16 @@ public class SIAccountBiz extends Service { log.info("bill_detail入库前删除数据数量:{}", ids.size()); for (List part : partitionIds) { getInsuranceAccountDetailMapper().batchDelAccountDetails(part, billMonth, param.getPaymentOrganization(), paymentStatus); + + //删除账单月份+个税扣缴义务人+人员id下的调差数据 + getInsuranceCompensationMapper().deleteByBillMonthPayOrgEmpIds(InsuranceCompensationPO.builder() + .billMonth(billMonth) + .paymentOrganization(param.getPaymentOrganization()) + .employeeIds(part) + .build()); } + //生成bill_detail入库数据 List collect = list.stream().map(item -> { InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO(); BeanUtils.copyProperties(item, insuranceAccountDetailPO); @@ -903,6 +955,9 @@ public class SIAccountBiz extends Service { // } getInsuranceAccountBatchMapper().deleteById(insuranceAccountBatchPO.getId()); getInsuranceAccountDetailMapper().batchDeleteNotFile(param.getBillMonth(), param.getPaymentOrganization()); + + //删除账单月份+个税扣缴义务人下的调差数据 + getInsuranceCompensationMapper().deleteByBillMonthAndPayOrg(param.getBillMonth(), param.getPaymentOrganization()); // LoggerContext insuranceSchemeContext = new LoggerContext(); // insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId())); // insuranceSchemeContext.setTargetName(insuranceAccountBatchPO.getBillMonth()); diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index dc4529180..62fa5fc76 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -884,6 +884,11 @@ public class SIArchivesBiz { request.setDepartmentIds(Arrays.stream(param.getDepartmentIdsStr().split(",")).map(BigDecimal::new).collect(Collectors.toList())); } + if (StringUtils.isNotBlank(param.getSubcompanyIdsStr())) { + request.setSubcompanyIds(Arrays.stream(param.getSubcompanyIdsStr().split(",")).map(BigDecimal::new).collect(Collectors.toList())); + } + + if (StringUtils.isNotBlank(param.getPositionsStr())) { request.setPositions(Arrays.stream(param.getPositionsStr().split(",")).map(BigDecimal::new).collect(Collectors.toList())); } diff --git a/src/com/engine/salary/entity/hrm/dto/HrmInfoDTO.java b/src/com/engine/salary/entity/hrm/dto/HrmInfoDTO.java index 21ec12013..f378fe85b 100644 --- a/src/com/engine/salary/entity/hrm/dto/HrmInfoDTO.java +++ b/src/com/engine/salary/entity/hrm/dto/HrmInfoDTO.java @@ -20,4 +20,7 @@ public class HrmInfoDTO { //姓名 private String username; + + + private Long target; } diff --git a/src/com/engine/salary/entity/hrm/param/HrmQueryParam.java b/src/com/engine/salary/entity/hrm/param/HrmQueryParam.java index 03787f33e..0e6da1aa6 100644 --- a/src/com/engine/salary/entity/hrm/param/HrmQueryParam.java +++ b/src/com/engine/salary/entity/hrm/param/HrmQueryParam.java @@ -18,10 +18,13 @@ import java.util.Collection; @AllArgsConstructor public class HrmQueryParam { - String userName; + private String userName; private int pageNum; private int pageSize; private Collection ids; + + private String billMonth; + private Long paymentOrganization; } diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java new file mode 100644 index 000000000..312a52344 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java @@ -0,0 +1,97 @@ +package com.engine.salary.entity.siaccount.dto; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.List; +import java.util.Map; + +/** + * @Author: sy + * @Description: 福利台账-调差 + * @Date: 2022/11/23 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +public class InsuranceCompensationDTO { + + /** + * 主键id + */ + private Long id; + + /** + * 前端自定义id + */ + private String originId; + + /** + * 只读,true为实际调差记录,false为调差配置数据(非实际调差记录) + * + */ + private Boolean status; + + /** + * 缴纳组织 + */ + private Long paymentOrganization; + + /** + * 员工id + */ + private Long employeeId; + + /** + * 统计调差福利 + */ + private Integer welfareType; + + /** + * 统计调差福利类型 + */ + private String categoryType; + + /** + * 统计调差福利类型选项 + */ + private List> categoryTypeOptions; + + /** + * 国家核算金额 + */ + private String countryTotal; + + /** + * 公司核算金额 + */ + private String companyTotal; + + /** + * 应调差额 + */ + private String adjustmentTotal; + + /** + * 调差到 + */ + private Long adjustTo; + + /** + * 对象 + */ + private Long target; + + /** + * 对象选项 + */ + private Map targetOptions; + + /** + * 账单月份 + */ + private String billMonth; +} diff --git a/src/com/engine/salary/entity/siaccount/param/CompensationParam.java b/src/com/engine/salary/entity/siaccount/param/CompensationParam.java new file mode 100644 index 000000000..7eeb7cb8f --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/param/CompensationParam.java @@ -0,0 +1,48 @@ +package com.engine.salary.entity.siaccount.param; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * @Author: sy + * @Description: 福利台账-调差请求参数 + * @Date: 2022/11/23 + **/ +@Data +@NoArgsConstructor +@AllArgsConstructor +@Builder +public class CompensationParam { + + /** + * 缴纳组织 + */ + private Long paymentOrganization; + + /** + * 对象,指InsuranceAccountDetailPO.id + */ + private Long target; + + /** + * 指被调差的人员id + */ + private String employeeId; + + /** + * 账单月份 + */ + private String billMonth; + + /** + * 统计调差福利 + */ + private Integer welfareType; + + /** + * 统计调差福利项,即社保、公积金、其他福利类型下的具体项目 + */ + private String categoryType; +} diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java new file mode 100644 index 000000000..7bf4e8a79 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java @@ -0,0 +1,80 @@ +package com.engine.salary.entity.siaccount.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Date; + +/** + * @Author: sy + * @Description: 社保福利台账-调差配置表 + * @Date: 2022/11/28 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_compensation_config +public class InsuranceCompensationConfigPO { + /** + * 主键id + */ + private Long id; + + /** + * 缴纳组织 + */ + private Long paymentAgency; + + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 统计调差福利 + */ + private Integer welfareType; + + /** + * 统计调差福利类型 + */ + private String categoryType; + + /** + * 调差到 + */ + private Long adjustTo; + + /** + * 员工id + */ + private Long employeeId; +} diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java new file mode 100644 index 000000000..24ebde645 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java @@ -0,0 +1,106 @@ +package com.engine.salary.entity.siaccount.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.util.Collection; +import java.util.Date; + +/** + * @Author: sy + * @Description: 社保福利台账-调差历史记录表 + * @Date: 2022/11/23 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_compensation_log +public class InsuranceCompensationPO { + + /** + * 主键id + */ + private Long id; + + /** + * 缴纳组织 + */ + private Long paymentAgency; + + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private Date createTime; + + /** + * 更新时间 + */ + private Date updateTime; + + /** + * 租户key + */ + private String tenantKey; + + /** + * 员工id + */ + private Long employeeId; + + /** + * 统计调差福利 + */ + private Integer welfareType; + + /** + * 统计调差福利类型 + */ + private String categoryType; + + /** + * 国家核算金额 + */ + private String countryTotal; + + /** + * 公司核算金额 + */ + private String companyTotal; + + /** + * 应调差额 + */ + private String adjustmentTotal; + + /** + * 调差到 + */ + private Long adjustTo; + + /** + * 账单月份 + */ + private String billMonth; + + //---------条件------- + private Collection ids; + private Collection employeeIds; +} diff --git a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java index 5bac5a942..2fd3bf1cc 100644 --- a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java +++ b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesListParam.java @@ -34,6 +34,7 @@ public class InsuranceArchivesListParam extends BaseQueryParam { private List subcompanyIds; private String departmentIdsStr; + private String subcompanyIdsStr; //状态(多线)") private List statuses; diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 030d68d5f..738208c58 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -1,11 +1,9 @@ package com.engine.salary.mapper.siaccount; -import com.engine.salary.entity.salarysob.po.SalarySobEmpFieldPO; import com.engine.salary.entity.siaccount.param.InsuranceAccountDetailParam; import com.engine.salary.entity.siaccount.param.SupplementAccountBaseParam; import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; -import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO; import org.apache.ibatis.annotations.Param; import java.util.Collection; @@ -168,4 +166,9 @@ public interface InsuranceAccountDetailMapper { * 删除退差数据(账单月份+退差月份+缴纳状态+人员id+个税扣缴义务人) */ void deleteRecessionData(InsuranceAccountDetailPO po); + + /** + * 获取数据(账单月份+缴纳状态+人员id+个税扣缴义务人) + */ + InsuranceAccountDetailPO getOneByBpep(InsuranceAccountDetailPO po); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 71b1b07c0..4901c5000 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -328,6 +328,7 @@ AND t.payment_organization = #{paymentOrganization} AND t.employee_id = #{employeeId} AND t.supplementary_month = #{supplementaryMonth} + AND t.payment_status = 1 + 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 + FROM + hrsa_bill_detail t + WHERE t.delete_type = 0 + AND t.bill_month = #{billMonth} + AND t.payment_status = #{paymentStatus} + AND t.payment_organization = #{paymentOrganization} + AND t.employee_id = #{employeeId} + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java new file mode 100644 index 000000000..e9756492f --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java @@ -0,0 +1,19 @@ +package com.engine.salary.mapper.siaccount; + +import com.engine.salary.entity.siaccount.po.InsuranceCompensationConfigPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface InsuranceCompensationConfigMapper { + + void batchInsert(@Param("collection") Collection compensationConfigPOS); + + void insert(InsuranceCompensationConfigPO compensationConfigPO); + + void deleteByPayOrg(Long paymentOrganization); + + List queryByPayOrg(@Param("paymentOrganization") Long paymentOrganization); + +} diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml new file mode 100644 index 000000000..fda8f1f01 --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + + + + + + t.id + , t.payment_agency + , t.employee_id + , t.payment_organization + , t.welfare_type + , t.category_type + , t.adjust_to + , t.create_time + , t.update_time + , t.creator + , t.delete_type + , t.tenant_key + + + + INSERT INTO hrsa_compensation_config( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + adjust_to, + create_time, + update_time, + creator, + delete_type, + tenant_key + ) + VALUES + + ( + #{item.id}, + #{item.employeeId}, + #{item.paymentOrganization}, + #{item.welfareType}, + #{item.categoryType}, + #{item.adjustTo}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + ) + + + + INSERT INTO hrsa_compensation_config( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + adjust_to, + create_time, + update_time, + creator, + delete_type, + tenant_key + ) + + + select + #{item.id,jdbcType=DOUBLE}, + #{item.employeeId,jdbcType=DOUBLE}, + #{item.paymentOrganization,jdbcType=DOUBLE}, + #{item.welfareType,jdbcType=INTEGER}, + #{item.categoryType,jdbcType=VARCHAR}, + #{item.adjustTo,jdbcType=DOUBLE}, + #{item.createTime,jdbcType=DATE}, + #{item.updateTime,jdbcType=DATE}, + #{item.creator,jdbcType=DOUBLE}, + #{item.deleteType,jdbcType=INTEGER}, + #{item.tenantKey,jdbcType=VARCHAR} + + from dual + + + + + INSERT INTO hrsa_compensation_config( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + adjust_to, + create_time, + update_time, + creator, + delete_type, + tenant_key + ) + VALUES + ( + #{item.id}, + #{item.employeeId}, + #{item.paymentOrganization}, + #{item.welfareType}, + #{item.categoryType}, + #{item.adjustTo}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + ) + + + + + insert into hrsa_compensation_config ( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + adjust_to, + create_time, + update_time, + creator, + delete_type, + tenant_key) + VALUES ( + #{id}, + #{employeeId}, + #{paymentOrganization}, + #{welfareType}, + #{categoryType}, + #{adjustTo}, + #{createTime}, + #{updateTime}, + #{creator}, + #{deleteType}, + #{tenantKey}) + + + + UPDATE hrsa_compensation_config + SET delete_type = 1 + WHERE payment_organization = #{paymentOrganization} + AND delete_type = 0 + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java new file mode 100644 index 000000000..e96a6b8bb --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -0,0 +1,28 @@ +package com.engine.salary.mapper.siaccount; + +import com.engine.salary.entity.siaccount.po.InsuranceCompensationPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; +import java.util.List; + +public interface InsuranceCompensationMapper { + + void batchInsert(@Param("collection") Collection insuranceCompensationPOS); + + void insert(InsuranceCompensationPO insuranceCompensationPO); + + InsuranceCompensationPO getById(Long id); + + List queryByBillMonthAndPayOrg(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); + + InsuranceCompensationPO getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO); + + List getByBillMonthPayOrgEmpIds(InsuranceCompensationPO insuranceCompensationPO); + + void deleteById(Long id); + + void deleteByBillMonthAndPayOrg(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); + + void deleteByBillMonthPayOrgEmpIds(InsuranceCompensationPO insuranceCompensationPO); +} diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml new file mode 100644 index 000000000..7e3d4e321 --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -0,0 +1,269 @@ + + + + + + + + + + + + + + + + + + + + + + + + + t.id + , t.payment_agency + , t.employee_id + , t.payment_organization + , t.welfare_type + , t.category_type + , t.country_total + , t.company_total + , t.adjustment_total + , t.adjust_to + , t.bill_month + , t.create_time + , t.update_time + , t.creator + , t.delete_type + , t.tenant_key + + + + INSERT INTO hrsa_compensation_log( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + country_total, + company_total, + adjustment_total, + adjust_to, + bill_month, + create_time, + update_time, + creator, + delete_type, + tenant_key + ) + VALUES + + ( + #{item.id}, + #{item.employeeId}, + #{item.paymentOrganization}, + #{item.welfareType}, + #{item.categoryType}, + #{item.countryTotal}, + #{item.companyTotal}, + #{item.adjustmentTotal}, + #{item.adjustTo}, + #{item.billMonth}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + ) + + + + INSERT INTO hrsa_compensation_log( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + country_total, + company_total, + adjustment_total, + adjust_to, + bill_month, + create_time, + update_time, + creator, + delete_type, + tenant_key + ) + + + select + #{item.id,jdbcType=DOUBLE}, + #{item.employeeId,jdbcType=DOUBLE}, + #{item.paymentOrganization,jdbcType=DOUBLE}, + #{item.welfareType,jdbcType=INTEGER}, + #{item.categoryType,jdbcType=VARCHAR}, + #{item.countryTotal,jdbcType=VARCHAR}, + #{item.companyTotal,jdbcType=VARCHAR}, + #{item.adjustmentTotal,jdbcType=VARCHAR}, + #{item.adjustTo,jdbcType=DOUBLE}, + #{item.billMonth,jdbcType=VARCHAR}, + #{item.createTime,jdbcType=DATE}, + #{item.updateTime,jdbcType=DATE}, + #{item.creator,jdbcType=DOUBLE}, + #{item.deleteType,jdbcType=INTEGER}, + #{item.tenantKey,jdbcType=VARCHAR} + from dual + + + + + INSERT INTO hrsa_compensation_log( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + country_total, + company_total, + adjustment_total, + adjust_to, + bill_month, + create_time, + update_time, + creator, + delete_type, + tenant_key + ) + VALUES + ( + #{item.id}, + #{item.employeeId}, + #{item.paymentOrganization}, + #{item.welfareType}, + #{item.categoryType}, + #{item.countryTotal}, + #{item.companyTotal}, + #{item.adjustmentTotal}, + #{item.adjustTo}, + #{item.billMonth}, + #{item.createTime}, + #{item.updateTime}, + #{item.creator}, + #{item.deleteType}, + #{item.tenantKey} + ) + + + + + insert into hrsa_compensation_log ( + id, + employee_id, + payment_organization, + welfare_type, + category_type, + country_total, + company_total, + adjustment_total, + adjust_to, + bill_month, + create_time, + update_time, + creator, + delete_type, + tenant_key) + VALUES ( + #{id}, + #{employeeId}, + #{paymentOrganization}, + #{welfareType}, + #{categoryType}, + #{countryTotal}, + #{companyTotal}, + #{adjustmentTotal}, + #{adjustTo}, + #{billMonth}, + #{createTime}, + #{updateTime}, + #{creator}, + #{deleteType}, + #{tenantKey}) + + + + + + + + + + + + + + + UPDATE hrsa_compensation_log + SET delete_type = 1 + WHERE id = #{id} + AND delete_type = 0 + + + + UPDATE hrsa_compensation_log + SET delete_type = 1 + WHERE bill_month = #{billMonth} + AND payment_organization = #{paymentOrganization} + AND delete_type = 0 + + + + UPDATE hrsa_compensation_log + SET delete_type = 1 + WHERE bill_month = #{billMonth} + AND payment_organization = #{paymentOrganization} + AND delete_type = 0 + + AND employee_id IN + + #{employeeId} + + + + + \ No newline at end of file diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java index 539655d4c..75fbefcaa 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java +++ b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java @@ -21,6 +21,13 @@ public interface SIAccountDetailTempMapper { */ void batchDelAccountTempDetails(@Param("employeeIds") Collection employeeIds, @Param("billMonth") String billMonth); + /** + * 批量删除 + * @param employeeIds + * @param billMonth + */ + void batchDelByEmpIdsAndMonthAndPayOrg(@Param("employeeIds") Collection employeeIds, @Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); + /** * 批量保存 * @param accounts diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml index 4ff9acfea..f99461416 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml @@ -111,6 +111,19 @@ + + + UPDATE hrsa_bill_detail_temp + SET delete_type = 1 + WHERE delete_type = 0 + AND bill_month = #{billMonth} + AND payment_organization = #{paymentOrganization} + AND employee_id IN + + #{employeeId} + + + INSERT INTO hrsa_bill_detail_temp diff --git a/src/com/engine/salary/service/ColumnBuildService.java b/src/com/engine/salary/service/ColumnBuildService.java index 9ec02d2e6..c1aec0b1b 100644 --- a/src/com/engine/salary/service/ColumnBuildService.java +++ b/src/com/engine/salary/service/ColumnBuildService.java @@ -3,6 +3,7 @@ package com.engine.salary.service; import com.cloudstore.eccom.pc.table.WeaTableColumn; import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; +import com.engine.salary.entity.siaccount.po.InsuranceCompensationPO; import java.util.List; @@ -26,5 +27,10 @@ public interface ColumnBuildService { List buildCommonColumns(List pos); List buildInspectColumns(List pos, Long paymentOrganization); + + /** + * 调差详情表头元素 + */ + List buildCompensationColumns(); } diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java new file mode 100644 index 000000000..b79c29fc4 --- /dev/null +++ b/src/com/engine/salary/service/SICompensationService.java @@ -0,0 +1,36 @@ +package com.engine.salary.service; + +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.util.page.PageInfo; + +import java.util.List; +import java.util.Map; + +public interface SICompensationService { + + List getEmployeeListToCompensation(HrmQueryParam param); + + List> compensationCategoryType(Long id); + + List> compensationComTotal(List paramList); + + Map compensationAccount(List list); + + /** + * 保存社保调差默认配置 + */ + String compensationConfigSave(List param); + + /** + * 社保调差撤回 + */ + String compensationRevert(InsuranceCompensationDTO param); + + /** + * 社保调差历史记录列表 + */ + Map compensationList(String billMonth, Long paymentOrganization); +} diff --git a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java index 93eedcbd7..64a053093 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -388,4 +388,24 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic result.put(WelfareTypeEnum.OTHER.getValue(), otherColumns); return result; } + + @Override + public List buildCompensationColumns() { + List list = new ArrayList<>(); + + WeaTableColumn weaTableNameColumn = new WeaTableColumn("300px",SalaryI18nUtil.getI18nLabel( 87000, "调差对象"), "target"); + weaTableNameColumn.setFixed("left"); + list.add(weaTableNameColumn); + + list.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel( 87001, "统计调差福利"), "welfareType")); + list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87001, "统计调差福利类型(单位)"), "categoryType")); + list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87002, "国家核算金额(单位)"), "countryTotal")); + list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87003, "公司核算金额(单位)"), "companyTotal")); + list.add(new WeaTableColumn("100px",SalaryI18nUtil.getI18nLabel( 87004, "应调差金额"), "adjustmentTotal")); + list.add(new WeaTableColumn("200px",SalaryI18nUtil.getI18nLabel( 87005, "调差到(单位)"), "adjustTo")); + + + return list; + } + } diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java new file mode 100644 index 000000000..18171a378 --- /dev/null +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -0,0 +1,562 @@ +package com.engine.salary.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alipay.oceanbase.jdbc.StringUtils; +import com.cloudstore.eccom.pc.table.WeaTable; +import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.constant.SalaryDefaultTenantConstant; +import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt; +import com.engine.salary.entity.datacollection.DataCollectionEmployee; +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.po.InsuranceAccountDetailPO; +import com.engine.salary.entity.siaccount.po.InsuranceCompensationConfigPO; +import com.engine.salary.entity.siaccount.po.InsuranceCompensationPO; +import com.engine.salary.entity.sicategory.po.ICategoryPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; +import com.engine.salary.enums.siaccount.PaymentStatusEnum; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; +import com.engine.salary.exception.SalaryRunTimeException; +import com.engine.salary.mapper.datacollection.EmployMapper; +import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; +import com.engine.salary.mapper.siaccount.InsuranceCompensationConfigMapper; +import com.engine.salary.mapper.siaccount.InsuranceCompensationMapper; +import com.engine.salary.mapper.sicategory.ICategoryMapper; +import com.engine.salary.service.ColumnBuildService; +import com.engine.salary.service.SIAccountService; +import com.engine.salary.service.SICategoryService; +import com.engine.salary.service.SICompensationService; +import com.engine.salary.util.SalaryAssert; +import com.engine.salary.util.SalaryEntityUtil; +import com.engine.salary.util.SalaryI18nUtil; +import com.engine.salary.util.db.MapperProxyFactory; +import com.engine.salary.util.page.Column; +import com.engine.salary.util.page.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; +import com.google.common.collect.Lists; +import dm.jdbc.util.IdGenerator; +import org.springframework.beans.BeanUtils; +import weaver.hrm.User; + +import java.math.BigDecimal; +import java.util.*; +import java.util.function.Function; +import java.util.stream.Collectors; + +/** + * @Author: sy + * @Description: 福利台账-调差实现类 + * @Date: 2022/11/23 + **/ +public class SICompensationServiceImpl extends Service implements SICompensationService { + + private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() { + return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class); + } + + private EmployMapper getEmployMapper() { + return MapperProxyFactory.getProxy(EmployMapper.class); + } + + public SICategoryService getSICategoryService(User user) { + return ServiceUtil.getService(SICategoryServiceImpl.class, user); + } + + private SIAccountService getSIAccountService(User user) { + return ServiceUtil.getService(SIAccountServiceImpl.class, user); + } + + private InsuranceCompensationMapper getInsuranceCompensationMapper() { + return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class); + } + + private InsuranceCompensationConfigMapper getInsuranceCompensationConfigMapper() { + return MapperProxyFactory.getProxy(InsuranceCompensationConfigMapper.class); + } + + public ColumnBuildService getColumnBuildService(User user) { + return ServiceUtil.getService(ColumnBuildServiceImpl.class, user); + } + + /** + * 可调差人员 + */ + @Override + public List getEmployeeListToCompensation(HrmQueryParam param) { + // 当前登录人员 + Long currentEmployeeId = (long) user.getUID(); + + //查询账单月份+个税扣缴义务人下的社保福利正常缴纳人员列表 + List normalDataList = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(param.getBillMonth(), param.getPaymentOrganization()); + List empIds = normalDataList.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList()); + //生成人员id和bill_detail.id的对应map + Map empIdToTargetMap = SalaryEntityUtil.convert2Map(normalDataList, InsuranceAccountDetailPO::getEmployeeId, InsuranceAccountDetailPO::getId); + + List resultData = new ArrayList<>(); + if (empIds.size() > 0) { + List> partition = Lists.partition(empIds, 1000); + partition.forEach(p -> { + param.setIds(p); + resultData.addAll(getEmployMapper().listHrmInfoByIdAndName(param)); + }); + + } + List finalResultData = new ArrayList<>(); + for (HrmInfoDTO dto : resultData) { + dto.setTarget(empIdToTargetMap.get(dto.getEmployeeId())); + finalResultData.add(dto); + } + + return finalResultData; + } +// public PageInfo getEmployeeListToCompensation(HrmQueryParam param) { +// // 当前登录人员 +// Long currentEmployeeId = (long) user.getUID(); +// +// //查询账单月份+个税扣缴义务人下的社保福利正常缴纳人员列表 +// List normalDataList = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(param.getBillMonth(), param.getPaymentOrganization()); +// List empIds = normalDataList.stream().map(InsuranceAccountDetailPO::getEmployeeId).collect(Collectors.toList()); +// +// List resultData = new ArrayList<>(); +// if (empIds.size() > 0) { +// List> partition = Lists.partition(empIds, 1000); +// partition.forEach(p -> { +// param.setIds(p); +// resultData.addAll(getEmployMapper().listHrmInfoByIdAndName(param)); +// }); +// +// } +// +// // 分页 +// PageInfo page = new PageInfo<>(); +// if (resultData.size() == 0) { +// return page; +// } +// page.setTotal(resultData.size()); +// +// page.setList(SalaryPageUtil.subList(param.getPageNum(), param.getPageSize(), resultData)); +// page.setPageSize(param.getPageSize()); +// page.setPageNum(param.getPageNum()); +// +// +// return page; +// } + + /** + * 调差福利项 + * @param id InsuranceAccountDetailPO.id + */ + @Override + public List> compensationCategoryType(Long id) { + SalaryAssert.notNull(id, SalaryI18nUtil.getI18nLabel(120999, "调差对象必选")); + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(id); + if (insuranceAccountDetailPO == null) { + return Lists.newArrayList(); + } + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + List> result = new ArrayList<>(); + String socialComJson = insuranceAccountDetailPO.getSocialComJson(); + if (StringUtils.isNotBlank(socialComJson)) { + Map categoryIdNameMap = getSICategoryService(user).categoryIdNameMap(); + Map socialJson = JSON.parseObject(socialComJson, new HashMap().getClass()); + for (Map.Entry entry : socialJson.entrySet()) { + Map temp = new HashMap<>(); + String insuranceId = entry.getKey(); + if (StringUtils.isNotBlank(categoryIdNameMap.get(insuranceId))) { + temp.put("id", insuranceId); + temp.put("content", categoryIdNameMap.get(insuranceId)); + result.add(temp); + } + } + } + return result; + } + + /** + * 获取当前调差福利类型-公司方支出总计 + */ + @Override + public List> compensationComTotal(List paramList) { + List> resultList = new ArrayList<>(); + paramList.forEach(compensation -> { + Map temp = new HashMap<>(); + temp.put("employeeId", compensation.getEmployeeId()); + if (StringUtils.isBlank(compensation.getCategoryType()) || compensation.getTarget() == null) { + temp.put("error", SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + temp.put("totalNum", "0"); + } else { + + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(compensation.getTarget()); + if (insuranceAccountDetailPO == null) { + temp.put("error", SalaryI18nUtil.getI18nLabel(121038, "当前月在该缴纳组织下没有核算记录")); + temp.put("totalNum", "0"); + } else { + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + //判断是否已有调差数据(个税扣缴义务人+账单月份+人员id) + InsuranceCompensationPO nowCompensation = getInsuranceCompensationMapper().getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO.builder() + .billMonth(insuranceAccountDetailPO.getBillMonth()) + .paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()) + .employeeId(insuranceAccountDetailPO.getEmployeeId()) + .build()); + if (nowCompensation != null) { + temp.put("error", SalaryI18nUtil.getI18nLabel(121039, "当前月在该缴纳组织下已存在调差数据")); + } + + //处理调差数据 + BigDecimal total = new BigDecimal("0"); + List categoryTypeList = Arrays.asList(compensation.getCategoryType().split(",")); + + if (nowCompensation == null && StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { + Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); + for (Map.Entry entry : socialJson.entrySet()) { + String insuranceId = entry.getKey(); + String num = entry.getValue(); + if (categoryTypeList.contains(insuranceId)) { + total = total.add(new BigDecimal(num)); + } + } + } + + temp.put("totalNum", total.toPlainString()); + } + + } + resultList.add(temp); + }); +// paramList.forEach((paymentOrganization, compensationList) -> { +// List> paymentList = new ArrayList<>(); +// compensationList.forEach(compensation -> { +// Map temp = new HashMap<>(); +// temp.put("employeeId", compensation.getEmployeeId()); +// if (StringUtils.isBlank(compensation.getCategoryType()) || compensation.getTarget() == null) { +// temp.put("error", SalaryI18nUtil.getI18nLabel(84026, "参数错误")); +// temp.put("totalNum", "0"); +// } else { +// +// InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(compensation.getTarget()); +// if (insuranceAccountDetailPO == null) { +// temp.put("error", SalaryI18nUtil.getI18nLabel(121038, "当前月在该缴纳组织下没有核算记录")); +// } +// InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); +// BigDecimal total = new BigDecimal("0"); +// List categoryTypeList = Arrays.asList(compensation.getCategoryType().split(",")); +// +// if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { +// Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); +// for (Map.Entry entry : socialJson.entrySet()) { +// String insuranceId = entry.getKey(); +// String num = entry.getValue(); +// if (categoryTypeList.contains(insuranceId)) { +// total = total.add(new BigDecimal(num)); +// } +// } +// } +// +// temp.put("totalNum", total.toPlainString()); +// } +// paymentList.add(temp); +// }); +// result.put(paymentOrganization, paymentList); +// }); + return resultList; + } + + @Override + public Map compensationAccount(List list) { + + long currentEmployeeId = user.getUID(); + List allEmployees = getEmployMapper().listAll(); + Map usernameMap = SalaryEntityUtil.convert2Map(allEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); + + Map result = new HashMap<>(); + List errorList = new ArrayList<>(); + List idList = new ArrayList<>(); + //过滤 + list = list.stream().collect(Collectors.collectingAndThen( + Collectors.toCollection(() -> + new TreeSet<>(Comparator.comparing(InsuranceCompensationDTO::getTarget))), ArrayList::new)); + + for (InsuranceCompensationDTO param : list) { + if (StringUtils.isBlank(param.getAdjustmentTotal()) || "0".equals(param.getAdjustmentTotal()) || "0.00".equals(param.getAdjustmentTotal())) { + errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差数额不正确!"); + continue; + } + if (StringUtils.isBlank(param.getCompanyTotal()) || "0".equals(param.getCompanyTotal()) || "0.00".equals(param.getCompanyTotal())) { + errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:公司核算金额为0,请检查数据是否属实或者当前人员已存在该月调差数据!"); + continue; + } + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(param.getTarget()); + if (insuranceAccountDetailPO == null) { + errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差对象不存在!"); + continue; + } + + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { + Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); + for (Map.Entry entry : socialJson.entrySet()) { + String insuranceId = entry.getKey(); + String num = entry.getValue(); + if (Objects.equals(String.valueOf(param.getAdjustTo()), insuranceId)) { + BigDecimal adjustmentTo = new BigDecimal(param.getAdjustmentTotal()); + // 调差单位缴纳明细 + BigDecimal insuranceNum = new BigDecimal(num); + insuranceNum = insuranceNum.add(adjustmentTo); + socialJson.replace(insuranceId, insuranceNum.toPlainString()); + insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialJson)); + // 调差单位合计 + BigDecimal comSum = new BigDecimal(insuranceAccountDetailPO.getComSum()); + comSum = comSum.add(adjustmentTo); + insuranceAccountDetailPO.setComSum(comSum.toPlainString()); + // 调差社保单位合计 + BigDecimal socialComSum = new BigDecimal(insuranceAccountDetailPO.getSocialComSum()); + socialComSum = socialComSum.add(adjustmentTo); + insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString()); + // 调差社保合计 + BigDecimal socialSum = new BigDecimal(insuranceAccountDetailPO.getSocialSum()); + socialSum = socialSum.add(adjustmentTo); + insuranceAccountDetailPO.setSocialSum(socialSum.toPlainString()); + // 调差合计 + BigDecimal totalSum = new BigDecimal(insuranceAccountDetailPO.getTotal()); + totalSum = totalSum.add(adjustmentTo); + insuranceAccountDetailPO.setTotal(totalSum.toPlainString()); + //更新社保调差后的明细 + InsuranceAccountDetailPOEncrypt.encryptItem(insuranceAccountDetailPO); + getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); + //新建调差记录 + InsuranceCompensationPO insuranceCompensationPO = new InsuranceCompensationPO(); + insuranceCompensationPO.setId(IdGenerator.generate()); + insuranceCompensationPO.setAdjustmentTotal(param.getAdjustmentTotal()); + insuranceCompensationPO.setAdjustTo(param.getAdjustTo()); + insuranceCompensationPO.setBillMonth(param.getBillMonth()); + insuranceCompensationPO.setCompanyTotal(param.getCompanyTotal()); + insuranceCompensationPO.setCreator(currentEmployeeId); + insuranceCompensationPO.setCategoryType(param.getCategoryType()); + insuranceCompensationPO.setCreateTime(new Date()); + insuranceCompensationPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + insuranceCompensationPO.setCountryTotal(param.getCountryTotal()); + insuranceCompensationPO.setEmployeeId(insuranceAccountDetailPO.getEmployeeId()); + + insuranceCompensationPO.setPaymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()); + insuranceCompensationPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + insuranceCompensationPO.setWelfareType(param.getWelfareType()); + insuranceCompensationPO.setUpdateTime(new Date()); + getInsuranceCompensationMapper().insert(insuranceCompensationPO); + + idList.add(insuranceCompensationPO.getId()); +// result.put(param.getOriginId(), insuranceCompensationPO.getId().toString()); + + } + } + } + } + //刷新bill_detail统计数据 + getSIAccountService(user).refreshBillBatch(list.get(0).getPaymentOrganization(), list.get(0).getBillMonth()); + if (errorList.size() == 0) { + result.put("data", "全部调差成功!"); + } else { + result.put("data", "存在调差失败项!"); + } + result.put("errorMessage", errorList); + result.put("successIds", idList); + return result; + } + + @Override + public String compensationConfigSave(List param) { + long currentEmployeeId = user.getUID(); + + SalaryAssert.notEmpty(param, SalaryI18nUtil.getI18nLabel(143746, "默认调差配置数据为空")); + // 清除历史默认配置 + getInsuranceCompensationConfigMapper().deleteByPayOrg(param.get(0).getPaymentOrganization()); + // 保存历史默认配置 + List configList = param.stream().map(config -> { + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(config.getTarget()); + SalaryAssert.notNull(insuranceAccountDetailPO, SalaryI18nUtil.getI18nLabel(138849, "调差对象不存在")); + return InsuranceCompensationConfigPO.builder() + .id(IdGenerator.generate()) + .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) + .employeeId(insuranceAccountDetailPO.getEmployeeId()) + .adjustTo(config.getAdjustTo()) + .createTime(new Date()) + .updateTime(new Date()) + .categoryType(config.getCategoryType()) + .paymentOrganization(config.getPaymentOrganization()) + .welfareType(config.getWelfareType()) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .creator(currentEmployeeId).build(); + }).collect(Collectors.toList()); + configList.forEach(config -> getInsuranceCompensationConfigMapper().insert(config)); + + return "配置成功"; + } + + /** + * 社保调差撤回 + */ + @Override + public String compensationRevert(InsuranceCompensationDTO param) { + InsuranceCompensationPO insuranceCompensationPO = getInsuranceCompensationMapper().getById(param.getId()); + SalaryAssert.notNull(insuranceCompensationPO, SalaryI18nUtil.getI18nLabel(121112, "当前补差记录不存在")); + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder() + .billMonth(insuranceCompensationPO.getBillMonth()) + .paymentStatus(PaymentStatusEnum.COMMON.getValue()) + .employeeId(insuranceCompensationPO.getEmployeeId()) + .paymentOrganization(insuranceCompensationPO.getPaymentOrganization()) + .build()); + + SalaryAssert.notNull(insuranceAccountDetailPO, SalaryI18nUtil.getI18nLabel(121108, "补差对象不存在")); + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + if (StringUtils.isNotBlank(insuranceAccountDetailPO.getSocialComJson())) { + Map socialJson = JSON.parseObject(insuranceAccountDetailPO.getSocialComJson(), new HashMap().getClass()); + for (Map.Entry entry : socialJson.entrySet()) { + String insuranceId = entry.getKey(); + String num = entry.getValue(); + if (Objects.equals(String.valueOf(insuranceCompensationPO.getAdjustTo()), insuranceId)) { + BigDecimal adjustmentTo = new BigDecimal(insuranceCompensationPO.getAdjustmentTotal()); + //回退调差单位缴纳明细 + BigDecimal insuranceNum = new BigDecimal(num); + insuranceNum = insuranceNum.subtract(adjustmentTo); + socialJson.replace(insuranceId, insuranceNum.toPlainString()); + insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialJson)); + //回退调差单位合计 + BigDecimal comSum = new BigDecimal(insuranceAccountDetailPO.getComSum()); + comSum = comSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setComSum(comSum.toPlainString()); + //回退调差社保单位合计 + BigDecimal socialComSum = new BigDecimal(insuranceAccountDetailPO.getSocialComSum()); + socialComSum = socialComSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString()); + //回退调差社保合计 + BigDecimal socialSum = new BigDecimal(insuranceAccountDetailPO.getSocialSum()); + socialSum = socialSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setSocialSum(socialSum.toPlainString()); + //回退调差合计 + BigDecimal totalSum = new BigDecimal(insuranceAccountDetailPO.getTotal()); + totalSum = totalSum.subtract(adjustmentTo); + insuranceAccountDetailPO.setTotal(totalSum.toPlainString()); + //更新社保调差后的明细 + InsuranceAccountDetailPOEncrypt.encryptItem(insuranceAccountDetailPO); + getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); + //删除调差记录 + getInsuranceCompensationMapper().deleteById(param.getId()); + + } + } + //刷新bill_detail统计数据 + getSIAccountService(user).refreshBillBatch(param.getPaymentOrganization(), param.getBillMonth()); + + } + return "撤回成功"; + } + + @Override + public Map compensationList(String billMonth, Long paymentOrganization) { + + Map datas = new HashMap<>(); + + //入参判断 + if (paymentOrganization == null || StringUtils.isBlank(billMonth)) { + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + } + + //设置调差详情列表头 + List weaTableColumn = getColumnBuildService(user).buildCompensationColumns(); + WeaTable table = new WeaTable(); + table.setPageUID(UUID.randomUUID().toString()); + table.setColumns(weaTableColumn); + List columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList()); + + //处理调差数据 + List compensationDTOList = dealCompensationData(billMonth, paymentOrganization); + + datas.put("columns", columns); + datas.put("data", compensationDTOList); + + return datas; + } + + private List dealCompensationData(String billMonth, Long paymentOrganization) { + + //获取调差历史记录数据 + List compensationPOList = getInsuranceCompensationMapper().queryByBillMonthAndPayOrg(billMonth, paymentOrganization); + //获取调差配置数据 + List compensationConfigPOList = getInsuranceCompensationConfigMapper().queryByPayOrg(paymentOrganization); + + List compensationDTOList = new ArrayList<>(); + + List detailPOList = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(billMonth, paymentOrganization); + Map detailPOMap = detailPOList.stream().collect(Collectors.toMap(InsuranceAccountDetailPO::getEmployeeId, Function.identity())); + + List allEmployees = getEmployMapper().listAll(); + Map usernameMap = SalaryEntityUtil.convert2Map(allEmployees, DataCollectionEmployee::getEmployeeId, DataCollectionEmployee::getUsername); + + List allCategoryList = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll(); + Map categoryNameMap = SalaryEntityUtil.convert2Map(allCategoryList, ICategoryPO::getId, ICategoryPO::getInsuranceName); + + boolean haveCompensation = compensationPOList != null && compensationPOList.size() > 0; + //存在调差历史记录时,输出记录数据 + if (haveCompensation) { + for (InsuranceCompensationPO po : compensationPOList) { + InsuranceCompensationDTO dto = new InsuranceCompensationDTO(); + BeanUtils.copyProperties(po, dto); + dto.setStatus(true); + //设置targetOptions + Map targetOptions = new HashMap<>(); + targetOptions.put("name", usernameMap.get(po.getEmployeeId())); + targetOptions.put("id", detailPOMap.get(po.getEmployeeId()).getId().toString()); + + dto.setTargetOptions(targetOptions); + + //设置categoryTypeOptions + List> categoryTypeOptions = new ArrayList<>(); + List categoryTypeList = Arrays.asList(po.getCategoryType().split(",")); + + for (String categoryType : categoryTypeList) { + Map categoryTypeMap = new HashMap<>(); + categoryTypeMap.put("id", categoryType); + categoryTypeMap.put("content", categoryNameMap.get(Long.valueOf(categoryType))); + categoryTypeOptions.add(categoryTypeMap); + } + dto.setCategoryTypeOptions(categoryTypeOptions); + + compensationDTOList.add(dto); + } + } + //不存在调差历史记录时,输出调差配置数据 + if (!haveCompensation && compensationConfigPOList.size() > 0) { + for (InsuranceCompensationConfigPO configPO : compensationConfigPOList) { + InsuranceCompensationDTO dto = new InsuranceCompensationDTO(); + BeanUtils.copyProperties(configPO, dto); + dto.setStatus(false); + //设置targetOptions + Map targetOptions = new HashMap<>(); + targetOptions.put("name", usernameMap.get(configPO.getEmployeeId())); + targetOptions.put("id", detailPOMap.get(configPO.getEmployeeId()).getId().toString()); + + dto.setTargetOptions(targetOptions); + + //设置categoryTypeOptions + List> categoryTypeOptions = new ArrayList<>(); + List categoryTypeList = Arrays.asList(configPO.getCategoryType().split(",")); + + for (String categoryType : categoryTypeList) { + Map categoryTypeMap = new HashMap<>(); + categoryTypeMap.put("id", categoryType); + categoryTypeMap.put("content", categoryNameMap.get(Long.valueOf(categoryType))); + categoryTypeOptions.add(categoryTypeMap); + } + dto.setCategoryTypeOptions(categoryTypeOptions); + + compensationDTOList.add(dto); + } + } + + return compensationDTOList; + } + +} diff --git a/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java b/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java index 9b1b45956..fae20634b 100644 --- a/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java @@ -357,7 +357,7 @@ public class SIRecessionServiceImpl extends Service implements SIRecessionServic // 分页 PageInfo page = new PageInfo<>(); - if (null == resultData) { + if (resultData.size() == 0) { return page; } page.setTotal(resultData.size()); diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index c6939c4e7..24a79c9c1 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -1228,6 +1228,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { // List socialEmployeeIds = socialSchemePOS.stream().map(InsuranceArchivesSocialSchemePO::getEmployeeId).collect(Collectors.toList()); // List> socialEmployeeIdPartition = Lists.partition(socialEmployeeIds, 100); // socialEmployeeIdPartition.forEach(getSocialSchemeMapper()::batchDeleteByEmployeeIds); + //去除员工id+个税扣缴义务人下重复的数据 + socialSchemePOS = socialSchemePOS.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); + List insuranceArchivesSocialSchemePOS = InsuranceArchivesSocialSchemePOEncrypt.encryptList(socialSchemePOS); List> partition = Lists.partition(insuranceArchivesSocialSchemePOS, 100); partition.forEach(getSocialSchemeMapper()::batchSave); @@ -1241,6 +1245,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { // List fundEmployeeIds = fundSchemePOS.stream().map(InsuranceArchivesFundSchemePO::getEmployeeId).collect(Collectors.toList()); // List> fundEmployeeIdsPartition = Lists.partition(fundEmployeeIds, 100); // fundEmployeeIdsPartition.forEach(getFundSchemeMapper()::batchDeleteByEmployeeIds); + //去除员工id+个税扣缴义务人下重复的数据 + fundSchemePOS = fundSchemePOS.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); + List insuranceArchivesFundSchemePOS = InsuranceArchivesFundSchemePOEncrypt.encryptList(fundSchemePOS); List> partition = Lists.partition(insuranceArchivesFundSchemePOS, 100); partition.forEach(getFundSchemeMapper()::batchSave); @@ -1254,6 +1262,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { // List otherEmployeeIds = otherSchemePOS.stream().map(InsuranceArchivesOtherSchemePO::getEmployeeId).collect(Collectors.toList()); // List> otherEmployeeIdsPartition = Lists.partition(otherEmployeeIds, 100); // otherEmployeeIdsPartition.forEach(getOtherSchemeMapper()::batchDeleteByEmployeeIds); + //去除员工id+个税扣缴义务人下重复的数据 + otherSchemePOS = otherSchemePOS.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); + List insuranceArchivesOtherSchemePOS = InsuranceArchivesOtherSchemePOEncrypt.encryptList(otherSchemePOS); List> partition = Lists.partition(insuranceArchivesOtherSchemePOS, 100); partition.forEach(getOtherSchemeMapper()::batchSave); @@ -1262,6 +1274,9 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { List baseInfoPOS = insuranceArchivesAccountPOS.stream().filter(Objects::nonNull).map(InsuranceArchivesAccountPO::getBaseInfo).collect(Collectors.toList()); if (CollectionUtils.isNotEmpty(baseInfoPOS)) { // baseInfoPOS = baseInfoPOS.stream().collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(InsuranceArchivesBaseInfoPO::getEmployeeId))), ArrayList::new)); + //去除员工id+个税扣缴义务人下重复的数据 + baseInfoPOS = baseInfoPOS.stream() + .collect(Collectors.collectingAndThen(Collectors.toCollection(() -> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new)); //根据人员id和个税扣缴义务人id删除对应档案 baseInfoPOS.forEach(getInsuranceBaseInfoMapper()::deleteByEmployeeIdAndPayOrg); //分批批量删除 diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 053219066..790c125f0 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -7,6 +7,7 @@ import com.engine.salary.entity.hrm.param.HrmQueryParam; import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAcctDetailImportFieldDTO; +import com.engine.salary.entity.siaccount.dto.InsuranceCompensationDTO; import com.engine.salary.entity.siaccount.param.*; import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO; import com.engine.salary.entity.taxagent.po.TaxAgentPO; @@ -698,4 +699,91 @@ public class SIAccountController { } // **********************************退差 end*********************************/ + + // **********************************调差 start*********************************/ + /** + * 获取当前登录人所控制的人员范围 + */ + @POST + @Path("/getEmployeeListToCompensation") + @Produces(MediaType.APPLICATION_JSON) + public String getEmployeeListToCompensation(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody HrmQueryParam param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSIAccountWrapper(user)::getEmployeeListToCompensation, param); + } + + /** + * 通过id获取InsuranceAccountDetailPO中的社保福利项 + */ + @GET + @Path("/compensationCategoryType") + @Produces(MediaType.APPLICATION_JSON) + public String compensationCategoryType(@Context HttpServletRequest request, @Context HttpServletResponse response, + @QueryParam("id") Long id) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>>(user).run(getSIAccountWrapper(user)::compensationCategoryType, id); + } + + /** + * 获取当前调差福利类型-公司方支出总计 + */ + @POST + @Path("/compensationComTotal") + @Produces(MediaType.APPLICATION_JSON) + public String compensationComTotal(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody List paramList) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, List>>(user).run(getSIAccountWrapper(user)::compensationComTotal, paramList); + } + + /** + * 社保调差保存 + */ + @POST + @Path("/compensationSave") + @Produces(MediaType.APPLICATION_JSON) + public String compensationSave(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody List param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, Map>(user).run(getSIAccountWrapper(user)::compensationSave, param); + } + + /** + * 社保调差默认配置保存 + */ + @POST + @Path("/compensationConfigSave") + @Produces(MediaType.APPLICATION_JSON) + public String compensationConfigSave(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody List param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult, String>(user).run(getSIAccountWrapper(user)::compensationConfigSave, param); + } + + /** + * 社保调差撤回 + */ + @POST + @Path("/compensationBack") + @Produces(MediaType.APPLICATION_JSON) + public String compensationBack(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody InsuranceCompensationDTO param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult(user).run(getSIAccountWrapper(user)::compensationBack, param); + } + + /** + * 社保调差列表 + */ + @POST + @Path("/compensationList") + @Produces(MediaType.APPLICATION_JSON) + public String compensationList(@Context HttpServletRequest request, @Context HttpServletResponse response, + @RequestBody InsuranceCompensationDTO param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getSIAccountWrapper(user)::compensationList, param); + } + + // **********************************调差 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 6f3b6e134..3180d9979 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -5,13 +5,19 @@ import com.engine.core.impl.Service; 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.RecessionParam; +import com.engine.salary.service.SICompensationService; import com.engine.salary.service.SIRecessionService; +import com.engine.salary.service.impl.SICompensationServiceImpl; import com.engine.salary.service.impl.SIRecessionServiceImpl; import com.engine.salary.util.page.PageInfo; import weaver.hrm.User; import java.util.Collection; +import java.util.List; +import java.util.Map; /** * @Author weaver_cl @@ -24,6 +30,10 @@ public class SIAccountWrapper extends Service { return (SIRecessionService) ServiceUtil.getService(SIRecessionServiceImpl.class, user); } + private SICompensationService getSICompensationService(User user) { + return (SICompensationService) ServiceUtil.getService(SICompensationServiceImpl.class, user); + } + /** * 新增退差数据 * @param param 退差请求体 @@ -42,8 +52,66 @@ public class SIAccountWrapper extends Service { getSIRecessionService(user).del(ids, currentEmployeeId); } + /** + * 可退差人员列表 + */ public PageInfo getEmployeeListByTaxAgent(HrmQueryParam param) { return getSIRecessionService(user).getEmployeeListByTaxAgent(param); } + + /** + * 可调差人员列表 + */ + public List getEmployeeListToCompensation(HrmQueryParam hrmQueryParam) { + + return getSICompensationService(user).getEmployeeListToCompensation(hrmQueryParam); + } + + /** + * 获取社保福利项 + */ + public List> compensationCategoryType(Long id) { + + return getSICompensationService(user).compensationCategoryType(id); + } + + /** + * 获取当前调差福利类型-公司方支出总计 + */ + public List> compensationComTotal(List paramList) { + + return getSICompensationService(user).compensationComTotal(paramList); + } + + /** + * 社保调差保存 + */ + public Map compensationSave(List param) { + + return getSICompensationService(user).compensationAccount(param); + } + + /** + * 社保调差默认配置保存 + */ + public String compensationConfigSave(List param) { + + return getSICompensationService(user).compensationConfigSave(param); + } + + /** + * 社保调差撤回 + */ + public String compensationBack(InsuranceCompensationDTO param) { + + return getSICompensationService(user).compensationRevert(param); + } + + /** + * 社保调差列表 + */ + public Map compensationList(InsuranceCompensationDTO param) { + return getSICompensationService(user).compensationList(param.getBillMonth(), param.getPaymentOrganization()); + } }