Merge branch 'auth-fl' into release

# Conflicts:
#	resource/sql/分权.sql
#	src/com/engine/salary/biz/SIAccountBiz.java
#	src/com/engine/salary/mapper/taxagent/TaxAgentMapper.xml
#	src/com/engine/salary/service/impl/SIAccountServiceImpl.java
#	src/com/engine/salary/service/impl/SIExportServiceImpl.java
This commit is contained in:
钱涛 2022-06-10 16:58:45 +08:00
commit e6c6b8eb57
29 changed files with 668 additions and 138 deletions

View File

@ -133,4 +133,10 @@ ALTER TABLE hrsa_tax_agent ADD COLUMN payment_agency varchar(255) NULL COMMENT '
ALTER TABLE hrsa_salary_sob ADD COLUMN tax_agent_id bigint(0) NULL COMMENT '个税扣缴义务人的主键id' AFTER tenant_key;
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');
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;

View File

@ -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 DEFAULT 0,
[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 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
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 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 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 DEFAULT 0
)
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 DEFAULT 0,
[tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS NULL,
[tax_agent_id] bigint NULL,
[employee_id] bigint NULL,
[change_type] int DEFAULT 0,
[employee_name] varchar(255) COLLATE Chinese_PRC_CI_AS NULL,
[module_type] int DEFAULT 0
)
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 DEFAULT 0,
[tenant_key] varchar(10) COLLATE Chinese_PRC_CI_AS 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
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 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
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, 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
ALTER TABLE hrsa_bill_detail ADD payment_organization bigint NULL
GO
ALTER TABLE hrsa_bill_batch ADD payment_organization bigint NULL
GO

View File

