福利台账

This commit is contained in:
MustangDeng 2022-06-08 17:52:10 +08:00
parent 28b49f9987
commit 69edbc63d1
7 changed files with 64 additions and 28 deletions

View File

@ -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<InsuranceAccountBatchPO> 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<Long> ids;
if (CollectionUtils.isEmpty(param.getIds())) {
ids = MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class).selectAccountIds(SalaryDateUtil.getMonthBegin(param.getBillMonth()), param.getPaymentOrganization());
// 需要分权的情况
if(getTaxAgentService().isNeedAuth(employeeId)) {
List<TaxAgentEmployeeDTO> 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<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);
@ -209,7 +224,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);
@ -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, "参数错误"));

View File

@ -39,7 +39,7 @@ public class AccountParam {
/**
* 个税扣缴义务人id
*/
@DataCheck(require = true,message = "个税扣缴义务人不能为空")
// @DataCheck(require = true,message = "个税扣缴义务人不能为空")
private Long paymentOrganization;
}

View File

@ -105,4 +105,5 @@ public class InsuranceAccountBatchPO {
*/
private Long paymentOrganization;
}

View File

@ -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 = ''

View File

@ -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<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth);
Collection<TaxAgentPO> getAdminTaxAgentList();
}

View File

@ -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<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
@ -85,7 +90,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
Map<String,Object> datas = new HashMap<>();
//福利台账列表
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);
@ -154,7 +159,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();
//数据组装
@ -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<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
PageInfo<InsuranceAccountViewListDTO> pageInfos = siAccountBiz.overView(queryParam);
PageInfo<InsuranceAccountViewListDTO> pageInfos = getSiAccountBiz(user).overView(queryParam);
return pageInfos;
}
@ -884,8 +889,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

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