From d81883e3d2ca5519f2a7fb5767974675b2fcea00 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 23 Nov 2022 14:49:44 +0800 Subject: [PATCH 01/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=B0=83=E5=B7=AE?= =?UTF-8?q?v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../entity/hrm/param/HrmQueryParam.java | 5 +- .../siaccount/param/CompensationParam.java | 48 ++++++ .../salary/service/SICompensationService.java | 18 ++ .../impl/SICompensationServiceImpl.java | 159 ++++++++++++++++++ 4 files changed, 229 insertions(+), 1 deletion(-) create mode 100644 src/com/engine/salary/entity/siaccount/param/CompensationParam.java create mode 100644 src/com/engine/salary/service/SICompensationService.java create mode 100644 src/com/engine/salary/service/impl/SICompensationServiceImpl.java 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/param/CompensationParam.java b/src/com/engine/salary/entity/siaccount/param/CompensationParam.java new file mode 100644 index 000000000..0aca6d1a3 --- /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; + + /** + * 前端rowId,指被调差的人员id + */ + private String rowId; + + /** + * 账单月份 + */ + private String billMonth; + + /** + * 统计调差福利 + */ + private Integer welfareType; + + /** + * 统计调差福利项,即社保、公积金、其他福利类型下的具体项目 + */ + private String categoryType; +} diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java new file mode 100644 index 000000000..8aa89a649 --- /dev/null +++ b/src/com/engine/salary/service/SICompensationService.java @@ -0,0 +1,18 @@ +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.param.CompensationParam; +import com.engine.salary.util.page.PageInfo; + +import java.util.List; +import java.util.Map; + +public interface SICompensationService { + + PageInfo getEmployeeListToCompensation(HrmQueryParam param); + + List> compensationCategoryType(Long id); + + Map>> compensationComTotal(Map> param); +} 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..17179f22d --- /dev/null +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -0,0 +1,159 @@ +package com.engine.salary.service.impl; + +import com.alibaba.fastjson.JSON; +import com.alipay.oceanbase.jdbc.StringUtils; +import com.engine.common.util.ServiceUtil; +import com.engine.core.impl.Service; +import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt; +import com.engine.salary.entity.hrm.dto.HrmInfoDTO; +import com.engine.salary.entity.hrm.param.HrmQueryParam; +import com.engine.salary.entity.siaccount.param.CompensationParam; +import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.mapper.datacollection.EmployMapper; +import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; +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.PageInfo; +import com.engine.salary.util.page.SalaryPageUtil; +import com.google.common.collect.Lists; +import weaver.hrm.User; + +import java.math.BigDecimal; +import java.util.*; +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); + } + + /** + * 可调差人员 + */ + @Override + 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 (null == resultData) { + 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 Map>> compensationComTotal(Map> param) { + Map>> result = new HashMap<>(); + param.forEach((paymentAgencyId, compensationList) -> { + List> paymentList = new ArrayList<>(); + compensationList.forEach(compensation -> { + Map temp = new HashMap<>(); + temp.put("rowId", compensation.getRowId()); + 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(paymentAgencyId, paymentList); + }); + return result; + } +} From f1bd574c81563ad910ee953cf30a4a7ecdaa1131 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 23 Nov 2022 15:39:42 +0800 Subject: [PATCH 02/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=B0=83=E5=B7=AE?= =?UTF-8?q?v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../impl/SICompensationServiceImpl.java | 2 +- .../service/impl/SIRecessionServiceImpl.java | 2 +- .../salary/web/SIAccountController.java | 40 +++++++++++++++++++ .../salary/wrapper/SIAccountWrapper.java | 36 +++++++++++++++++ 4 files changed, 78 insertions(+), 2 deletions(-) diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 17179f22d..84b72b4c6 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -70,7 +70,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation // 分页 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/SIRecessionServiceImpl.java b/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java index 09cfd8b0b..9cec4e79a 100644 --- a/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIRecessionServiceImpl.java @@ -331,7 +331,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/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 053219066..fcc78dbf0 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -698,4 +698,44 @@ 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 Map> param) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>, Map>>>(user).run(getSIAccountWrapper(user)::compensationComTotal, param); + } + + + // **********************************调差 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 6f3b6e134..c8c50a02f 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -5,13 +5,18 @@ 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.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 +29,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 +51,35 @@ public class SIAccountWrapper extends Service { getSIRecessionService(user).del(ids, currentEmployeeId); } + /** + * 可退差人员列表 + */ public PageInfo getEmployeeListByTaxAgent(HrmQueryParam param) { return getSIRecessionService(user).getEmployeeListByTaxAgent(param); } + + /** + * 可调差人员列表 + */ + public PageInfo getEmployeeListToCompensation(HrmQueryParam hrmQueryParam) { + + return getSICompensationService(user).getEmployeeListToCompensation(hrmQueryParam); + } + + /** + * 获取社保福利项 + */ + public List> compensationCategoryType(Long id) { + + return getSICompensationService(user).compensationCategoryType(id); + } + + /** + * 获取当前调差福利类型-公司方支出总计 + */ + public Map>> compensationComTotal(Map> param) { + + return getSICompensationService(user).compensationComTotal(param); + } } From 27dd8b4450f19fe95a943884b4d8af6268415809 Mon Sep 17 00:00:00 2001 From: sy Date: Thu, 24 Nov 2022 09:17:08 +0800 Subject: [PATCH 03/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=B0=83=E5=B7=AE?= =?UTF-8?q?=E4=BF=9D=E5=AD=98v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/InsuranceCompensationDTO.java | 97 +++++++++++++++++ .../siaccount/po/InsuranceCompensationPO.java | 101 ++++++++++++++++++ .../salary/service/SICompensationService.java | 3 + .../impl/SICompensationServiceImpl.java | 79 ++++++++++++++ 4 files changed, 280 insertions(+) create mode 100644 src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java create mode 100644 src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java 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..445c6b40c --- /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; + + /** + * 只读 + * + */ + private Boolean status; + + /** + * 缴纳组织 + */ + private Long paymentOrganization; + + /** + * 员工id + */ + private Long employeeId; + + /** + * 统计调差福利 + */ + private String welfareType; + + /** + * 统计调差福利类型 + */ + private String categoryType; + + /** + * 统计调差福利类型选项 + */ + private List> categoryTypeOptions; + + /** + * 国家核算金额 + */ + private String countryTotal; + + /** + * 公司核算金额 + */ + private String companyTotal; + + /** + * 应调差额 + */ + private String adjustmentTotal; + + /** + * 调差到 + */ + private Long adjustTo; + + /** + * 对象 + */ + private Long target; + + /** + * 对象选项 + */ + private List> targetOptions; + + /** + * 账单月份 + */ + private String billMonth; +} 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..a361a5b65 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java @@ -0,0 +1,101 @@ +package com.engine.salary.entity.siaccount.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @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 LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime 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; +} diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java index 8aa89a649..7ac42f21c 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -2,6 +2,7 @@ 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; @@ -15,4 +16,6 @@ public interface SICompensationService { List> compensationCategoryType(Long id); Map>> compensationComTotal(Map> param); + + Map compensationAccount(List list); } diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 84b72b4c6..dd59b6fa4 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -4,12 +4,16 @@ import com.alibaba.fastjson.JSON; import com.alipay.oceanbase.jdbc.StringUtils; 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.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.InsuranceCompensationPO; import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; import com.engine.salary.service.SICategoryService; @@ -21,9 +25,11 @@ import com.engine.salary.util.db.MapperProxyFactory; 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 weaver.hrm.User; import java.math.BigDecimal; +import java.time.LocalDateTime; import java.util.*; import java.util.stream.Collectors; @@ -156,4 +162,77 @@ public class SICompensationServiceImpl extends Service implements SICompensation }); return result; } + + @Override + public Map compensationAccount(List list) { + + long currentEmployeeId = user.getUID(); + + Map result = new HashMap<>(); + for (InsuranceCompensationDTO param : list) { + if (StringUtils.isBlank(param.getAdjustmentTotal()) || "0".equals(param.getAdjustmentTotal())) { + continue; + } + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(param.getTarget()); + SalaryAssert.notNull(insuranceAccountDetailPO, SalaryI18nUtil.getI18nLabel(138849, "调差对象不存在")); + 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()); + //更新社保调差后的明细 + 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(LocalDateTime.now()); + insuranceCompensationPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); + insuranceCompensationPO.setCountryTotal(param.getCountryTotal()); + insuranceCompensationPO.setEmployeeId(insuranceAccountDetailPO.getEmployeeId()); +// insuranceCompensationPO.setPaymentAgency(insuranceAccountDetailPO.getPaymentAgency()); + insuranceCompensationPO.setPaymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()); + insuranceCompensationPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + insuranceCompensationPO.setWelfareType(Integer.valueOf(param.getWelfareType())); + insuranceCompensationPO.setUpdateTime(LocalDateTime.now()); +// insuranceCompensationMapper.insert(insuranceCompensationPO); + //刷新bill_detail统计数据 + + result.put(param.getOriginId(), insuranceCompensationPO.getId().toString()); + + } + } + } + } + return result; + } } From bbc58281f3ac7e480470755525ae04941d7f7751 Mon Sep 17 00:00:00 2001 From: sy Date: Thu, 24 Nov 2022 13:29:40 +0800 Subject: [PATCH 04/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=B0=83=E5=B7=AE?= =?UTF-8?q?=E4=BF=9D=E5=AD=98v2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/impl/SICompensationServiceImpl.java | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index dd59b6fa4..1dc8f4e73 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -16,6 +16,7 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; +import com.engine.salary.service.SIAccountService; import com.engine.salary.service.SICategoryService; import com.engine.salary.service.SICompensationService; import com.engine.salary.util.SalaryAssert; @@ -52,6 +53,10 @@ public class SICompensationServiceImpl extends Service implements SICompensation return ServiceUtil.getService(SICategoryServiceImpl.class, user); } + private SIAccountService getSIAccountService(User user) { + return ServiceUtil.getService(SIAccountServiceImpl.class, user); + } + /** * 可调差人员 */ @@ -225,7 +230,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation insuranceCompensationPO.setWelfareType(Integer.valueOf(param.getWelfareType())); insuranceCompensationPO.setUpdateTime(LocalDateTime.now()); // insuranceCompensationMapper.insert(insuranceCompensationPO); - //刷新bill_detail统计数据 + result.put(param.getOriginId(), insuranceCompensationPO.getId().toString()); @@ -233,6 +238,8 @@ public class SICompensationServiceImpl extends Service implements SICompensation } } } + //刷新bill_detail统计数据 + getSIAccountService(user).refreshBillBatch(list.get(0).getPaymentOrganization(), list.get(0).getBillMonth()); return result; } } From ff20acd15adb37fca14b614da3fd6a83de96f760 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 09:55:29 +0800 Subject: [PATCH 05/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=B0=83=E5=B7=AE?= =?UTF-8?q?=E8=AE=B0=E5=BD=95=E8=A1=A8po=E5=92=8C=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E8=A1=A8po?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../po/InsuranceCompensationConfigPO.java | 75 +++++++++++++++++++ .../siaccount/po/InsuranceCompensationPO.java | 6 +- 2 files changed, 78 insertions(+), 3 deletions(-) create mode 100644 src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java 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..0cd4da439 --- /dev/null +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java @@ -0,0 +1,75 @@ +package com.engine.salary.entity.siaccount.po; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +import java.time.LocalDateTime; + +/** + * @Author: sy + * @Description: 社保福利台账-调差配置表 + * @Date: 2022/11/28 + **/ +@Data +@Builder +@NoArgsConstructor +@AllArgsConstructor +//hrsa_compensation_config +public class InsuranceCompensationConfigPO { + /** + * 主键id + */ + private Long id; + + /** + * 缴纳组织 + */ + private Long paymentAgency; + + /** + * 创建人id + */ + private Long creator; + + /** + * 是否删除 + */ + private Integer deleteType; + + /** + * 创建时间 + */ + private LocalDateTime createTime; + + /** + * 更新时间 + */ + private LocalDateTime 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 index a361a5b65..dbd00ae12 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; +import java.util.Date; /** * @Author: sy @@ -47,12 +47,12 @@ public class InsuranceCompensationPO { /** * 创建时间 */ - private LocalDateTime createTime; + private Date createTime; /** * 更新时间 */ - private LocalDateTime updateTime; + private Date updateTime; /** * 租户key From 8d211c7db06081d665fd776dc645727c974404fa Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 11:35:05 +0800 Subject: [PATCH 06/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E4=BF=9D=E5=AD=98v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../po/InsuranceCompensationConfigPO.java | 5 + .../InsuranceCompensationConfigMapper.java | 13 ++ .../InsuranceCompensationConfigMapper.xml | 155 ++++++++++++++ .../InsuranceCompensationMapper.java | 13 ++ .../siaccount/InsuranceCompensationMapper.xml | 196 ++++++++++++++++++ .../impl/SICompensationServiceImpl.java | 13 +- .../salary/web/SIAccountController.java | 13 ++ .../salary/wrapper/SIAccountWrapper.java | 9 + 8 files changed, 413 insertions(+), 4 deletions(-) create mode 100644 src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java create mode 100644 src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml create mode 100644 src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java create mode 100644 src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java index 0cd4da439..7a64efe2e 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java @@ -28,6 +28,11 @@ public class InsuranceCompensationConfigPO { */ private Long paymentAgency; + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; + /** * 创建人id */ 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..d16747376 --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java @@ -0,0 +1,13 @@ +package com.engine.salary.mapper.siaccount; + +import com.engine.salary.entity.siaccount.po.InsuranceCompensationConfigPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; + +public interface InsuranceCompensationConfigMapper { + + void bathInsert(@Param("collection") Collection compensationConfigPOS); + + void insert(InsuranceCompensationConfigPO compensationConfigPO); +} 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..20671d11b --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml @@ -0,0 +1,155 @@ + + + + + + + + + + + + + + + + + + + + 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}) + + \ 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..a021cc4a9 --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -0,0 +1,13 @@ +package com.engine.salary.mapper.siaccount; + +import com.engine.salary.entity.siaccount.po.InsuranceCompensationPO; +import org.apache.ibatis.annotations.Param; + +import java.util.Collection; + +public interface InsuranceCompensationMapper { + + void bathInsert(@Param("collection") Collection insuranceCompensationPOS); + + void insert(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..dece492ec --- /dev/null +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + + + + + + + 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}) + + \ No newline at end of file diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 1dc8f4e73..ca94b5635 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -16,6 +16,7 @@ import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; +import com.engine.salary.mapper.siaccount.InsuranceCompensationMapper; import com.engine.salary.service.SIAccountService; import com.engine.salary.service.SICategoryService; import com.engine.salary.service.SICompensationService; @@ -57,6 +58,10 @@ public class SICompensationServiceImpl extends Service implements SICompensation return ServiceUtil.getService(SIAccountServiceImpl.class, user); } + private InsuranceCompensationMapper getInsuranceCompensationMapper() { + return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class); + } + /** * 可调差人员 */ @@ -220,16 +225,16 @@ public class SICompensationServiceImpl extends Service implements SICompensation insuranceCompensationPO.setCompanyTotal(param.getCompanyTotal()); insuranceCompensationPO.setCreator(currentEmployeeId); insuranceCompensationPO.setCategoryType(param.getCategoryType()); - insuranceCompensationPO.setCreateTime(LocalDateTime.now()); + insuranceCompensationPO.setCreateTime(new Date()); insuranceCompensationPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue()); insuranceCompensationPO.setCountryTotal(param.getCountryTotal()); insuranceCompensationPO.setEmployeeId(insuranceAccountDetailPO.getEmployeeId()); -// insuranceCompensationPO.setPaymentAgency(insuranceAccountDetailPO.getPaymentAgency()); + insuranceCompensationPO.setPaymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()); insuranceCompensationPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); insuranceCompensationPO.setWelfareType(Integer.valueOf(param.getWelfareType())); - insuranceCompensationPO.setUpdateTime(LocalDateTime.now()); -// insuranceCompensationMapper.insert(insuranceCompensationPO); + insuranceCompensationPO.setUpdateTime(new Date()); + getInsuranceCompensationMapper().insert(insuranceCompensationPO); result.put(param.getOriginId(), insuranceCompensationPO.getId().toString()); diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index fcc78dbf0..7d8215025 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; @@ -736,6 +737,18 @@ public class SIAccountController { return new ResponseResult>, Map>>>(user).run(getSIAccountWrapper(user)::compensationComTotal, param); } + /** + * 社保调差保存 + */ + @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); + } + // **********************************调差 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index c8c50a02f..7d3f2f52b 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -5,6 +5,7 @@ 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; @@ -82,4 +83,12 @@ public class SIAccountWrapper extends Service { return getSICompensationService(user).compensationComTotal(param); } + + /** + * 社保调差保存 + */ + public Map compensationSave(List param) { + + return getSICompensationService(user).compensationAccount(param); + } } From 49466f9f3b9332dc46f96619c631031beeb1046c Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 13:42:53 +0800 Subject: [PATCH 07/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E9=BB=98=E8=AE=A4=E9=85=8D=E7=BD=AE=E4=BF=9D?= =?UTF-8?q?=E5=AD=98v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsuranceCompensationConfigMapper.java | 2 ++ .../InsuranceCompensationConfigMapper.xml | 7 ++++ .../salary/service/SICompensationService.java | 5 +++ .../impl/SICompensationServiceImpl.java | 34 +++++++++++++++++++ .../salary/web/SIAccountController.java | 11 ++++++ .../salary/wrapper/SIAccountWrapper.java | 8 +++++ 6 files changed, 67 insertions(+) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java index d16747376..211404c34 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java @@ -10,4 +10,6 @@ public interface InsuranceCompensationConfigMapper { void bathInsert(@Param("collection") Collection compensationConfigPOS); void insert(InsuranceCompensationConfigPO compensationConfigPO); + + void deleteByPayOrg(Long paymentOrganization); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml index 20671d11b..d4a39d697 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml @@ -152,4 +152,11 @@ #{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/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java index 7ac42f21c..032d21275 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -18,4 +18,9 @@ public interface SICompensationService { Map>> compensationComTotal(Map> param); Map compensationAccount(List list); + + /** + * 保存社保调差默认配置 + */ + String compensationConfigSave(List param); } diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index ca94b5635..ccb89bf82 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -11,11 +11,13 @@ 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.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.enums.sicategory.DeleteTypeEnum; 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.service.SIAccountService; import com.engine.salary.service.SICategoryService; @@ -62,6 +64,9 @@ public class SICompensationServiceImpl extends Service implements SICompensation return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class); } + private InsuranceCompensationConfigMapper getInsuranceCompensationConfigMapper() { + return MapperProxyFactory.getProxy(InsuranceCompensationConfigMapper.class); + } /** * 可调差人员 */ @@ -247,4 +252,33 @@ public class SICompensationServiceImpl extends Service implements SICompensation getSIAccountService(user).refreshBillBatch(list.get(0).getPaymentOrganization(), list.get(0).getBillMonth()); 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(LocalDateTime.now()) + .updateTime(LocalDateTime.now()) + .categoryType(config.getCategoryType()) + .paymentOrganization(config.getPaymentOrganization()) + .welfareType(Integer.valueOf(config.getWelfareType())) + .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .creator(currentEmployeeId).build(); + }).collect(Collectors.toList()); + configList.forEach(config -> getInsuranceCompensationConfigMapper().insert(config)); + + return "配置成功"; + } } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 7d8215025..307d69ee5 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -749,6 +749,17 @@ public class SIAccountController { 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); + } // **********************************调差 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 7d3f2f52b..09bb1e97d 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -91,4 +91,12 @@ public class SIAccountWrapper extends Service { return getSICompensationService(user).compensationAccount(param); } + + /** + * 社保调差默认配置保存 + */ + public String compensationConfigSave(List param) { + + return getSICompensationService(user).compensationConfigSave(param); + } } From 1747a613dd8073aa87daf67f1dc3f01dff0f5d0e Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 14:57:29 +0800 Subject: [PATCH 08/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E6=92=A4=E5=9B=9Ev1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsuranceAccountDetailMapper.java | 5 ++ .../InsuranceAccountDetailMapper.xml | 16 +++++ .../InsuranceCompensationMapper.java | 4 ++ .../siaccount/InsuranceCompensationMapper.xml | 15 +++++ .../salary/service/SICompensationService.java | 5 ++ .../impl/SICompensationServiceImpl.java | 59 +++++++++++++++++++ .../salary/web/SIAccountController.java | 12 ++++ .../salary/wrapper/SIAccountWrapper.java | 8 +++ 8 files changed, 124 insertions(+) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 030d68d5f..6c2643c6a 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -168,4 +168,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..182b26111 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -1195,4 +1195,20 @@ AND supplementary_month = #{supplementaryMonth} AND employee_id = #{employeeId} + + \ 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 index a021cc4a9..65015dc3d 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -10,4 +10,8 @@ public interface InsuranceCompensationMapper { void bathInsert(@Param("collection") Collection insuranceCompensationPOS); void insert(InsuranceCompensationPO insuranceCompensationPO); + + InsuranceCompensationPO getById(Long id); + + void deleteById(Long id); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index dece492ec..1fd899ae5 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -193,4 +193,19 @@ #{deleteType}, #{tenantKey}) + + + + + + UPDATE hrsa_compensation_log + SET delete_type = 1 + WHERE id = #{id} + AND delete_type = 0 + \ No newline at end of file diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java index 032d21275..fdd8265a2 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -23,4 +23,9 @@ public interface SICompensationService { * 保存社保调差默认配置 */ String compensationConfigSave(List param); + + /** + * 社保调差撤回 + */ + String compensationRevert(InsuranceCompensationDTO param); } diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index ccb89bf82..0491ecc45 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -14,6 +14,7 @@ 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.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.enums.siaccount.PaymentStatusEnum; import com.engine.salary.enums.sicategory.DeleteTypeEnum; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; @@ -281,4 +282,62 @@ public class SICompensationServiceImpl extends Service implements SICompensation 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()); + //更新社保补差后的明细 + getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); + //删除补差记录 + getInsuranceCompensationMapper().deleteById(param.getId()); + + } + } + //刷新bill_detail统计数据 + getSIAccountService(user).refreshBillBatch(param.getPaymentOrganization(), param.getBillMonth()); + + } + return "撤回成功"; + } } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 307d69ee5..8257119ce 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -761,5 +761,17 @@ public class SIAccountController { 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); + } + // **********************************调差 end*********************************/ } diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index 09bb1e97d..b20840943 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -99,4 +99,12 @@ public class SIAccountWrapper extends Service { return getSICompensationService(user).compensationConfigSave(param); } + + /** + * 社保调差撤回 + */ + public String compensationBack(InsuranceCompensationDTO param) { + + return getSICompensationService(user).compensationRevert(param); + } } From d9c7a6c0e3631440840b050e6587601d0cc09f8f Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 15:50:52 +0800 Subject: [PATCH 09/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E6=92=A4=E5=9B=9Ev2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/mapper/siaccount/InsuranceCompensationMapper.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index 1fd899ae5..573e403d0 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -199,7 +199,7 @@ SELECT FROM hrsa_compensation_log t - WHERE id = #{id} AND delete_type = 0 + WHERE t.id = #{id} AND t.delete_type = 0 From 5486d3f849e947c295193de5bcae9a09c7eace94 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 16:25:52 +0800 Subject: [PATCH 10/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E5=AD=97=E6=AE=B5=E7=B1=BB=E5=9E=8B=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../siaccount/po/InsuranceCompensationConfigPO.java | 6 +++--- .../siaccount/InsuranceCompensationConfigMapper.java | 2 +- .../siaccount/InsuranceCompensationConfigMapper.xml | 8 ++++---- .../mapper/siaccount/InsuranceCompensationMapper.java | 2 +- .../mapper/siaccount/InsuranceCompensationMapper.xml | 9 ++++----- .../salary/service/impl/SICompensationServiceImpl.java | 4 ++-- 6 files changed, 15 insertions(+), 16 deletions(-) diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java index 7a64efe2e..7bf4e8a79 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationConfigPO.java @@ -5,7 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import java.time.LocalDateTime; +import java.util.Date; /** * @Author: sy @@ -46,12 +46,12 @@ public class InsuranceCompensationConfigPO { /** * 创建时间 */ - private LocalDateTime createTime; + private Date createTime; /** * 更新时间 */ - private LocalDateTime updateTime; + private Date updateTime; /** * 租户key diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java index 211404c34..5aa6e5863 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java @@ -7,7 +7,7 @@ import java.util.Collection; public interface InsuranceCompensationConfigMapper { - void bathInsert(@Param("collection") Collection compensationConfigPOS); + void batchInsert(@Param("collection") Collection compensationConfigPOS); void insert(InsuranceCompensationConfigPO compensationConfigPO); diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml index d4a39d697..690d59f57 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml @@ -31,7 +31,7 @@ , t.tenant_key - + INSERT INTO hrsa_compensation_config( id, employee_id, @@ -62,7 +62,7 @@ ) - + INSERT INTO hrsa_compensation_config( id, employee_id, @@ -94,7 +94,7 @@ from dual - + INSERT INTO hrsa_compensation_config( id, @@ -126,7 +126,7 @@ - + insert into hrsa_compensation_config ( id, employee_id, diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java index 65015dc3d..c3aa3ee20 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -7,7 +7,7 @@ import java.util.Collection; public interface InsuranceCompensationMapper { - void bathInsert(@Param("collection") Collection insuranceCompensationPOS); + void batchInsert(@Param("collection") Collection insuranceCompensationPOS); void insert(InsuranceCompensationPO insuranceCompensationPO); diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index 573e403d0..1dae2c343 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -40,7 +40,7 @@ , t.tenant_key - + INSERT INTO hrsa_compensation_log( id, employee_id, @@ -79,7 +79,7 @@ ) - + INSERT INTO hrsa_compensation_log( id, employee_id, @@ -115,11 +115,10 @@ #{item.creator,jdbcType=DOUBLE}, #{item.deleteType,jdbcType=INTEGER}, #{item.tenantKey,jdbcType=VARCHAR} - from dual - + INSERT INTO hrsa_compensation_log( id, @@ -159,7 +158,7 @@ - + insert into hrsa_compensation_log ( id, employee_id, diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 0491ecc45..a097da227 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -270,8 +270,8 @@ public class SICompensationServiceImpl extends Service implements SICompensation .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .employeeId(insuranceAccountDetailPO.getEmployeeId()) .adjustTo(config.getAdjustTo()) - .createTime(LocalDateTime.now()) - .updateTime(LocalDateTime.now()) + .createTime(new Date()) + .updateTime(new Date()) .categoryType(config.getCategoryType()) .paymentOrganization(config.getPaymentOrganization()) .welfareType(Integer.valueOf(config.getWelfareType())) From f68219ff87314ff2463d2d868b2e475eea7e2ae0 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 28 Nov 2022 16:58:20 +0800 Subject: [PATCH 11/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=EF=BC=8C=E9=AB=98=E7=BA=A7?= =?UTF-8?q?=E6=90=9C=E7=B4=A2=E5=88=86=E9=83=A8=E9=80=BB=E8=BE=91=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIArchivesBiz.java | 5 +++++ .../entity/siarchives/param/InsuranceArchivesListParam.java | 1 + 2 files changed, 6 insertions(+) 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/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; From 2ceeeb165f513f1349bb5e1ee045170dfdec7c51 Mon Sep 17 00:00:00 2001 From: sy Date: Tue, 29 Nov 2022 15:33:57 +0800 Subject: [PATCH 12/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E5=88=97=E8=A1=A8v1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/InsuranceCompensationDTO.java | 4 +- .../InsuranceCompensationConfigMapper.java | 4 + .../InsuranceCompensationConfigMapper.xml | 9 ++ .../InsuranceCompensationMapper.java | 3 + .../siaccount/InsuranceCompensationMapper.xml | 9 ++ .../salary/service/ColumnBuildService.java | 6 + .../salary/service/SICompensationService.java | 5 + .../service/impl/ColumnBuildServiceImpl.java | 19 +++ .../impl/SICompensationServiceImpl.java | 127 ++++++++++++++++-- .../salary/web/SIAccountController.java | 12 ++ .../salary/wrapper/SIAccountWrapper.java | 7 + 11 files changed, 194 insertions(+), 11 deletions(-) diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java index 445c6b40c..e100e69ed 100644 --- a/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java @@ -30,7 +30,7 @@ public class InsuranceCompensationDTO { private String originId; /** - * 只读 + * 只读,true为实际调差记录,false为调差配置数据(非实际调差记录) * */ private Boolean status; @@ -88,7 +88,7 @@ public class InsuranceCompensationDTO { /** * 对象选项 */ - private List> targetOptions; + private Map targetOptions; /** * 账单月份 diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java index 5aa6e5863..2228e7f37 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java @@ -4,6 +4,7 @@ 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 { @@ -12,4 +13,7 @@ public interface InsuranceCompensationConfigMapper { void insert(InsuranceCompensationConfigPO compensationConfigPO); void deleteByPayOrg(Long paymentOrganization); + + List queryByBillMonthAndPayOrg(String billMonth, Long paymentOrganization); + } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml index 690d59f57..8153657d8 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml @@ -159,4 +159,13 @@ 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 index c3aa3ee20..2ee45f10d 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -4,6 +4,7 @@ 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 { @@ -13,5 +14,7 @@ public interface InsuranceCompensationMapper { InsuranceCompensationPO getById(Long id); + List queryByBillMonthAndPayOrg(String billMonth, Long paymentOrganization); + void deleteById(Long id); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index 1dae2c343..2a62fcc5e 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -201,6 +201,15 @@ WHERE t.id = #{id} AND t.delete_type = 0 + + UPDATE hrsa_compensation_log SET delete_type = 1 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 index fdd8265a2..a4ade6b5f 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -28,4 +28,9 @@ public interface SICompensationService { * 社保调差撤回 */ 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..9c008d7a2 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -388,4 +388,23 @@ 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(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 index a097da227..92407ad33 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -2,10 +2,12 @@ package com.engine.salary.service.impl; import com.alibaba.fastjson.JSON; import com.alipay.oceanbase.jdbc.StringUtils; +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; @@ -13,13 +15,16 @@ 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.taxagent.dto.TaxAgentEmployeeDTO; +import com.engine.salary.entity.sicategory.po.ICategoryPO; 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; @@ -31,11 +36,12 @@ 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.time.LocalDateTime; import java.util.*; +import java.util.function.Function; import java.util.stream.Collectors; /** @@ -68,6 +74,11 @@ public class SICompensationServiceImpl extends Service implements SICompensation private InsuranceCompensationConfigMapper getInsuranceCompensationConfigMapper() { return MapperProxyFactory.getProxy(InsuranceCompensationConfigMapper.class); } + + public ColumnBuildService getColumnBuildService(User user) { + return ServiceUtil.getService(ColumnBuildServiceImpl.class, user); + } + /** * 可调差人员 */ @@ -306,30 +317,30 @@ public class SICompensationServiceImpl extends Service implements SICompensation 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()); - //更新社保补差后的明细 + //更新社保调差后的明细 getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); - //删除补差记录 + //删除调差记录 getInsuranceCompensationMapper().deleteById(param.getId()); } @@ -340,4 +351,102 @@ public class SICompensationServiceImpl extends Service implements SICompensation } 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(); + + //处理调差数据 + List compensationDTOList = dealCompensationData(billMonth, paymentOrganization); + + datas.put("columns", weaTableColumn); + datas.put("data", compensationDTOList); + + return datas; + } + + private List dealCompensationData(String billMonth, Long paymentOrganization) { + + //获取调差历史记录数据 + List compensationPOList = getInsuranceCompensationMapper().queryByBillMonthAndPayOrg(billMonth, paymentOrganization); + //获取调差配置数据 + List compensationConfigPOList = getInsuranceCompensationConfigMapper().queryByBillMonthAndPayOrg(billMonth, 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(",")); + Map categoryTypeMap = new HashMap<>(); + for (String categoryType : categoryTypeList) { + categoryTypeMap.put("id", categoryType); + categoryTypeMap.put("content", categoryNameMap.get(Long.valueOf(categoryType))); + categoryTypeOptions.add(categoryTypeMap); + } + + dto.setCategoryTypeOptions(categoryTypeOptions); + } + } + //不存在调差历史记录时,输出调差配置数据 + 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(",")); + Map categoryTypeMap = new HashMap<>(); + for (String categoryType : categoryTypeList) { + categoryTypeMap.put("id", categoryType); + categoryTypeMap.put("content", categoryNameMap.get(Long.valueOf(categoryType))); + categoryTypeOptions.add(categoryTypeMap); + } + + dto.setCategoryTypeOptions(categoryTypeOptions); + } + } + + return compensationDTOList; + } + } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 8257119ce..bf4515621 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -773,5 +773,17 @@ public class SIAccountController { 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 b20840943..f5bdc8678 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -107,4 +107,11 @@ public class SIAccountWrapper extends Service { return getSICompensationService(user).compensationRevert(param); } + + /** + * 社保调差列表 + */ + public Map compensationList(InsuranceCompensationDTO param) { + return getSICompensationService(user).compensationList(param.getBillMonth(), param.getPaymentOrganization()); + } } From a0bda933a161662ef3840b810daeb72a0bc6744d Mon Sep 17 00:00:00 2001 From: sy Date: Tue, 29 Nov 2022 17:36:18 +0800 Subject: [PATCH 13/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E9=A1=B9=E5=85=AC=E5=8F=B8=E6=94=AF=E5=87=BA?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../siaccount/param/CompensationParam.java | 4 +- .../salary/service/SICompensationService.java | 2 +- .../impl/SICompensationServiceImpl.java | 95 ++++++++++++------- .../salary/web/SIAccountController.java | 4 +- .../salary/wrapper/SIAccountWrapper.java | 4 +- 5 files changed, 70 insertions(+), 39 deletions(-) diff --git a/src/com/engine/salary/entity/siaccount/param/CompensationParam.java b/src/com/engine/salary/entity/siaccount/param/CompensationParam.java index 0aca6d1a3..7eeb7cb8f 100644 --- a/src/com/engine/salary/entity/siaccount/param/CompensationParam.java +++ b/src/com/engine/salary/entity/siaccount/param/CompensationParam.java @@ -27,9 +27,9 @@ public class CompensationParam { private Long target; /** - * 前端rowId,指被调差的人员id + * 指被调差的人员id */ - private String rowId; + private String employeeId; /** * 账单月份 diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java index a4ade6b5f..7ffc6a916 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -15,7 +15,7 @@ public interface SICompensationService { List> compensationCategoryType(Long id); - Map>> compensationComTotal(Map> param); + List> compensationComTotal(List paramList); Map compensationAccount(List list); diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 92407ad33..4f8e34e60 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -150,44 +150,75 @@ public class SICompensationServiceImpl extends Service implements SICompensation * 获取当前调差福利类型-公司方支出总计 */ @Override - public Map>> compensationComTotal(Map> param) { - Map>> result = new HashMap<>(); - param.forEach((paymentAgencyId, compensationList) -> { - List> paymentList = new ArrayList<>(); - compensationList.forEach(compensation -> { - Map temp = new HashMap<>(); - temp.put("rowId", compensation.getRowId()); - if (StringUtils.isBlank(compensation.getCategoryType()) || compensation.getTarget() == null) { - temp.put("error", SalaryI18nUtil.getI18nLabel(84026, "参数错误")); - temp.put("totalNum", "0"); - } else { + 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, "当前月在该缴纳组织下没有核算记录")); - } - InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); - BigDecimal total = new BigDecimal("0"); - List categoryTypeList = Arrays.asList(compensation.getCategoryType().split(",")); + 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)); - } + 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(paymentAgencyId, paymentList); + + temp.put("totalNum", total.toPlainString()); + } + resultList.add(temp); }); - return result; +// 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 diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index bf4515621..4660c6ea8 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -732,9 +732,9 @@ public class SIAccountController { @Path("/compensationComTotal") @Produces(MediaType.APPLICATION_JSON) public String compensationComTotal(@Context HttpServletRequest request, @Context HttpServletResponse response, - @RequestBody Map> param) { + @RequestBody List paramList) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult>, Map>>>(user).run(getSIAccountWrapper(user)::compensationComTotal, param); + return new ResponseResult, List>>(user).run(getSIAccountWrapper(user)::compensationComTotal, paramList); } /** diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index f5bdc8678..c898094bf 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -79,9 +79,9 @@ public class SIAccountWrapper extends Service { /** * 获取当前调差福利类型-公司方支出总计 */ - public Map>> compensationComTotal(Map> param) { + public List> compensationComTotal(List paramList) { - return getSICompensationService(user).compensationComTotal(param); + return getSICompensationService(user).compensationComTotal(paramList); } /** From ee7309ffd15adf91bb28a9aec98e27327c5ce2ff Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 30 Nov 2022 14:07:28 +0800 Subject: [PATCH 14/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E9=A1=B9=E5=85=AC=E5=8F=B8=E6=94=AF=E5=87=BA?= =?UTF-8?q?=E8=B4=B9=E7=94=A8=E7=BB=9F=E8=AE=A1=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96=EF=BC=8C=E5=AF=B9=E4=BA=8E=E5=B7=B2=E5=AD=98=E5=9C=A8?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E9=A1=B9=EF=BC=8C=E7=BB=99=E5=87=BA=E6=8F=90?= =?UTF-8?q?=E7=A4=BA=EF=BC=8C=E5=B9=B6=E4=B8=94=E4=B8=8D=E8=BF=9B=E8=A1=8C?= =?UTF-8?q?=E8=AE=A1=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsuranceCompensationMapper.java | 2 + .../siaccount/InsuranceCompensationMapper.xml | 11 ++++++ .../impl/SICompensationServiceImpl.java | 39 +++++++++++++------ 3 files changed, 40 insertions(+), 12 deletions(-) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java index 2ee45f10d..fe0caa3f3 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -16,5 +16,7 @@ public interface InsuranceCompensationMapper { List queryByBillMonthAndPayOrg(String billMonth, Long paymentOrganization); + InsuranceCompensationPO getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO); + void deleteById(Long id); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index 2a62fcc5e..8cdd6992f 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -210,6 +210,17 @@ AND t.delete_type = 0 + + + UPDATE hrsa_compensation_log SET delete_type = 1 diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 4f8e34e60..ac2d22b84 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -163,23 +163,37 @@ public class SICompensationServiceImpl extends Service implements SICompensation 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(",")); + 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, "当前月在该缴纳组织下已存在调差数据")); + } - 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)); + //处理调差数据 + 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()); } - temp.put("totalNum", total.toPlainString()); } resultList.add(temp); }); @@ -263,6 +277,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation totalSum = totalSum.add(adjustmentTo); insuranceAccountDetailPO.setTotal(totalSum.toPlainString()); //更新社保调差后的明细 + InsuranceAccountDetailPOEncrypt.encryptItem(insuranceAccountDetailPO); getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); //新建调差记录 InsuranceCompensationPO insuranceCompensationPO = new InsuranceCompensationPO(); From 4d01c324e05cb8e0cbadfaf48a9d59a1be18afea Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 30 Nov 2022 15:05:24 +0800 Subject: [PATCH 15/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E4=BF=9D=E5=AD=98=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/SICompensationService.java | 2 +- .../impl/SICompensationServiceImpl.java | 23 +++++++++++++++---- .../salary/web/SIAccountController.java | 2 +- .../salary/wrapper/SIAccountWrapper.java | 2 +- 4 files changed, 21 insertions(+), 8 deletions(-) diff --git a/src/com/engine/salary/service/SICompensationService.java b/src/com/engine/salary/service/SICompensationService.java index 7ffc6a916..6dfe429f2 100644 --- a/src/com/engine/salary/service/SICompensationService.java +++ b/src/com/engine/salary/service/SICompensationService.java @@ -17,7 +17,7 @@ public interface SICompensationService { List> compensationComTotal(List paramList); - Map compensationAccount(List list); + Map compensationAccount(List list); /** * 保存社保调差默认配置 diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index ac2d22b84..a61e27a44 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -236,17 +236,25 @@ public class SICompensationServiceImpl extends Service implements SICompensation } @Override - public Map compensationAccount(List list) { + 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<>(); + Map result = new HashMap<>(); + List errorList = new ArrayList<>(); for (InsuranceCompensationDTO param : list) { if (StringUtils.isBlank(param.getAdjustmentTotal()) || "0".equals(param.getAdjustmentTotal())) { + errorList.add(usernameMap.get(param.getEmployeeId()) + "-调差失败:调差数额不正确!"); continue; } InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(param.getTarget()); - SalaryAssert.notNull(insuranceAccountDetailPO, SalaryI18nUtil.getI18nLabel(138849, "调差对象不存在")); + 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()); @@ -299,8 +307,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation insuranceCompensationPO.setUpdateTime(new Date()); getInsuranceCompensationMapper().insert(insuranceCompensationPO); - - result.put(param.getOriginId(), insuranceCompensationPO.getId().toString()); +// result.put(param.getOriginId(), insuranceCompensationPO.getId().toString()); } } @@ -308,6 +315,12 @@ public class SICompensationServiceImpl extends Service implements SICompensation } //刷新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); return result; } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 4660c6ea8..8b740d537 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -746,7 +746,7 @@ public class SIAccountController { 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); + return new ResponseResult, Map>(user).run(getSIAccountWrapper(user)::compensationSave, param); } /** diff --git a/src/com/engine/salary/wrapper/SIAccountWrapper.java b/src/com/engine/salary/wrapper/SIAccountWrapper.java index c898094bf..cc886cb2f 100644 --- a/src/com/engine/salary/wrapper/SIAccountWrapper.java +++ b/src/com/engine/salary/wrapper/SIAccountWrapper.java @@ -87,7 +87,7 @@ public class SIAccountWrapper extends Service { /** * 社保调差保存 */ - public Map compensationSave(List param) { + public Map compensationSave(List param) { return getSICompensationService(user).compensationAccount(param); } From d3d2074aedeef0a632cbf162a0cfb1e4761ec5df Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 30 Nov 2022 15:55:23 +0800 Subject: [PATCH 16/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E5=9C=A8=E7=A4=BE?= =?UTF-8?q?=E4=BF=9D=E6=A0=B8=E7=AE=97=E6=9C=88=E6=95=B0=E6=8D=AE=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E6=97=B6=EF=BC=8C=E7=A4=BE=E4=BF=9D=E8=B0=83=E5=B7=AE?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E8=A2=AB=E5=88=A0=E9=99=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 7 +++++++ .../siaccount/InsuranceCompensationMapper.java | 4 +++- .../mapper/siaccount/InsuranceCompensationMapper.xml | 12 ++++++++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 52b76d7dc..5e8c8a054 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -109,6 +109,10 @@ public class SIAccountBiz extends Service { return ServiceUtil.getService(SalarySysConfServiceImpl.class, user); } + private InsuranceCompensationMapper getInsuranceCompensationMapper() { + return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class); + } + public PageInfo listPage(InsuranceAccountBatchParam queryParam) { SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); List list = getInsuranceAccountBatchMapper().list(queryParam); @@ -903,6 +907,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/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java index fe0caa3f3..b407bdf50 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -14,9 +14,11 @@ public interface InsuranceCompensationMapper { InsuranceCompensationPO getById(Long id); - List queryByBillMonthAndPayOrg(String billMonth, Long paymentOrganization); + List queryByBillMonthAndPayOrg(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); InsuranceCompensationPO getOneByBillMonthPayOrgEmpId(InsuranceCompensationPO insuranceCompensationPO); void deleteById(Long id); + + void deleteByBillMonthAndPayOrg(@Param("billMonth") String billMonth, @Param("paymentOrganization") Long paymentOrganization); } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml index 8cdd6992f..1b87e7579 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -201,7 +201,7 @@ WHERE t.id = #{id} AND t.delete_type = 0 - SELECT FROM hrsa_compensation_log t @@ -225,6 +225,14 @@ UPDATE hrsa_compensation_log SET delete_type = 1 WHERE id = #{id} - AND delete_type = 0 + AND delete_type = 0 + + + + UPDATE hrsa_compensation_log + SET delete_type = 1 + WHERE bill_month = #{billMonth} + AND payment_organization = #{paymentOrganization} + AND delete_type = 0 \ No newline at end of file From 5436742c748e594ceab5c1c1e97c1fdd5dcb8441 Mon Sep 17 00:00:00 2001 From: sy Date: Wed, 30 Nov 2022 17:57:25 +0800 Subject: [PATCH 17/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E5=8A=9F?= =?UTF-8?q?=E8=83=BD=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dto/InsuranceCompensationDTO.java | 2 +- .../InsuranceCompensationConfigMapper.java | 2 +- .../InsuranceCompensationConfigMapper.xml | 5 ++-- .../service/impl/ColumnBuildServiceImpl.java | 1 + .../impl/SICompensationServiceImpl.java | 26 +++++++++++++------ 5 files changed, 23 insertions(+), 13 deletions(-) diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java index e100e69ed..312a52344 100644 --- a/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceCompensationDTO.java @@ -48,7 +48,7 @@ public class InsuranceCompensationDTO { /** * 统计调差福利 */ - private String welfareType; + private Integer welfareType; /** * 统计调差福利类型 diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java index 2228e7f37..e9756492f 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.java @@ -14,6 +14,6 @@ public interface InsuranceCompensationConfigMapper { void deleteByPayOrg(Long paymentOrganization); - List queryByBillMonthAndPayOrg(String billMonth, 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 index 8153657d8..fda8f1f01 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationConfigMapper.xml @@ -160,12 +160,11 @@ AND delete_type = 0 - SELECT FROM hrsa_compensation_config t - WHERE t.bill_month = #{billMonth} - AND t.payment_organization = #{paymentOrganization} + WHERE t.payment_organization = #{paymentOrganization} AND t.delete_type = 0 \ No newline at end of file diff --git a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java index 9c008d7a2..64a053093 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -395,6 +395,7 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic 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")); diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index a61e27a44..8e9ff27b6 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -2,6 +2,7 @@ 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; @@ -32,6 +33,7 @@ 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; @@ -303,7 +305,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation insuranceCompensationPO.setPaymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()); insuranceCompensationPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); - insuranceCompensationPO.setWelfareType(Integer.valueOf(param.getWelfareType())); + insuranceCompensationPO.setWelfareType(param.getWelfareType()); insuranceCompensationPO.setUpdateTime(new Date()); getInsuranceCompensationMapper().insert(insuranceCompensationPO); @@ -344,7 +346,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation .updateTime(new Date()) .categoryType(config.getCategoryType()) .paymentOrganization(config.getPaymentOrganization()) - .welfareType(Integer.valueOf(config.getWelfareType())) + .welfareType(config.getWelfareType()) .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) .creator(currentEmployeeId).build(); }).collect(Collectors.toList()); @@ -423,11 +425,15 @@ public class SICompensationServiceImpl extends Service implements SICompensation //设置调差详情列表头 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", weaTableColumn); + datas.put("columns", columns); datas.put("data", compensationDTOList); return datas; @@ -438,7 +444,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation //获取调差历史记录数据 List compensationPOList = getInsuranceCompensationMapper().queryByBillMonthAndPayOrg(billMonth, paymentOrganization); //获取调差配置数据 - List compensationConfigPOList = getInsuranceCompensationConfigMapper().queryByBillMonthAndPayOrg(billMonth, paymentOrganization); + List compensationConfigPOList = getInsuranceCompensationConfigMapper().queryByPayOrg(paymentOrganization); List compensationDTOList = new ArrayList<>(); @@ -468,14 +474,16 @@ public class SICompensationServiceImpl extends Service implements SICompensation //设置categoryTypeOptions List> categoryTypeOptions = new ArrayList<>(); List categoryTypeList = Arrays.asList(po.getCategoryType().split(",")); - Map categoryTypeMap = new HashMap<>(); + 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); } } //不存在调差历史记录时,输出调差配置数据 @@ -494,14 +502,16 @@ public class SICompensationServiceImpl extends Service implements SICompensation //设置categoryTypeOptions List> categoryTypeOptions = new ArrayList<>(); List categoryTypeList = Arrays.asList(configPO.getCategoryType().split(",")); - Map categoryTypeMap = new HashMap<>(); + 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); } } From da7b9d8e6a68285657de092d9acf94d97b99807f Mon Sep 17 00:00:00 2001 From: sy Date: Thu, 1 Dec 2022 10:22:47 +0800 Subject: [PATCH 18/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E6=95=B0=E6=8D=AE=E5=88=A0=E9=99=A4=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E5=9C=A8=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6?= =?UTF-8?q?=E9=87=8D=E6=96=B0=E6=A0=B8=E7=AE=97=E6=97=B6=EF=BC=8C=E5=88=A0?= =?UTF-8?q?=E9=99=A4=E5=B7=B2=E6=9C=89=E8=B0=83=E6=9F=A5=E8=AE=B0=E5=BD=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 5e8c8a054..2d2d063ba 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -416,7 +416,10 @@ public class SIAccountBiz extends Service { for (List part : partitionIds) { getInsuranceAccountDetailMapper().batchDelAccountDetails(part, billMonth, param.getPaymentOrganization(), paymentStatus); } + //删除账单月份+个税扣缴义务人下的调差数据 + getInsuranceCompensationMapper().deleteByBillMonthAndPayOrg(param.getBillMonth(), param.getPaymentOrganization()); + //生成bill_detail入库数据 List collect = list.stream().map(item -> { InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO(); BeanUtils.copyProperties(item, insuranceAccountDetailPO); From 119640e2729dceb654e37ea4444080d95942759a Mon Sep 17 00:00:00 2001 From: sy Date: Thu, 1 Dec 2022 10:50:34 +0800 Subject: [PATCH 19/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E5=9C=A8=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E5=8F=B0=E8=B4=A6=E9=87=8D=E6=96=B0=E6=A0=B8=E7=AE=97?= =?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E8=B0=83=E5=B7=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E6=97=B6=E5=A2=9E=E5=8A=A0=E4=BA=BA=E5=91=98id?= =?UTF-8?q?=E7=AD=9B=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 14 +++++---- .../siaccount/po/InsuranceCompensationPO.java | 5 +++ .../InsuranceCompensationMapper.java | 4 +++ .../siaccount/InsuranceCompensationMapper.xml | 31 +++++++++++++++++++ 4 files changed, 48 insertions(+), 6 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 2d2d063ba..c285bbef3 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -16,10 +16,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; @@ -415,9 +412,14 @@ 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()); } - //删除账单月份+个税扣缴义务人下的调差数据 - getInsuranceCompensationMapper().deleteByBillMonthAndPayOrg(param.getBillMonth(), param.getPaymentOrganization()); //生成bill_detail入库数据 List collect = list.stream().map(item -> { diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java index dbd00ae12..24ebde645 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceCompensationPO.java @@ -5,6 +5,7 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.Collection; import java.util.Date; /** @@ -98,4 +99,8 @@ public class InsuranceCompensationPO { * 账单月份 */ private String billMonth; + + //---------条件------- + private Collection ids; + private Collection employeeIds; } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java index b407bdf50..e96a6b8bb 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.java @@ -18,7 +18,11 @@ public interface InsuranceCompensationMapper { 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 index 1b87e7579..7e3d4e321 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceCompensationMapper.xml @@ -221,6 +221,22 @@ AND t.delete_type = 0 + + + UPDATE hrsa_compensation_log SET delete_type = 1 @@ -235,4 +251,19 @@ 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 From e462992206ed3996babe8ec54fd3c0fab6f553fa Mon Sep 17 00:00:00 2001 From: sy Date: Thu, 1 Dec 2022 11:50:37 +0800 Subject: [PATCH 20/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A4=BE=E4=BF=9D?= =?UTF-8?q?=E8=B0=83=E5=B7=AE=E6=92=A4=E5=9B=9E=E5=8A=9F=E8=83=BD=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/mapper/siaccount/InsuranceAccountDetailMapper.xml | 3 ++- .../engine/salary/service/impl/SICompensationServiceImpl.java | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 182b26111..b11229c8b 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -1202,7 +1202,8 @@ 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.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 diff --git a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java index 8e9ff27b6..33cf6047d 100644 --- a/src/com/engine/salary/service/impl/SICompensationServiceImpl.java +++ b/src/com/engine/salary/service/impl/SICompensationServiceImpl.java @@ -400,6 +400,7 @@ public class SICompensationServiceImpl extends Service implements SICompensation totalSum = totalSum.subtract(adjustmentTo); insuranceAccountDetailPO.setTotal(totalSum.toPlainString()); //更新社保调差后的明细 + InsuranceAccountDetailPOEncrypt.encryptItem(insuranceAccountDetailPO); getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO); //删除调差记录 getInsuranceCompensationMapper().deleteById(param.getId()); From 22a7258229f4899257a2488001635d34fa250303 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 2 Dec 2022 17:08:35 +0800 Subject: [PATCH 21/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E6=A0=B8=E7=AE=97=E6=B7=BB=E5=8A=A0=E6=A0=B8=E7=AE=97=E8=BF=9B?= =?UTF-8?q?=E5=BA=A6=E6=9F=A5=E8=AF=A2=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 46 ++++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index c285bbef3..752388f6f 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; @@ -30,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; @@ -50,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; @@ -110,6 +114,10 @@ public class SIAccountBiz extends Service { 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); @@ -222,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); } @@ -291,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());*/ @@ -311,6 +341,8 @@ public class SIAccountBiz extends Service { handleData(ids, param, employeeId, tenantKey, currentUserName); /*}*/ MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).batchDelAccountTempDetails(ids, param.getBillMonth()); + + 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())); @@ -324,6 +356,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()); } } @@ -365,6 +398,7 @@ 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); } } if (CollectionUtils.isNotEmpty(list)) { From 33aa8ea50768ad1681d2069a4c14b00a4a61bcf5 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 2 Dec 2022 17:57:09 +0800 Subject: [PATCH 22/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88=EF=BC=8C=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=80=9A=E8=BF=87=E5=AF=BC=E5=85=A5excel?= =?UTF-8?q?=E5=85=A5=E5=BA=93=E5=89=8D=EF=BC=8C=E6=A0=B9=E6=8D=AE=E4=BA=BA?= =?UTF-8?q?=E5=91=98id=E5=92=8C=E4=B8=AA=E7=A8=8E=E6=89=A3=E7=BC=B4?= =?UTF-8?q?=E4=B9=89=E5=8A=A1=E4=BA=BA=E8=BF=9B=E8=A1=8C=E5=8E=BB=E9=87=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/service/impl/SISchemeServiceImpl.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index e8c454de5..56c6a6b17 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -1226,6 +1226,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); @@ -1239,6 +1243,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); @@ -1252,6 +1260,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); @@ -1260,6 +1272,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); //分批批量删除 From 014190f6d0d9c1c0e5a704aca7b5e6232f0b5b52 Mon Sep 17 00:00:00 2001 From: sy Date: Mon, 5 Dec 2022 10:09:43 +0800 Subject: [PATCH 23/28] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-?= =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E8=A1=A5=E7=BC=B4?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=9F=A5=E8=AF=A2=E4=BC=98=E5=8C=96=EF=BC=8C?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=BC=B4=E7=BA=B3=E7=8A=B6=E6=80=81=E7=AD=9B?= =?UTF-8?q?=E9=80=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../salary/mapper/siaccount/InsuranceAccountDetailMapper.java | 2 -- .../salary/mapper/siaccount/InsuranceAccountDetailMapper.xml | 1 + 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 6c2643c6a..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; diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index b11229c8b..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