@ -1,8 +1,9 @@
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.common.util.ServiceUtil;
import com.engine.core.impl.Service;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt;
@ -17,9 +18,13 @@ 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.taxagent.dto.TaxAgentEmployeeDTO;
import com.engine.salary.entity.taxrate.TaxAgent;
import com.engine.salary.enums.siaccount.*;
import com.engine.salary.enums.sicategory.*;
@ -30,9 +35,10 @@ 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.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;
@ -40,6 +46,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;
@ -47,7 +54,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;
@ -57,7 +63,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
@ -66,10 +71,14 @@ 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();
private TaxAgentService getTaxAgentService() {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
public PageInfo<InsuranceAccountBatchPO> listPage(InsuranceAccountBatchParam queryParam, Long employeeId) {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
@ -79,8 +88,10 @@ public class SIAccountBiz extends Service{
List<InsuranceAccountBatchPO> list = insuranceAccountBatchMapper.list(queryParam);
list = SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
PageInfo<InsuranceAccountBatchPO> pageInfo = new PageInfo<>(list,InsuranceAccountBatchPO.class);
List<InsuranceAccountBatchPO> list = insuranceAccountBatchMapper.list(queryParam);
PageInfo<InsuranceAccountBatchPO> pageInfo = new PageInfo<>(list, InsuranceAccountBatchPO.class);
return pageInfo;
}finally {
} finally {
sqlSession.close();
}
@ -95,19 +106,24 @@ public class SIAccountBiz extends Service{
List<InsuranceAccountDetailPO> list = insuranceAccountDetailMapper.list(queryParam);
InsuranceAccountDetailPOEncrypt.decryptInsuranceAccountDetailPOList(list);
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list,InsuranceAccountDetailPO.class);
PageInfo<InsuranceAccountDetailPO> 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());
insuranceAccountBatchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
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())
@ -117,6 +133,7 @@ public class SIAccountBiz extends Service{
.createTime(new Date())
.updateTime(new Date())
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.paymentOrganization(param.getPaymentOrganization())
.build();
SiAccountEncrypt.encryptInsuranceAccountBatch(build);
MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).insert(build);
@ -129,15 +146,16 @@ 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<Long> employeeIds = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(billMonth));
public void account(AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
List<Long> employeeIds = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization());
if (CollectionUtils.isEmpty(employeeIds)) {
List<InsuranceAccountBatchPO> list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth));
SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
List<InsuranceAccountBatchPO> 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());
@ -145,35 +163,41 @@ 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<Long> ids;
if (CollectionUtils.isEmpty(param.getIds())) {
ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()));
// 需要分权的情况
if(getTaxAgentService().isNeedAuth(employeeId)) {
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();
}
@ -181,13 +205,13 @@ 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<List<Long>> partition = Lists.partition(ids, 100);
CountDownLatch countDownLatch = new CountDownLatch(partition.size());
BlockingDeque<Boolean> 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<Long> batchIds : partition) {
taskExecutor.execute(() -> {
commonAccount(countDownLatch, results, param.getBillMonth(), batchIds, simpleEmployee);
@ -196,13 +220,14 @@ 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<InsuranceAccountBatchPO> list = Lists.newArrayList(MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(param.getBillMonth()));
list = SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
List<InsuranceAccountBatchPO> 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());
@ -216,7 +241,7 @@ public class SIAccountBiz extends Service{
}
public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque<Boolean> results,*/ String billMonth, List<Long> ids, Long employeeId, String tenantKey) {
public void commonAccount(/*CountDownLatch countDownLatch, BlockingDeque<Boolean> results,*/ String billMonth, List<Long> ids, Long employeeId, String tenantKey, Long paymentOrganization) {
/* try {*/
SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, tenantKey);
@ -237,6 +262,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);
//核算公积金
@ -270,23 +297,23 @@ public class SIAccountBiz extends Service{
}*/
}
private List<List<InsuranceAccountDetailTempPO>> splitList(List<InsuranceAccountDetailTempPO> list , int groupSize){
private List<List<InsuranceAccountDetailTempPO>> splitList(List<InsuranceAccountDetailTempPO> list, int groupSize) {
int length = list.size();
// 计算可以分成多少组
int num = ( length + groupSize - 1 )/groupSize ;
int num = (length + groupSize - 1) / groupSize;
List<List<InsuranceAccountDetailTempPO>> 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<Long> ids, String billMonth, Long employeeId, String tenantKey,String currentUserName) {
private void handleData(List<Long> ids, AccountParam param, Long employeeId, String tenantKey, String currentUserName) {
//事务后续处理
//TransactionStatus status = transactionManager.getTransaction(new DefaultTransactionDefinition());
try {
@ -305,7 +332,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) {
@ -676,12 +703,12 @@ 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<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(billMonth, String.valueOf(param.getPaymentOrganization()));
Map<Long, List<InsuranceAccountDetailPO>> map = insuranceAccountDetailPOS.stream().filter(item -> item.getEmployeeId() != null)
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId));
int socialAccountPerson = 0;
@ -725,6 +752,8 @@ public class SIAccountBiz extends Service{
}
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth);
SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillMonth(billMonth,param.getPaymentOrganization());
DataCollectionEmployee simpleEmployee = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeById(employeeId);
insuranceAccountBatchPO.setAccountant(currentUserName);
insuranceAccountBatchPO.setUpdateTime(new Date());
@ -748,28 +777,34 @@ public class SIAccountBiz extends Service{
}
public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId,String currentUserName) {
public void saveCommonAccount(SaveCommonAccountParam param, Long employeeId, String currentUserName) {
List<Long> 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());
SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
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());
@ -780,21 +815,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<Long> 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<SupplementAccountBaseParam> baseList = new ArrayList<>();
employeeIds.stream().forEach(id -> {
param.getBillMonthList().stream().forEach(month -> {
@ -808,8 +843,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);
}
/**
@ -817,21 +853,21 @@ public class SIAccountBiz extends Service{
* @param employeeIds 需要补缴的员工id
* @return
*/
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth,Long employeeId) {
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, String billMonth, Long employeeId) {
//(k,v) k-员工id v-员工对应的福利档案数据
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds,SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
//核算结果集
List<InsuranceAccountDetailPO> 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<Integer> projects = baseParam.getProjects();
insuranceAccountDetailPO.setBillMonth(baseParam.getBillMonth());
@ -1218,19 +1254,19 @@ public class SIAccountBiz extends Service{
}
private List<List<InsuranceAccountDetailPO>> splitDetailList(List<InsuranceAccountDetailPO> list , int groupSize){
private List<List<InsuranceAccountDetailPO>> splitDetailList(List<InsuranceAccountDetailPO> list, int groupSize) {
int length = list.size();
// 计算可以分成多少组
int num = ( length + groupSize - 1 )/groupSize ; // TODO
int num = (length + groupSize - 1) / groupSize; // TODO
List<List<InsuranceAccountDetailPO>> 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
@ -1269,11 +1305,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());
@ -1282,10 +1319,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<SupplementAccountBaseParam> param, Long employeeId,String currentUserName) {
public void deleteSupplementaryAccount(List<SupplementAccountBaseParam> param, Long employeeId, String currentUserName) {
SalaryAssert.notEmpty(param, SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
boolean valid = param.stream().anyMatch(item -> item.getEmployeeId() == null
|| StringUtils.isBlank(item.getSupplementaryMonth())
@ -1304,11 +1341,11 @@ 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) {
// TODO 归档前检查是否有核算异常
public void file(String billMonth, Long employeeId, Long paymentOrganization) {
// 归档前检查是否有核算异常
// List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getByInspectStatusAndBillMonth(InspectStatusEnum.IGNORE.getValue(),billMonth);
// SalaryAssert.isEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100500, "当前核算月存在核算异常数据"));
@ -1317,10 +1354,14 @@ public class SIAccountBiz extends Service{
SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel( 100503, "月份账单不存在"));
SalaryAssert.isFalse(insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.ARCHIVED.getValue(), SalaryI18nUtil.getI18nLabel( 100504, "月份账单已归档"));
InsuranceAccountBatchPO insuranceAccountBatchPO = MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).getByBillStatus(billMonth, BillStatusEnum.NOT_ARCHIVED.getValue(), paymentOrganization);
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(100503, "月份账单不存在"));
SalaryAssert.isFalse(insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.ARCHIVED.getValue(), SalaryI18nUtil.getI18nLabel(100504, "月份账单已归档"));
insuranceAccountBatchPO.setBillStatus(BillStatusEnum.ARCHIVED.getValue());
SiAccountEncrypt.encryptInsuranceAccountBatch(insuranceAccountBatchPO);
MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class).updateById(insuranceAccountBatchPO);
//日志记录
//日志记录
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId()));
// insuranceSchemeContext.setTargetName(insuranceAccountBatchPO.getBillMonth());
@ -1332,9 +1373,9 @@ public class SIAccountBiz extends Service{
}
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId,String currentUserName) {
public void accountInspect(Collection<Long> ids, String billMonth, Long employeeId, String currentUserName) {
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = allInspects(ids, billMonth);
SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100515, "无核算数据"));
SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel(100515, "无核算数据"));
List<InsuranceAccountInspectPO> commonInspects = insuranceAccountInspectPOS.stream()
.filter(e -> Objects.equals(e.getPaymentStatus(), PaymentStatusEnum.COMMON.getValue()))
.collect(Collectors.toList());
@ -1346,7 +1387,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)) {
@ -1360,13 +1401,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<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth) {
List<InsuranceAccountInspectPO> list = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getList(billMonth,InspectStatusEnum.IGNORE.getValue(),ids);
List<InsuranceAccountInspectPO> list = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class).getList(billMonth, InspectStatusEnum.IGNORE.getValue(), ids);
if (CollectionUtils.isNotEmpty(list)) {
return list;
@ -1380,9 +1421,11 @@ public class SIAccountBiz extends Service{
// SalaryPageUtil.start(queryParam.getCurrent(),queryParam.getPageSize());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
InsuranceAccountDetailPOEncrypt.decryptInsuranceAccountDetailPOList(insuranceAccountDetailPOS);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth(), queryParam.getPaymentOrganization());
//获取扣缴义务人信息
List<TaxAgent> paymentList = MapperProxyFactory.getProxy(TaxAgentMapper.class).listAll();
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel( 100341, "该租户无扣缴义务人"));
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(100341, "该租户无扣缴义务人"));
Map<Long, TaxAgent> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgent::getId, Function.identity()));
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = buildRecords(insuranceAccountDetailPOS, paymentMap);
@ -1391,7 +1434,7 @@ public class SIAccountBiz extends Service{
// Page<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new Page<>(page.getCurrent(), insuranceAccountViewListDTOS.size(), insuranceAccountViewListDTOS.size(),
// page.isSearchCount());
PageInfo<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS,InsuranceAccountViewListDTO.class);
PageInfo<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS, InsuranceAccountViewListDTO.class);
insuranceAccountViewListDTOPage.setTotal(insuranceAccountViewListDTOS.size());
return insuranceAccountViewListDTOPage;
}

