From eacb04388fa721bdc9faf58fc4ec740f35cdcdc6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Mon, 6 Jun 2022 19:08:39 +0800 Subject: [PATCH 01/13] =?UTF-8?q?=E7=A4=BE=E4=BF=9D=E7=A6=8F=E5=88=A9?= =?UTF-8?q?=E5=88=86=E6=9D=832.0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权.sql | 6 + src/com/engine/salary/biz/SIAccountBiz.java | 180 ++++++++++-------- .../entity/siaccount/param/AccountParam.java | 7 + .../param/SaveCommonAccountParam.java | 7 + .../param/SaveSupplementaryAccountParam.java | 7 + .../param/SupplementAccountBaseParam.java | 7 + .../siaccount/po/InsuranceAccountBatchPO.java | 5 + .../po/InsuranceAccountDetailPO.java | 7 +- .../po/InsuranceAccountDetailTempPO.java | 6 +- .../InsuranceAccountBatchMapper.java | 3 +- .../siaccount/InsuranceAccountBatchMapper.xml | 9 + .../InsuranceAccountDetailMapper.java | 6 +- .../InsuranceAccountDetailMapper.xml | 21 +- .../siaccount/SIAccountDetailTempMapper.java | 2 +- .../siaccount/SIAccountDetailTempMapper.xml | 18 +- .../salary/service/SIAccountService.java | 4 +- .../service/impl/SIAccountServiceImpl.java | 18 +- .../salary/web/SIAccountController.java | 5 +- 18 files changed, 199 insertions(+), 119 deletions(-) diff --git a/resource/sql/分权.sql b/resource/sql/分权.sql index 15116bb76..ff55b57c1 100644 --- a/resource/sql/分权.sql +++ b/resource/sql/分权.sql @@ -134,3 +134,9 @@ ALTER TABLE hrsa_salary_sob ADD COLUMN tax_agent_id bigint(0) NULL COMMENT '个 INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 1, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); + +ALTER TABLE hrsa_bill_detail_temp ADD COLUMN payment_organization bigint(0) NULL COMMENT '个税扣缴义务人id' AFTER tenant_key; + +ALTER TABLE hrsa_bill_detail ADD COLUMN payment_organization bigint(0) NULL COMMENT '个税扣缴义务人id' AFTER tenant_key; + +ALTER TABLE hrsa_bill_batch ADD COLUMN payment_organization bigint(0) NULL COMMENT '个税扣缴义务人id' AFTER tenant_key; \ No newline at end of file diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 1b1c62705..50ecdb12f 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -1,8 +1,8 @@ package com.engine.salary.biz; -import com.alibaba.druid.support.json.JSONUtils; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.TypeReference; +import com.engine.core.impl.Service; import com.engine.salary.constant.SalaryDefaultTenantConstant; import com.engine.salary.entity.datacollection.DataCollectionEmployee; import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO; @@ -12,7 +12,10 @@ 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.siarchives.po.*; +import com.engine.salary.entity.siarchives.po.InsuranceArchivesAccountPO; +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.entity.sicategory.po.ICategoryPO; import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO; import com.engine.salary.entity.taxrate.TaxAgent; @@ -25,7 +28,6 @@ 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.siaccount.SIAccountDetailTempMapper; - import com.engine.salary.mapper.sicategory.ICategoryMapper; import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper; import com.engine.salary.util.SalaryAssert; @@ -35,6 +37,7 @@ 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.engine.salary.util.valid.ValidUtil; import com.google.common.collect.Lists; import dm.jdbc.util.IdGenerator; import lombok.extern.slf4j.Slf4j; @@ -42,7 +45,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import org.apache.ibatis.session.SqlSession; import org.springframework.beans.BeanUtils; - import weaver.conn.mybatis.MyBatisFactory; import java.math.BigDecimal; @@ -52,7 +54,6 @@ import java.util.concurrent.Executors; import java.util.function.Function; import java.util.regex.Pattern; import java.util.stream.Collectors; -import com.engine.core.impl.Service; /** * @Author weaver_cl @@ -61,7 +62,7 @@ import com.engine.core.impl.Service; * @Version V1.0 **/ @Slf4j -public class SIAccountBiz extends Service{ +public class SIAccountBiz extends Service { private SIArchivesBiz siArchivesBiz = new SIArchivesBiz(); @@ -71,10 +72,10 @@ public class SIAccountBiz extends Service{ try { InsuranceAccountBatchMapper insuranceAccountBatchMapper = sqlSession.getMapper(InsuranceAccountBatchMapper.class); SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); - List list = insuranceAccountBatchMapper.list(queryParam); - PageInfo pageInfo = new PageInfo<>(list,InsuranceAccountBatchPO.class); + List list = insuranceAccountBatchMapper.list(queryParam); + PageInfo pageInfo = new PageInfo<>(list, InsuranceAccountBatchPO.class); return pageInfo; - }finally { + } finally { sqlSession.close(); } @@ -87,19 +88,21 @@ public class SIAccountBiz extends Service{ SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize()); queryParam.setPaymentStatus(PaymentStatusEnum.COMMON.getValue()); List list = insuranceAccountDetailMapper.list(queryParam); - PageInfo pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class); + PageInfo pageInfo = new PageInfo<>(list, InsuranceAccountDetailPO.class); return pageInfo; - }finally { + } finally { sqlSession.close(); } } - public void save(boolean flag, AccountParam param,Long employeeId,String currentUserName) { + public void save(boolean flag, AccountParam param, Long employeeId, String currentUserName) { if (flag) { - InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth()); - SalaryAssert.isNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 100461, "所属月份存在核算数据")); + InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()); + SalaryAssert.isNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(100461, "所属月份存在核算数据")); + InsuranceAccountBatchPO build = InsuranceAccountBatchPO.builder() - //.id(IdGenerator.generate()) + //.id(IdGenerator.generate()) + .paymentOrganization(param.getPaymentOrganization()) .accountant(currentUserName) .billMonth(param.getBillMonth()) .billStatus(BillStatusEnum.NOT_ARCHIVED.getValue()) @@ -120,14 +123,14 @@ public class SIAccountBiz extends Service{ // insuranceSchemeContext.setNewValues(build); // siAccountLoggerTemplate.write(insuranceSchemeContext); } - account(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName); + account(param, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName); } - public void account(String billMonth, Long employeeId, String tenantKey,String currentUserName) { - List employeeIds = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(billMonth)); + public void account(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { + List employeeIds = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); if (CollectionUtils.isEmpty(employeeIds)) { - List list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth)); + List list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth(), param.getPaymentOrganization())); if (CollectionUtils.isNotEmpty(list)) { list.stream().forEach(f -> { MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).deleteById(f.getId()); @@ -135,35 +138,36 @@ public class SIAccountBiz extends Service{ } } SalaryAssert.notEmpty(employeeIds, "no account data"); - AccountParam param = new AccountParam(); - param.setBillMonth(billMonth); + AccountParam selectParam = new AccountParam(); + selectParam.setBillMonth(param.getBillMonth()); + selectParam.setPaymentOrganization(param.getPaymentOrganization()); ExecutorService taskExecutor = Executors.newCachedThreadPool(); taskExecutor.execute(() -> { try { DSTenantKeyThreadVar.tenantKey.set(tenantKey); - accounting(param, employeeId, tenantKey,currentUserName); + accounting(selectParam, employeeId, tenantKey, currentUserName); } finally { DSTenantKeyThreadVar.tenantKey.remove(); } }); } - public void accounting(AccountParam param, Long employeeId, String tenantKey,String currentUserName) { + 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; // } - doAccounting(param, employeeId, tenantKey,currentUserName); + doAccounting(param, employeeId, tenantKey, currentUserName); } //@Transactional(propagation = Propagation.NEVER, rollbackFor = Exception.class) - public void doAccounting(AccountParam param, Long employeeId, String tenantKey,String currentUserName) { + public void doAccounting(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { try { List ids; if (CollectionUtils.isEmpty(param.getIds())) { - ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth())); + ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); } else { ids = param.getIds(); } @@ -171,7 +175,7 @@ public class SIAccountBiz extends Service{ //salaryAcctProgressService.fail(tenantKey + param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 100468, "无需要核算的人员")); return; } - SalaryAcctProgressDTO salaryAcctProgressDTO = new SalaryAcctProgressDTO(SalaryI18nUtil.getI18nLabel( 97515, "核算中"), 97515L, ids.size(), 0, + SalaryAcctProgressDTO salaryAcctProgressDTO = new SalaryAcctProgressDTO(SalaryI18nUtil.getI18nLabel(97515, "核算中"), 97515L, ids.size(), 0, BigDecimal.ZERO, true, "", true); //salaryAcctProgressService.initProgress(tenantKey + param.getBillMonth(), salaryAcctProgressDTO, employeeId, tenantKey); /* List> partition = Lists.partition(ids, 100); @@ -186,12 +190,12 @@ public class SIAccountBiz extends Service{ countDownLatch.await(); boolean allSuccess = results.stream().allMatch(Boolean::booleanValue);*/ /* if (allSuccess) {*/ - handleData(ids, param.getBillMonth(), employeeId, tenantKey,currentUserName); + handleData(ids, param, employeeId, tenantKey, currentUserName); /*}*/ MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).batchDelAccountTempDetails(ids, param.getBillMonth()); } catch (Exception e) { log.error("account run fail", e); - List list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth())); + List list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth(), param.getPaymentOrganization())); if (CollectionUtils.isNotEmpty(list)) { list.stream().forEach(f -> { MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).deleteById(f.getId()); @@ -258,28 +262,30 @@ public class SIAccountBiz extends Service{ }*/ } - private List> splitList(List list , int groupSize){ + private List> splitList(List list, int groupSize) { int length = list.size(); // 计算可以分成多少组 - int num = ( length + groupSize - 1 )/groupSize ; + int num = (length + groupSize - 1) / groupSize; List> newList = new ArrayList<>(num); for (int i = 0; i < num; i++) { // 开始位置 int fromIndex = i * groupSize; // 结束位置 - int toIndex = (i+1) * groupSize < length ? ( i+1 ) * groupSize : length ; - newList.add(list.subList(fromIndex,toIndex)) ; + int toIndex = (i + 1) * groupSize < length ? (i + 1) * groupSize : length; + newList.add(list.subList(fromIndex, toIndex)); } - return newList ; + return newList; } - private void handleData(List ids, String billMonth, Long employeeId, String tenantKey,String currentUserName) { + private void handleData(List ids, AccountParam param, Long employeeId, String tenantKey, String currentUserName) { //事务后续处理 //TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition()); try { - List list = MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).getListByEmployeeIdsAndBillMonth(ids,billMonth); - MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelAccountDetails(ids, billMonth); + String billMonth = param.getBillMonth(); + Long paymentOrganization = param.getPaymentOrganization(); + List list = MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class).getListByEmployeeIdsAndBillMonth(ids, billMonth, paymentOrganization); + MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelAccountDetails(ids,billMonth,paymentOrganization); List collect = list.stream().map(item -> { InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO(); BeanUtils.copyProperties(item, insuranceAccountDetailPO); @@ -291,7 +297,7 @@ public class SIAccountBiz extends Service{ lists.forEach(subList -> { MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchSaveAccountDetails(subList); }); - updateBatchAccount(billMonth, employeeId, tenantKey,currentUserName); + updateBatchAccount(param, employeeId, tenantKey, currentUserName); } //transactionManager.commit(status); } catch (Exception e) { @@ -659,10 +665,10 @@ public class SIAccountBiz extends Service{ /** * 跟新台账接口 * - * @param billMonth 账单月份 * @param tenantKey 租户key */ - public void updateBatchAccount(String billMonth, Long employeeId, String tenantKey,String currentUserName) { + public void updateBatchAccount(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { + String billMonth = param.getBillMonth(); List insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth); Map> map = insuranceAccountDetailPOS.stream().filter(item -> item.getEmployeeId() != null) @@ -699,7 +705,7 @@ public class SIAccountBiz extends Service{ otherAccountPerson += 1; } } - InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth); + InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth,param.getPaymentOrganization()); DataCollectionEmployee simpleEmployee = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeById(employeeId); insuranceAccountBatchPO.setAccountant(currentUserName); @@ -723,27 +729,31 @@ public class SIAccountBiz extends Service{ } - public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId,String currentUserName) { + public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId, String currentUserName) { List collect; - SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel( 100466, "参数为空")); - SalaryAssert.notNull(param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 100467, "账单月为空")); + SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel(100466, "参数为空")); + SalaryAssert.notNull(param.getBillMonth(), SalaryI18nUtil.getI18nLabel(100467, "账单月为空")); if (CollectionUtils.isNotEmpty(param.getExcludes())) { collect = param.getIncludes().stream().filter(item -> !param.getExcludes().contains(item)).collect(Collectors.toList()); } else { collect = param.getIncludes(); } - SalaryAssert.notEmpty(collect, SalaryI18nUtil.getI18nLabel( 99920, "无核算人员")); + SalaryAssert.notEmpty(collect, SalaryI18nUtil.getI18nLabel(99920, "无核算人员")); AccountParam accountParam = new AccountParam(); accountParam.setBillMonth(param.getBillMonth()); accountParam.setIds(collect); - accounting(accountParam, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName); + accounting(accountParam, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName); } public void delete(AccountParam param, Long employeeId) { - InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth()); - SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); + if(param.getPaymentOrganization()==null){ + throw new SalaryRunTimeException("个税扣缴义务人为空"); + } + + InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth(),param.getPaymentOrganization()); + SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(84026, "参数错误")); MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).deleteById(insuranceAccountBatchPO.getId()); - MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDeleteNotFile(param.getBillMonth()); + MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDeleteNotFile(param.getBillMonth(),param.getPaymentOrganization()); // LoggerContext insuranceSchemeContext = new LoggerContext(); // insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId())); // insuranceSchemeContext.setTargetName(insuranceAccountBatchPO.getBillMonth()); @@ -754,21 +764,21 @@ public class SIAccountBiz extends Service{ // siAccountLoggerTemplate.write(insuranceSchemeContext); } - public void saveSupplementaryAccount(SaveSupplementaryAccountParam param, Long employeeId,String currentUserName) { + public void saveSupplementaryAccount(SaveSupplementaryAccountParam param, Long employeeId, String currentUserName) { if (StringUtils.isBlank(param.getBillMonth()) || CollectionUtils.isEmpty(param.getBillMonthList()) || CollectionUtils.isEmpty(param.getProjects()) || CollectionUtils.isEmpty(param.getIncludes())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(84026, "参数错误")); } //需要补缴的月份 if (param.getBillMonthList().contains(param.getBillMonth())) { - throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel( 100481, "当前月走正常缴纳")); + throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100481, "当前月走正常缴纳")); } //需要补缴的员工id List employeeIds = param.getIncludes(); if (CollectionUtils.isNotEmpty(param.getExcludes())) { employeeIds = employeeIds.stream().filter(item -> !param.getExcludes().contains(item)).collect(Collectors.toList()); } - SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel( 99920, "无核算人员")); + SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel(99920, "无核算人员")); List baseList = new ArrayList<>(); employeeIds.stream().forEach(id -> { param.getBillMonthList().stream().forEach(month -> { @@ -782,8 +792,9 @@ public class SIAccountBiz extends Service{ }); }); //核算开始 - accountSupplement(baseList, employeeIds, param.getBillMonth(),employeeId); - updateBatchAccount(param.getBillMonth(), employeeId,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName); + accountSupplement(baseList, employeeIds, param.getBillMonth(), employeeId); + + updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName); } /** @@ -791,21 +802,21 @@ public class SIAccountBiz extends Service{ * @param employeeIds 需要补缴的员工id * @return */ - public String accountSupplement(List baseList, List employeeIds, String billMonth,Long employeeId) { + 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, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); //核算结果集 List pos = new ArrayList<>(); baseList.forEach(baseParam -> { - InsuranceAccountDetailPO insuranceAccountDetailPO = accountSingleEmployeeBill(baseParam, longInsuranceArchivesAccountPOMap.get(baseParam.getEmployeeId()),employeeId); + InsuranceAccountDetailPO insuranceAccountDetailPO = accountSingleEmployeeBill(baseParam, longInsuranceArchivesAccountPOMap.get(baseParam.getEmployeeId()), employeeId); pos.add(insuranceAccountDetailPO); }); - batchSaveSupplementAccount(pos, billMonth,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); + batchSaveSupplementAccount(pos, billMonth, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY); return SalaryI18nUtil.getI18nLabel(100492, "核算完成,数据保存成功"); } - public InsuranceAccountDetailPO accountSingleEmployeeBill(SupplementAccountBaseParam baseParam, InsuranceArchivesAccountPO accountPO,Long employeeId) { + public InsuranceAccountDetailPO accountSingleEmployeeBill(SupplementAccountBaseParam baseParam, InsuranceArchivesAccountPO accountPO, Long employeeId) { InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO(); List projects = baseParam.getProjects(); insuranceAccountDetailPO.setBillMonth(baseParam.getBillMonth()); @@ -1188,19 +1199,19 @@ public class SIAccountBiz extends Service{ } - private List> splitDetailList(List list , int groupSize){ + private List> splitDetailList(List list, int groupSize) { int length = list.size(); // 计算可以分成多少组 - int num = ( length + groupSize - 1 )/groupSize ; // TODO + int num = (length + groupSize - 1) / groupSize; // TODO List> newList = new ArrayList<>(num); for (int i = 0; i < num; i++) { // 开始位置 int fromIndex = i * groupSize; // 结束位置 - int toIndex = (i+1) * groupSize < length ? ( i+1 ) * groupSize : length ; - newList.add(list.subList(fromIndex,toIndex)) ; + int toIndex = (i + 1) * groupSize < length ? (i + 1) * groupSize : length; + newList.add(list.subList(fromIndex, toIndex)); } - return newList ; + return newList; } //@Transactional @@ -1238,11 +1249,12 @@ public class SIAccountBiz extends Service{ // }); } - public void deleteCommonAccount(SaveCommonAccountParam param, Long employeeId,String currentUserName) { - SalaryAssert.notBlank(param.getBillMonth(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); - SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel( 84026, "参数错误")); - MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelAccountDetails(param.getIncludes(), param.getBillMonth()); - //记录日志 + public void deleteCommonAccount(SaveCommonAccountParam param, Long employeeId, String currentUserName) { + ValidUtil.doValidator(param); + SalaryAssert.notBlank(param.getBillMonth(), SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + SalaryAssert.notEmpty(param.getIncludes(), SalaryI18nUtil.getI18nLabel(84026, "参数错误")); + MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).batchDelAccountDetails(param.getIncludes(), param.getBillMonth(),param.getPaymentOrganization()); + //记录日志 // LoggerContext insuranceSchemeContext = new LoggerContext(); // insuranceSchemeContext.setTargetId(String.join(",", param.getIncludes().stream().map(item -> String.valueOf(item)).collect(Collectors.toList()))); // insuranceSchemeContext.setTargetName(param.getBillMonth()); @@ -1251,10 +1263,10 @@ public class SIAccountBiz extends Service{ // insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(tenantKey, employeeId, 100462, "新增台账")); // insuranceSchemeContext.setNewValues(param); // siAccountLoggerTemplate.write(insuranceSchemeContext); - updateBatchAccount(param.getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName); + updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName); } - public void deleteSupplementaryAccount(List param, Long employeeId,String currentUserName) { + public void deleteSupplementaryAccount(List param, Long employeeId, String currentUserName) { SalaryAssert.notEmpty(param, SalaryI18nUtil.getI18nLabel(84026, "参数错误")); boolean valid = param.stream().anyMatch(item -> item.getEmployeeId() == null || StringUtils.isBlank(item.getSupplementaryMonth()) @@ -1273,7 +1285,7 @@ public class SIAccountBiz extends Service{ // insuranceSchemeContext.setNewValues(item); // siAccountLoggerTemplate.write(insuranceSchemeContext); // }); - updateBatchAccount(param.get(0).getBillMonth(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY,currentUserName); + updateBatchAccount(AccountParam.builder().billMonth(param.get(0).getBillMonth()).paymentOrganization(param.get(0).getPaymentOrganization()).build(), employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, currentUserName); } public void file(String billMonth, Long employeeId) { @@ -1282,13 +1294,13 @@ public class SIAccountBiz extends Service{ // SalaryAssert.isEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100500, "当前核算月存在核算异常数据")); //开始归档数据 - InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillStatus(billMonth,BillStatusEnum.NOT_ARCHIVED.getValue()); + InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillStatus(billMonth, BillStatusEnum.NOT_ARCHIVED.getValue()); - SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 100503, "月份账单不存在")); - SalaryAssert.isFalse(insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.ARCHIVED.getValue(), SalaryI18nUtil.getI18nLabel( 100504, "月份账单已归档")); + SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(100503, "月份账单不存在")); + SalaryAssert.isFalse(insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.ARCHIVED.getValue(), SalaryI18nUtil.getI18nLabel(100504, "月份账单已归档")); insuranceAccountBatchPO.setBillStatus(BillStatusEnum.ARCHIVED.getValue()); MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).updateById(insuranceAccountBatchPO); - //日志记录 + //日志记录 // LoggerContext insuranceSchemeContext = new LoggerContext(); // insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId())); // insuranceSchemeContext.setTargetName(insuranceAccountBatchPO.getBillMonth()); @@ -1300,9 +1312,9 @@ public class SIAccountBiz extends Service{ } - public void accountInspect(Collection ids, String billMonth, Long employeeId,String currentUserName) { + public void accountInspect(Collection ids, String billMonth, Long employeeId, String currentUserName) { List insuranceAccountInspectPOS = allInspects(ids, billMonth); - SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100515, "无核算数据")); + SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel(100515, "无核算数据")); List commonInspects = insuranceAccountInspectPOS.stream() .filter(e -> Objects.equals(e.getPaymentStatus(), PaymentStatusEnum.COMMON.getValue())) .collect(Collectors.toList()); @@ -1314,7 +1326,7 @@ public class SIAccountBiz extends Service{ SaveCommonAccountParam param = new SaveCommonAccountParam(); param.setBillMonth(billMonth); param.setIncludes(commonInspects.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList())); - saveCommonAccount(param, employeeId,currentUserName); + saveCommonAccount(param, employeeId, currentUserName); } //核算补缴 if (CollectionUtils.isNotEmpty(supplementInspects)) { @@ -1328,13 +1340,13 @@ public class SIAccountBiz extends Service{ base.setSupplementaryMonth(e.getSupplementaryMonth()); baseList.add(base); }); - accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), billMonth,employeeId); + accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), billMonth, employeeId); } } public List allInspects(Collection ids, String billMonth) { - List list = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getList(billMonth,InspectStatusEnum.IGNORE.getValue(),ids); + List list = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getList(billMonth, InspectStatusEnum.IGNORE.getValue(), ids); if (CollectionUtils.isNotEmpty(list)) { return list; @@ -1350,7 +1362,7 @@ public class SIAccountBiz extends Service{ //获取扣缴义务人信息 List paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll(); - SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人")); + SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人")); Map paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity())); List insuranceAccountViewListDTOS = buildRecords(insuranceAccountDetailPOS, paymentMap); @@ -1359,7 +1371,7 @@ public class SIAccountBiz extends Service{ // Page insuranceAccountViewListDTOPage = new Page<>(page.getCurrent(), insuranceAccountViewListDTOS.size(), insuranceAccountViewListDTOS.size(), // page.isSearchCount()); - PageInfo insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS,InsuranceAccountViewListDTO.class); + PageInfo insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS, InsuranceAccountViewListDTO.class); insuranceAccountViewListDTOPage.setTotal(insuranceAccountViewListDTOS.size()); return insuranceAccountViewListDTOPage; } diff --git a/src/com/engine/salary/entity/siaccount/param/AccountParam.java b/src/com/engine/salary/entity/siaccount/param/AccountParam.java index 9e67046d7..74cb238cf 100644 --- a/src/com/engine/salary/entity/siaccount/param/AccountParam.java +++ b/src/com/engine/salary/entity/siaccount/param/AccountParam.java @@ -35,4 +35,11 @@ public class AccountParam { // 是否是首次核算 private boolean flag = true; + + /** + * 个税扣缴义务人id + */ + @DataCheck(require = true,message = "个税扣缴义务人不能为空") + private Long paymentOrganization; + } diff --git a/src/com/engine/salary/entity/siaccount/param/SaveCommonAccountParam.java b/src/com/engine/salary/entity/siaccount/param/SaveCommonAccountParam.java index 14b6eded1..00c33f845 100644 --- a/src/com/engine/salary/entity/siaccount/param/SaveCommonAccountParam.java +++ b/src/com/engine/salary/entity/siaccount/param/SaveCommonAccountParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.siaccount.param; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -27,4 +28,10 @@ public class SaveCommonAccountParam { //账单月份") private String billMonth; + + /** + * 个税扣缴义务人id + */ + @DataCheck(require = true,message = "个税扣缴义务人不能为空") + private Long paymentOrganization; } diff --git a/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java b/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java index 2ce919024..9ca1d1688 100644 --- a/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java +++ b/src/com/engine/salary/entity/siaccount/param/SaveSupplementaryAccountParam.java @@ -2,6 +2,7 @@ package com.engine.salary.entity.siaccount.param; import com.alibaba.fastjson.annotation.JSONField; import com.alibaba.fastjson.serializer.ToStringSerializer; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -38,4 +39,10 @@ public class SaveSupplementaryAccountParam { //账单月份") private String billMonth; + + /** + * 个税扣缴义务人id + */ + @DataCheck(require = true,message = "个税扣缴义务人不能为空") + private Long paymentOrganization; } diff --git a/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java b/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java index 09d8c3be2..1d70cabc4 100644 --- a/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java +++ b/src/com/engine/salary/entity/siaccount/param/SupplementAccountBaseParam.java @@ -1,5 +1,6 @@ package com.engine.salary.entity.siaccount.param; +import com.engine.salary.util.valid.DataCheck; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; @@ -25,6 +26,12 @@ public class SupplementAccountBaseParam { //账单月份") private String billMonth; + /** + * 个税扣缴义务人id + */ + @DataCheck(require = true,message = "个税扣缴义务人不能为空") + private Long paymentOrganization; + //补缴月份") private String supplementaryMonth; diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java index e00d9126e..244c1e130 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountBatchPO.java @@ -100,4 +100,9 @@ public class InsuranceAccountBatchPO { */ private String tenantKey; + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; + } diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java index 9b249b0e5..b1ed7db6e 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailPO.java @@ -2,12 +2,10 @@ package com.engine.salary.entity.siaccount.po; import com.cloudstore.eccom.pc.table.WeaTableType; import com.engine.salary.annotation.SalaryTable; -import com.engine.salary.annotation.SalaryTableOperate; import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; import java.util.Date; @@ -239,4 +237,9 @@ public class InsuranceAccountDetailPO { * 租户key */ private String tenantKey; + + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; } diff --git a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java index 37d376c61..f2090de3a 100644 --- a/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java +++ b/src/com/engine/salary/entity/siaccount/po/InsuranceAccountDetailTempPO.java @@ -4,7 +4,6 @@ import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; import java.util.Date; @@ -235,4 +234,9 @@ public class InsuranceAccountDetailTempPO { * 租户key */ private String tenantKey; + + /** + * 个税扣缴义务人 + */ + private Long paymentOrganization; } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java index 24262cceb..d4c1ea3ee 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.java @@ -4,7 +4,6 @@ import com.engine.salary.entity.siaccount.param.InsuranceAccountBatchParam; import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO; import org.apache.ibatis.annotations.Param; -import java.util.Collection; import java.util.List; /** @@ -27,7 +26,7 @@ public interface InsuranceAccountBatchMapper { * @param billMonth * @return */ - InsuranceAccountBatchPO getByBillMonth(@Param("billMonth") String billMonth); + InsuranceAccountBatchPO getByBillMonth(@Param("billMonth") String billMonth,@Param("paymentOrganization") Long paymentOrganization); /** * 插入 diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml index 578d953f6..c3d691530 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml @@ -18,6 +18,7 @@ + @@ -38,6 +39,7 @@ , t.create_time , t.update_time , t.tenant_key + , t.payment_organization #{billMonth}, @@ -77,6 +80,7 @@ #{createTime}, #{updateTime}, #{tenantKey}, + #{paymentOrganization}, @@ -103,6 +107,7 @@ create_time, update_time, tenant_key, + payment_organization, #{billMonth}, @@ -120,6 +125,7 @@ #{createTime}, #{updateTime}, #{tenantKey}, + #{paymentOrganization}, @@ -161,6 +167,9 @@ hrsa_bill_batch t WHERE t.delete_type = 0 AND t.bill_month = #{billMonth} + + AND t.payment_organization = #{paymentOrganization} + diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java index 3c7183a43..92e318e6e 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.java @@ -29,7 +29,7 @@ public interface InsuranceAccountDetailMapper { * @param time * @return */ - List selectAccountIds(@Param("time") String time); + List selectAccountIds(@Param("time") String time,@Param("paymentOrganization") Long paymentOrganization); /** * 根据id删除 @@ -40,7 +40,7 @@ public interface InsuranceAccountDetailMapper { /** * 批量删除 */ - void batchDelAccountDetails(@Param("employeeIds") Collection employeeIds, @Param("billMonth") String billMonth); + void batchDelAccountDetails(@Param("employeeIds") Collection employeeIds, @Param("billMonth") String billMonth,@Param("paymentOrganization") Long paymentOrganization); /** * 批量保存 @@ -63,7 +63,7 @@ public interface InsuranceAccountDetailMapper { * 根据账单月份删除 * @param billMonth */ - void batchDeleteNotFile(@Param("billMonth") String billMonth); + void batchDeleteNotFile(@Param("billMonth") String billMonth,@Param("paymentOrganization") Long paymentOrganization); /** diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml index ae917a135..91b22d672 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountDetailMapper.xml @@ -45,6 +45,7 @@ + @@ -93,6 +94,7 @@ , t.create_time , t.update_time , t.tenant_key + , t.payment_organization @@ -223,6 +225,8 @@ ) OR ( social.social_start_time IS NOT NULL AND social.social_start_time != '' +-- 个税扣缴义务人 + social.social_pay_org = #{paymentOrganization} AND( social.social_end_time IS NULL OR social.social_end_time = '' @@ -316,6 +320,7 @@ FROM hrsa_bill_detail WHERE delete_type = 0 AND bill_month = #{billMonth} + AND payment_organization = #{paymentOrganization} AND bill_status = 0 @@ -363,6 +368,7 @@ SET delete_type = 1 WHERE delete_type = 0 AND bill_month = #{billMonth} + AND payment_organization = #{paymentOrganization} AND employee_id IN @@ -388,7 +394,7 @@ (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) + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) VALUES ( @@ -432,7 +438,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.paymentOrganization} ) @@ -441,7 +448,7 @@ (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) + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) select #{item.employeeId}, @@ -484,7 +491,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.paymentOrganization} from dual @@ -494,7 +502,7 @@ (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) + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) VALUES ( #{item.employeeId}, @@ -537,7 +545,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.paymentOrganization} ) diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java index 0312219e8..2f38c1b0b 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java +++ b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.java @@ -34,5 +34,5 @@ public interface SIAccountDetailTempMapper { * @param billMonth * @return */ - List getListByEmployeeIdsAndBillMonth(@Param("employeeIds") Collection employeeIds, @Param("billMonth") String billMonth); + List getListByEmployeeIdsAndBillMonth(@Param("employeeIds") Collection employeeIds, @Param("billMonth") String billMonth,@Param("paymentOrganization") Long paymentOrganization); } diff --git a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml index c6719b37f..60674d6c3 100644 --- a/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/SIAccountDetailTempMapper.xml @@ -45,6 +45,7 @@ + @@ -92,6 +93,7 @@ , t.create_time , t.update_time , t.tenant_key + , t.payment_organization @@ -115,7 +117,7 @@ (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) + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) VALUES ( @@ -159,7 +161,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.paymentOrganization} ) @@ -168,7 +171,7 @@ (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) + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) select @@ -212,7 +215,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.paymentOrganization} from dual @@ -222,7 +226,7 @@ (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) + com_sum,social_sum,fund_sum,other_sum,total,creator,create_time,update_time,delete_type,tenant_key,payment_organization) VALUES ( #{item.employeeId}, @@ -265,7 +269,8 @@ #{item.createTime}, #{item.updateTime}, #{item.deleteType}, - #{item.tenantKey} + #{item.tenantKey}, + #{item.paymentOrganization} ) @@ -277,6 +282,7 @@ hrsa_bill_detail_temp t WHERE t.delete_type = 0 AND t.bill_month = #{billMonth} + AND t.payment_organization = #{paymentOrganization} AND t.employee_id IN diff --git a/src/com/engine/salary/service/SIAccountService.java b/src/com/engine/salary/service/SIAccountService.java index 39d96d030..0119aadbc 100644 --- a/src/com/engine/salary/service/SIAccountService.java +++ b/src/com/engine/salary/service/SIAccountService.java @@ -4,9 +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.siexport.param.InsuranceExportParam; import com.engine.salary.util.page.PageInfo; -import org.apache.poi.xssf.usermodel.XSSFWorkbook; import java.util.Collection; import java.util.List; @@ -134,7 +132,7 @@ public interface SIAccountService { * tab信息 * @param billMonth */ - InsuranceAccountTabDTO tabList(String billMonth); + InsuranceAccountTabDTO tabList(AccountParam build); /** * 人员异动 diff --git a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java index d1ab56944..885d1ccb7 100644 --- a/src/com/engine/salary/service/impl/SIAccountServiceImpl.java +++ b/src/com/engine/salary/service/impl/SIAccountServiceImpl.java @@ -35,11 +35,6 @@ 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 java.math.BigDecimal; -import java.util.*; -import java.util.stream.Collectors; - import com.engine.salary.service.SICategoryService; import com.engine.salary.util.SalaryDateUtil; import com.engine.salary.util.SalaryFormItemUtil; @@ -54,6 +49,10 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; import weaver.hrm.User; +import java.math.BigDecimal; +import java.util.*; +import java.util.stream.Collectors; + /** * @Author weaver_cl @@ -320,6 +319,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { @Override public void deleteCommonAccount(SaveCommonAccountParam param) { + ValidUtil.doValidator(param); Long employeeId = (long)user.getUID(); String currentUserName = user.getLastname(); siAccountBiz.deleteCommonAccount(param,employeeId,currentUserName); @@ -372,9 +372,9 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { } @Override - public InsuranceAccountTabDTO tabList(String billMonth) { + public InsuranceAccountTabDTO tabList(AccountParam build) { InsuranceAccountTabDTO insuranceAccountTabDTO = InsuranceAccountTabDTO.builder().build(); - InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth); + InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(build.getBillMonth(),build.getPaymentOrganization()); boolean isShow = false; if (insuranceAccountBatchPO == null || insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.NOT_ARCHIVED.getValue()) { isShow = true; @@ -404,7 +404,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { tabList.add(overView); insuranceAccountTabDTO.setTabList(tabList); insuranceAccountTabDTO.setShow(isShow); - insuranceAccountTabDTO.setBillMonth(billMonth); + insuranceAccountTabDTO.setBillMonth(build.getBillMonth()); return insuranceAccountTabDTO; } @@ -594,7 +594,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService { @Override public List> welfareData(String billMonth, List employeeIds) { - InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth); + InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth,null); if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) { return Lists.newArrayList(); } diff --git a/src/com/engine/salary/web/SIAccountController.java b/src/com/engine/salary/web/SIAccountController.java index 13f35404d..bf4cf8f4e 100644 --- a/src/com/engine/salary/web/SIAccountController.java +++ b/src/com/engine/salary/web/SIAccountController.java @@ -292,9 +292,10 @@ public class SIAccountController { @Path("/tabList") @Produces(MediaType.APPLICATION_JSON) public String tabList(@Context HttpServletRequest request, @Context HttpServletResponse response, - @QueryParam("billMonth") String billMonth) { + @QueryParam("billMonth") String billMonth,@QueryParam("paymentOrganization") Long paymentOrganization) { User user = HrmUserVarify.getUser(request, response); - return new ResponseResult(user).run(getService(user)::tabList, billMonth); + AccountParam build = AccountParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization).build(); + return new ResponseResult(user).run(getService(user)::tabList, build); } @POST From 38c08b6e796e27e0aec7aaad6048546320b408b6 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 7 Jun 2022 13:26:00 +0800 Subject: [PATCH 02/13] =?UTF-8?q?sql=20server=20=E5=88=86=E6=9D=83sql?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权sql server.sql | 333 ++++++++++++++++++++++++++++++++ 1 file changed, 333 insertions(+) create mode 100644 resource/sql/分权sql server.sql diff --git a/resource/sql/分权sql server.sql b/resource/sql/分权sql server.sql new file mode 100644 index 000000000..91473dee4 --- /dev/null +++ b/resource/sql/分权sql server.sql @@ -0,0 +1,333 @@ +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_emp]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_emp] +GO + +CREATE TABLE [hrsa_tax_agent_emp] ( + [id] bigint NOT NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, + [tax_agent_id] bigint NULL, + [employee_id] bigint NULL, + [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_emp] SET (LOCK_ESCALATION = TABLE) +GO + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_emp] ( + [tenant_key] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_tax_agent] +ON [hrsa_tax_agent_emp] ( + [tax_agent_id] ASC +) +GO +ALTER TABLE [hrsa_tax_agent_emp] ADD CONSTRAINT [PK__hrsa_tax__3213E83F1A221DC1] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + + + + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_base]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_base] +GO + +CREATE TABLE [hrsa_tax_agent_base] ( + [id] bigint NOT NULL, + [devolution_status] int NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_base] SET (LOCK_ESCALATION = TABLE) +GO + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_base] ( + [tenant_key] ASC +) +GO + + +ALTER TABLE [hrsa_tax_agent_base] ADD CONSTRAINT [PK__hrsa_tax__3213E83FE121B302] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + + + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_manage_range]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_manage_range] +GO + +CREATE TABLE [hrsa_tax_agent_manage_range] ( + [id] bigint NOT NULL, + [tax_agent_id] bigint NULL, + [employee_id] bigint NULL, + [tax_agent_sub_admin_id] bigint NULL, + [target_type] tinyint NULL, + [target_id] bigint NULL, + [employee_status] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + [include_type] int NULL, + [creator] bigint NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, + [range_type] int NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_manage_range] SET (LOCK_ESCALATION = TABLE) +GO + +CREATE NONCLUSTERED INDEX [idx_tax_agent_sub_admin_id] +ON [hrsa_tax_agent_manage_range] ( + [tax_agent_sub_admin_id] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_manage_range] ( + [tenant_key] ASC +) +GO + +ALTER TABLE [hrsa_tax_agent_manage_range] ADD CONSTRAINT [PK__hrsa_tax__3213E83F877A395F] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_emp_change]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_emp_change] +GO + +CREATE TABLE [hrsa_tax_agent_emp_change] ( + [id] bigint NOT NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, + [tax_agent_id] bigint NULL, + [employee_id] bigint NULL, + [change_type] int NULL, + [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL, + [module_type] int NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_emp_change] SET (LOCK_ESCALATION = TABLE) +GO + + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_emp_change] ( + [tenant_key] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_tax_agent] +ON [hrsa_tax_agent_emp_change] ( + [tax_agent_id] ASC +) +GO + +ALTER TABLE [hrsa_tax_agent_emp_change] ADD CONSTRAINT [PK__hrsa_tax__3213E83F2DC37AA6] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_sub_admin_emp]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_sub_admin_emp] +GO + +CREATE TABLE [hrsa_tax_agent_sub_admin_emp] ( + [id] bigint NOT NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, + [tax_agent_id] bigint NULL, + [tax_agent_sub_admin_id] bigint NULL, + [employee_id] bigint NULL, + [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_sub_admin_emp] SET (LOCK_ESCALATION = TABLE) +GO + + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_sub_admin_emp] ( + [tenant_key] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_tax_agent] +ON [hrsa_tax_agent_sub_admin_emp] ( + [tax_agent_id] ASC +) +GO + +ALTER TABLE [hrsa_tax_agent_sub_admin_emp] ADD CONSTRAINT [PK__hrsa_tax__3213E83F2F2EE404] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_sub_admin]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_sub_admin] +GO + +CREATE TABLE [hrsa_tax_agent_sub_admin] ( + [id] bigint NOT NULL, + [tax_agent_id] bigint NULL, + [employee_id] bigint NULL, + [description] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, + [remark] text COLLATE Chinese_PRC_CI_AS NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_sub_admin] SET (LOCK_ESCALATION = TABLE) +GO + + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_sub_admin] ( + [tenant_key] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_tax_agent_id] +ON [hrsa_tax_agent_sub_admin] ( + [tax_agent_id] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_employee_id] +ON [hrsa_tax_agent_sub_admin] ( + [employee_id] ASC +) +GO + +ALTER TABLE [hrsa_tax_agent_sub_admin] ADD CONSTRAINT [PK__hrsa_tax__3213E83F26DE578A] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_sub_admin]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_sub_admin] +GO + +CREATE TABLE [hrsa_tax_agent_sub_admin] ( + [id] bigint NOT NULL, + [tax_agent_id] bigint NULL, + [employee_id] bigint NULL, + [description] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, + [remark] text COLLATE Chinese_PRC_CI_AS NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_sub_admin] SET (LOCK_ESCALATION = TABLE) +GO + + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_sub_admin] ( + [tenant_key] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_tax_agent_id] +ON [hrsa_tax_agent_sub_admin] ( + [tax_agent_id] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_employee_id] +ON [hrsa_tax_agent_sub_admin] ( + [employee_id] ASC +) +GO + +ALTER TABLE [hrsa_tax_agent_sub_admin] ADD CONSTRAINT [PK__hrsa_tax__3213E83F26DE578A] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + + +IF EXISTS (SELECT * FROM sys.all_objects WHERE object_id = OBJECT_ID(N'[hrsa_tax_agent_admin]') AND type IN ('U')) + DROP TABLE [hrsa_tax_agent_admin] +GO + +CREATE TABLE [hrsa_tax_agent_admin] ( + [id] bigint NOT NULL, + [tax_agent_id] bigint NULL, + [employee_id] bigint NULL, + [create_time] datetime NULL, + [update_time] datetime NULL, + [creator] bigint NULL, + [delete_type] int NULL, + [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL +) +GO + +ALTER TABLE [hrsa_tax_agent_admin] SET (LOCK_ESCALATION = TABLE) +GO + +CREATE NONCLUSTERED INDEX [idx_tenant_key] +ON [hrsa_tax_agent_admin] ( + [tenant_key] ASC +) +GO + +CREATE NONCLUSTERED INDEX [idx_employee_id] +ON [hrsa_tax_agent_admin] ( + [employee_id] ASC +) +GO + +ALTER TABLE [hrsa_tax_agent_admin] ADD CONSTRAINT [PK__hrsa_tax__3213E83F01D6FDC9] PRIMARY KEY CLUSTERED ([id]) +WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) +ON [PRIMARY] +GO + +ALTER TABLE hrsa_tax_agent ADD payment_agency varchar(255) NULL +GO + +ALTER TABLE hrsa_salary_sob ADD tax_agent_id bigint NULL +GO + +INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 1, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); +GO +ALTER TABLE hrsa_bill_detail_temp ADD payment_organization bigint NULL +GO +ALTER TABLE hrsa_bill_detail ADD payment_organization bigint NULL +GO +ALTER TABLE hrsa_bill_batch ADD payment_organization bigint NULL +GO \ No newline at end of file From 83c7ea3f5c99290dd7597a6f31e6f160b19e5b94 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 7 Jun 2022 14:24:14 +0800 Subject: [PATCH 03/13] =?UTF-8?q?sql=20server=20=E8=87=AA=E5=A2=9E?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml | 2 -- src/com/engine/salary/service/impl/TaxAgentServiceImpl.java | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml index 25b1baffd..8f14c32de 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml @@ -73,7 +73,6 @@ creator, delete_type, description, - id, name, tenant_key, update_time, @@ -83,7 +82,6 @@ #{creator}, #{deleteType}, #{description}, - #{id}, #{name}, #{tenantKey}, #{updateTime}, diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index c83c84a95..65f15670a 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -286,7 +286,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { // throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(115130, "名称不允许与社保福利代缴机构名称重复")); // } // 保存 - saveParam.setId(IdGenerator.generate()); +// saveParam.setId(IdGenerator.generate()); TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, (long) user.getUID()); getTaxAgentMapper().insert(taxAgent); if (isOpenDevolution) { From 20e04f503eadb251ac3fdd8ec6712bc417e7e034 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 7 Jun 2022 15:19:21 +0800 Subject: [PATCH 04/13] =?UTF-8?q?sql=20server=20=E5=88=86=E6=9D=83?= =?UTF-8?q?=E8=84=9A=E6=9C=AC=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权sql server.sql | 56 +++++++++---------- .../service/impl/TaxAgentServiceImpl.java | 2 +- 2 files changed, 29 insertions(+), 29 deletions(-) diff --git a/resource/sql/分权sql server.sql b/resource/sql/分权sql server.sql index 91473dee4..3ca742cae 100644 --- a/resource/sql/分权sql server.sql +++ b/resource/sql/分权sql server.sql @@ -7,7 +7,7 @@ CREATE TABLE [hrsa_tax_agent_emp] ( [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, - [delete_type] int NULL, + [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, @@ -43,11 +43,11 @@ GO CREATE TABLE [hrsa_tax_agent_base] ( [id] bigint NOT NULL, - [devolution_status] int NULL, - [create_time] datetime NULL, - [update_time] datetime NULL, - [creator] bigint NULL, - [delete_type] int NULL, + [devolution_status] int DEFAULT 0, + [create_time] datetime DEFAULT getdate(), + [update_time] datetime DEFAULT getdate(), + [creator] bigint DEFAULT 0, + [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ) GO @@ -75,19 +75,19 @@ GO CREATE TABLE [hrsa_tax_agent_manage_range] ( [id] bigint NOT NULL, - [tax_agent_id] bigint NULL, - [employee_id] bigint NULL, - [tax_agent_sub_admin_id] bigint NULL, - [target_type] tinyint NULL, - [target_id] bigint NULL, + [tax_agent_id] bigint DEFAULT 0, + [employee_id] bigint DEFAULT 0, + [tax_agent_sub_admin_id] bigint DEFAULT 0, + [target_type] tinyint DEFAULT 1, + [target_id] bigint DEFAULT 0, [employee_status] varchar(100) COLLATE Chinese_PRC_CI_AS NULL, - [include_type] int NULL, - [creator] bigint NULL, - [create_time] datetime NULL, - [update_time] datetime NULL, - [delete_type] int NULL, + [include_type] int DEFAULT 1, + [creator] bigint DEFAULT 0, + [create_time] datetime DEFAULT getdate(), + [update_time] datetime DEFAULT getdate(), + [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, - [range_type] int NULL + [range_type] int DEFAULT 0 ) GO @@ -120,13 +120,13 @@ CREATE TABLE [hrsa_tax_agent_emp_change] ( [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, - [delete_type] int NULL, + [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, - [change_type] int NULL, + [change_type] int DEFAULT 0, [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL, - [module_type] int NULL + [module_type] int DEFAULT 0 ) GO @@ -160,11 +160,11 @@ CREATE TABLE [hrsa_tax_agent_sub_admin_emp] ( [create_time] datetime NULL, [update_time] datetime NULL, [creator] bigint NULL, - [delete_type] int NULL, + [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL, - [tax_agent_id] bigint NULL, - [tax_agent_sub_admin_id] bigint NULL, - [employee_id] bigint NULL, + [tax_agent_id] bigint DEFAULT 0, + [tax_agent_sub_admin_id] bigint DEFAULT 0, + [employee_id] bigint DEFAULT 0, [employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL ) GO @@ -289,10 +289,10 @@ CREATE TABLE [hrsa_tax_agent_admin] ( [id] bigint NOT NULL, [tax_agent_id] bigint NULL, [employee_id] bigint NULL, - [create_time] datetime NULL, - [update_time] datetime NULL, - [creator] bigint NULL, - [delete_type] int NULL, + [create_time] datetime DEFAULT getdate(), + [update_time] datetime DEFAULT getdate(), + [creator] bigint DEFAULT 0, + [delete_type] int DEFAULT 0, [tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL ) GO diff --git a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java index 65f15670a..98a241e74 100644 --- a/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java +++ b/src/com/engine/salary/service/impl/TaxAgentServiceImpl.java @@ -290,7 +290,7 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService { TaxAgentPO taxAgent = TaxAgentBO.convertToPO(saveParam, (long) user.getUID()); getTaxAgentMapper().insert(taxAgent); if (isOpenDevolution) { - getTaxAgentAdminService(user).batchInsert(saveParam.getId(), saveParam.getAdminUserIds()); + getTaxAgentAdminService(user).batchInsert(taxAgent.getId(), saveParam.getAdminUserIds()); } // 记录日志 // SalaryLoggerUtil.recordAddSingleLog(taxAgentLoggerTemplate, From 28b49f99872d36c4c5908fb52fa4ed7f8c26ee4f Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Tue, 7 Jun 2022 17:35:39 +0800 Subject: [PATCH 05/13] fix bug --- src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml | 1 - src/com/engine/salary/service/impl/SISchemeServiceImpl.java | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml index 68d2bd744..4ae8b815d 100644 --- a/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml +++ b/src/com/engine/salary/mapper/taxagent/TaxAgentEmpMapper.xml @@ -284,7 +284,6 @@ #{item.employeeId}, #{item.taxAgentId}, #{item.employeeName}, - #{item.operator}, #{item.createTime}, #{item.updateTime}, #{item.creator}, diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index fd664c178..1dae17e59 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -731,7 +731,7 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { } String fundStartMonth = (String) fundStartTimeMap.get(SalaryI18nUtil.getI18nLabel(91483, "公积金起始缴纳月")); - if(StringUtils.isNotBlank(fundStartMonth) && socialEndMonth.length() > 7) { + if(StringUtils.isNotBlank(fundStartMonth) && fundStartMonth.length() > 7) { fundStartMonth = fundStartMonth.substring(0, 7); } if (StringUtils.isNotBlank(fundStartMonth) && !SalaryDateUtil.checkYearMonth(fundStartMonth)) { From 6c54847f88f281f21fe50fcebbea1a772a14fcd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=92=B1=E6=B6=9B?= <15850646081@163.com> Date: Tue, 7 Jun 2022 19:16:13 +0800 Subject: [PATCH 06/13] =?UTF-8?q?=E9=BB=98=E8=AE=A4=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- resource/sql/分权sql server.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resource/sql/分权sql server.sql b/resource/sql/分权sql server.sql index 3ca742cae..c61507486 100644 --- a/resource/sql/分权sql server.sql +++ b/resource/sql/分权sql server.sql @@ -323,7 +323,7 @@ GO ALTER TABLE hrsa_salary_sob ADD tax_agent_id bigint NULL GO -INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 1, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); +INSERT INTO hrsa_tax_agent_base(id, devolution_status, create_time, update_time, creator, delete_type, tenant_key) VALUES (1653303537239, 0, '2022-05-23 18:58:53', '2022-05-23 19:12:12', 1, 0, 'all_teams'); GO ALTER TABLE hrsa_bill_detail_temp ADD payment_organization bigint NULL GO 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 07/13] =?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); + } } From 2fe161386864b0e72557668466b7264071c6c243 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Thu, 9 Jun 2022 15:16:33 +0800 Subject: [PATCH 08/13] =?UTF-8?q?=E5=8F=B0=E8=B4=A6=E6=A0=B8=E7=AE=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 2 +- .../entity/siaccount/dto/InsuranceAccountBatchListDTO.java | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index b3648c094..475e91775 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -179,7 +179,7 @@ public class SIAccountBiz extends Service { // 需要分权的情况 if(getTaxAgentService().isNeedAuth(employeeId)) { List taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee((long) user.getUID()); - ids = taxAgentEmployeeDTOS.stream().map(TaxAgentEmployeeDTO::getTaxAgentId).collect(Collectors.toList()); + ids = taxAgentEmployeeDTOS.stream().map(TaxAgentEmployeeDTO::getEmployeeId).collect(Collectors.toList()); } else { ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); } diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java index 4265676fe..6920a440a 100644 --- a/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java @@ -41,6 +41,9 @@ public class InsuranceAccountBatchListDTO { @TableTitle(title = "账单月份", dataIndex = "billMonth", key = "billMonth") private String billMonth; + @TableTitle(title = "个税扣缴义务人", dataIndex = "paymentOrganization", key = "paymentOrganization") + private String paymentOrganization; + /** * 账单状态 0-未归档 1-已归档 */ @@ -102,4 +105,6 @@ public class InsuranceAccountBatchListDTO { private String remarks; + + } From 85f0b1164ca3632abcdc8a885a86c19c22157a73 Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Thu, 9 Jun 2022 18:31:36 +0800 Subject: [PATCH 09/13] =?UTF-8?q?=E7=A6=8F=E5=88=A9=E5=8F=B0=E8=B4=A6?= =?UTF-8?q?=E5=88=86=E6=9D=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIAccountBiz.java | 9 ++++---- .../siaccount/bo/InsuranceAccountBO.java | 4 ++++ .../dto/InsuranceAccountBatchListDTO.java | 2 ++ .../param/InsuranceAccountBatchParam.java | 4 ++++ .../param/InsuranceAccountDetailParam.java | 2 ++ .../siexport/param/InsuranceExportParam.java | 2 ++ .../siaccount/InsuranceAccountBatchMapper.xml | 10 ++++++++- .../InsuranceAccountDetailMapper.java | 2 +- .../InsuranceAccountDetailMapper.xml | 22 ++++++++++++++++++- .../service/impl/SIAccountServiceImpl.java | 7 ++++++ .../service/impl/SIExportServiceImpl.java | 2 +- 11 files changed, 57 insertions(+), 9 deletions(-) diff --git a/src/com/engine/salary/biz/SIAccountBiz.java b/src/com/engine/salary/biz/SIAccountBiz.java index 475e91775..37c379404 100644 --- a/src/com/engine/salary/biz/SIAccountBiz.java +++ b/src/com/engine/salary/biz/SIAccountBiz.java @@ -178,10 +178,9 @@ public class SIAccountBiz extends Service { if (CollectionUtils.isEmpty(param.getIds())) { // 需要分权的情况 if(getTaxAgentService().isNeedAuth(employeeId)) { - List taxAgentEmployeeDTOS = getTaxAgentService().listTaxAgentAndEmployee((long) user.getUID()); - ids = taxAgentEmployeeDTOS.stream().map(TaxAgentEmployeeDTO::getEmployeeId).collect(Collectors.toList()); - } else { ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization()); + } else { + ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), null); } } else { ids = param.getIds(); @@ -687,7 +686,7 @@ public class SIAccountBiz extends Service { public void updateBatchAccount(AccountParam param, Long employeeId, String tenantKey, String currentUserName) { String billMonth = param.getBillMonth(); - List insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth); + List insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth, String.valueOf(param.getPaymentOrganization())); Map> map = insuranceAccountDetailPOS.stream().filter(item -> item.getEmployeeId() != null) .collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId)); int socialAccountPerson = 0; @@ -1375,7 +1374,7 @@ public class SIAccountBiz extends Service { public PageInfo overView(InsuranceAccountDetailParam queryParam) { // SalaryPageUtil.start(queryParam.getCurrent(),queryParam.getPageSize()); - List insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth()); + List insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth(), queryParam.getPaymentOrganization()); //获取扣缴义务人信息 List paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll(); diff --git a/src/com/engine/salary/entity/siaccount/bo/InsuranceAccountBO.java b/src/com/engine/salary/entity/siaccount/bo/InsuranceAccountBO.java index 5bc24bf01..aa39ab226 100644 --- a/src/com/engine/salary/entity/siaccount/bo/InsuranceAccountBO.java +++ b/src/com/engine/salary/entity/siaccount/bo/InsuranceAccountBO.java @@ -4,8 +4,10 @@ package com.engine.salary.entity.siaccount.bo; import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO; import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO; import com.engine.salary.enums.siaccount.BillStatusEnum; +import com.engine.salary.mapper.TaxAgentMapper; import com.engine.salary.util.SalaryEntityUtil; import com.engine.salary.util.SalaryEnumUtil; +import com.engine.salary.util.db.MapperProxyFactory; import org.apache.commons.collections.CollectionUtils; import java.text.SimpleDateFormat; @@ -61,6 +63,8 @@ public class InsuranceAccountBO { .remarks(e.getRemarks()) .socialNum(e.getSocialNum()) .socialPay(SalaryEntityUtil.thousandthConvert(e.getSocialPay())) + .paymentOrganization(e.getPaymentOrganization() != null ? MapperProxyFactory.getProxy(TaxAgentMapper.class).getById(e.getPaymentOrganization()).getName() : "") + .paymentOrganizationId(e.getPaymentOrganization()) .build() ).collect(Collectors.toList()); } diff --git a/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java b/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java index 6920a440a..c41e2138c 100644 --- a/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java +++ b/src/com/engine/salary/entity/siaccount/dto/InsuranceAccountBatchListDTO.java @@ -44,6 +44,8 @@ public class InsuranceAccountBatchListDTO { @TableTitle(title = "个税扣缴义务人", dataIndex = "paymentOrganization", key = "paymentOrganization") private String paymentOrganization; + private Long paymentOrganizationId; + /** * 账单状态 0-未归档 1-已归档 */ diff --git a/src/com/engine/salary/entity/siaccount/param/InsuranceAccountBatchParam.java b/src/com/engine/salary/entity/siaccount/param/InsuranceAccountBatchParam.java index 4fc596729..99894b6d3 100644 --- a/src/com/engine/salary/entity/siaccount/param/InsuranceAccountBatchParam.java +++ b/src/com/engine/salary/entity/siaccount/param/InsuranceAccountBatchParam.java @@ -6,6 +6,8 @@ import lombok.Builder; import lombok.Data; import lombok.NoArgsConstructor; +import java.util.List; + /** * @Author weaver_cl * @Description: TODO @@ -23,4 +25,6 @@ public class InsuranceAccountBatchParam extends BaseQueryParam { //结束时间 private String endTime; + + private List taxAgents; } diff --git a/src/com/engine/salary/entity/siaccount/param/InsuranceAccountDetailParam.java b/src/com/engine/salary/entity/siaccount/param/InsuranceAccountDetailParam.java index 293a4c172..bbe81cd98 100644 --- a/src/com/engine/salary/entity/siaccount/param/InsuranceAccountDetailParam.java +++ b/src/com/engine/salary/entity/siaccount/param/InsuranceAccountDetailParam.java @@ -25,4 +25,6 @@ public class InsuranceAccountDetailParam extends BaseQueryParam { private List employeeIds; private String userName; + + private String paymentOrganization; } diff --git a/src/com/engine/salary/entity/siexport/param/InsuranceExportParam.java b/src/com/engine/salary/entity/siexport/param/InsuranceExportParam.java index 0e199aaae..b6a216a55 100644 --- a/src/com/engine/salary/entity/siexport/param/InsuranceExportParam.java +++ b/src/com/engine/salary/entity/siexport/param/InsuranceExportParam.java @@ -22,4 +22,6 @@ public class InsuranceExportParam { //@NotBlank @DataCheck(require = true,message = "账单月份不可为空") private String billMonth; + + private String paymentOrganization; } diff --git a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml index c3d691530..45a04a850 100644 --- a/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml +++ b/src/com/engine/salary/mapper/siaccount/InsuranceAccountBatchMapper.xml @@ -136,14 +136,22 @@ AND t.bill_month between #{param.startTime} and #{param.endTime} + + AND + t.payment_organization in + + #{taxAgent} + + From ca1c20329c8b1463e75e838416977494378db4fe Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Fri, 10 Jun 2022 15:12:56 +0800 Subject: [PATCH 12/13] =?UTF-8?q?fix=20=E7=A6=8F=E5=88=A9=E6=A1=A3?= =?UTF-8?q?=E6=A1=88=E5=AF=BC=E5=85=A5bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/mapper/datacollection/EmployMapper.xml | 3 ++- src/com/engine/salary/service/impl/SISchemeServiceImpl.java | 3 +-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml index 41406d770..2d4dfca06 100644 --- a/src/com/engine/salary/mapper/datacollection/EmployMapper.xml +++ b/src/com/engine/salary/mapper/datacollection/EmployMapper.xml @@ -6,7 +6,8 @@ select e.ID as employeeId, e.LASTNAME as username, d.DEPARTMENTNAME as departmentName, - e.status + e.status, + e.mobile from hrmresource e left join hrmdepartment d on e.departmentid = d.id where e.status not in (7) and (e.accounttype is null or e.accounttype = 0) diff --git a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java index 1dae17e59..655625d48 100644 --- a/src/com/engine/salary/service/impl/SISchemeServiceImpl.java +++ b/src/com/engine/salary/service/impl/SISchemeServiceImpl.java @@ -670,11 +670,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService { excelComments.add(errorMessageMap); isError = true; } - String exchangeUserStatus = userStateExchange(userStatus); List employees = employeeByIds.stream().filter(e -> (StringUtils.isBlank(userName) || Objects.equals(e.getUsername(), userName)) && (StringUtils.isBlank(deparmentName) || Objects.equals(e.getDepartmentName(), deparmentName)) && (StringUtils.isBlank(telephone) || Objects.equals(e.getMobile(), telephone)) - && (StringUtils.isBlank(exchangeUserStatus) || e.getStatus() == null || Objects.equals(e.getStatus(), exchangeUserStatus))).map(DataCollectionEmployee::getEmployeeId) + && (StringUtils.isBlank(userStatus) || Objects.equals(userStateExchange(e.getStatus()), userStatus))).map(DataCollectionEmployee::getEmployeeId) .collect(Collectors.toList()); if (CollectionUtils.isEmpty(employees) || employees.size() > 1) { Map errorMessageMap = Maps.newHashMap(); From 9315882742731f6678041eee01c30197f7a12fbc Mon Sep 17 00:00:00 2001 From: MustangDeng <670124965@qq.com> Date: Fri, 10 Jun 2022 16:35:01 +0800 Subject: [PATCH 13/13] =?UTF-8?q?=E7=A6=8F=E5=88=A9=E6=A1=A3=E6=A1=88?= =?UTF-8?q?=E5=88=97=E8=A1=A8log?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/com/engine/salary/biz/SIArchivesBiz.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/com/engine/salary/biz/SIArchivesBiz.java b/src/com/engine/salary/biz/SIArchivesBiz.java index 139255f1f..91fd44fc0 100644 --- a/src/com/engine/salary/biz/SIArchivesBiz.java +++ b/src/com/engine/salary/biz/SIArchivesBiz.java @@ -41,6 +41,7 @@ import com.engine.salary.util.db.MapperProxyFactory; import com.engine.salary.util.page.PageInfo; import com.engine.salary.util.page.SalaryPageUtil; import lombok.Data; +import lombok.extern.slf4j.Slf4j; import org.apache.commons.collections.CollectionUtils; import org.apache.commons.lang.StringUtils; import org.apache.ibatis.session.SqlSession; @@ -61,6 +62,7 @@ import java.util.stream.Collectors; * @Version V1.0 **/ @Data +@Slf4j public class SIArchivesBiz { Boolean needAuth ; @@ -635,11 +637,14 @@ 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);