diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 342478fee..9d9b6c98d 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -37,7 +37,9 @@ import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper; import com.engine.salary.mapper.siaccount.SIAccountDetailTempMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; +import com.engine.salary.service.SalaryEmployeeService; import com.engine.salary.service.TaxAgentService; +import com.engine.salary.service.impl.SalaryEmployeeServiceImpl; import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryDateUtil; @@ -78,6 +80,10 @@ public class SIAccountBiz extends Service { return ServiceUtil.getService(TaxAgentServiceImpl.class, user); } + private SalaryEmployeeService getSalaryEmployeeService() { + return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user); + } + private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() { return SqlProxyHandle.getProxy(InsuranceAccountBatchMapper.class); } @@ -155,7 +161,8 @@ public class SIAccountBiz extends Service { public void account(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { Long paymentOrganization = param.getPaymentOrganization(); - List employeeIds = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), paymentOrganization); +// List employeeIds = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), paymentOrganization); + List employeeIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(paymentOrganization); if (CollectionUtils.isEmpty(employeeIds)) { List list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), paymentOrganization)); @@ -195,10 +202,33 @@ public class SIAccountBiz extends Service { public void doAccounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { try { List ids; + List validIds = new ArrayList<>(); if (CollectionUtils.isEmpty(param.getIds())) { // 需要分权的情况 // if(getTaxAgentService().isOpenDevolution()) { - ids = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); + List empIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(param.getPaymentOrganization()); + + List socials = siArchivesBiz.getSocialByEmployeeIds(empIds); + List emp1 = socials.stream().filter(s -> StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getSocialEndTime())) <= 0)) + .map(InsuranceArchivesSocialSchemePO::getEmployeeId) + .collect(Collectors.toList()); + + List funds = siArchivesBiz.getFundByEmployeeIds(empIds); + List emp2 = funds.stream().filter(s -> StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getFundEndTime())) <= 0)) + .map(InsuranceArchivesFundSchemePO::getEmployeeId) + .collect(Collectors.toList()); + + List others = siArchivesBiz.getOtherByEmployeeIds(empIds); + List emp3 = others.stream().filter(s -> StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime()) != null && SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").compareTo(SalaryDateUtil.stringToDate(s.getOtherEndTime())) <= 0)) + .map(InsuranceArchivesOtherSchemePO::getEmployeeId) + .collect(Collectors.toList()); + validIds.addAll(emp1); + validIds.addAll(emp2); + validIds.addAll(emp3); + + List finalValidIds = validIds.stream().distinct().collect(Collectors.toList()); + ids = empIds.stream().filter(finalValidIds::contains).collect(Collectors.toList()); + // } else { // ids = getInsuranceAccountDetailMapper().selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), null); // } @@ -247,7 +277,7 @@ public class SIAccountBiz extends Service { public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque results,*/ String billMonth, List ids, Long employeeId, String tenantKey, Long paymentOrganization) { /* try {*/ SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); - Map insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, tenantKey); + Map insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids); List list = new ArrayList<>(); int count = 0; for (Map.Entry entry : insuranceArchivesAccountPOS.entrySet()) { @@ -854,7 +884,7 @@ public class SIAccountBiz extends Service { */ public String accountSupplement(List baseList, List employeeIds, String billMonth, Long employeeId) { //(k,v) k-员工id v-员工对应的福利档案数据 - Map longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + Map longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds); //核算结果集 List pos = new ArrayList<>(); baseList.forEach(baseParam -> { diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 1f529529a..ba377fb74 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -39,9 +39,11 @@ import com.engine.salary.mapper.siarchives.SocialSchemeMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; +import com.engine.salary.mapper.taxagent.TaxAgentMapper; import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryFormItemUtil; +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; @@ -70,9 +72,13 @@ import java.util.stream.Collectors; @Slf4j public class SIArchivesBiz { - Boolean needAuth ; + Boolean needAuth; Collection taxAgentPOS; + private TaxAgentMapper getTaxAgentMapper() { + return MapperProxyFactory.getProxy(TaxAgentMapper.class); + } + /** * @param welfareType * @param employeeId @@ -318,7 +324,7 @@ public class SIArchivesBiz { List insuranceSchemeDetailPOS = insuranceSchemeDetailMapper.queryListByPrimaryIdIsPayment(schemeId, IsPaymentEnum.YES.getValue(), welfareType); InsuranceSchemeDetailPOEncrypt.decryptList(insuranceSchemeDetailPOS); return insuranceSchemeDetailPOS; - }finally { + } finally { sqlSession.close(); } } @@ -356,7 +362,7 @@ public class SIArchivesBiz { InsuranceArchivesOtherSchemeDTO data = InsuranceArchivesBO.convertOtherPOtoDTO(insuranceArchivesOtherSchemePO, employeeId); if (insuranceArchivesOtherSchemePO == null) { data.setEmployeeId(employeeId); - data.setUnderTake(UndertakerEnum.SCOPE_PERSON); + data.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue().toString()); } return data; } finally { @@ -383,7 +389,7 @@ public class SIArchivesBiz { InsuranceArchivesFundSchemeDTO data = InsuranceArchivesBO.convertFundPOtoDTO(insuranceArchivesFundSchemePO, employeeId); if (insuranceArchivesFundSchemePO == null) { data.setEmployeeId(employeeId); - data.setUnderTake(UndertakerEnum.SCOPE_PERSON); + data.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue().toString()); } return data; } finally { @@ -404,7 +410,7 @@ public class SIArchivesBiz { InsuranceArchivesSocialSchemeDTO data = InsuranceArchivesBO.convertSocialPOtoDTO(insuranceArchivesSocialSchemePO, employeeId); if (insuranceArchivesSocialSchemePO == null) { data.setEmployeeId(employeeId); - data.setUnderTake(UndertakerEnum.SCOPE_PERSON); + data.setUnderTake(UndertakerEnum.SCOPE_PERSON.getValue().toString()); } return data; } @@ -422,7 +428,7 @@ public class SIArchivesBiz { SocialSchemeMapper socialSchemeMapper = sqlSession.getMapper(SocialSchemeMapper.class); List socialList = socialSchemeMapper.getSocialByEmployeeId(Collections.singletonList(employeeId)); InsuranceArchivesSocialSchemePOEncrypt.decryptList(socialList); - return socialList.size() != 0 ? socialList.get(0) : null; + return socialList.size() != 0 ? socialList.get(0) : null; } finally { sqlSession.close(); } @@ -518,7 +524,7 @@ public class SIArchivesBiz { InsuranceArchivesOtherSchemePO.builder() .otherSchemeId(param.getOtherName()) .otherStartTime(param.getOtherStartTime()) - .underTake(param.getUnderTake().getValue()) + .underTake(param.getUnderTake()) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .welfareType(paramReq.getWelfareType().getValue()) .otherEndTime(param.getOtherEndTime()) @@ -565,7 +571,7 @@ public class SIArchivesBiz { .nonPayment(param.getNonPayment()) .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) - .underTake(param.getUnderTake().getValue()) + .underTake(param.getUnderTake()) .paymentOrganization(param.getPaymentOrganization()) .updateTime(new Date()) .welfareType(paramReq.getWelfareType().getValue()) @@ -610,7 +616,7 @@ public class SIArchivesBiz { .tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY) .employeeId(param.getEmployeeId()) .updateTime(new Date()) - .underTake(param.getUnderTake().getValue()) + .underTake(param.getUnderTake()) .socialAccount(param.getSchemeAccount()) .paymentOrganization(param.getPaymentOrganization()) .build(); @@ -699,14 +705,11 @@ public class SIArchivesBiz { PageInfo pageInfo = new PageInfo<>(InsuranceArchivesEmployeePO.class); if (needAuth) { Collection taxAgentEmployeeIds = param.getTaxAgentEmployeeIds(); - log.info("taxAgentEmployeeIds: ", taxAgentEmployeeIds); page = socialSchemeMapper.queryEmployeeList(param); - log.info("page size: ", page.size()); page = page.stream().filter(f -> // 作为管理员 taxAgentEmployeeIds.contains(f.getEmployeeId()) ).collect(Collectors.toList()); - log.info("page collect size: ", page.size()); // 填充总数和当页数据 // 分页参数 pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(), InsuranceArchivesEmployeePO.class); @@ -760,6 +763,7 @@ public class SIArchivesBiz { WeaTableColumn nameColumn = new WeaTableColumn("100px", "姓名", "employeeName"); nameColumn.setFixed("left"); list.add(nameColumn); + list.add(new WeaTableColumn("150px", "个税扣缴义务人", "paymentOrganizationName")); list.add(new WeaTableColumn("150px", "部门", "departmentName")); list.add(new WeaTableColumn("150px", "手机号", "mobile")); list.add(new WeaTableColumn("150px", "员工状态", "status")); @@ -886,6 +890,10 @@ public class SIArchivesBiz { * @return */ public List> buildTableData(List insuranceArchivesEmployeePOS) { + List taxAgentPOS = getTaxAgentMapper().listAll(); + Map longTaxAgentPOMap = SalaryEntityUtil.convert2Map(taxAgentPOS, TaxAgentPO::getId); + + SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); List> records = new ArrayList<>(); try { @@ -896,7 +904,7 @@ public class SIArchivesBiz { List employeeIds = insuranceArchivesEmployeePOS.stream().map(InsuranceArchivesEmployeePO::getEmployeeId).collect(Collectors.toList()); Map socialSchemePOMap = InsuranceArchivesSocialSchemePOEncrypt.decryptList(this.getSocialByEmployeeIds(employeeIds)) - .stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); + .stream().collect(Collectors.toMap(InsuranceArchivesSocialSchemePO::getEmployeeId, Function.identity())); Map fundSchemePOMap = InsuranceArchivesFundSchemePOEncrypt.decryptList(this.getFundByEmployeeIds(employeeIds)) .stream().collect(Collectors.toMap(InsuranceArchivesFundSchemePO::getEmployeeId, Function.identity())); @@ -910,6 +918,7 @@ public class SIArchivesBiz { InsuranceArchivesOtherSchemePO otherItem = otherSchemePOMap.get(item.getEmployeeId()); Map map = new HashMap<>(); map.put("employeeName", item.getUserName()); + map.put("paymentOrganizationName", longTaxAgentPOMap.get(item.getPaymentOrganization()) != null ? longTaxAgentPOMap.get(item.getPaymentOrganization()).getName() : ""); map.put("employeeId", item.getEmployeeId()); map.put("departmentName", item.getDepartmentName()); map.put("departmentId", item.getDepartmentId()); @@ -1117,11 +1126,10 @@ public class SIArchivesBiz { /** * 组装员工的社保,公积金,其他福利数据 * - * @param ids 员工id集合 - * @param tenantKey 租户key + * @param ids 员工id集合 * @return map */ - public Map buildBatchAccount(List ids, String tenantKey) { + public Map buildBatchAccount(List ids) { if (CollectionUtils.isEmpty(ids)) { return new HashMap<>(); } @@ -1153,8 +1161,6 @@ public class SIArchivesBiz { } - - private List decryptSchemeDetailList(List encryptList) { encryptList.forEach(item -> { item.setUpperLimit(AESEncryptUtil.decrypt(item.getUpperLimit())); diff --git a/src/com/engine/salary/entity/siarchives/bo/InsuranceArchivesBO.java b/src/com/engine/salary/entity/siarchives/bo/InsuranceArchivesBO.java index c7d3a429b..97d34d429 100644 --- a/src/com/engine/salary/entity/siarchives/bo/InsuranceArchivesBO.java +++ b/src/com/engine/salary/entity/siarchives/bo/InsuranceArchivesBO.java @@ -6,7 +6,6 @@ import com.engine.salary.entity.siarchives.dto.InsuranceArchivesSocialSchemeDTO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import com.engine.salary.util.SalaryEnumUtil; @@ -35,7 +34,7 @@ public class InsuranceArchivesBO { .socialStartTime(po.getSocialStartTime()) .schemeAccount(po.getSocialAccount()) .schemePaymentBaseString(po.getSocialPaymentBaseString()) - .underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class)) + .underTake(po.getUnderTake() + "") .build(); } @@ -55,7 +54,7 @@ public class InsuranceArchivesBO { .fundStartTime(po.getFundStartTime()) .supplementFundAccount(po.getSupplementFundAccount()) .nonPayment(po.getNonPayment()) - .underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class)) + .underTake(po.getUnderTake() + "") .welfareType(SalaryEnumUtil.enumMatchByValue(po.getWelfareType(), WelfareTypeEnum.values(), WelfareTypeEnum.class)) .build(); } @@ -67,7 +66,7 @@ public class InsuranceArchivesBO { return InsuranceArchivesOtherSchemeDTO.builder() .id(po.getId()) .employeeId(po.getEmployeeId()) - .underTake(SalaryEnumUtil.enumMatchByValue(po.getUnderTake(), UndertakerEnum.values(), UndertakerEnum.class)) + .underTake(po.getUnderTake() + "") .nonPayment(po.getNonPayment()) .otherName(po.getOtherSchemeId() == null ? null : String.valueOf(po.getOtherSchemeId())) .otherSchemeId(po.getOtherSchemeId()) diff --git a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesFundSchemeDTO.java b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesFundSchemeDTO.java index a0ee1c7a9..3a4995408 100644 --- a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesFundSchemeDTO.java +++ b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesFundSchemeDTO.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.siarchives.dto; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -62,7 +61,7 @@ public class InsuranceArchivesFundSchemeDTO { //private List paymentOrganizationList; // 公积金个人实际承担方 - private UndertakerEnum underTake; + private String underTake; //缴纳基数 private String fundPaymentBaseString; diff --git a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesOtherSchemeDTO.java b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesOtherSchemeDTO.java index 21b2867ec..226548db2 100644 --- a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesOtherSchemeDTO.java +++ b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesOtherSchemeDTO.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.siarchives.dto; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -53,7 +52,7 @@ public class InsuranceArchivesOtherSchemeDTO { //private List paymentOrganizationList; //其他福利个人实际承担方 - private UndertakerEnum underTake; + private String underTake; private String otherPaymentBaseString; diff --git a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesSocialSchemeDTO.java b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesSocialSchemeDTO.java index a8c70c9a8..b3cd6d1bd 100644 --- a/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesSocialSchemeDTO.java +++ b/src/com/engine/salary/entity/siarchives/dto/InsuranceArchivesSocialSchemeDTO.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.siarchives.dto; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -54,8 +53,8 @@ public class InsuranceArchivesSocialSchemeDTO { //private List paymentOrganizationList; - //社保个人实际承担方 - private UndertakerEnum underTake; + //社保个人实际承担方 UndertakerEnum + private String underTake; //社保缴纳基数 private String schemePaymentBaseString; diff --git a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesFundSaveParam.java b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesFundSaveParam.java index fec8a8437..f723f7ea3 100644 --- a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesFundSaveParam.java +++ b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesFundSaveParam.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.siarchives.param; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -52,7 +51,7 @@ public class InsuranceArchivesFundSaveParam { private Long paymentOrganization; //公积金个人实际承担方 - private UndertakerEnum underTake; + private Integer underTake; //公积金基数jsonString private String paymentForm; diff --git a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesOtherSaveParam.java b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesOtherSaveParam.java index 1c93c9675..7244adb58 100644 --- a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesOtherSaveParam.java +++ b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesOtherSaveParam.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.siarchives.param; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -47,7 +46,7 @@ public class InsuranceArchivesOtherSaveParam { private Long paymentOrganization; //其他福利个人实际承担方 - private UndertakerEnum underTake; + private Integer underTake; //其他福利基数jsonString private String paymentForm; diff --git a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesSocialSaveParam.java b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesSocialSaveParam.java index e011b900f..f174d6730 100644 --- a/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesSocialSaveParam.java +++ b/src/com/engine/salary/entity/siarchives/param/InsuranceArchivesSocialSaveParam.java @@ -1,6 +1,5 @@ package com.engine.salary.entity.siarchives.param; -import com.engine.salary.enums.sicategory.UndertakerEnum; import com.engine.salary.enums.sicategory.WelfareTypeEnum; import lombok.AllArgsConstructor; import lombok.Builder; @@ -51,7 +50,7 @@ public class InsuranceArchivesSocialSaveParam { private Long paymentOrganization; //社保个人实际承担方 - private UndertakerEnum underTake; + private Integer underTake; //基数jsonString private String paymentForm; diff --git a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java index e12cde01f..4d75656e6 100644 --- a/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java +++ b/src/com/engine/salary/entity/siarchives/po/InsuranceArchivesEmployeePO.java @@ -22,6 +22,11 @@ import java.util.Date; public class InsuranceArchivesEmployeePO { private Long employeeId;//员工id + /** + * 缴纳组织 + */ + private Long paymentOrganization; + private String userName; private BigDecimal departmentId; diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index f29d72cbb..ff7a56b9d 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -31,6 +31,14 @@ public interface InsuranceAccountDetailMapper { */ List selectAccountIds(@Param("time") String time,@Param("paymentOrganization") Long paymentOrganization); + + /** + * 根据缴纳组织获取员工id + * @param paymentOrganization + * @return + */ + List selectEmpByPaymentOrg(@Param("paymentOrganization") Long paymentOrganization); + /** * 根据id删除 * @param id diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 1b2475793..510ef8fb6 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -50,7 +50,9 @@ - t.id + t + . + id , t.employee_id , e.status as employee_status , t.bill_month @@ -97,7 +99,7 @@ , t.payment_organization - + AND t.bill_month = #{param.billMonth} @@ -124,7 +126,7 @@ AND ( - e.lastname like '%'||#{param.userName}||'%' + e.lastname like '%'||#{param.userName}||'%' ) @@ -138,7 +140,6 @@ - SELECT DISTINCT a.ID FROM ( - SELECT t.ID, - social.social_start_time, - social.social_end_time, - fund.fund_start_time, - fund.fund_end_time, - other.other_start_time, - other.other_end_time - FROM ( - SELECT e.ID - FROM hrmresource e + SELECT t.ID, + social.social_start_time, + social.social_end_time, + fund.fund_start_time, + fund.fund_end_time, + other.other_start_time, + other.other_end_time + FROM ( + SELECT e.ID + FROM hrmresource e LEFT JOIN (SELECT t.* FROM @@ -209,134 +210,142 @@ log.dismissdate FROM bill_hrmdismiss log ) t) l - ON e.ID = l.resource_n - WHERE( - e.status != '5' - and (e.accounttype is null or e.accounttype = 0) - OR l.dismissdate IS NULL - OR l.dismissdate = '' - OR l.dismissdate - > #{time} - ) - ) t - LEFT JOIN hrsa_social_archives social ON t.ID = social.employee_id - LEFT JOIN hrsa_fund_archives fund ON t.ID = fund.employee_id - LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id - WHERE ( - fund.delete_type = 0 and - fund.fund_start_time IS NOT NULL AND fund.fund_start_time != '' + ON e.ID = l.resource_n + WHERE( + e.status != '5' + and (e.accounttype is null or e.accounttype = 0) + OR l.dismissdate IS NULL + OR l.dismissdate = '' + OR l.dismissdate + > #{time} + ) + ) t + LEFT JOIN hrsa_social_archives social ON t.ID = social.employee_id + LEFT JOIN hrsa_fund_archives fund ON t.ID = fund.employee_id + LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id + WHERE ( + fund.delete_type = 0 and + fund.fund_start_time IS NOT NULL AND fund.fund_start_time != '' AND( fund.fund_end_time IS NULL OR fund.fund_end_time = '' OR fund.fund_end_time > #{time} - ) - ) - OR ( + ) + ) + OR ( social.delete_type = 0 and - social.social_start_time IS NOT NULL AND social.social_start_time != '' - - AND --- 个税扣缴义务人 - social.payment_organization = #{paymentOrganization} - + social.social_start_time IS NOT NULL AND social.social_start_time != '' + + AND + -- 个税扣缴义务人 + social.payment_organization = #{paymentOrganization} + AND( social.social_end_time IS NULL OR social.social_end_time = '' OR social.social_end_time > #{time} - ) - ) - OR ( - other.delete_type = 0 and - other.other_start_time IS NOT NULL AND other.other_start_time != '' + ) + ) + OR ( + other.delete_type = 0 and + other.other_start_time IS NOT NULL AND other.other_start_time != '' AND( other.other_end_time IS NULL OR other.other_end_time = '' OR other.other_end_time > #{time} - ) - ) - ) a + ) + ) + ) a - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + UPDATE hrsa_bill_detail SET delete_type = 1 WHERE id = #{id} - AND delete_type = 0 + AND delete_type = 0 - DELETE + DELETE FROM hrsa_bill_detail - WHERE delete_type = 0 - AND bill_month = #{billMonth} - AND bill_status = 0 - - AND payment_organization = #{paymentOrganization} - + WHERE delete_type = 0 + AND bill_month = #{billMonth} + AND bill_status = 0 + + AND payment_organization = #{paymentOrganization} + @@ -385,10 +394,10 @@ AND bill_month = #{billMonth} AND payment_organization = #{paymentOrganization} - AND employee_id IN - - #{employeeId} - + AND employee_id IN + + #{employeeId} + @@ -405,7 +414,7 @@ - INSERT INTO hrsa_bill_detail + INSERT INTO hrsa_bill_detail (employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, @@ -459,7 +468,7 @@ - INSERT INTO hrsa_bill_detail + INSERT INTO hrsa_bill_detail (employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, @@ -513,12 +522,12 @@ - INSERT INTO hrsa_bill_detail - (employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, - fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, - social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, - com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) - VALUES + INSERT INTO hrsa_bill_detail + (employee_id,bill_month,bill_status,payment_status,supplementary_month,resource_from,social_pay_org,social_account,social_scheme_id,social_payment_base_string, + fund_pay_org,fund_account,supplement_fund_account,fund_scheme_id,fund_payment_base_string,other_pay_org,other_scheme_id,other_payment_base_string,social_per_json, + social_per_sum,fund_per_json,fund_per_sum,other_per_json,other_per_sum,per_sum,social_com_json,social_com_sum,fund_com_json,fund_com_sum,other_com_json,other_com_sum, + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) + VALUES ( #{item.employeeId}, #{item.billMonth}, diff --git a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml index 7016df035..e4d97f2da 100644 --- a/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml +++ b/src/com/engine/salary/mapper/siarchives/SocialSchemeMapper.xml @@ -305,6 +305,7 @@ a.hiredate, l.dimissionDate, social.siSchemeId, + social.paymentOrganization, fund.fundSchemeId, other.otherSchemeId FROM @@ -334,7 +335,8 @@ LEFT JOIN( SELECT social.employee_id, - social.social_scheme_id AS siSchemeId + social.social_scheme_id AS siSchemeId, + social.payment_organization AS paymentOrganization FROM hrsa_social_archives social WHERE social.delete_type = 0 diff --git a/src/com/engine/salary/service/SalaryEmployeeService.java b/src/com/engine/salary/service/SalaryEmployeeService.java index a1c15cc0a..445ccb0b9 100644 --- a/src/com/engine/salary/service/SalaryEmployeeService.java +++ b/src/com/engine/salary/service/SalaryEmployeeService.java @@ -29,10 +29,25 @@ public interface SalaryEmployeeService { */ List listBySalarySobId(Long salarySobId); + /** + * 获取人员信息 + * @param ids + * @return 全量 + */ List listByIds(List ids); + /** + * 获取人员信息 + * @param employeeId + * @return 全量 + */ DataCollectionEmployee getEmployeeById(Long employeeId); + /** + * 获取人员信息 + * @param simpleEmployeeIds + * @return 简单 + */ List getEmployeeByIds(List simpleEmployeeIds); /** diff --git a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java index a1ccda24c..d3a9bef18 100644 --- a/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/ColumnBuildServiceImpl.java @@ -3,8 +3,8 @@ package com.engine.salary.service.impl; import com.alibaba.fastjson.JSON; import com.cloudstore.eccom.constant.WeaBoolAttr; import com.cloudstore.eccom.pc.table.WeaTableColumn; +import com.engine.core.impl.Service; import com.engine.salary.biz.SIArchivesBiz; -import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesAccountPO; @@ -18,7 +18,6 @@ import com.engine.salary.service.ColumnBuildService; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.lang3.StringUtils; -import com.engine.core.impl.Service; import java.util.*; import java.util.stream.Collectors; @@ -267,7 +266,7 @@ public class ColumnBuildServiceImpl extends Service implements ColumnBuildServic List list = new ArrayList<>(); SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); List employeeIds = pos.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList()); - Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds); Map categoryIdNameMap = MapperProxyFactory.getProxy(ICategoryMapper.class).listAll().stream().collect(Collectors.toMap(ICategoryPO -> String.valueOf(ICategoryPO.getId()), ICategoryPO::getInsuranceName)); Map> columns = buildInspectTableTitle(new ArrayList<>(insuranceArchivesAccountPOMap.values()), categoryIdNameMap); WeaTableColumn weaTableNameColumn = new WeaTableColumn("150px",SalaryI18nUtil.getI18nLabel( 85429, "姓名"), "userName"); diff --git a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java index a64cd58bb..1bda3d56e 100644 --- a/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java +++ b/src/com/engine/salary/service/impl/RecordsBuildServiceImpl.java @@ -1,8 +1,8 @@ package com.engine.salary.service.impl; import com.alibaba.fastjson.JSON; +import com.engine.core.impl.Service; import com.engine.salary.biz.SIArchivesBiz; -import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; @@ -18,7 +18,6 @@ import com.engine.salary.mapper.TaxAgentMapper; import com.engine.salary.mapper.datacollection.EmployMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper; import com.engine.salary.service.RecordsBuildService; -import com.engine.core.impl.Service; import com.engine.salary.util.*; import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.collections4.CollectionUtils; @@ -167,7 +166,7 @@ public class RecordsBuildServiceImpl extends Service implements RecordsBuildServ return result; } Map collect = employeeByIds.stream().collect(Collectors.toMap(DataCollectionEmployee::getEmployeeId, Function.identity())); - Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + Map insuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds); list.forEach(item -> { Map record = new HashMap<>(); DataCollectionEmployee simpleEmployee = collect.get(item.getEmployeeId()) == null ? new DataCollectionEmployee() : collect.get(item.getEmployeeId()); diff --git a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java index c459e54bc..00d3ba70c 100644 --- a/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIArchivesServiceImpl.java @@ -18,6 +18,7 @@ import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryI18nUtil; import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.excel.ExcelUtil; +import org.apache.commons.lang3.StringUtils; import org.apache.poi.xssf.usermodel.XSSFWorkbook; import weaver.general.Util; import weaver.hrm.User; @@ -67,7 +68,12 @@ public class SIArchivesServiceImpl extends Service implements SIArchivesService SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); WelfareTypeEnum welfareTypeEnum = (WelfareTypeEnum) params.get("welfareTypeEnum"); Long employeeId = Long.valueOf(Util.null2String(params.get("employeeId"))); - Long schemeId = Long.valueOf(Util.null2String(params.get("schemeId"))); + String schemeIdStr = Util.null2String(params.get("schemeId")); + Long schemeId = null; + if (StringUtils.isNotBlank(schemeIdStr)) { + schemeId = Long.valueOf(schemeIdStr); + } + apidatas = siArchivesBiz.getPaymentForm(user, welfareTypeEnum, employeeId, (long) user.getUID(), schemeId); return apidatas; } diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index e85b7dae1..014199984 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -704,6 +704,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { errorMessageMap.put("message", rowIndex + "员工信息不存在"); excelComments.add(errorMessageMap); isError = true; + return isError; } else { //含在职和离职,选在职数据 if (employees.size() > 1) { @@ -745,14 +746,19 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { //社保缴纳组织=个税扣缴义务人 String paymentOrg = (String) paymentMap.get("社保缴纳组织"); - if (!paymentNameIdMap.containsKey(paymentOrg)) { + if (StringUtils.isBlank(paymentOrg)) { + Map errorMessageMap = Maps.newHashMap(); + errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "社保缴纳组织不能为空")); + excelComments.add(errorMessageMap); + isError = true; + }else if (!paymentNameIdMap.containsKey(paymentOrg)) { Map errorMessageMap = Maps.newHashMap(); errorMessageMap.put("message", rowIndex + SalaryI18nUtil.getI18nLabel(100312, "社保缴纳组织应和个税扣缴义务人名称一致,社保缴纳组织不存在或不在权限范围内")); excelComments.add(errorMessageMap); isError = true; } - if (openDevolution) { + if (openDevolution && !isError) { Long paymentOrgId = paymentNameIdMap.get(paymentOrg); TaxAgentManageRangeEmployeeDTO taxAgentManageRangeEmployeeDTO = taxAgentManageRangeEmployeeTree.stream().filter(tax -> tax.getTaxAgentId().equals(paymentOrgId)).findFirst().get(); Optional o = taxAgentManageRangeEmployeeDTO.getEmployeeList().stream().map(TaxAgentManageRangeEmployeeDTO.TaxAgentEmployee::getEmployeeId).filter(e -> e.equals(employeeId)).findFirst(); diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index 1115046aa..f3f42472b 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -4,7 +4,6 @@ import com.engine.common.service.HrmCommonService; import com.engine.common.service.impl.HrmCommonServiceImpl; import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; -import com.engine.salary.biz.SalaryRoleBiz; import com.engine.salary.constant.SalaryAuthConstant; import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt; import com.engine.salary.encrypt.datacollection.AddUpSituationEncrypt; @@ -59,8 +58,6 @@ import java.util.stream.Collectors; @Slf4j public class TaxAgentServiceImpl extends Service implements TaxAgentService { - // private ExtEmployeeService extEmployeeService; - SalaryRoleBiz salaryRoleBiz = new SalaryRoleBiz(); private TaxAgentBaseService getTaxAgentBaseService(User user) { return ServiceUtil.getService(TaxAgentBaseServiceImpl.class, user); @@ -71,9 +68,6 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { } private TaxAgentSubAdminService taxAgentSubAdminService; -// private TaxAgentSubAdminService getTaxAgentSubAdminService(User user) { -// return ServiceUtil.getService(TaxAgentSubAdminServiceImpl.class, user); -// } private TaxAgentManageRangeService getTaxAgentManageRangeService(User user) { return ServiceUtil.getService(TaxAgentManageRangeServiceImpl.class, user); @@ -84,9 +78,6 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { } private TaxAgentSubAdminEmpService taxAgentSubAdminEmpService; -// private TaxAgentSubAdminEmpService getTaxAgentSubAdminEmpService(User user) { -// return ServiceUtil.getService(TaxAgentSubAdminEmpServiceImpl.class, user); -// } private HrmCommonService getHrmCommonService(User user) { return ServiceUtil.getService(HrmCommonServiceImpl.class, user);