View File

@ -46,6 +46,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;
@ -66,6 +67,7 @@ import java.util.stream.Collectors;
* @Version V1.0
**/
@Data
@Slf4j
public class SIArchivesBiz {
Boolean needAuth ;
@ -648,11 +650,14 @@ public class SIArchivesBiz {
PageInfo<InsuranceArchivesEmployeePO> pageInfo = new PageInfo<>(InsuranceArchivesEmployeePO.class);
if (needAuth) {
Collection<Long> 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);

View File

@ -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());
}

View File

@ -41,6 +41,11 @@ public class InsuranceAccountBatchListDTO {
@TableTitle(title = "账单月份", dataIndex = "billMonth", key = "billMonth")
private String billMonth;
@TableTitle(title = "个税扣缴义务人", dataIndex = "paymentOrganization", key = "paymentOrganization")
private String paymentOrganization;
private Long paymentOrganizationId;
/**
* 账单状态 0-未归档 1-已归档
*/
@ -102,4 +107,6 @@ public class InsuranceAccountBatchListDTO {
private String remarks;
}

View File

@ -35,4 +35,11 @@ public class AccountParam {
// 是否是首次核算
private boolean flag = true;
/**
* 个税扣缴义务人id
*/
// @DataCheck(require = true,message = "个税扣缴义务人不能为空")
private Long paymentOrganization;
}

View File

@ -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<Long> taxAgents;
}

