From 69edbc63d12fda1aca095b3b4dd1b2b8f134655e Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Wed, 8 Jun 2022 17:52:10 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 29 +++++++++--- .../entity/siaccount/param/AccountParam.java | 2 +- .../siaccount/po/InsuranceAccountBatchPO.java | 1 + .../InsuranceAccountDetailMapper.xml | 4 +- .../salary/service/SIAccountService.java | 3 ++ .../service/impl/SIAccountServiceImpl.java | 45 +++++++++++-------- .../salary/web/SIAccountController.java | 8 ++++ 7 files changed, 64 insertions(+), 28 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 50ecdb12f..b3648c094 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -2,6 +2,7 @@ package com.engine.salary.biz; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; +import com.engine.common.util.ServiceUtil; import com.engine.core.impl.Service; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; @@ -18,6 +19,7 @@ import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO; import com.engine.salary.entity.sicategory.po.ICategoryPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; +import com.engine.salary.entity.taxagent.dto.TaxAgentEmployeeDTO; import com.engine.salary.entity.taxrate.TaxAgent; import com.engine.salary.enums.siaccount.*; import com.engine.salary.enums.sicategory.*; @@ -30,6 +32,8 @@ 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.TaxAgentService; +import com.engine.salary.service.impl.TaxAgentServiceImpl; import com.engine.salary.util.SalaryAssert; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryEntityUtil; @@ -66,6 +70,10 @@ public class SIAccountBiz extends Service { private SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); + private TaxAgentService getTaxAgentService() { + return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + } + public PageInfo listPage(InsuranceAccountBatchParam queryParam, Long employeeId) { SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession(); @@ -112,6 +120,7 @@ public class SIAccountBiz extends Service { .createTime(new Date()) .updateTime(new Date()) .deleteType(DeleteTypeEnum.NOT_DELETED.getValue()) + .paymentOrganization(param.getPaymentOrganization()) .build(); MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).insert(build); // LoggerContext insuranceSchemeContext = new LoggerContext(); @@ -167,7 +176,13 @@ public class SIAccountBiz extends Service { try { List ids; if (CollectionUtils.isEmpty(param.getIds())) { - ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); + // 需要分权的情况 + if(getTaxAgentService().isNeedAuth(employeeId)) { + List taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee((long) user.getUID()); + ids = taxAgentEmployeeDTOS.stream().map(TaxAgentEmployeeDTO::getTaxAgentId).collect(Collectors.toList()); + } else { + ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); + } } else { ids = param.getIds(); } @@ -181,7 +196,7 @@ public class SIAccountBiz extends Service { /* List> partition = Lists.partition(ids, 100); CountDownLatch countDownLatch = new CountDownLatch(partition.size()); BlockingDeque results = new LinkedBlockingDeque<>(partition.size());*/ - commonAccount(/*countDownLatch, results, */param.getBillMonth(), ids, employeeId, tenantKey); + commonAccount(/*countDownLatch, results, */param.getBillMonth(), ids, employeeId, tenantKey, param.getPaymentOrganization()); /* for (List batchIds : partition) { taskExecutor.execute(() -> { commonAccount(countDownLatch, results, param.getBillMonth(), batchIds, simpleEmployee); @@ -209,7 +224,7 @@ public class SIAccountBiz extends Service { } - public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque results,*/ String billMonth, List ids, Long employeeId, String tenantKey) { + 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); @@ -230,6 +245,8 @@ public class SIAccountBiz extends Service { insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.COMMON.getValue()); insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue()); insuranceAccountDetailPO.setTenantKey(tenantKey); + insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization); + //核算社保 accountSocial(insuranceAccountDetailPO, v, tenantKey); //核算公积金 @@ -746,9 +763,9 @@ public class SIAccountBiz extends Service { } public void delete(AccountParam param, Long employeeId) { - if(param.getPaymentOrganization()==null){ - throw new SalaryRunTimeException("个税扣缴义务人为空"); - } +// if(param.getPaymentOrganization()==null){ +// throw new SalaryRunTimeException("个税扣缴义务人为空"); +// } InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth(),param.getPaymentOrganization()); SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(84026, "参数错误")); diff --git a/src/com/engine/salary/entity/siaccount/param/AccountParam.java b/src/com/engine/salary/entity/siaccount/param/AccountParam.java index 74cb238cf..c6695da7c 100644 --- a/src/com/engine/salary/entity/siaccount/param/AccountParam.java +++ b/src/com/engine/salary/entity/siaccount/param/AccountParam.java @@ -39,7 +39,7 @@ public class AccountParam { /** * 个税扣缴义务人id */ - @DataCheck(require = true,message = "个税扣缴义务人不能为空") +// @DataCheck(require = true,message = "个税扣缴义务人不能为空") private Long paymentOrganization; } diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java index 244c1e130..3aec5159e 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java @@ -105,4 +105,5 @@ public class InsuranceAccountBatchPO { */ private Long paymentOrganization; + } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index 91b22d672..15ccf7b82 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -224,9 +224,9 @@ ) ) OR ( - social.social_start_time IS NOT NULL AND social.social_start_time != '' + social.social_start_time IS NOT NULL AND social.social_start_time != '' AND -- 个税扣缴义务人 - social.social_pay_org = #{paymentOrganization} + social.payment_organization = #{paymentOrganization} AND( social.social_end_time IS NULL OR social.social_end_time = '' diff --git a/src/com/engine/salary/service/SIAccountService.java b/src/com/engine/salary/service/SIAccountService.java index 0119aadbc..70bbc7851 100644 --- a/src/com/engine/salary/service/SIAccountService.java +++ b/src/com/engine/salary/service/SIAccountService.java @@ -4,6 +4,7 @@ import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO; import com.engine.salary.entity.siaccount.param.*; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.util.page.PageInfo; import java.util.Collection; @@ -199,5 +200,7 @@ public interface SIAccountService { * @return */ List allInspects(Collection ids, String billMonth); + + Collection getAdminTaxAgentList(); } diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index 885d1ccb7..92b4c279b 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -22,6 +22,7 @@ import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO; import com.engine.salary.entity.siaccount.po.InsuranceAccountInspectPO; import com.engine.salary.entity.siarchives.po.InsuranceArchivesEmployeePO; import com.engine.salary.entity.sicategory.po.ICategoryPO; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.enums.UserStatusEnum; import com.engine.salary.enums.siaccount.BillStatusEnum; import com.engine.salary.enums.siaccount.InspectStatusEnum; @@ -32,10 +33,7 @@ import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper; import com.engine.salary.mapper.siaccount.InsuranceAccountInspectMapper; import com.engine.salary.mapper.sicategory.ICategoryMapper; -import com.engine.salary.service.ColumnBuildService; -import com.engine.salary.service.RecordsBuildService; -import com.engine.salary.service.SIAccountService; -import com.engine.salary.service.SICategoryService; +import com.engine.salary.service.*; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryFormItemUtil; import com.engine.salary.util.SalaryI18nUtil; @@ -62,7 +60,7 @@ import java.util.stream.Collectors; **/ public class SIAccountServiceImpl extends Service implements SIAccountService { - private SIAccountBiz siAccountBiz = new SIAccountBiz(); +// private SIAccountBiz siAccountBiz = new SIAccountBiz(); private SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); @@ -70,6 +68,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return ServiceUtil.getService(RecordsBuildServiceImpl.class,user); } + public SIAccountBiz getSiAccountBiz(User user) { + return ServiceUtil.getService(SIAccountBiz.class,user); + } + public ColumnBuildService getColumnBuildService(User user) { return ServiceUtil.getService(ColumnBuildServiceImpl.class,user); } @@ -78,6 +80,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return ServiceUtil.getService(SICategoryServiceImpl.class,user); } + private TaxAgentService getTaxAgentService(User user) { + return ServiceUtil.getService(TaxAgentServiceImpl.class, user); + } @Override public Map listPage(InsuranceAccountBatchParam queryParam) { @@ -85,7 +90,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Map datas = new HashMap<>(); //福利台账列表 - PageInfo pageInfo = siAccountBiz.listPage(queryParam,employeeId); + PageInfo pageInfo = getSiAccountBiz(user).listPage(queryParam,employeeId); Collection insuranceAccountBatchPOS = pageInfo.getList(); List insuranceAccountBatchListDTOS = InsuranceAccountBO.buildAccountBatchDTOList(insuranceAccountBatchPOS); @@ -154,7 +159,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Map datas = new HashMap<>(); //正常缴纳列表 - PageInfo pageInfo = siAccountBiz.listCommonPage(queryParam); + PageInfo pageInfo = getSiAccountBiz(user).listCommonPage(queryParam); List insuranceAccountDetailPOS = pageInfo.getList(); //数据组装 @@ -286,7 +291,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long)user.getUID(); String lastName = user.getLastname(); ValidUtil.doValidator(param); - siAccountBiz.save(param.isFlag(),param,employeeId,lastName); + getSiAccountBiz(user).save(param.isFlag(),param,employeeId,lastName); } @Override @@ -294,27 +299,27 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long)user.getUID(); ValidUtil.doValidator(param); String currentUserName = user.getLastname(); - siAccountBiz.saveCommonAccount(param,employeeId,currentUserName); + getSiAccountBiz(user).saveCommonAccount(param,employeeId,currentUserName); } @Override public void delete(AccountParam accountParam) { Long employeeId = (long)user.getUID(); - siAccountBiz.delete(accountParam,employeeId); + getSiAccountBiz(user).delete(accountParam,employeeId); } @Override public void saveCommonAccount(SaveCommonAccountParam accountParam) { Long employeeId = (long)user.getUID(); String currentUserName = user.getLastname(); - siAccountBiz.saveCommonAccount(accountParam,employeeId,currentUserName); + getSiAccountBiz(user).saveCommonAccount(accountParam,employeeId,currentUserName); } @Override public void saveSupplementaryAccount(SaveSupplementaryAccountParam saveSupplementaryAccountParam) { Long employeeId = (long)user.getUID(); String currentUserName = user.getLastname(); - siAccountBiz.saveSupplementaryAccount(saveSupplementaryAccountParam,employeeId,currentUserName); + getSiAccountBiz(user).saveSupplementaryAccount(saveSupplementaryAccountParam,employeeId,currentUserName); } @Override @@ -322,7 +327,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { ValidUtil.doValidator(param); Long employeeId = (long)user.getUID(); String currentUserName = user.getLastname(); - siAccountBiz.deleteCommonAccount(param,employeeId,currentUserName); + getSiAccountBiz(user).deleteCommonAccount(param,employeeId,currentUserName); } @Override @@ -330,14 +335,14 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long)user.getUID(); String currentUserName = user.getLastname(); - siAccountBiz.deleteSupplementaryAccount(supplementAccountBaseParams,employeeId,currentUserName); + getSiAccountBiz(user).deleteSupplementaryAccount(supplementAccountBaseParams,employeeId,currentUserName); } @Override public void file(AccountParam accountParam) { Long employeeId = (long)user.getUID(); String billMonth = accountParam.getBillMonth(); - siAccountBiz.file(billMonth,employeeId); + getSiAccountBiz(user).file(billMonth,employeeId); } @Override @@ -467,7 +472,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { Long employeeId = (long)user.getUID(); ValidUtil.doValidator(param); String currentUserName = user.getLastname(); - siAccountBiz.accountInspect(param.getIds(),param.getBillMonth(),employeeId,currentUserName); + getSiAccountBiz(user).accountInspect(param.getIds(),param.getBillMonth(),employeeId,currentUserName); } @Override @@ -588,7 +593,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { @Override public PageInfo overView(InsuranceAccountDetailParam queryParam) { - PageInfo pageInfos = siAccountBiz.overView(queryParam); + PageInfo pageInfos = getSiAccountBiz(user).overView(queryParam); return pageInfos; } @@ -884,8 +889,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { return Collections.emptyList(); } - - + @Override + public Collection getAdminTaxAgentList() { + return getTaxAgentService(user).listAllTaxAgentsAsAdmin((long)user.getUID()); + } } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index bf4cf8f4e..d481d7744 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -5,6 +5,7 @@ import com.engine.common.util.ServiceUtil; import com.engine.salary.entity.siaccount.dto.InsuranceAccountTabDTO; import com.engine.salary.entity.siaccount.dto.InsuranceAccountViewListDTO; import com.engine.salary.entity.siaccount.param.*; +import com.engine.salary.entity.taxagent.po.TaxAgentPO; import com.engine.salary.service.impl.SIAccountServiceImpl; import com.engine.salary.util.ResponseResult; import com.engine.salary.util.page.PageInfo; @@ -348,5 +349,12 @@ public class SIAccountController { return new ResponseResult>(user).run(getService(user)::buttonCheck, billMonth); } + @GET + @Path("/getAdminTaxAgentList") + @Produces(MediaType.APPLICATION_JSON) + public String getAdminTaxAgentList(@Context HttpServletRequest request, @Context HttpServletResponse response) { + User user = HrmUserVarify.getUser(request, response); + return new ResponseResult>(user).run(getService(user)::getAdminTaxAgentList); + } }