From 746ab58ed32ffff28268eaf4ff8ef4e452f2e1c8 Mon Sep 17 00:00:00 2001 From: sy Date: Fri, 18 Nov 2022 16:07:20 +0800 Subject: [PATCH] =?UTF-8?q?=E8=96=AA=E9=85=AC=E7=B3=BB=E7=BB=9F-=E7=A6=8F?= =?UTF-8?q?=E5=88=A9=E5=8F=B0=E8=B4=A6=EF=BC=8C=E9=80=80=E5=B7=AE=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E5=8D=95=E6=9D=A1=E6=9F=A5=E7=9C=8Bv2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../InsuranceAccountDetailPOEncrypt.java | 24 +++ .../InsuranceAccountDetailMapper.java | 5 + .../InsuranceAccountDetailMapper.xml | 10 ++ .../salary/service/SIAccountService.java | 5 + .../service/impl/SIAccountServiceImpl.java | 168 +++++++----------- .../salary/web/SIAccountController.java | 17 ++ 6 files changed, 122 insertions(+), 107 deletions(-) diff --git a/src/com/engine/salary/encrypt/siaccount/InsuranceAccountDetailPOEncrypt.java b/src/com/engine/salary/encrypt/siaccount/InsuranceAccountDetailPOEncrypt.java index bed2885a3..841140839 100644 --- a/src/com/engine/salary/encrypt/siaccount/InsuranceAccountDetailPOEncrypt.java +++ b/src/com/engine/salary/encrypt/siaccount/InsuranceAccountDetailPOEncrypt.java @@ -107,5 +107,29 @@ public class InsuranceAccountDetailPOEncrypt { return item; } + public static InsuranceAccountDetailPO encryptItem(InsuranceAccountDetailPO item) { + if(item == null) { + return item; + } + item.setSocialPaymentBaseString(AESEncryptUtil.encrypt(item.getSocialPaymentBaseString())); + item.setFundPaymentBaseString(AESEncryptUtil.encrypt(item.getFundPaymentBaseString())); + item.setOtherPaymentBaseString(AESEncryptUtil.encrypt(item.getOtherPaymentBaseString())); + item.setSocialPerJson(AESEncryptUtil.encrypt(item.getSocialPerJson())); + item.setSocialPerSum(AESEncryptUtil.encrypt(item.getSocialPerSum())); + item.setFundPerJson(AESEncryptUtil.encrypt(item.getFundPerJson())); + item.setFundPerSum(AESEncryptUtil.encrypt(item.getFundPerSum())); + item.setOtherPerJson(AESEncryptUtil.encrypt(item.getOtherPerJson())); + item.setOtherPerSum(AESEncryptUtil.encrypt(item.getOtherPerSum())); + item.setPerSum(AESEncryptUtil.encrypt(item.getPerSum())); + item.setSocialComJson(AESEncryptUtil.encrypt(item.getSocialComJson())); + item.setSocialComSum(AESEncryptUtil.encrypt(item.getSocialComSum())); + item.setComSum(AESEncryptUtil.encrypt(item.getComSum())); + item.setSocialSum(AESEncryptUtil.encrypt(item.getSocialSum())); + item.setFundSum(AESEncryptUtil.encrypt(item.getFundSum())); + item.setOtherSum(AESEncryptUtil.encrypt(item.getOtherSum())); + item.setTotal(AESEncryptUtil.encrypt(item.getTotal())); + return item; + } + } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 7d2c97d53..360511fee 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -26,6 +26,11 @@ public interface InsuranceAccountDetailMapper { */ List list(@Param("param") InsuranceAccountDetailParam queryParam); + /** + * 通过id查询 + */ + InsuranceAccountDetailPO getById(@Param("id") Long id); + /** * 根据账单月份获取所有员工 * diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 029e8486c..09dcdab8e 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -1144,4 +1144,14 @@ + + \ No newline at end of file diff --git a/src/com/engine/salary/service/SIAccountService.java b/src/com/engine/salary/service/SIAccountService.java index ddebc102a..710b5f8cb 100644 --- a/src/com/engine/salary/service/SIAccountService.java +++ b/src/com/engine/salary/service/SIAccountService.java @@ -245,5 +245,10 @@ public interface SIAccountService { */ Map importExcelInsuranceDetail(ExcelInsuranceImportParam excelInsuranceImportParam); + /** + * 将通过id获取InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据 + */ + Map getPaymentById(Long id); + } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 18ccbca35..49077b9fb 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -2140,112 +2140,66 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return excelInsuranceDetailPO; } -// @Override -// public InsuranceSupplementListFoldDTO getPaymentById(Long id) { -// InsuranceSupplementListFoldDTO result = new InsuranceSupplementListFoldDTO(); -// WeaTable weaTable = new WeaTable<>(); -// EditableTable editableTable = new EditableTable<>(weaTable); -// editableTable.setColumns(InsuranceArchivesBO.buildCompensationEditTableColumns(employeeId, tenantKey)); -// editableTable.setComProps(InsuranceArchivesBO.buildSupplementEditTableItemMap()); -// editableTable.setShowCheck(false); -// editableTable.setEllipsis(true); -// result.setEditableTable(editableTable); -// InsuranceAccountDetailPO insuranceAccountDetailPO = new LambdaQueryChainWrapper<>(siAccountDetailMapper) -// .eq(InsuranceAccountDetailPO::getId, id) -// .one(); -// SalaryAssert.notNull(insuranceAccountDetailPO, SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 139811, "人员不存在")); -// insuranceAccountDetailPO = (InsuranceAccountDetailPO) dataSecurityService.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class, tenantKey); -// Map> group = new HashMap<>(); -// //组装社保数据 -// Set socialInsuranceIds = new HashSet<>(); -// String socialPerJson = insuranceAccountDetailPO.getSocialPerJson(); -// HashMap socialPerMap = new HashMap<>(); -// if (StringUtils.isNotBlank(socialPerJson)) { -// socialPerMap = JSON.parseObject(socialPerJson, new HashMap().getClass()); -// socialPerMap.forEach((k, v) -> socialInsuranceIds.add(k)); -// } -// String socialComJson = insuranceAccountDetailPO.getSocialComJson(); -// HashMap socialComMap = new HashMap<>(); -// if (StringUtils.isNotBlank(socialComJson)) { -// socialComMap = JSON.parseObject(socialComJson, new HashMap().getClass()); -// socialComMap.forEach((k, v) -> socialInsuranceIds.add(k)); -// } -// List socialSupplementList = new ArrayList<>(); -// for (String insuranceId : socialInsuranceIds) { -// InsuranceSupplementListDTO dto = new InsuranceSupplementListDTO(); -// dto.setItem(siCategoryService.getCategoryNameById(Long.valueOf(insuranceId), tenantKey)); -// dto.setPaymentPer(socialPerMap.get(insuranceId)); -// dto.setPaymentCom(socialComMap.get(insuranceId)); -// dto.setId(insuranceId); -// socialSupplementList.add(dto); -// } -// group.put("social", socialSupplementList); -// -// //组装公积金数据 -// Set fundInsuranceIds = new HashSet<>(); -// String fundPerJson = insuranceAccountDetailPO.getFundPerJson(); -// HashMap fundperMap = new HashMap<>(); -// if (StringUtils.isNotBlank(fundPerJson)) { -// fundperMap = JSON.parseObject(fundPerJson, new HashMap().getClass()); -// fundperMap.forEach((k, v) -> fundInsuranceIds.add(k)); -// } -// String fundComJson = insuranceAccountDetailPO.getFundComJson(); -// HashMap fundComMap = new HashMap<>(); -// if (StringUtils.isNotBlank(fundComJson)) { -// fundComMap = JSON.parseObject(fundComJson, new HashMap().getClass()); -// fundComMap.forEach((k, v) -> fundInsuranceIds.add(k)); -// } -// List fundSupplementList = new ArrayList<>(); -// for (String insuranceId : fundInsuranceIds) { -// InsuranceSupplementListDTO dto = new InsuranceSupplementListDTO(); -// dto.setItem(siCategoryService.getCategoryNameById(Long.valueOf(insuranceId), tenantKey)); -// dto.setPaymentPer(fundperMap.get(insuranceId)); -// dto.setPaymentCom(fundComMap.get(insuranceId)); -// dto.setId(insuranceId); -// fundSupplementList.add(dto); -// } -// group.put("fund", fundSupplementList); -// -// //组装其他福利数据 -// Set otherInsuranceIds = new HashSet<>(); -// String otherPerJson = insuranceAccountDetailPO.getOtherPerJson(); -// HashMap otherPerMap = new HashMap<>(); -// if (StringUtils.isNotBlank(otherPerJson)) { -// otherPerMap = JSON.parseObject(otherPerJson, new HashMap().getClass()); -// otherPerMap.forEach((k, v) -> otherInsuranceIds.add(k)); -// } -// String otherComJson = insuranceAccountDetailPO.getOtherComJson(); -// HashMap otherComMap = new HashMap<>(); -// if (StringUtils.isNotBlank(otherComJson)) { -// otherComMap = JSON.parseObject(otherComJson, new HashMap().getClass()); -// otherComMap.forEach((k, v) -> otherInsuranceIds.add(k)); -// } -// List otherSupplementList = new ArrayList<>(); -// for (String insuranceId : otherInsuranceIds) { -// InsuranceSupplementListDTO dto = new InsuranceSupplementListDTO(); -// dto.setItem(siCategoryService.getCategoryNameById(Long.valueOf(insuranceId), tenantKey)); -// dto.setPaymentPer(otherPerMap.get(insuranceId)); -// dto.setPaymentCom(otherComMap.get(insuranceId)); -// dto.setId(insuranceId); -// otherSupplementList.add(dto); -// } -// group.put("other", otherSupplementList); -// Map> items = new HashMap<>(); -// Map socialItem = new HashMap<>(); -// socialItem.put("index", "0"); -// socialItem.put("groupName", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86568, "社保")); -// items.put("social", socialItem); -// Map fundItem = new HashMap<>(); -// fundItem.put("index", "1"); -// fundItem.put("groupName", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 86569, "公积金")); -// items.put("fund", fundItem); -// Map otherItem = new HashMap<>(); -// otherItem.put("index", "2"); -// otherItem.put("groupName", SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 93112, "企业年金及其他福利")); -// items.put("other", otherItem); -// result.setItems(items); -// result.setGroup(group); -// return result; -// } + /** + * 将通过id获取InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据 + */ + @Override + public Map getPaymentById(Long id) { + + InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(id); + if (insuranceAccountDetailPO == null) { + throw new SalaryRunTimeException("该条核算数据不存在!"); + } + InsuranceAccountDetailPOEncrypt.decryptItem(insuranceAccountDetailPO); + String socialPerJson = insuranceAccountDetailPO.getSocialPerJson(); + String socialComJson = insuranceAccountDetailPO.getSocialComJson(); + String fundPerJson = insuranceAccountDetailPO.getFundPerJson(); + String fundComJson = insuranceAccountDetailPO.getFundComJson(); + String otherPerJson = insuranceAccountDetailPO.getOtherPerJson(); + String otherComJson = insuranceAccountDetailPO.getOtherComJson(); + + Map dataMap = new HashMap<>(); + List addGroups = new ArrayList<>(); + + getPaymentGroup(socialPerJson, "个人", "社保", dataMap, addGroups); + getPaymentGroup(socialComJson, "公司", "社保", dataMap, addGroups); + getPaymentGroup(fundPerJson, "个人", "公积金", dataMap, addGroups); + getPaymentGroup(fundComJson, "公司", "公积金", dataMap, addGroups); + getPaymentGroup(otherPerJson, "个人", "其他福利", dataMap, addGroups); + getPaymentGroup(otherComJson, "公司", "其他福利", dataMap, addGroups); + + Map resultMap = new HashMap<>(); + resultMap.put("data", dataMap); + resultMap.put("items", addGroups); + + return resultMap; + } + + public void getPaymentGroup(String baseJson, String groupType, String welfareType, Map dataMap, List addGroups) { + + if (StringUtils.isBlank(baseJson)) { + addGroups.add(new SearchConditionGroup(welfareType + groupType +"缴纳", true, null)); + return; + } + + String groupPrefix = "个人".equals(groupType) ? "per" : "com"; + + Map toDealMap = JSON.parseObject(baseJson, new HashMap().getClass()); + Map baseJsonMap = new HashMap<>(); + List inputItems = new ArrayList<>(); + + for (Map.Entry entry : toDealMap.entrySet()) { + //获取福利项信息 + ICategoryPO iCategoryPO = siCategoryBiz.getByID(Long.valueOf(entry.getKey())); + if (iCategoryPO != null) { + String name = groupPrefix + iCategoryPO.getId().toString(); + String label = iCategoryPO.getInsuranceName(); + inputItems.add(SalaryFormItemUtil.inputNumberItem(user, "precision:2", 2, 12, 2, label, name)); + } + baseJsonMap.put(groupPrefix + entry.getKey(), entry.getValue()); + } + dataMap.putAll(baseJsonMap); + addGroups.add(new SearchConditionGroup(welfareType + groupType +"缴纳", true, inputItems)); + } } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 8a06a0256..cbd8da06f 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -654,5 +654,22 @@ public class SIAccountController { User user = HrmUserVarify.getUser(request, response); return new ResponseResult>(user).run(getService(user)::listRecessionPage, insuranceAccountDetailParam); } + + /** + * 通过id获取InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据 + * @param request + * @param response + * @param id + * @return + */ + @GET + @Path("/getPaymentById") + @Produces(MediaType.APPLICATION_JSON) + public String getPaymentById(@Context HttpServletRequest request, @Context HttpServletResponse response, + @QueryParam("id") Long id) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getService(user)::getPaymentById, id); + } + // **********************************退差 end*********************************/ }