View File

@ -25,4 +25,6 @@ public class InsuranceAccountDetailParam extends BaseQueryParam {
private List<Long> employeeIds;
private String userName;
private String paymentOrganization;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -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;

View File

@ -100,4 +100,10 @@ public class InsuranceAccountBatchPO {
*/
private String tenantKey;
/**
* 个税扣缴义务人
*/
private Long paymentOrganization;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -22,4 +22,6 @@ public class InsuranceExportParam {
//@NotBlank
@DataCheck(require = true,message = "账单月份不可为空")
private String billMonth;
private String paymentOrganization;
}

View File

@ -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)

View File

@ -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);
/**
* 插入
@ -56,7 +55,7 @@ public interface InsuranceAccountBatchMapper {
* @param billStatus
* @return
*/
InsuranceAccountBatchPO getByBillStatus(@Param("billMonth") String billMonth,@Param("billStatus")Integer billStatus);
InsuranceAccountBatchPO getByBillStatus(@Param("billMonth") String billMonth,@Param("billStatus")Integer billStatus, @Param("paymentOrganization") Long paymentOrganization);
List<InsuranceAccountBatchPO> listByTimeRange(@Param("minDate") String minDate, @Param("maxDate") String maxDate);

View File

@ -18,6 +18,7 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="tenant_key" property="tenantKey"/>
<result column="payment_organization" property="paymentOrganization"/>
</resultMap>
<!-- 表字段 -->
@ -38,6 +39,7 @@
, t.create_time
, t.update_time
, t.tenant_key
, t.payment_organization
</sql>
<insert id="insert" parameterType="com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO"
@ -60,6 +62,7 @@
create_time,
update_time,
tenant_key,
payment_organization,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{billMonth},
@ -77,6 +80,7 @@
#{createTime},
#{updateTime},
#{tenantKey},
#{paymentOrganization},
</trim>
</insert>
@ -103,6 +107,7 @@
create_time,
update_time,
tenant_key,
payment_organization,
</trim>
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
#{billMonth},
@ -120,6 +125,7 @@
#{createTime},
#{updateTime},
#{tenantKey},
#{paymentOrganization},
</trim>
</insert>
@ -130,14 +136,22 @@
AND
t.bill_month between #{param.startTime} and #{param.endTime}
</if>
<if test="param.taxAgents != null and param.taxAgents.size() > 0 ">
AND
t.payment_organization in
<foreach collection="param.taxAgents" open="(" item="taxAgent" separator="," close=")">
#{taxAgent}
</foreach>
</if>
</sql>
<select id="list" resultMap="BaseResultMap">
SELECT
<include refid="baseColumns"/>
<include refid="baseColumns" />
FROM
hrsa_bill_batch t
left join hrsa_tax_agent t1 on t.payment_organization = t1.id
WHERE t.delete_type = 0
<include refid="paramSql"/>
ORDER BY t.bill_month DESC
@ -161,6 +175,9 @@
hrsa_bill_batch t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
<if test="paymentOrganization != null">
AND t.payment_organization = #{paymentOrganization}
</if>
</select>
@ -172,6 +189,9 @@
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
AND t.bill_status = #{billStatus}
<if test="paymentOrganization != null">
AND t.payment_organization = #{paymentOrganization}
</if>
</select>
@ -197,6 +217,9 @@
bill_status=#{billStatus}
</set>
WHERE id = #{id} AND delete_type = 0
<if test="paymentOrganization != null">
AND payment_organization = #{paymentOrganization}
</if>
</update>

View File

@ -29,7 +29,7 @@ public interface InsuranceAccountDetailMapper {
* @param time
* @return
*/
List<Long> selectAccountIds(@Param("time") String time);
List<Long> selectAccountIds(@Param("time") String time,@Param("paymentOrganization") Long paymentOrganization);
/**
* 根据id删除
@ -40,7 +40,7 @@ public interface InsuranceAccountDetailMapper {
/**
* 批量删除
*/
void batchDelAccountDetails(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth);
void batchDelAccountDetails(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth,@Param("paymentOrganization") Long paymentOrganization);
/**
* 批量保存
@ -54,7 +54,7 @@ public interface InsuranceAccountDetailMapper {
* @param billMonth
* @return
*/
List<InsuranceAccountDetailPO> selectList(@Param("billMonth") String billMonth);
List<InsuranceAccountDetailPO> selectList(@Param("billMonth") String billMonth, @Param("paymentOrganization") String paymentOrganization);
List<InsuranceAccountDetailPO> queryList(@Param("billMonth") String billMonth,@Param("employeeIds") Collection<Long> employeeIds);
@ -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);
/**

View File

@ -45,6 +45,7 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="tenant_key" property="tenantKey"/>
<result column="payment_organization" property="paymentOrganization"/>
</resultMap>
<!-- 表字段 -->
@ -93,6 +94,7 @@
, t.create_time
, t.update_time
, t.tenant_key
, t.payment_organization
</sql>
<sql id="paramSqlCommon" >
@ -104,6 +106,10 @@
AND
t.payment_status = #{param.paymentStatus}
</if>
<if test="param.paymentOrganization != null and param.paymentOrganization != ''">
AND
t.payment_organization = #{param.paymentOrganization}
</if>
</sql>
<sql id="paramSql">
@ -156,6 +162,9 @@
hrsa_bill_detail t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
<if test="paymentOrganization != null and paymentOrganization != ''">
AND t.payment_organization = #{paymentOrganization}
</if>
</select>
<select id="queryList" resultMap="BaseResultMap">
@ -215,6 +224,11 @@
LEFT JOIN hrsa_other_archives other ON t.ID = other.employee_id
WHERE (
fund.fund_start_time IS NOT NULL AND fund.fund_start_time != ''
<if test="paymentOrganization != null and paymentOrganization != ''">
AND
-- 个税扣缴义务人
fund.payment_organization = #{paymentOrganization}
</if>
AND(
fund.fund_end_time IS NULL
OR fund.fund_end_time = ''
@ -223,6 +237,11 @@
)
OR (
social.social_start_time IS NOT NULL AND social.social_start_time != ''
<if test="paymentOrganization != null and paymentOrganization != ''">
AND
-- 个税扣缴义务人
social.payment_organization = #{paymentOrganization}
</if>
AND(
social.social_end_time IS NULL
OR social.social_end_time = ''
@ -231,6 +250,11 @@
)
OR (
other.other_start_time IS NOT NULL AND other.other_start_time != ''
<if test="paymentOrganization != null and paymentOrganization != ''">
AND
-- 个税扣缴义务人
other.payment_organization = #{paymentOrganization}
</if>
AND(
other.other_end_time IS NULL
OR other.other_end_time = ''
@ -316,7 +340,10 @@
FROM hrsa_bill_detail
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND bill_status = 0
AND bill_status = 0
<if test="paymentOrganization != null">
AND payment_organization = #{paymentOrganization}
</if>
</delete>
@ -363,6 +390,7 @@
SET delete_type = 1
WHERE delete_type = 0
AND bill_month = #{billMonth}
AND payment_organization = #{paymentOrganization}
<if test="employeeIds != null and employeeIds.size()>0">
AND employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">
@ -388,7 +416,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
<foreach collection="accounts" item="item" separator=",">
(
@ -432,7 +460,8 @@
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
#{item.tenantKey},
#{item.paymentOrganization}
)
</foreach>
</insert>
@ -441,7 +470,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)
<foreach collection="accounts" item="item" separator="union all">
select
#{item.employeeId},
@ -484,7 +513,8 @@
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
#{item.tenantKey},
#{item.paymentOrganization}
from dual
</foreach>
</insert>
@ -494,7 +524,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 +567,8 @@
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
#{item.tenantKey},
#{item.paymentOrganization}
)
</foreach>
</insert>

View File

@ -34,5 +34,5 @@ public interface SIAccountDetailTempMapper {
* @param billMonth
* @return
*/
List<InsuranceAccountDetailTempPO> getListByEmployeeIdsAndBillMonth(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth);
List<InsuranceAccountDetailTempPO> getListByEmployeeIdsAndBillMonth(@Param("employeeIds") Collection<Long> employeeIds, @Param("billMonth") String billMonth,@Param("paymentOrganization") Long paymentOrganization);
}

View File

@ -45,6 +45,7 @@
<result column="create_time" property="createTime"/>
<result column="update_time" property="updateTime"/>
<result column="tenant_key" property="tenantKey"/>
<result column="payment_organization" property="paymentOrganization"/>
</resultMap>
<!-- 表字段 -->
@ -92,6 +93,7 @@
, t.create_time
, t.update_time
, t.tenant_key
, t.payment_organization
</sql>
@ -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
<foreach collection="accounts" item="item" separator=",">
(
@ -159,7 +161,8 @@
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
#{item.tenantKey},
#{item.paymentOrganization}
)
</foreach>
</insert>
@ -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)
<foreach collection="accounts" item="item" separator="union all">
select
@ -212,7 +215,8 @@
#{item.createTime},
#{item.updateTime},
#{item.deleteType},
#{item.tenantKey}
#{item.tenantKey},
#{item.paymentOrganization}
from dual
</foreach>
</insert>
@ -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}
)
</foreach>
</insert>
@ -277,6 +282,7 @@
hrsa_bill_detail_temp t
WHERE t.delete_type = 0
AND t.bill_month = #{billMonth}
AND t.payment_organization = #{paymentOrganization}
<if test="employeeIds != null and employeeIds.size()>0">
AND t.employee_id IN
<foreach collection="employeeIds" open="(" item="employeeId" separator="," close=")">

View File

@ -63,6 +63,8 @@
WHERE id = #{id} AND delete_type = 0
</select>
<insert id="insertIgnoreNull" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentPO"
keyProperty="id" keyColumn="id" useGeneratedKeys="true"
>
@ -183,7 +185,6 @@
</if>
</trim>
</insert>
<!-- 更新,更新全部字段 -->
<update id="update" parameterType="com.engine.salary.entity.taxagent.po.TaxAgentPO">
UPDATE hrsa_tax_agent

View File

@ -4,9 +4,8 @@ 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.entity.taxagent.po.TaxAgentPO;
import com.engine.salary.util.page.PageInfo;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import java.util.Collection;
import java.util.List;
@ -134,7 +133,7 @@ public interface SIAccountService {
* tab信息
* @param billMonth
*/
InsuranceAccountTabDTO tabList(String billMonth);
InsuranceAccountTabDTO tabList(AccountParam build);
/**
* 人员异动
@ -201,5 +200,7 @@ public interface SIAccountService {
* @return
*/
List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth);
Collection<TaxAgentPO> getAdminTaxAgentList();
}

View File

@ -24,6 +24,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;
@ -34,15 +35,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 java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
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;
@ -56,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
@ -65,7 +62,7 @@ import weaver.hrm.User;
**/
public class SIAccountServiceImpl extends Service implements SIAccountService {
private SIAccountBiz siAccountBiz = new SIAccountBiz();
// private SIAccountBiz siAccountBiz = new SIAccountBiz();
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
@ -73,6 +70,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);
}
@ -81,14 +82,24 @@ 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<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
Long employeeId = (long)user.getUID();
Map<String,Object> datas = new HashMap<>();
// 分权逻辑
if(getTaxAgentService(user).isNeedAuth((long) user.getUID())) {
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
queryParam.setTaxAgents(taxAgents);
}
//福利台账列表
PageInfo<InsuranceAccountBatchPO> pageInfo = siAccountBiz.listPage(queryParam,employeeId);
PageInfo<InsuranceAccountBatchPO> pageInfo = getSiAccountBiz(user).listPage(queryParam,employeeId);
Collection<InsuranceAccountBatchPO> insuranceAccountBatchPOS = pageInfo.getList();
List<InsuranceAccountBatchListDTO> insuranceAccountBatchListDTOS = InsuranceAccountBO.buildAccountBatchDTOList(insuranceAccountBatchPOS);
@ -157,7 +168,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String,Object> datas = new HashMap<>();
//正常缴纳列表
PageInfo<InsuranceAccountDetailPO> pageInfo = siAccountBiz.listCommonPage(queryParam);
PageInfo<InsuranceAccountDetailPO> pageInfo = getSiAccountBiz(user).listCommonPage(queryParam);
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
//数据组装
@ -290,7 +301,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
@ -298,49 +309,49 @@ 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
public void deleteCommonAccount(SaveCommonAccountParam param) {
ValidUtil.doValidator(param);
Long employeeId = (long)user.getUID();
String currentUserName = user.getLastname();
siAccountBiz.deleteCommonAccount(param,employeeId,currentUserName);
getSiAccountBiz(user).deleteCommonAccount(param,employeeId,currentUserName);
}
@Override
public void deleteSummplementaryAccount(List<SupplementAccountBaseParam> supplementAccountBaseParams) {
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, accountParam.getPaymentOrganization());
}
@Override
@ -375,9 +386,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());
insuranceAccountBatchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
boolean isShow = false;
if (insuranceAccountBatchPO == null || insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.NOT_ARCHIVED.getValue()) {
@ -408,7 +419,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;
}
@ -471,7 +482,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
@ -592,7 +603,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
@Override
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
PageInfo<InsuranceAccountViewListDTO> pageInfos = siAccountBiz.overView(queryParam);
PageInfo<InsuranceAccountViewListDTO> pageInfos = getSiAccountBiz(user).overView(queryParam);
return pageInfos;
}
@ -891,8 +902,10 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
return Collections.emptyList();
}
@Override
public Collection<TaxAgentPO> getAdminTaxAgentList() {
return getTaxAgentService(user).listAllTaxAgentsAsAdmin((long)user.getUID());
}
}

View File

@ -58,7 +58,7 @@ public class SIExportServiceImpl extends Service implements SIExportService {
@Override
public XSSFWorkbook exportOverView(InsuranceExportParam queryParam) {
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth());
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectList(queryParam.getBillMonth(), queryParam.getPaymentOrganization());
InsuranceAccountDetailPOEncrypt.decryptInsuranceAccountDetailPOList(insuranceAccountDetailPOS);
//获取扣缴义务人信息

View File

@ -680,11 +680,10 @@ public class SISchemeServiceImpl extends Service implements SISchemeService {
excelComments.add(errorMessageMap);
isError = true;
}
String exchangeUserStatus = userStateExchange(userStatus);
List<Long> 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<String, String> errorMessageMap = Maps.newHashMap();

View File

@ -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;
@ -292,9 +293,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<String, InsuranceAccountTabDTO>(user).run(getService(user)::tabList, billMonth);
AccountParam build = AccountParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization).build();
return new ResponseResult<AccountParam, InsuranceAccountTabDTO>(user).run(getService(user)::tabList, build);
}
@POST
@ -347,5 +349,12 @@ public class SIAccountController {
return new ResponseResult<String, Map<String, Boolean>>(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<String, Collection<TaxAgentPO>>(user).run(getService(user)::getAdminTaxAgentList);
}
}