2022-04-11 19:07:35 +08:00
|
|
|
|
package com.engine.salary.service.impl;
|
|
|
|
|
|
|
2024-04-01 20:25:23 +08:00
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
2022-04-27 14:36:05 +08:00
|
|
|
|
import com.alibaba.fastjson.JSON;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.alibaba.fastjson.TypeReference;
|
2022-04-12 19:29:19 +08:00
|
|
|
|
import com.api.browser.bean.SearchConditionGroup;
|
|
|
|
|
|
import com.api.browser.bean.SearchConditionItem;
|
2022-04-18 20:24:43 +08:00
|
|
|
|
import com.api.browser.bean.SearchConditionOption;
|
2022-09-15 16:14:34 +08:00
|
|
|
|
import com.api.formmode.mybatis.util.SqlProxyHandle;
|
2024-03-01 17:40:19 +08:00
|
|
|
|
import com.cloudstore.dev.api.util.Util_DataCache;
|
2022-04-16 16:43:33 +08:00
|
|
|
|
import com.cloudstore.eccom.pc.table.*;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
import com.cloudstore.eccom.result.WeaResultMsg;
|
2022-04-12 10:24:21 +08:00
|
|
|
|
import com.engine.common.util.ServiceUtil;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
import com.engine.core.impl.Service;
|
2024-04-01 20:25:23 +08:00
|
|
|
|
import com.engine.hrmelog.entity.dto.LoggerContext;
|
|
|
|
|
|
import com.engine.salary.biz.TaxAgentBiz;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.cache.SalaryCacheKey;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
import com.engine.salary.component.SalaryWeaTable;
|
2024-02-20 16:50:45 +08:00
|
|
|
|
import com.engine.salary.config.SalaryElogConfig;
|
2022-04-12 19:29:19 +08:00
|
|
|
|
import com.engine.salary.constant.SalaryDefaultTenantConstant;
|
2024-03-01 17:40:19 +08:00
|
|
|
|
import com.engine.salary.constant.SalaryItemConstant;
|
2022-12-12 15:40:01 +08:00
|
|
|
|
import com.engine.salary.encrypt.EncryptUtil;
|
2022-09-02 11:53:38 +08:00
|
|
|
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.entity.progress.ProgressDTO;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
|
2024-01-19 11:35:11 +08:00
|
|
|
|
import com.engine.salary.entity.siaccount.dto.*;
|
2022-04-15 13:17:25 +08:00
|
|
|
|
import com.engine.salary.entity.siaccount.param.*;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.entity.siaccount.po.*;
|
|
|
|
|
|
import com.engine.salary.entity.siarchives.po.*;
|
2022-04-27 16:21:24 +08:00
|
|
|
|
import com.engine.salary.entity.sicategory.po.ICategoryPO;
|
2023-04-18 14:21:05 +08:00
|
|
|
|
import com.engine.salary.entity.siexport.param.InsuranceExportParam;
|
|
|
|
|
|
import com.engine.salary.entity.siexport.po.AccountExportPO;
|
|
|
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
|
2022-09-27 17:36:06 +08:00
|
|
|
|
import com.engine.salary.entity.sischeme.po.InsuranceSchemePO;
|
2022-06-08 17:52:10 +08:00
|
|
|
|
import com.engine.salary.entity.taxagent.po.TaxAgentPO;
|
2024-02-20 16:50:45 +08:00
|
|
|
|
import com.engine.salary.enums.OperateTypeEnum;
|
2022-04-16 16:43:33 +08:00
|
|
|
|
import com.engine.salary.enums.UserStatusEnum;
|
2024-09-26 10:35:46 +08:00
|
|
|
|
import com.engine.salary.enums.auth.AuthFilterTypeEnum;
|
2023-03-16 16:10:29 +08:00
|
|
|
|
import com.engine.salary.enums.datacollection.UseEmployeeTypeEnum;
|
2022-10-20 11:27:27 +08:00
|
|
|
|
import com.engine.salary.enums.siaccount.*;
|
2023-11-24 14:05:03 +08:00
|
|
|
|
import com.engine.salary.enums.sicategory.*;
|
2022-07-20 15:40:51 +08:00
|
|
|
|
import com.engine.salary.exception.SalaryRunTimeException;
|
2023-04-18 14:21:05 +08:00
|
|
|
|
import com.engine.salary.mapper.InsuranceExportMapper;
|
2024-02-20 16:50:45 +08:00
|
|
|
|
import com.engine.salary.mapper.datacollection.EmployMapper;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.mapper.siaccount.*;
|
2022-12-07 17:09:53 +08:00
|
|
|
|
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
|
2022-10-20 16:29:49 +08:00
|
|
|
|
import com.engine.salary.mapper.siarchives.InsuranceBaseInfoMapper;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
|
2022-12-07 17:09:53 +08:00
|
|
|
|
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
|
2022-04-27 16:21:24 +08:00
|
|
|
|
import com.engine.salary.mapper.sicategory.ICategoryMapper;
|
2023-04-18 14:21:05 +08:00
|
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
|
2022-09-27 17:36:06 +08:00
|
|
|
|
import com.engine.salary.mapper.sischeme.InsuranceSchemeMapper;
|
2022-09-15 16:14:34 +08:00
|
|
|
|
import com.engine.salary.mapper.sys.SalarySysConfMapper;
|
2022-09-06 17:13:33 +08:00
|
|
|
|
import com.engine.salary.mapper.taxagent.TaxAgentMapper;
|
2022-06-08 17:52:10 +08:00
|
|
|
|
import com.engine.salary.service.*;
|
2024-09-26 10:35:46 +08:00
|
|
|
|
import com.engine.salary.service.auth.AuthService;
|
|
|
|
|
|
import com.engine.salary.service.auth.AuthServiceImpl;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.sys.constant.SalarySysConstant;
|
2022-09-15 16:14:34 +08:00
|
|
|
|
import com.engine.salary.sys.entity.po.SalarySysConfPO;
|
2022-09-27 10:19:09 +08:00
|
|
|
|
import com.engine.salary.sys.entity.vo.OrderRuleVO;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.sys.enums.SalaryAcctEmployeeRuleEnum;
|
2022-09-27 10:19:09 +08:00
|
|
|
|
import com.engine.salary.sys.service.SalarySysConfService;
|
|
|
|
|
|
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import com.engine.salary.util.*;
|
2024-04-01 20:25:23 +08:00
|
|
|
|
import com.engine.salary.util.db.IdGenerator;
|
2022-04-12 19:29:19 +08:00
|
|
|
|
import com.engine.salary.util.db.MapperProxyFactory;
|
2022-09-02 11:53:38 +08:00
|
|
|
|
import com.engine.salary.util.excel.ExcelParseHelper;
|
|
|
|
|
|
import com.engine.salary.util.excel.ExcelSupport;
|
|
|
|
|
|
import com.engine.salary.util.excel.ExcelUtil;
|
2023-12-08 11:16:18 +08:00
|
|
|
|
import com.engine.salary.util.excel.ExcelUtilPlus;
|
2022-04-19 12:19:06 +08:00
|
|
|
|
import com.engine.salary.util.page.Column;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
import com.engine.salary.util.page.PageInfo;
|
2022-05-25 13:10:03 +08:00
|
|
|
|
import com.engine.salary.util.page.SalaryPageUtil;
|
2022-04-14 11:54:16 +08:00
|
|
|
|
import com.engine.salary.util.valid.ValidUtil;
|
2023-09-12 11:05:46 +08:00
|
|
|
|
import com.engine.salary.wrapper.SalaryFormulaWrapper;
|
2022-04-27 14:36:05 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
2022-09-02 11:53:38 +08:00
|
|
|
|
import com.google.common.collect.Maps;
|
2023-09-12 11:05:46 +08:00
|
|
|
|
import com.mzlion.core.utils.BeanUtils;
|
2024-01-19 11:35:11 +08:00
|
|
|
|
import com.wbi.util.StringUtil;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
2022-04-12 19:29:19 +08:00
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import org.apache.commons.lang.math.NumberUtils;
|
2022-04-12 19:29:19 +08:00
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
2022-09-02 11:53:38 +08:00
|
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
|
|
|
|
import org.apache.poi.util.IOUtils;
|
|
|
|
|
|
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
|
|
|
import weaver.file.ImageFileManager;
|
|
|
|
|
|
import weaver.general.Util;
|
2022-04-12 10:24:21 +08:00
|
|
|
|
import weaver.hrm.User;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
import java.io.InputStream;
|
2022-06-06 19:08:39 +08:00
|
|
|
|
import java.math.BigDecimal;
|
2024-01-19 11:35:11 +08:00
|
|
|
|
import java.text.SimpleDateFormat;
|
2022-06-06 19:08:39 +08:00
|
|
|
|
import java.util.*;
|
2022-11-17 13:39:50 +08:00
|
|
|
|
import java.util.concurrent.ExecutorService;
|
|
|
|
|
|
import java.util.concurrent.Executors;
|
2024-01-17 16:07:27 +08:00
|
|
|
|
import java.util.function.Function;
|
2022-09-14 14:36:05 +08:00
|
|
|
|
import java.util.regex.Matcher;
|
|
|
|
|
|
import java.util.regex.Pattern;
|
2022-06-06 19:08:39 +08:00
|
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
import static com.engine.salary.util.excel.ExcelSupport.EXCEL_TYPE_XLSX;
|
|
|
|
|
|
|
2022-04-11 19:07:35 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @Author weaver_cl
|
2022-07-13 11:45:16 +08:00
|
|
|
|
* @Description:
|
2022-04-11 19:07:35 +08:00
|
|
|
|
* @Date 2022/4/11
|
|
|
|
|
|
* @Version V1.0
|
|
|
|
|
|
**/
|
2024-01-17 16:07:27 +08:00
|
|
|
|
@Slf4j
|
2022-04-11 19:07:35 +08:00
|
|
|
|
public class SIAccountServiceImpl extends Service implements SIAccountService {
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
|
2022-04-16 16:43:33 +08:00
|
|
|
|
|
2022-12-12 15:40:01 +08:00
|
|
|
|
private EncryptUtil encryptUtil = new EncryptUtil();
|
|
|
|
|
|
|
2022-04-12 10:24:21 +08:00
|
|
|
|
public RecordsBuildService getService(User user) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
return ServiceUtil.getService(RecordsBuildServiceImpl.class, user);
|
2022-04-12 10:24:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// public SIAccountBiz getSiAccountBiz(User user) {
|
|
|
|
|
|
// return ServiceUtil.getService(SIAccountBiz.class, user);
|
|
|
|
|
|
// }
|
2022-06-08 17:52:10 +08:00
|
|
|
|
|
2022-04-12 19:29:19 +08:00
|
|
|
|
public ColumnBuildService getColumnBuildService(User user) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
return ServiceUtil.getService(ColumnBuildServiceImpl.class, user);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 16:21:24 +08:00
|
|
|
|
public SICategoryService getSICategoryService(User user) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
return ServiceUtil.getService(SICategoryServiceImpl.class, user);
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-08 17:52:10 +08:00
|
|
|
|
private TaxAgentService getTaxAgentService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
|
|
|
|
|
|
}
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
2022-08-02 14:58:18 +08:00
|
|
|
|
private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 17:36:06 +08:00
|
|
|
|
private ExcelInsuranceDetailMapper getExcelInsuranceDetailMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(ExcelInsuranceDetailMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
private SalaryItemService getSalaryItemService(User user) {
|
|
|
|
|
|
return (SalaryItemService) ServiceUtil.getService(SalaryItemServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
private TaxAgentMapper getTaxAgentMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(TaxAgentMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-04 10:11:10 +08:00
|
|
|
|
// SICategoryBiz siCategoryBiz = new SICategoryBiz();
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
2022-09-15 16:14:34 +08:00
|
|
|
|
private SalarySysConfMapper getSalarySysConfMapper() {
|
|
|
|
|
|
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-21 15:49:55 +08:00
|
|
|
|
private SalaryEmployeeService getSalaryEmployeeService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SalaryEmployeeServiceImpl.class, user);
|
2022-09-15 16:14:34 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 10:19:09 +08:00
|
|
|
|
private SalarySysConfService getSalarySysConfService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 17:36:06 +08:00
|
|
|
|
private InsuranceSchemeMapper getInsuranceSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-10-20 16:29:49 +08:00
|
|
|
|
private InsuranceBaseInfoMapper getInsuranceBaseInfoMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceBaseInfoMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-07 17:09:53 +08:00
|
|
|
|
private SocialSchemeMapper getSocialSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private FundSchemeMapper getFundSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-17 16:07:27 +08:00
|
|
|
|
private OtherSchemeMapper getOtherSchemeMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-19 17:59:12 +08:00
|
|
|
|
private TaxAgentBiz taxAgentBiz = new TaxAgentBiz();
|
|
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
|
private ICategoryMapper getICategoryMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(ICategoryMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceAccountInspectMapper getInsuranceAccountInspectMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-04-18 14:21:05 +08:00
|
|
|
|
private InsuranceExportMapper getInsuranceExportMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceExportMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-09-12 11:05:46 +08:00
|
|
|
|
private SalaryFormulaWrapper getSalaryFormulaWrapper(User user) {
|
|
|
|
|
|
return (SalaryFormulaWrapper) ServiceUtil.getService(SalaryFormulaWrapper.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public SIExportService getSIExportService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SIExportServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-24 14:05:03 +08:00
|
|
|
|
private SIBalanceService getSIBalanceService(User user) {
|
|
|
|
|
|
return (SIBalanceService) ServiceUtil.getService(SIBalanceServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-17 16:07:27 +08:00
|
|
|
|
private ProgressService getSalaryAcctProgressService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(ProgressServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private SIAccountDetailTempMapper getSIAccountDetailTempMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(SIAccountDetailTempMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private InsuranceCompensationMapper getInsuranceCompensationMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(InsuranceCompensationMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
private SIAccountUtilMapper getSIAccountUtilMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(SIAccountUtilMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
public SIArchivesService getSIArchivesService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(SIArchivesServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-20 16:50:45 +08:00
|
|
|
|
private EmployMapper getEmployMapper() {
|
|
|
|
|
|
return MapperProxyFactory.getProxy(EmployMapper.class);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-26 10:35:46 +08:00
|
|
|
|
public AuthService getAuthService(User user) {
|
|
|
|
|
|
return ServiceUtil.getService(AuthServiceImpl.class, user);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-11 19:07:35 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listPage(InsuranceAccountBatchParam queryParam) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
2022-04-11 19:07:35 +08:00
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
PageInfo<InsuranceAccountBatchPO> pageInfo = siBatchListPage(queryParam);
|
2022-04-11 19:07:35 +08:00
|
|
|
|
Collection<InsuranceAccountBatchPO> insuranceAccountBatchPOS = pageInfo.getList();
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountBatchListDTO> insuranceAccountBatchListDTOS = InsuranceAccountBO.buildAccountBatchDTOList(insuranceAccountBatchPOS);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
PageInfo<InsuranceAccountBatchListDTO> pageInfos = new PageInfo<>(insuranceAccountBatchListDTOS, InsuranceAccountBatchListDTO.class);
|
2022-04-22 18:50:03 +08:00
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
2022-04-11 19:07:35 +08:00
|
|
|
|
pageInfos.setPageNum(queryParam.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(queryParam.getPageSize());
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
List<Map<Integer, List<Permission>>> operatesPermission = new ArrayList<>();
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
2022-04-11 19:07:35 +08:00
|
|
|
|
SalaryWeaTable<InsuranceAccountBatchListDTO> table = new SalaryWeaTable<>(user, InsuranceAccountBatchListDTO.class);
|
2022-04-19 12:19:06 +08:00
|
|
|
|
List<Column> columns = pageInfos.getColumns();
|
|
|
|
|
|
List<WeaTableColumn> weaTableColumn = columns.stream().map(v -> new WeaTableColumn("100", v.getTitle(), v.getKey())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
table.setColumns(weaTableColumn);
|
2022-04-11 19:07:35 +08:00
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
datas.put("operatesPermission", operatesPermission);
|
|
|
|
|
|
datas.put("dataKey", result.getResultMap());
|
2022-04-11 19:07:35 +08:00
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-04-12 10:24:21 +08:00
|
|
|
|
public Map<String, Object> listCommonPage(InsuranceAccountDetailParam queryParam) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
2022-04-11 19:07:35 +08:00
|
|
|
|
|
2022-04-12 10:24:21 +08:00
|
|
|
|
//正常缴纳列表
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// PageInfo<InsuranceAccountDetailPO> pageInfo = getSiAccountBiz(user).listCommonPage(queryParam);
|
|
|
|
|
|
PageInfo<InsuranceAccountDetailPO> pageInfo = siBatchListCommonPage(queryParam);
|
2022-04-12 10:24:21 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
|
|
|
|
|
|
|
|
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId, false);
|
2022-04-15 19:01:09 +08:00
|
|
|
|
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
2022-04-22 18:50:03 +08:00
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
pageInfos.setPageNum(queryParam.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(queryParam.getPageSize());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//动态列组装
|
2022-11-16 15:45:36 +08:00
|
|
|
|
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, queryParam.getPaymentStatus());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
2022-04-19 13:31:46 +08:00
|
|
|
|
WeaTable table = new WeaTable();
|
2022-04-19 17:46:24 +08:00
|
|
|
|
table.setPageUID(UUID.randomUUID().toString());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
table.setColumns(weaTableColumn);
|
2022-04-19 12:19:06 +08:00
|
|
|
|
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
|
|
|
|
|
|
pageInfos.setColumns(columns);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
2022-04-19 17:46:24 +08:00
|
|
|
|
//datas.put("dataKey",result.getResultMap());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-16 16:43:33 +08:00
|
|
|
|
|
2022-04-12 19:29:19 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listCommonPageByName(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
//增加查询参数userName
|
|
|
|
|
|
if (StringUtils.isNotBlank(queryParam.getUserName())) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
queryParam.setUserName(queryParam.getUserName());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
return listCommonPage(queryParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listSupplementaryPage(InsuranceAccountDetailParam queryParam) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
2023-04-17 10:27:31 +08:00
|
|
|
|
// //过滤出福利档案基础信息表中runStatus为正在缴纳和待减员的人员
|
|
|
|
|
|
// List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
|
|
|
|
|
// List<Long> canAccountIds = baseInfoPOList.stream()
|
|
|
|
|
|
// .filter(f->f.getPaymentOrganization().toString().equals(queryParam.getPaymentOrganization())
|
|
|
|
|
|
// && (f.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())))
|
|
|
|
|
|
// .map(InsuranceArchivesBaseInfoPO::getEmployeeId)
|
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
|
// queryParam.setEmployeeIds(canAccountIds);
|
2022-10-20 17:33:29 +08:00
|
|
|
|
|
2022-04-15 19:01:09 +08:00
|
|
|
|
//补缴缴纳列表
|
2022-04-12 19:29:19 +08:00
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
|
2022-09-27 10:19:09 +08:00
|
|
|
|
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//系统人员核算明细
|
2022-08-02 14:58:18 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
2022-12-12 10:25:55 +08:00
|
|
|
|
PageInfo<InsuranceAccountDetailPO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(),queryParam.getPageSize(),
|
|
|
|
|
|
list, InsuranceAccountDetailPO.class);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId, false);
|
2022-04-19 12:19:06 +08:00
|
|
|
|
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
2022-04-22 18:50:03 +08:00
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
pageInfos.setPageNum(queryParam.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(queryParam.getPageSize());
|
2022-04-12 10:24:21 +08:00
|
|
|
|
|
|
|
|
|
|
|
2022-04-12 19:29:19 +08:00
|
|
|
|
//动态列组装
|
2022-11-16 15:45:36 +08:00
|
|
|
|
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, queryParam.getPaymentStatus());
|
2022-04-12 10:24:21 +08:00
|
|
|
|
|
2022-04-19 12:19:06 +08:00
|
|
|
|
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, InsuranceAccountDetailPO.class);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
table.setColumns(weaTableColumn);
|
2022-04-19 17:46:24 +08:00
|
|
|
|
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
|
|
|
|
|
|
pageInfos.setColumns(columns);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
2022-04-19 17:46:24 +08:00
|
|
|
|
//datas.put("dataKey",result.getResultMap());
|
2022-04-12 10:24:21 +08:00
|
|
|
|
return datas;
|
2022-04-11 19:07:35 +08:00
|
|
|
|
}
|
2022-04-12 10:24:21 +08:00
|
|
|
|
|
2022-04-16 16:43:33 +08:00
|
|
|
|
|
2022-04-12 19:29:19 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> supplementaryByNameList(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
//增加查询参数userName
|
|
|
|
|
|
if (StringUtils.isNotBlank(queryParam.getUserName())) {
|
2022-04-19 17:46:24 +08:00
|
|
|
|
queryParam.setUserName(queryParam.getUserName());
|
2022-04-12 19:29:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
return listSupplementaryPage(queryParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-11-16 15:45:36 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listRecessionPage(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 分权逻辑
|
|
|
|
|
|
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
|
|
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
|
|
|
|
|
|
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(taxAgents)) {
|
|
|
|
|
|
//防止普通用户查询
|
|
|
|
|
|
queryParam.setTaxAgents(Collections.singletonList(-1L));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
queryParam.setTaxAgents(taxAgents);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-11-22 09:46:37 +08:00
|
|
|
|
//退差列表
|
2022-11-16 15:45:36 +08:00
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//系统人员核算明细
|
2022-11-16 15:45:36 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
2022-12-12 10:25:55 +08:00
|
|
|
|
PageInfo<InsuranceAccountDetailPO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(),queryParam.getPageSize(),
|
|
|
|
|
|
list, InsuranceAccountDetailPO.class);
|
2022-11-16 15:45:36 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
|
2022-12-09 14:50:29 +08:00
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId, false);
|
2022-12-09 14:50:29 +08:00
|
|
|
|
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
|
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
|
|
|
|
|
pageInfos.setPageNum(queryParam.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(queryParam.getPageSize());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//动态列组装
|
|
|
|
|
|
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, queryParam.getPaymentStatus());
|
|
|
|
|
|
|
|
|
|
|
|
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
table.setColumns(weaTableColumn);
|
|
|
|
|
|
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
|
|
|
|
|
|
pageInfos.setColumns(columns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
|
|
|
|
|
//datas.put("dataKey",result.getResultMap());
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listBalancePage(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 分权逻辑
|
|
|
|
|
|
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
|
|
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
|
|
|
|
|
|
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(taxAgents)) {
|
|
|
|
|
|
//防止普通用户查询
|
|
|
|
|
|
queryParam.setTaxAgents(Collections.singletonList(-1L));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
queryParam.setTaxAgents(taxAgents);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//补差列表
|
|
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//系统人员核算明细
|
2022-12-09 14:50:29 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
2022-12-09 14:50:29 +08:00
|
|
|
|
PageInfo<InsuranceAccountDetailPO> pageInfo = new PageInfo<>(list, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
|
2022-12-15 17:11:38 +08:00
|
|
|
|
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
|
2022-11-16 15:45:36 +08:00
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId, false);
|
2022-11-16 15:45:36 +08:00
|
|
|
|
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
|
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
|
|
|
|
|
pageInfos.setPageNum(queryParam.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(queryParam.getPageSize());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//动态列组装
|
|
|
|
|
|
List<WeaTableColumn> weaTableColumn = getColumnBuildService(user).buildCommonColumnsWithStyle(insuranceAccountDetailPOS, employeeId, SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY, queryParam.getPaymentStatus());
|
|
|
|
|
|
|
|
|
|
|
|
SalaryWeaTable<InsuranceAccountDetailPO> table = new SalaryWeaTable<>(user, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
table.setColumns(weaTableColumn);
|
|
|
|
|
|
List<Column> columns = weaTableColumn.stream().map(v -> new Column(v.getText(), v.getColumn(), v.getColumn())).collect(Collectors.toList());
|
|
|
|
|
|
pageInfos.setColumns(columns);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
|
|
|
|
|
datas.put("pageInfo", pageInfos);
|
|
|
|
|
|
//datas.put("dataKey",result.getResultMap());
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-12 19:29:19 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getForm(Map<String, Object> params) {
|
2022-04-14 11:54:16 +08:00
|
|
|
|
Map<String, Object> apidatas = new HashMap<>();
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
|
|
|
|
|
//条件组
|
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
2022-04-20 19:12:01 +08:00
|
|
|
|
SearchConditionItem datePickerItem = SalaryFormItemUtil.datePickerItem(user, 2, 16, true, 2, "账单月份", "billMonth");
|
2022-04-14 11:54:16 +08:00
|
|
|
|
String minDate = SalaryDateUtil.getYearMonth(-1, 0);
|
|
|
|
|
|
String maxDate = SalaryDateUtil.getYearMonth(0, 6);
|
2022-04-20 19:12:01 +08:00
|
|
|
|
datePickerItem.setOtherParams(new HashMap<>());
|
2022-07-08 11:19:08 +08:00
|
|
|
|
datePickerItem.getOtherParams().put("minDate", minDate);
|
|
|
|
|
|
datePickerItem.getOtherParams().put("maxDate", maxDate);
|
2022-04-14 11:54:16 +08:00
|
|
|
|
|
2022-08-02 14:58:18 +08:00
|
|
|
|
List<InsuranceAccountBatchPO> billMonthList = getInsuranceAccountBatchMapper().listByTimeRange(minDate, maxDate);
|
2022-12-12 15:40:01 +08:00
|
|
|
|
encryptUtil.decryptList(billMonthList, InsuranceAccountBatchPO.class);
|
2022-04-14 11:54:16 +08:00
|
|
|
|
if (CollectionUtils.isEmpty(billMonthList)) {
|
|
|
|
|
|
datePickerItem.getOtherParams().put("disabledData", Collections.emptyList());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
datePickerItem.getOtherParams().put("disabledData", billMonthList.stream().map(InsuranceAccountBatchPO::getBillMonth).collect(Collectors.toList()));
|
|
|
|
|
|
}
|
|
|
|
|
|
datePickerItem.getOtherParams().put("type", "month");
|
|
|
|
|
|
datePickerItem.getOtherParams().put("format", "YYYY-MM");
|
|
|
|
|
|
datePickerItem.getOtherParams().put("showFormat", "YYYY-MM");
|
|
|
|
|
|
conditionItems.add(datePickerItem);
|
2022-04-12 19:29:19 +08:00
|
|
|
|
|
2022-04-20 19:12:01 +08:00
|
|
|
|
SearchConditionItem textareaItem = SalaryFormItemUtil.textareaItem(user, 2, 16, true, 2, 60, "备注", "remarks");
|
2022-04-14 11:54:16 +08:00
|
|
|
|
conditionItems.add(textareaItem);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
addGroups.add(new SearchConditionGroup("常用条件", true, conditionItems));
|
2022-04-14 11:54:16 +08:00
|
|
|
|
|
|
|
|
|
|
apidatas.put("billMonth", SalaryDateUtil.getYearMonth(0, 0));
|
|
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
apidatas.put("condition", addGroups);
|
2022-04-14 11:54:16 +08:00
|
|
|
|
|
|
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-11-23 15:01:28 +08:00
|
|
|
|
public String save(AccountParam param) {
|
2024-01-17 16:07:27 +08:00
|
|
|
|
// ValidUtil.doValidator(param);
|
|
|
|
|
|
//
|
|
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String lastName = user.getLastname();
|
|
|
|
|
|
// return getSiAccountBiz(user).save(param.isFlag(), param, employeeId, lastName);
|
|
|
|
|
|
return saveAndFile(param);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void commonAccount(SaveCommonAccountParam param) {
|
2024-01-17 16:07:27 +08:00
|
|
|
|
// ValidUtil.doValidator(param);
|
|
|
|
|
|
//
|
|
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String currentUserName = user.getLastname();
|
|
|
|
|
|
// getSiAccountBiz(user).saveCommonAccount(param, employeeId, currentUserName);
|
|
|
|
|
|
siSaveCommonAccount(param);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void delete(AccountParam accountParam) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
Long employeeId = (long) user.getUID();
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// getSiAccountBiz(user).delete(accountParam, employeeId);
|
|
|
|
|
|
siDelete(accountParam);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void saveCommonAccount(SaveCommonAccountParam accountParam) {
|
2024-01-17 16:07:27 +08:00
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String currentUserName = user.getLastname();
|
|
|
|
|
|
// getSiAccountBiz(user).saveCommonAccount(accountParam, employeeId, currentUserName);
|
|
|
|
|
|
siSaveCommonAccount(accountParam);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 福利台账正常缴纳页-核算
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void siSaveCommonAccount(SaveCommonAccountParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> collect;
|
|
|
|
|
|
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, "无核算人员"));
|
|
|
|
|
|
AccountParam accountParam = new AccountParam();
|
|
|
|
|
|
accountParam.setBillMonth(param.getBillMonth());
|
|
|
|
|
|
accountParam.setIds(collect);
|
|
|
|
|
|
siAccounting(accountParam);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void saveSupplementaryAccount(SaveSupplementaryAccountParam saveSupplementaryAccountParam) {
|
2022-06-28 18:21:44 +08:00
|
|
|
|
ValidUtil.doValidator(saveSupplementaryAccountParam);
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String currentUserName = user.getLastname();
|
|
|
|
|
|
// getSiAccountBiz(user).saveSupplementaryAccount(saveSupplementaryAccountParam, employeeId, currentUserName);
|
|
|
|
|
|
siSaveSupplementaryAccount(saveSupplementaryAccountParam);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void deleteCommonAccount(SaveCommonAccountParam param) {
|
2022-06-06 19:08:39 +08:00
|
|
|
|
ValidUtil.doValidator(param);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String currentUserName = user.getLastname();
|
|
|
|
|
|
// getSiAccountBiz(user).deleteCommonAccount(param, employeeId, currentUserName);
|
|
|
|
|
|
siDeleteCommonAccount(param);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2024-02-22 09:33:35 +08:00
|
|
|
|
public void deleteSupplementaryAccount(SaveCommonAccountParam param) {
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String currentUserName = user.getLastname();
|
|
|
|
|
|
// getSiAccountBiz(user).deleteSupplementaryAccount(supplementAccountBaseParams, employeeId, currentUserName);
|
2024-02-22 09:33:35 +08:00
|
|
|
|
siDeleteSupplementaryAccount(param);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void file(AccountParam accountParam) {
|
2024-01-17 16:07:27 +08:00
|
|
|
|
// Long employeeId = (long) user.getUID();
|
|
|
|
|
|
// String billMonth = accountParam.getBillMonth();
|
|
|
|
|
|
// getSiAccountBiz(user).file(billMonth, employeeId, accountParam.getPaymentOrganization());
|
|
|
|
|
|
siFile(accountParam.getBillMonth(), accountParam.getPaymentOrganization());
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void unconfirmed(Collection<Long> ids) {
|
2023-03-07 14:21:01 +08:00
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getInsuranceAccountInspectMapper().getByInspectStatusAndIds(InspectStatusEnum.COMFORED.getValue(), ids);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceAccountInspectPOS)) {
|
2022-08-02 14:58:18 +08:00
|
|
|
|
getInsuranceAccountDetailMapper().batchUnConfirmedInspectDetails(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getId).collect(Collectors.toList()));
|
2022-04-15 13:17:25 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Boolean> buttonCheck(String billMonth) {
|
|
|
|
|
|
Map<String, Boolean> result = new HashMap<>();
|
2023-03-07 14:21:01 +08:00
|
|
|
|
List<InsuranceAccountInspectPO> list = getInsuranceAccountInspectMapper().getByInspectStatusAndBillMonth(InspectStatusEnum.IGNORE.getValue(), billMonth);
|
2022-04-15 13:17:25 +08:00
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
|
result.put("displayFlag", false);
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
result.put("displayFlag", true);
|
|
|
|
|
|
return result;
|
2022-04-12 19:29:19 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-15 19:01:09 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void ignore(Collection<Long> ids) {
|
2023-03-07 14:21:01 +08:00
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getInsuranceAccountInspectMapper().getByInspectStatusAndIds(InspectStatusEnum.IGNORE.getValue(), ids);
|
2022-04-15 19:01:09 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceAccountInspectPOS)) {
|
2022-08-02 14:58:18 +08:00
|
|
|
|
getInsuranceAccountDetailMapper().batchIgnoreInspectDetails(insuranceAccountInspectPOS.stream().map(InsuranceAccountInspectPO::getId).collect(Collectors.toList()));
|
2022-04-15 19:01:09 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
2022-06-06 19:08:39 +08:00
|
|
|
|
public InsuranceAccountTabDTO tabList(AccountParam build) {
|
2022-04-15 19:01:09 +08:00
|
|
|
|
InsuranceAccountTabDTO insuranceAccountTabDTO = InsuranceAccountTabDTO.builder().build();
|
2022-08-02 14:58:18 +08:00
|
|
|
|
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(build.getBillMonth(), build.getPaymentOrganization());
|
2022-12-12 15:40:01 +08:00
|
|
|
|
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
2022-04-15 19:01:09 +08:00
|
|
|
|
boolean isShow = false;
|
|
|
|
|
|
if (insuranceAccountBatchPO == null || insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.NOT_ARCHIVED.getValue()) {
|
|
|
|
|
|
isShow = true;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (insuranceAccountBatchPO != null) {
|
|
|
|
|
|
insuranceAccountTabDTO.setRemarks(insuranceAccountBatchPO.getRemarks());
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Map<String, Object>> tabList = new ArrayList<>();
|
|
|
|
|
|
Map<String, Object> common = new HashMap<>();
|
|
|
|
|
|
common.put("id", "1");
|
2022-07-08 11:19:08 +08:00
|
|
|
|
common.put("content", SalaryI18nUtil.getI18nLabel(92265, "正常缴纳"));
|
2022-04-15 19:01:09 +08:00
|
|
|
|
tabList.add(common);
|
|
|
|
|
|
if (isShow) {
|
|
|
|
|
|
Map<String, Object> change = new HashMap<>();
|
|
|
|
|
|
change.put("id", "2");
|
2022-07-08 11:19:08 +08:00
|
|
|
|
change.put("content", SalaryI18nUtil.getI18nLabel(100509, "异动清单"));
|
2022-04-15 19:01:09 +08:00
|
|
|
|
tabList.add(change);
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String, Object> repair = new HashMap<>();
|
|
|
|
|
|
repair.put("id", "3");
|
|
|
|
|
|
repair.put("content", SalaryI18nUtil.getI18nLabel(92267, "补缴"));
|
|
|
|
|
|
tabList.add(repair);
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> overView = new HashMap<>();
|
|
|
|
|
|
overView.put("id", "4");
|
2022-07-08 11:19:08 +08:00
|
|
|
|
overView.put("content", SalaryI18nUtil.getI18nLabel(99927, "总览"));
|
2022-04-15 19:01:09 +08:00
|
|
|
|
tabList.add(overView);
|
2022-11-22 13:35:09 +08:00
|
|
|
|
|
|
|
|
|
|
Map<String, Object> recession = new HashMap<>();
|
|
|
|
|
|
recession.put("id", "5");
|
|
|
|
|
|
recession.put("content", SalaryI18nUtil.getI18nLabel(92270, "退差"));
|
|
|
|
|
|
tabList.add(recession);
|
|
|
|
|
|
|
2022-12-16 11:13:28 +08:00
|
|
|
|
Map<String, Object> balance = new HashMap<>();
|
|
|
|
|
|
balance.put("id", "6");
|
|
|
|
|
|
balance.put("content", SalaryI18nUtil.getI18nLabel(92271, "补差"));
|
|
|
|
|
|
tabList.add(balance);
|
|
|
|
|
|
|
2022-04-15 19:01:09 +08:00
|
|
|
|
insuranceAccountTabDTO.setTabList(tabList);
|
|
|
|
|
|
insuranceAccountTabDTO.setShow(isShow);
|
2022-06-06 19:08:39 +08:00
|
|
|
|
insuranceAccountTabDTO.setBillMonth(build.getBillMonth());
|
2022-04-15 19:01:09 +08:00
|
|
|
|
return insuranceAccountTabDTO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-16 16:43:33 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> changeList(InsuranceAccountDetailParam param) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
2022-08-02 14:58:18 +08:00
|
|
|
|
List<InsuranceArchivesEmployeePO> insuranceArchivesEmployeePOS = getInsuranceAccountDetailMapper().changeList(param.getUserName());
|
2022-12-12 10:25:55 +08:00
|
|
|
|
PageInfo<InsuranceArchivesEmployeePO> pageInfo = SalaryPageUtil.buildPage(param.getCurrent(), param.getPageSize(),
|
|
|
|
|
|
insuranceArchivesEmployeePOS, InsuranceArchivesEmployeePO.class);
|
2022-04-22 18:50:03 +08:00
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// List<Map<String, Object>> records = siArchivesBiz.buildTableData(insuranceArchivesEmployeePOS);
|
|
|
|
|
|
List<Map<String, Object>> records = getSIArchivesService(user).buildTableData(insuranceArchivesEmployeePOS);
|
2022-04-16 16:43:33 +08:00
|
|
|
|
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(records);
|
2022-04-22 18:50:03 +08:00
|
|
|
|
pageInfos.setTotal(pageInfo.getTotal());
|
2022-04-16 16:43:33 +08:00
|
|
|
|
pageInfos.setPageNum(param.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(param.getPageSize());
|
|
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// List<WeaTableColumn> weaTableColumns = siArchivesBiz.buildWeaTableColumns(insuranceArchivesEmployeePOS, employeeId);
|
|
|
|
|
|
List<WeaTableColumn> weaTableColumns = getSIArchivesService(user).buildWeaTableColumns(insuranceArchivesEmployeePOS);
|
2022-04-16 16:43:33 +08:00
|
|
|
|
|
|
|
|
|
|
WeaTable table = new WeaTable();
|
|
|
|
|
|
table.setPageUID(UUID.randomUUID().toString());
|
|
|
|
|
|
table.setColumns(weaTableColumns);
|
|
|
|
|
|
table.setTableType(WeaTableType.CHECKBOX);
|
|
|
|
|
|
WeaTableOperates weaTableOperates = new WeaTableOperates();
|
|
|
|
|
|
WeaTableOperate weaTableOperate = new WeaTableOperate();
|
|
|
|
|
|
weaTableOperate.setIndex("0");
|
|
|
|
|
|
weaTableOperate.setText("移除");
|
|
|
|
|
|
WeaTableOperate weaTableOperate1 = new WeaTableOperate();
|
|
|
|
|
|
weaTableOperate1.setIndex("1");
|
|
|
|
|
|
weaTableOperate1.setText("添加");
|
|
|
|
|
|
table.setOperates(weaTableOperates);
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Permission>> permissions = new ArrayList<>();
|
|
|
|
|
|
for (int i = 0; i < records.size(); i++) {
|
|
|
|
|
|
List<Permission> permission = new ArrayList<>();
|
2022-07-27 16:56:13 +08:00
|
|
|
|
if (UserStatusEnum.DEPARTURE.getDefaultLabel().equals(records.get(i).get("status"))) {
|
2022-04-16 16:43:33 +08:00
|
|
|
|
permission.add(new Permission(true, false));
|
|
|
|
|
|
permission.add(new Permission(false, false));
|
|
|
|
|
|
permissions.add(permission);
|
|
|
|
|
|
}
|
2022-07-27 16:56:13 +08:00
|
|
|
|
if (UserStatusEnum.DEPARTURE.getDefaultLabel().equals(records.get(i).get("status"))) {
|
2022-04-16 16:43:33 +08:00
|
|
|
|
permission.add(new Permission(false, false));
|
|
|
|
|
|
permission.add(new Permission(true, false));
|
|
|
|
|
|
permissions.add(permission);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
datas.put("permissions", permissions);
|
2022-04-16 16:43:33 +08:00
|
|
|
|
datas.put("pageInfo", pageInfos);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
datas.put("dataKey", result.getResultMap());
|
2022-04-16 16:43:33 +08:00
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void accountInspect(InspectAccountParam param) {
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// Long employeeId = (long) user.getUID();
|
2022-04-16 16:43:33 +08:00
|
|
|
|
ValidUtil.doValidator(param);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// String currentUserName = user.getLastname();
|
|
|
|
|
|
// getSiAccountBiz(user).accountInspect(param.getIds(), param.getBillMonth(), employeeId, currentUserName, param.getPaymentOrganization());
|
|
|
|
|
|
accountInspect(param.getIds(), param.getBillMonth(), param.getPaymentOrganization());
|
2022-04-16 16:43:33 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getInspectTable(InsuranceAccountDetailParam param) {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
2022-04-16 16:43:33 +08:00
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = getInsuranceAccountInspectMapper().getByBillMonth(param.getBillMonth());
|
2022-10-28 15:25:58 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildInspectRecords(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization()));
|
2022-12-12 10:25:55 +08:00
|
|
|
|
List<Map<String, Object>> paged = SalaryPageUtil.subList(param.getCurrent(), param.getPageSize(), records);
|
|
|
|
|
|
PageInfo<Map<String, Object>> pageInfos = new PageInfo<>(paged);
|
2022-04-16 16:43:33 +08:00
|
|
|
|
pageInfos.setTotal(records.size());
|
|
|
|
|
|
pageInfos.setPageNum(param.getCurrent());
|
|
|
|
|
|
pageInfos.setPageSize(param.getPageSize());
|
|
|
|
|
|
|
2022-10-28 15:25:58 +08:00
|
|
|
|
List<WeaTableColumn> weaTableColumns = getColumnBuildService(user).buildInspectColumns(insuranceAccountInspectPOS, Long.valueOf(param.getPaymentOrganization()));
|
2022-04-16 16:43:33 +08:00
|
|
|
|
WeaTable table = new WeaTable();
|
|
|
|
|
|
table.setPageUID(UUID.randomUUID().toString());
|
|
|
|
|
|
table.setColumns(weaTableColumns);
|
|
|
|
|
|
table.setTableType(WeaTableType.CHECKBOX);
|
|
|
|
|
|
WeaTableOperates weaTableOperates = new WeaTableOperates();
|
|
|
|
|
|
WeaTableOperate weaTableOperate = new WeaTableOperate();
|
|
|
|
|
|
weaTableOperate.setIndex("0");
|
|
|
|
|
|
weaTableOperate.setText("忽略");
|
|
|
|
|
|
WeaTableOperate weaTableOperate1 = new WeaTableOperate();
|
|
|
|
|
|
weaTableOperate1.setIndex("1");
|
|
|
|
|
|
weaTableOperate1.setText("重置");
|
|
|
|
|
|
table.setOperates(weaTableOperates);
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Permission>> permissions = new ArrayList<>();
|
|
|
|
|
|
for (int i = 0; i < records.size(); i++) {
|
|
|
|
|
|
List<Permission> permission = new ArrayList<>();
|
|
|
|
|
|
Permission permissionCheckBox = new Permission();
|
|
|
|
|
|
if (InspectStatusEnum.IGNORE.getValue() == records.get(i).get("inspectStatus")) {
|
|
|
|
|
|
permissionCheckBox.setVisible(true);
|
|
|
|
|
|
permissionCheckBox.setDisabled(false);
|
|
|
|
|
|
permission.add(new Permission(true, false));
|
|
|
|
|
|
permission.add(new Permission(false, true));
|
|
|
|
|
|
permissions.add(permission);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (InspectStatusEnum.COMFORED.getValue() == records.get(i).get("inspectStatus")) {
|
|
|
|
|
|
permissionCheckBox.setVisible(true);
|
|
|
|
|
|
permissionCheckBox.setDisabled(true);
|
|
|
|
|
|
permission.add(new Permission(false, true));
|
|
|
|
|
|
permission.add(new Permission(true, false));
|
|
|
|
|
|
permissions.add(permission);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
WeaResultMsg result = new WeaResultMsg(false);
|
|
|
|
|
|
result.putAll(table.makeDataResult());
|
|
|
|
|
|
result.success();
|
|
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
datas.put("permissions", permissions);
|
2022-04-16 16:43:33 +08:00
|
|
|
|
datas.put("pageInfo", pageInfos);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
datas.put("dataKey", result.getResultMap());
|
2022-04-16 16:43:33 +08:00
|
|
|
|
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getCommonForm(Map<String, Object> params) {
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
//条件组
|
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
|
|
List<SearchConditionItem> conditionItem = new ArrayList<>();
|
|
|
|
|
|
|
2022-04-22 16:42:06 +08:00
|
|
|
|
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 12, 2, true, "对象", "required", "17", "includes");
|
2022-04-18 20:24:43 +08:00
|
|
|
|
conditionItems.add(includes);
|
2022-04-22 16:42:06 +08:00
|
|
|
|
SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 12, 2, true, "选择人员", "required", "17", "excludes");
|
2022-04-18 20:24:43 +08:00
|
|
|
|
conditionItem.add(excludes);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
addGroups.add(new SearchConditionGroup("人员范围", true, conditionItems));
|
|
|
|
|
|
addGroups.add(new SearchConditionGroup("人员范围排除", true, conditionItem));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
apidatas.put("condition", addGroups);
|
2022-04-18 20:24:43 +08:00
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getSupplementaryForm(Map<String, Object> params) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
//条件组
|
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
|
List<SearchConditionItem> condition = new ArrayList<>();
|
|
|
|
|
|
List<SearchConditionItem> conditionItems = new ArrayList<>();
|
|
|
|
|
|
List<SearchConditionItem> conditionItem = new ArrayList<>();
|
|
|
|
|
|
|
2022-09-22 14:25:50 +08:00
|
|
|
|
SearchConditionItem billMonthList = SalaryFormItemUtil.datePickerItem(user, 2, 16, true, 2, "补缴月份", "billMonth");
|
2022-04-18 20:24:43 +08:00
|
|
|
|
billMonthList.setMultiple(true);
|
2022-04-20 19:12:01 +08:00
|
|
|
|
billMonthList.setOtherParams(new HashMap<>());
|
2022-04-18 20:24:43 +08:00
|
|
|
|
billMonthList.getOtherParams().put("type", "months");
|
|
|
|
|
|
billMonthList.getOtherParams().put("format", "YYYY-MM");
|
|
|
|
|
|
billMonthList.getOtherParams().put("showFormat", "YYYY-MM");
|
|
|
|
|
|
billMonthList.setMultiple(true);
|
2022-09-22 14:25:50 +08:00
|
|
|
|
billMonthList.setViewAttr(3);
|
|
|
|
|
|
billMonthList.setRules("required");
|
2022-04-18 20:24:43 +08:00
|
|
|
|
condition.add(billMonthList);
|
|
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SearchConditionItem billProjects = SalaryFormItemUtil.selectItem(user, buildBillProjectsOptions(), 2, 16, 6, true, "补缴项目", "projects");
|
2022-09-22 14:25:50 +08:00
|
|
|
|
billProjects.setViewAttr(3);
|
2022-05-26 11:00:38 +08:00
|
|
|
|
billProjects.setDetailtype(2);
|
2022-09-22 14:25:50 +08:00
|
|
|
|
billProjects.setRules("required");
|
2022-04-18 20:24:43 +08:00
|
|
|
|
condition.add(billProjects);
|
|
|
|
|
|
|
2022-04-22 15:17:31 +08:00
|
|
|
|
SearchConditionItem includes = SalaryFormItemUtil.browserItem(user, 18, 6, 3, true, "对象", "required", "17", "includes");
|
2022-04-18 20:24:43 +08:00
|
|
|
|
conditionItems.add(includes);
|
2022-05-26 11:00:38 +08:00
|
|
|
|
// SearchConditionItem excludes = SalaryFormItemUtil.browserItem(user, 18, 6, 2, true, "选择人员", "required", "17", "excludes");
|
|
|
|
|
|
// excludes.setViewAttr(2);
|
|
|
|
|
|
// conditionItem.add(excludes);
|
2022-07-08 11:19:08 +08:00
|
|
|
|
addGroups.add(new SearchConditionGroup("基础信息", true, condition));
|
|
|
|
|
|
addGroups.add(new SearchConditionGroup("人员范围", true, conditionItems));
|
2022-05-26 11:00:38 +08:00
|
|
|
|
// addGroups.add(new SearchConditionGroup("人员范围排除",true,conditionItem));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
2022-07-08 11:19:08 +08:00
|
|
|
|
apidatas.put("condition", addGroups);
|
2022-04-18 20:24:43 +08:00
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public PageInfo<InsuranceAccountViewListDTO> overView(InsuranceAccountDetailParam queryParam) {
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// PageInfo<InsuranceAccountViewListDTO> pageInfos = getSiAccountBiz(user).overView(queryParam);
|
|
|
|
|
|
PageInfo<InsuranceAccountViewListDTO> pageInfos = siOverView(queryParam);
|
2022-04-18 20:24:43 +08:00
|
|
|
|
return pageInfos;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
@Override
|
2022-07-08 11:19:08 +08:00
|
|
|
|
public List<Map<String, Object>> welfareData(String billMonth, List<Long> employeeIds, Long taxAgentId) {
|
2022-08-02 14:58:18 +08:00
|
|
|
|
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, taxAgentId);
|
2022-12-12 15:40:01 +08:00
|
|
|
|
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
2022-04-27 14:36:05 +08:00
|
|
|
|
if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) {
|
|
|
|
|
|
return Lists.newArrayList();
|
|
|
|
|
|
}
|
2023-08-18 13:30:42 +08:00
|
|
|
|
|
2023-07-10 10:26:08 +08:00
|
|
|
|
//20230707增加福利核算明细中的缴纳状态+合计的数据项
|
2023-10-20 09:50:44 +08:00
|
|
|
|
// List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().queryList(billMonth, taxAgentId, employeeIds);
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = new ArrayList<>();
|
|
|
|
|
|
List<List<Long>> empIdsPart = Lists.partition((List<Long>) employeeIds, 500);
|
|
|
|
|
|
for (List<Long> part : empIdsPart) {
|
|
|
|
|
|
insuranceAccountDetailPOS.addAll(
|
|
|
|
|
|
getInsuranceAccountDetailMapper().queryList(billMonth, taxAgentId, part));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-07-10 10:26:08 +08:00
|
|
|
|
//退差数据不参与薪资核算
|
|
|
|
|
|
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
|
|
|
|
|
|
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())
|
|
|
|
|
|
|| f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())
|
|
|
|
|
|
|| f.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue()) )
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<InsuranceAccountDetailPO> list = buildNewInsuranceDetailPOS(insuranceAccountDetailPOS);
|
|
|
|
|
|
Map<String, InsuranceAccountDetailPO> siAcctResultWithEmpAndPayStatus = insuranceAccountDetailPOS.stream()
|
|
|
|
|
|
.collect(Collectors.toMap(po -> po.getEmployeeId() + "_" + po.getPaymentStatus(), a -> a, (a, b) -> a));
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
List<Map<String, Object>> result = new ArrayList<>();
|
|
|
|
|
|
list.stream().forEach(item -> {
|
|
|
|
|
|
Map<String, Object> record = new HashMap<>();
|
|
|
|
|
|
record.put("employeeId", item.getEmployeeId());
|
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getSocialPerJson())) {
|
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getSocialComJson())) {
|
|
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
record.put("socialPerSum", item.getSocialPerSum());
|
|
|
|
|
|
record.put("socialComSum", item.getSocialComSum());
|
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getFundPerJson())) {
|
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getFundComJson())) {
|
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
record.put("fundPerSum", item.getFundPerSum());
|
|
|
|
|
|
record.put("fundComSum", item.getFundComSum());
|
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getOtherPerJson())) {
|
|
|
|
|
|
Map<String, Object> fundPerJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundPerJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotEmpty(item.getOtherComJson())) {
|
|
|
|
|
|
Map<String, Object> fundComJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, Object>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (fundComJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
2022-04-27 14:36:05 +08:00
|
|
|
|
fundComJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
record.put("otherPerSum", item.getOtherPerSum());
|
|
|
|
|
|
record.put("otherComSum", item.getOtherComSum());
|
|
|
|
|
|
record.put("perSum", item.getPerSum());
|
|
|
|
|
|
record.put("comSum", item.getComSum());
|
2023-07-10 10:26:08 +08:00
|
|
|
|
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//20230707增加福利核算明细中的缴纳状态+合计的数据项、缴纳状态+福利项的数据项
|
2023-07-10 10:26:08 +08:00
|
|
|
|
InsuranceAccountDetailPO commonSiAcct = siAcctResultWithEmpAndPayStatus.get(item.getEmployeeId() + "_" + PaymentStatusEnum.COMMON.getValue());
|
|
|
|
|
|
InsuranceAccountDetailPO repairSiAcct = siAcctResultWithEmpAndPayStatus.get(item.getEmployeeId() + "_" + PaymentStatusEnum.REPAIR.getValue());
|
|
|
|
|
|
InsuranceAccountDetailPO balanceSiAcct = siAcctResultWithEmpAndPayStatus.get(item.getEmployeeId() + "_" + PaymentStatusEnum.BALANCE.getValue());
|
2023-08-18 13:30:42 +08:00
|
|
|
|
//取正常缴纳的福利基数信息
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialPaymentBaseString())) {
|
2023-08-18 13:30:42 +08:00
|
|
|
|
Map<String, Object> socialBaseJson = JSON.parseObject(commonSiAcct.getSocialPaymentBaseString(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialBaseJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialBase", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundPaymentBaseString())) {
|
2023-08-18 13:30:42 +08:00
|
|
|
|
Map<String, Object> fundBaseJson = JSON.parseObject(commonSiAcct.getFundPaymentBaseString(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundBaseJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundBase", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getOtherPaymentBaseString())) {
|
2023-08-18 13:30:42 +08:00
|
|
|
|
Map<String, Object> otherBaseJson = JSON.parseObject(commonSiAcct.getOtherPaymentBaseString(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherBaseJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherBase", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//社保-正常缴纳
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getSocialPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialCommonPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getSocialComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getSocialComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialCommonCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("socialPerCommonSum", commonSiAcct != null ? commonSiAcct.getSocialPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("socialComCommonSum", commonSiAcct != null ? commonSiAcct.getSocialComSum() : new BigDecimal("0"));
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//社保-补缴
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getSocialPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(repairSiAcct.getSocialPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialRepairPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getSocialComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(repairSiAcct.getSocialComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialRepairCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("socialPerRepairSum", repairSiAcct != null ? repairSiAcct.getSocialPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("socialComRepairSum", repairSiAcct != null ? repairSiAcct.getSocialComSum() : new BigDecimal("0"));
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//社保-补差
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (balanceSiAcct != null && StringUtils.isNotEmpty(balanceSiAcct.getSocialPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(balanceSiAcct.getSocialPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialBalancePer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (balanceSiAcct != null && StringUtils.isNotEmpty(balanceSiAcct.getSocialComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(balanceSiAcct.getSocialComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "socialBalanceCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("socialPerBalanceSum", balanceSiAcct != null ? balanceSiAcct.getSocialPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("socialComBalanceSum", balanceSiAcct != null ? balanceSiAcct.getSocialComSum() : new BigDecimal("0"));
|
|
|
|
|
|
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//公积金-正常缴纳
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getFundPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundCommonPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getFundComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> socialJson = JSON.parseObject(commonSiAcct.getFundComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
socialJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundCommonCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("fundPerCommonSum", commonSiAcct != null ? commonSiAcct.getFundPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("fundComCommonSum", commonSiAcct != null ? commonSiAcct.getFundComSum() : new BigDecimal("0"));
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//公积金-补缴
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getFundPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> fundJson = JSON.parseObject(repairSiAcct.getFundPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundRepairPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getFundComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> fundJson = JSON.parseObject(repairSiAcct.getFundComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundRepairCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("fundPerRepairSum", repairSiAcct != null ? repairSiAcct.getFundPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("fundComRepairSum", repairSiAcct != null ? repairSiAcct.getFundComSum() : new BigDecimal("0"));
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//公积金-补差
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (balanceSiAcct != null && StringUtils.isNotEmpty(balanceSiAcct.getFundPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> fundJson = JSON.parseObject(balanceSiAcct.getFundPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundBalancePer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (balanceSiAcct != null && StringUtils.isNotEmpty(balanceSiAcct.getFundComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> fundJson = JSON.parseObject(balanceSiAcct.getFundComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
fundJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "fundBalanceCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("fundPerBalanceSum", balanceSiAcct != null ? balanceSiAcct.getFundPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("fundComBalanceSum", balanceSiAcct != null ? balanceSiAcct.getFundComSum() : new BigDecimal("0"));
|
|
|
|
|
|
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//其他福利-正常缴纳
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getOtherPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(commonSiAcct.getOtherPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherCommonPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-09-20 14:13:00 +08:00
|
|
|
|
if (commonSiAcct != null && StringUtils.isNotEmpty(commonSiAcct.getOtherComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(commonSiAcct.getOtherComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherCommonCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("otherPerCommonSum", commonSiAcct != null ? commonSiAcct.getOtherPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("otherComCommonSum", commonSiAcct != null ? commonSiAcct.getOtherComSum() : new BigDecimal("0"));
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//其他福利-补缴
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getOtherPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(repairSiAcct.getOtherPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherRepairPer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (repairSiAcct != null && StringUtils.isNotEmpty(repairSiAcct.getOtherComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(repairSiAcct.getOtherComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherRepairCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("otherPerRepairSum", repairSiAcct != null ? repairSiAcct.getOtherPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("otherComRepairSum", repairSiAcct != null ? repairSiAcct.getOtherComSum() : new BigDecimal("0"));
|
2023-07-14 09:13:19 +08:00
|
|
|
|
//其他福利-补差
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (balanceSiAcct != null && StringUtils.isNotEmpty(balanceSiAcct.getOtherPerJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(balanceSiAcct.getOtherPerJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherBalancePer", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-14 14:43:30 +08:00
|
|
|
|
if (balanceSiAcct != null && StringUtils.isNotEmpty(balanceSiAcct.getOtherComJson())) {
|
2023-07-14 09:13:19 +08:00
|
|
|
|
Map<String, Object> otherJson = JSON.parseObject(balanceSiAcct.getOtherComJson(), new HashMap<String, Object>().getClass());
|
|
|
|
|
|
otherJson.forEach((k, v) -> {
|
|
|
|
|
|
record.put(k + "otherBalanceCom", v);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2023-07-10 10:26:08 +08:00
|
|
|
|
record.put("otherPerBalanceSum", balanceSiAcct != null ? balanceSiAcct.getOtherPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("otherComBalanceSum", balanceSiAcct != null ? balanceSiAcct.getOtherComSum() : new BigDecimal("0"));
|
|
|
|
|
|
|
|
|
|
|
|
record.put("perCommonSum", commonSiAcct != null ? commonSiAcct.getPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("comCommonSum", commonSiAcct != null ? commonSiAcct.getComSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("perRepairSum", repairSiAcct != null ? repairSiAcct.getPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("comRepairSum", repairSiAcct != null ? repairSiAcct.getComSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("perBalanceSum", balanceSiAcct != null ? balanceSiAcct.getPerSum() : new BigDecimal("0"));
|
|
|
|
|
|
record.put("comBalanceSum", balanceSiAcct != null ? balanceSiAcct.getComSum() : new BigDecimal("0"));
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
result.add(record);
|
|
|
|
|
|
});
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
2022-04-27 16:21:24 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, String> welfareColumns() {
|
2023-08-04 14:14:44 +08:00
|
|
|
|
List<ICategoryPO> listAll = getICategoryMapper().listAll().stream().filter(f -> f.getIsUse().equals(IsUseEnum.START.getValue())).collect(Collectors.toList());
|
2022-04-27 16:21:24 +08:00
|
|
|
|
List<ICategoryPO> list = new ArrayList<>();
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(listAll)) {
|
|
|
|
|
|
list.addAll(listAll);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> result = new LinkedHashMap<>();
|
2023-07-14 09:13:19 +08:00
|
|
|
|
|
|
|
|
|
|
Map<String, String> commonResult = new LinkedHashMap<>();
|
|
|
|
|
|
Map<String, String> repairResult = new LinkedHashMap<>();
|
|
|
|
|
|
Map<String, String> balanceResult = new LinkedHashMap<>();
|
2023-08-18 13:30:42 +08:00
|
|
|
|
Map<String, String> baseResult = new LinkedHashMap<>();
|
2023-07-14 09:13:19 +08:00
|
|
|
|
|
2022-04-27 16:21:24 +08:00
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100393, "个人合计"), "perSum");
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"), "socialPerSum");
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"), "fundPerSum");
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计"), "otherPerSum");
|
2023-07-10 10:26:08 +08:00
|
|
|
|
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "个人正常缴纳合计"), "perCommonSum");
|
|
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人正常缴纳合计"), "socialPerCommonSum");
|
|
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人正常缴纳合计"), "fundPerCommonSum");
|
|
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利个人正常缴纳合计"), "otherPerCommonSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "个人补缴合计"), "perRepairSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人补缴合计"), "socialPerRepairSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人补缴合计"), "fundPerRepairSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利个人补缴合计"), "otherPerRepairSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "个人补差合计"), "perBalanceSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "社保个人补差合计"), "socialPerBalanceSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金个人补差合计"), "fundPerBalanceSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利个人补差合计"), "otherPerBalanceSum");
|
2023-07-10 10:26:08 +08:00
|
|
|
|
|
2022-04-27 16:21:24 +08:00
|
|
|
|
Map<String, String> categoryIdNameMap = getSICategoryService(user).categoryIdNameMap();
|
|
|
|
|
|
list.stream().forEach(item -> {
|
|
|
|
|
|
if (Objects.equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), item.getWelfareType())) {
|
2023-08-18 13:30:42 +08:00
|
|
|
|
if (Objects.equals(DataTypeEnum.SYSTEM.getValue(), item.getDataType())) {
|
|
|
|
|
|
baseResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "申报基数"), item.getId() + "socialBase");
|
|
|
|
|
|
}
|
2022-04-27 16:21:24 +08:00
|
|
|
|
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "socialPer");
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "socialCommonPer");
|
|
|
|
|
|
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "socialRepairPer");
|
|
|
|
|
|
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "socialBalancePer");
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (Objects.equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), item.getWelfareType())) {
|
2023-08-18 13:30:42 +08:00
|
|
|
|
if (Objects.equals(DataTypeEnum.SYSTEM.getValue(), item.getDataType())) {
|
|
|
|
|
|
baseResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "申报基数"), item.getId() + "fundBase");
|
|
|
|
|
|
}
|
2022-04-27 16:21:24 +08:00
|
|
|
|
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "fundPer");
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "fundCommonPer");
|
|
|
|
|
|
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "fundRepairPer");
|
|
|
|
|
|
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "fundBalancePer");
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (Objects.equals(WelfareTypeEnum.OTHER.getValue(), item.getWelfareType())) {
|
2023-08-18 13:30:42 +08:00
|
|
|
|
if (Objects.equals(DataTypeEnum.SYSTEM.getValue(), item.getDataType())) {
|
|
|
|
|
|
baseResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "申报基数"), item.getId() + "otherBase");
|
|
|
|
|
|
}
|
2022-04-27 16:21:24 +08:00
|
|
|
|
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(87159, "个人"), item.getId() + "otherPer");
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳个人"), item.getId() + "otherCommonPer");
|
|
|
|
|
|
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴个人"), item.getId() + "otherRepairPer");
|
|
|
|
|
|
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差个人"), item.getId() + "otherBalancePer");
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
2023-08-18 13:30:42 +08:00
|
|
|
|
|
2022-04-27 16:21:24 +08:00
|
|
|
|
});
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100397, "单位合计"), "comSum");
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100394, "社保单位合计"), "socialComSum");
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计"), "fundComSum");
|
|
|
|
|
|
result.put(SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计"), "otherComSum");
|
2023-07-10 10:26:08 +08:00
|
|
|
|
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "单位正常缴纳合计"), "comCommonSum");
|
|
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "社保单位正常缴纳合计"), "socialComCommonSum");
|
|
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金单位正常缴纳合计"), "fundComCommonSum");
|
|
|
|
|
|
commonResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利单位正常缴纳合计"), "otherComCommonSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "单位补缴合计"), "comRepairSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "社保单位补缴合计"), "socialComRepairSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金单位补缴合计"), "fundComRepairSum");
|
|
|
|
|
|
repairResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利单位补缴合计"), "otherComRepairSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "单位补差合计"), "comBalanceSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "社保单位补差合计"), "socialComBalanceSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "公积金单位补差合计"), "fundComBalanceSum");
|
|
|
|
|
|
balanceResult.put(SalaryI18nUtil.getI18nLabel(0, "其他福利单位补差合计"), "otherComBalanceSum");
|
2023-07-10 10:26:08 +08:00
|
|
|
|
|
2022-04-27 16:21:24 +08:00
|
|
|
|
list.stream().forEach(item -> {
|
|
|
|
|
|
if (Objects.equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue(), item.getWelfareType())) {
|
|
|
|
|
|
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(100289, "单位"), item.getId() + "socialCom");
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳单位"), item.getId() + "socialCommonCom");
|
|
|
|
|
|
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴单位"), item.getId() + "socialRepairCom");
|
|
|
|
|
|
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差单位"), item.getId() + "socialBalanceCom");
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (Objects.equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue(), item.getWelfareType())) {
|
|
|
|
|
|
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(100289, "单位"), item.getId() + "fundCom");
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳单位"), item.getId() + "fundCommonCom");
|
|
|
|
|
|
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴单位"), item.getId() + "fundRepairCom");
|
|
|
|
|
|
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差单位"), item.getId() + "fundBalanceCom");
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (Objects.equals(WelfareTypeEnum.OTHER.getValue(), item.getWelfareType())) {
|
|
|
|
|
|
result.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(100289, "单位"), item.getId() + "otherCom");
|
2023-07-14 09:13:19 +08:00
|
|
|
|
commonResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "正常缴纳单位"), item.getId() + "otherCommonCom");
|
|
|
|
|
|
repairResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补缴单位"), item.getId() + "otherRepairCom");
|
|
|
|
|
|
balanceResult.put(categoryIdNameMap.get(String.valueOf(item.getId())) + SalaryI18nUtil.getI18nLabel(0, "补差单位"), item.getId() + "otherBalanceCom");
|
2022-04-27 16:21:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
});
|
2023-07-14 09:13:19 +08:00
|
|
|
|
|
2023-08-18 13:30:42 +08:00
|
|
|
|
result.putAll(baseResult);
|
2023-07-14 09:13:19 +08:00
|
|
|
|
result.putAll(commonResult);
|
|
|
|
|
|
result.putAll(repairResult);
|
|
|
|
|
|
result.putAll(balanceResult);
|
2022-04-27 16:21:24 +08:00
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-18 20:24:43 +08:00
|
|
|
|
|
|
|
|
|
|
public List<SearchConditionOption> buildBillProjectsOptions() {
|
|
|
|
|
|
List<SearchConditionOption> options = new ArrayList<>();
|
|
|
|
|
|
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ALL.getValue()),
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(ProjectTypeEnum.ALL.getLabelId(), ProjectTypeEnum.ALL.getDefaultLabel())));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.SOCIAL.getValue()),
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(ProjectTypeEnum.SOCIAL.getLabelId(), ProjectTypeEnum.SOCIAL.getDefaultLabel())));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.FUND.getValue()),
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(ProjectTypeEnum.FUND.getLabelId(), ProjectTypeEnum.FUND.getDefaultLabel())));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.OTHER.getValue()),
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(ProjectTypeEnum.OTHER.getLabelId(), ProjectTypeEnum.OTHER.getDefaultLabel())));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue()),
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(ProjectTypeEnum.ENDOWMENT_INSURANCE.getLabelId(), ProjectTypeEnum.ENDOWMENT_INSURANCE.getDefaultLabel())));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
options.add(new SearchConditionOption(String.valueOf(ProjectTypeEnum.MEDICAL_INSURANCE.getValue()),
|
2022-07-08 11:19:08 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(ProjectTypeEnum.MEDICAL_INSURANCE.getLabelId(), ProjectTypeEnum.MEDICAL_INSURANCE.getDefaultLabel())));
|
2022-04-18 20:24:43 +08:00
|
|
|
|
return options;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-08-02 14:58:18 +08:00
|
|
|
|
public List<InsuranceAccountDetailPO> queryList(String billMonth, Long taxAgentId, List<Long> employeeIds) {
|
2022-08-18 15:02:04 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().queryList(billMonth, taxAgentId, employeeIds);
|
2022-11-22 10:26:34 +08:00
|
|
|
|
//退差数据不参与薪资核算
|
2022-12-21 11:12:14 +08:00
|
|
|
|
insuranceAccountDetailPOS = insuranceAccountDetailPOS.stream()
|
|
|
|
|
|
.filter(f -> f.getPaymentStatus().equals(PaymentStatusEnum.COMMON.getValue())
|
|
|
|
|
|
|| f.getPaymentStatus().equals(PaymentStatusEnum.REPAIR.getValue())
|
|
|
|
|
|
|| f.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue()) )
|
|
|
|
|
|
.collect(Collectors.toList());
|
2022-08-18 15:02:04 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = buildNewInsuranceDetailPOS(insuranceAccountDetailPOS);
|
2022-06-06 20:05:37 +08:00
|
|
|
|
// InsuranceAccountDetailPOEncrypt.decryptInsuranceAccountDetailPOList(list);
|
2022-04-27 14:36:05 +08:00
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<InsuranceAccountDetailPO> buildNewInsuranceDetailPOS(List<InsuranceAccountDetailPO> list) {
|
|
|
|
|
|
List<InsuranceAccountDetailPO> newList = new ArrayList<>();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
|
return newList;
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<Long, List<InsuranceAccountDetailPO>> employeeMap = list.stream().filter(item -> item.getEmployeeId() != null)
|
|
|
|
|
|
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId));
|
|
|
|
|
|
for (Map.Entry<Long, List<InsuranceAccountDetailPO>> entry : employeeMap.entrySet()) {
|
|
|
|
|
|
Long k = entry.getKey();
|
|
|
|
|
|
List<InsuranceAccountDetailPO> v = entry.getValue();
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
insuranceAccountDetailPO.setEmployeeId(k);
|
|
|
|
|
|
Map<String, String> socialPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> socialComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherComMap = new HashMap<>();
|
|
|
|
|
|
BigDecimal socialPer = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal socialCom = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal fundPer = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal fundCom = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal otherPer = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal otherCom = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal perSum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal comSum = new BigDecimal("0");
|
|
|
|
|
|
for (InsuranceAccountDetailPO item : v) {
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.decrypt(item, InsuranceAccountDetailPO.class);
|
2022-09-20 10:13:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setId(item.getId());
|
2023-08-18 13:30:42 +08:00
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentBaseString(item.getSocialPaymentBaseString());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPaymentBaseString(item.getFundPaymentBaseString());
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPaymentBaseString(item.getOtherPaymentBaseString());
|
2022-04-27 14:36:05 +08:00
|
|
|
|
BigDecimal socialPerSum = StringUtils.isBlank(item.getSocialPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getSocialPerSum());
|
|
|
|
|
|
BigDecimal socialComSum = StringUtils.isBlank(item.getSocialComSum()) ? new BigDecimal("0") : new BigDecimal(item.getSocialComSum());
|
|
|
|
|
|
BigDecimal fundPerSum = StringUtils.isBlank(item.getFundPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getFundPerSum());
|
|
|
|
|
|
BigDecimal fundComSum = StringUtils.isBlank(item.getFundComSum()) ? new BigDecimal("0") : new BigDecimal(item.getFundComSum());
|
|
|
|
|
|
BigDecimal otherPerSum = StringUtils.isBlank(item.getOtherPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getOtherPerSum());
|
|
|
|
|
|
BigDecimal otherComSum = StringUtils.isBlank(item.getOtherComSum()) ? new BigDecimal("0") : new BigDecimal(item.getOtherComSum());
|
|
|
|
|
|
BigDecimal perSumItem = StringUtils.isBlank(item.getPerSum()) ? new BigDecimal("0") : new BigDecimal(item.getPerSum());
|
|
|
|
|
|
BigDecimal comSumItem = StringUtils.isBlank(item.getComSum()) ? new BigDecimal("0") : new BigDecimal(item.getComSum());
|
|
|
|
|
|
socialPer = socialPer.add(socialPerSum);
|
|
|
|
|
|
socialCom = socialCom.add(socialComSum);
|
|
|
|
|
|
fundPer = fundPer.add(fundPerSum);
|
|
|
|
|
|
fundCom = fundCom.add(fundComSum);
|
|
|
|
|
|
otherPer = otherPer.add(otherPerSum);
|
|
|
|
|
|
otherCom = otherCom.add(otherComSum);
|
|
|
|
|
|
perSum = perSum.add(perSumItem);
|
|
|
|
|
|
comSum = comSum.add(comSumItem);
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialPerJson())) {
|
|
|
|
|
|
Map<String, String> socialJson = JSON.parseObject(item.getSocialPerJson(), new HashMap<String, String>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (socialJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
socialJson.forEach((insuranceId, num) -> {
|
|
|
|
|
|
if (socialPerMap.get(insuranceId) == null) {
|
|
|
|
|
|
socialPerMap.put(insuranceId, num);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String oldNum = socialPerMap.get(insuranceId);
|
|
|
|
|
|
BigDecimal insuanceNum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal oldDecimal = new BigDecimal(oldNum);
|
|
|
|
|
|
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
|
|
|
|
|
|
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
|
|
|
|
|
|
socialPerMap.put(insuranceId, insuanceNum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialComJson())) {
|
|
|
|
|
|
Map<String, String> socialJson = JSON.parseObject(item.getSocialComJson(), new HashMap<String, String>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (socialJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
socialJson.forEach((insuranceId, num) -> {
|
|
|
|
|
|
if (socialComMap.get(insuranceId) == null) {
|
|
|
|
|
|
socialComMap.put(insuranceId, num);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String oldNum = socialComMap.get(insuranceId);
|
|
|
|
|
|
BigDecimal insuanceNum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal oldDecimal = new BigDecimal(oldNum);
|
|
|
|
|
|
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
|
|
|
|
|
|
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
|
|
|
|
|
|
socialComMap.put(insuranceId, insuanceNum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundPerJson())) {
|
|
|
|
|
|
Map<String, String> fundJson = JSON.parseObject(item.getFundPerJson(), new HashMap<String, String>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (fundJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
fundJson.forEach((insuranceId, num) -> {
|
|
|
|
|
|
if (fundPerMap.get(insuranceId) == null) {
|
|
|
|
|
|
fundPerMap.put(insuranceId, num);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String oldNum = fundPerMap.get(insuranceId);
|
|
|
|
|
|
BigDecimal insuanceNum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal oldDecimal = new BigDecimal(oldNum);
|
|
|
|
|
|
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
|
|
|
|
|
|
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
|
|
|
|
|
|
fundPerMap.put(insuranceId, insuanceNum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundComJson())) {
|
|
|
|
|
|
Map<String, String> fundJson = JSON.parseObject(item.getFundComJson(), new HashMap<String, String>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (fundJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
fundJson.forEach((insuranceId, num) -> {
|
|
|
|
|
|
if (fundComMap.get(insuranceId) == null) {
|
|
|
|
|
|
fundComMap.put(insuranceId, num);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String oldNum = fundComMap.get(insuranceId);
|
|
|
|
|
|
BigDecimal insuanceNum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal oldDecimal = new BigDecimal(oldNum);
|
|
|
|
|
|
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
|
|
|
|
|
|
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
|
|
|
|
|
|
fundComMap.put(insuranceId, insuanceNum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherPerJson())) {
|
|
|
|
|
|
Map<String, String> otherJson = JSON.parseObject(item.getOtherPerJson(), new HashMap<String, String>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (otherJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
otherJson.forEach((insuranceId, num) -> {
|
|
|
|
|
|
if (otherPerMap.get(insuranceId) == null) {
|
|
|
|
|
|
otherPerMap.put(insuranceId, num);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String oldNum = otherPerMap.get(insuranceId);
|
|
|
|
|
|
BigDecimal insuanceNum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal oldDecimal = new BigDecimal(oldNum);
|
|
|
|
|
|
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
|
|
|
|
|
|
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
|
|
|
|
|
|
otherPerMap.put(insuranceId, insuanceNum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherComJson())) {
|
|
|
|
|
|
Map<String, String> otherJson = JSON.parseObject(item.getOtherComJson(), new HashMap<String, String>().getClass());
|
2022-08-02 14:58:18 +08:00
|
|
|
|
if (otherJson != null) {
|
2022-07-21 17:28:47 +08:00
|
|
|
|
otherJson.forEach((insuranceId, num) -> {
|
|
|
|
|
|
if (otherComMap.get(insuranceId) == null) {
|
|
|
|
|
|
otherComMap.put(insuranceId, num);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
String oldNum = otherComMap.get(insuranceId);
|
|
|
|
|
|
BigDecimal insuanceNum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal oldDecimal = new BigDecimal(oldNum);
|
|
|
|
|
|
BigDecimal numDecimal = num == null ? new BigDecimal("0") : new BigDecimal(num);
|
|
|
|
|
|
insuanceNum = insuanceNum.add(numDecimal).add(oldDecimal);
|
|
|
|
|
|
otherComMap.put(insuranceId, insuanceNum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-27 14:36:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerMap));
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap));
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap));
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComMap));
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerMap));
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComMap));
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPer.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialCom.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(fundPer.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComSum(fundCom.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(otherPer.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(otherCom.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setPerSum(perSum.toPlainString());
|
|
|
|
|
|
insuranceAccountDetailPO.setComSum(comSum.toPlainString());
|
|
|
|
|
|
newList.add(insuranceAccountDetailPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
return newList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-04-12 10:24:21 +08:00
|
|
|
|
|
2022-05-09 11:18:54 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public List<InsuranceAccountInspectPO> allInspects(Collection<Long> ids, String billMonth) {
|
2023-03-07 14:21:01 +08:00
|
|
|
|
// InsuranceAccountInspectMapper siAccountInspectMapper = MapperProxyFactory.getProxy(InsuranceAccountInspectMapper.class);
|
|
|
|
|
|
List<InsuranceAccountInspectPO> list = getInsuranceAccountInspectMapper().getList(billMonth, InspectStatusEnum.IGNORE.getValue(), ids);
|
2022-05-09 11:18:54 +08:00
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
return list;
|
|
|
|
|
|
}
|
|
|
|
|
|
return Collections.emptyList();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-08 17:52:10 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Collection<TaxAgentPO> getAdminTaxAgentList() {
|
2022-07-08 11:19:08 +08:00
|
|
|
|
return getTaxAgentService(user).listAllTaxAgentsAsAdmin((long) user.getUID());
|
2022-06-08 17:52:10 +08:00
|
|
|
|
}
|
2022-04-22 15:17:31 +08:00
|
|
|
|
|
2022-07-20 15:40:51 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void socialSecurityBenefitsRecalculate(InsuranceAccountBatchPO param) {
|
2022-09-21 11:12:05 +08:00
|
|
|
|
//fixme 重新核算的校验逻辑 1、先取台账对应扣缴义务人下的所有账套 2、取账套下所有核算记录 3、判断核算记录有没有使用对应月份的福利台账
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// int num = getSiAccountBiz(user).checkIfBusinessaccounting(param);
|
|
|
|
|
|
int num = checkIfBusinessAccounting(param);
|
2023-07-11 17:56:45 +08:00
|
|
|
|
//表示已经被核算过不能重新核算
|
|
|
|
|
|
if (num > 0) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "已被薪酬核算给核算过,无法重新核算!"));
|
|
|
|
|
|
}
|
2022-07-20 15:40:51 +08:00
|
|
|
|
param.setBillStatus(0);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// getSiAccountBiz(user).updateById(param);
|
|
|
|
|
|
updateById(param);
|
2024-02-20 16:50:45 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getById(param.getId());
|
|
|
|
|
|
encryptUtil.decrypt(targetPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountBatchPO> loggerContext = new LoggerContext<>();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId("" + targetPO.getId());
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账-重新核算"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账-重新核算")
|
|
|
|
|
|
+ ": " + taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setNewValues(targetPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2022-07-20 15:40:51 +08:00
|
|
|
|
}
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导出“福利核算导入模板”
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook exportImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
2023-09-12 11:05:46 +08:00
|
|
|
|
Long employeeId = (long) user.getUID();
|
2022-09-02 11:53:38 +08:00
|
|
|
|
// 必须选择导入模板所需的薪资项目(福利项)
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 模板表头(默认必带"个税扣缴义务人"、"姓名")
|
|
|
|
|
|
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
|
|
|
|
|
"部门",
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
2022-09-15 10:43:34 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
2024-05-29 15:32:19 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "证件号码"),
|
2022-09-02 11:53:38 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
|
|
|
|
|
|
"账单月份");
|
2023-09-12 11:05:46 +08:00
|
|
|
|
// List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode", "taxAgentName", "billMonth");
|
2024-05-29 15:32:19 +08:00
|
|
|
|
List<String> dataIndexList = Lists.newArrayList("userName", "department", "mobile", "workcode","idNo", "socialPayOrg", "billMonth");
|
2022-09-06 17:13:33 +08:00
|
|
|
|
// 查询福利核算项目
|
|
|
|
|
|
List<String> welfareNames = (List<String>) param.getWelfareNames();
|
|
|
|
|
|
headerList.addAll(welfareNames);
|
2023-09-12 11:05:46 +08:00
|
|
|
|
//匹配welfareName对应的id
|
|
|
|
|
|
List<InsuranceAcctDetailImportFieldDTO> welfareList = getSalaryFormulaWrapper(user).welfareList();
|
|
|
|
|
|
Map<String, String> welfareNameMap = welfareList.stream().collect(Collectors.toMap(InsuranceAcctDetailImportFieldDTO::getSalaryItemName, InsuranceAcctDetailImportFieldDTO::getFieldId, (key1, key2) -> key2));
|
|
|
|
|
|
welfareNames.forEach(f -> {
|
|
|
|
|
|
if (StringUtils.isNotBlank(welfareNameMap.get(f))) {
|
|
|
|
|
|
dataIndexList.add(welfareNameMap.get(f));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
2022-09-02 11:53:38 +08:00
|
|
|
|
// excel导出的数据
|
2023-09-12 11:05:46 +08:00
|
|
|
|
// //查询当前已有的正常缴纳数据
|
|
|
|
|
|
// List<Map<String, Object>> resultMapList = getNormalDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
// // excel导出的数据
|
|
|
|
|
|
// List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
|
|
|
|
|
|
// rows.add(headerList);
|
|
|
|
|
|
// for (Map<String, Object> map : resultMapList) {
|
|
|
|
|
|
// List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
|
|
|
|
|
|
// for (String dataIndex : dataIndexList) {
|
|
|
|
|
|
// row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// rows.add(row);
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
InsuranceExportParam exportParam = new InsuranceExportParam();
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
exportParam.setOrderRule(orderRule);
|
|
|
|
|
|
exportParam.setBillMonth(param.getBillMonth());
|
|
|
|
|
|
exportParam.setPaymentOrganization(param.getPaymentOrganization().toString());
|
|
|
|
|
|
List<AccountExportPO> accountExportPOS = new ArrayList<>();
|
|
|
|
|
|
accountExportPOS = getInsuranceExportMapper().exportAccount(PaymentStatusEnum.COMMON.getValue(), exportParam);
|
|
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<AccountExportPO> extAccountExportPOS = getInsuranceExportMapper().exportExtAccount(PaymentStatusEnum.COMMON.getValue(), exportParam);
|
|
|
|
|
|
accountExportPOS.addAll(extAccountExportPOS);
|
|
|
|
|
|
encryptUtil.decryptList(accountExportPOS, AccountExportPO.class);
|
2024-04-08 17:57:59 +08:00
|
|
|
|
SalaryI18nUtil.i18nList(accountExportPOS);
|
2023-09-12 11:05:46 +08:00
|
|
|
|
// 数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getSIExportService(user).buildCommonRecords(accountExportPOS, true);
|
2023-09-12 11:05:46 +08:00
|
|
|
|
|
2022-09-30 15:40:15 +08:00
|
|
|
|
// excel导出的数据
|
2023-09-12 11:05:46 +08:00
|
|
|
|
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(records.size());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
rows.add(headerList);
|
2023-09-12 11:05:46 +08:00
|
|
|
|
for (Map<String, Object> map : records) {
|
2022-09-30 15:40:15 +08:00
|
|
|
|
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
|
|
|
|
|
|
for (String dataIndex : dataIndexList) {
|
|
|
|
|
|
row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
|
|
|
|
|
|
}
|
|
|
|
|
|
rows.add(row);
|
|
|
|
|
|
}
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
|
|
|
|
|
String sheetName = "福利核算导入模板";
|
|
|
|
|
|
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 将福利核算模板导入的数据更新到数据库
|
|
|
|
|
|
*/
|
2022-09-02 11:53:38 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> importInsuranceAcctDetail(InsuranceAcctImportParam importParam) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
// long currentEmployeeId = user.getUID();
|
|
|
|
|
|
// Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
|
2022-09-15 16:14:34 +08:00
|
|
|
|
//查询对于人员信息导入筛选的全局配置
|
|
|
|
|
|
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
2022-09-19 15:11:27 +08:00
|
|
|
|
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
2022-09-02 11:53:38 +08:00
|
|
|
|
//检验参数
|
|
|
|
|
|
//excel文件id
|
|
|
|
|
|
String imageId = Util.null2String(importParam.getImageId());
|
2022-09-06 17:13:33 +08:00
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
if (StringUtils.isBlank(imageId)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("文件不存在");
|
|
|
|
|
|
}
|
2022-09-06 17:13:33 +08:00
|
|
|
|
// // 获取所有个税扣缴义务人
|
|
|
|
|
|
// List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
|
|
|
|
|
|
// Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
|
|
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
// 获取租户下所有的人员
|
2023-09-07 15:11:10 +08:00
|
|
|
|
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
|
|
|
|
|
// 失败的数量
|
|
|
|
|
|
int failCount = 0;
|
|
|
|
|
|
// 成功的数量
|
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
|
InputStream fileInputStream = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(importParam.getImageId()));
|
|
|
|
|
|
|
|
|
|
|
|
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
|
|
|
|
|
|
// 错误提示信息
|
|
|
|
|
|
List<Map> excelComments = Lists.newArrayList();
|
|
|
|
|
|
// 存在错误的那行数据
|
|
|
|
|
|
List<Map<String, Object>> errorDatas = Lists.newArrayList();
|
|
|
|
|
|
// 表头
|
|
|
|
|
|
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
|
|
|
|
|
// 处理数值
|
|
|
|
|
|
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(headers)) {
|
2022-11-17 13:39:50 +08:00
|
|
|
|
throw new SalaryRunTimeException("表头为空");
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isEmpty(data)) {
|
2022-11-17 13:39:50 +08:00
|
|
|
|
throw new SalaryRunTimeException("无数据");
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//存储待更新的InsuranceAccountDetailPO数据
|
|
|
|
|
|
List<InsuranceAccountDetailPO> updateInsuranceAccountDetailList = new ArrayList<>();
|
2024-03-19 17:23:53 +08:00
|
|
|
|
//存储待新增的InsuranceAccountDetailPO数据
|
|
|
|
|
|
List<InsuranceAccountDetailPO> insertInsuranceAccountDetailList = new ArrayList<>();
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//遍历excel表具体数据
|
2022-09-02 11:53:38 +08:00
|
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
|
|
|
|
|
|
String row = "第" + (i + 2) + "行";
|
|
|
|
|
|
|
|
|
|
|
|
boolean isError = false;
|
|
|
|
|
|
Map<String, Object> map = data.get(i);
|
|
|
|
|
|
Long employeeId = 0L;
|
2022-09-06 17:13:33 +08:00
|
|
|
|
// Long taxAgentId = 0L;
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
String billMonth = (String) map.getOrDefault("账单月份", "");
|
|
|
|
|
|
String taxAgentName = (String) map.getOrDefault("个税扣缴义务人", "");
|
2022-09-20 10:13:05 +08:00
|
|
|
|
String supplementaryMonth = (String) map.getOrDefault("补缴月份", "");
|
2022-09-06 17:13:33 +08:00
|
|
|
|
Long paymentOrganization = 0L;
|
|
|
|
|
|
List<TaxAgentPO> taxAgentPoList = getTaxAgentMapper().listByName(taxAgentName);
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (taxAgentPoList.size() == 1) {
|
|
|
|
|
|
paymentOrganization = taxAgentPoList.get(0).getId();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-07 16:46:17 +08:00
|
|
|
|
if (billMonth.length() < 7 || !SalaryDateUtil.checkYearMonth(billMonth.substring(0, 7))) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "账单月份输入有误,请参照“2022-09”这种格式进行检查"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
2023-08-07 16:46:17 +08:00
|
|
|
|
if (headers.contains("补缴月份") && (supplementaryMonth.length() < 7 || !SalaryDateUtil.checkYearMonth(supplementaryMonth.substring(0, 7)))) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "补缴月份输入有误,请参照“2022-09”这种格式进行检查"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
2022-09-02 15:40:05 +08:00
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//遍历表头
|
2022-09-02 11:53:38 +08:00
|
|
|
|
for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
|
String header = headers.get(j);
|
|
|
|
|
|
String dataKey = header;
|
|
|
|
|
|
if (dataKey == null) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
String dataValue = (String) map.getOrDefault(dataKey.toString(), "");
|
|
|
|
|
|
String deparmentName = (String) map.getOrDefault("部门", "");
|
|
|
|
|
|
String mobile = (String) map.getOrDefault("手机号", "");
|
2022-09-15 16:14:34 +08:00
|
|
|
|
String workcode = (String) map.getOrDefault("工号", "");
|
2024-05-23 09:16:28 +08:00
|
|
|
|
String idNo = (String) map.getOrDefault("证件号码", "");
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
2022-09-20 10:13:05 +08:00
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
|
2022-09-15 16:14:34 +08:00
|
|
|
|
//当人员信息导入筛选的全局配置为"0"时,姓名才是必填项
|
2022-09-19 15:11:27 +08:00
|
|
|
|
if (StringUtils.isEmpty(dataValue) && "0".equals(confValue)) {
|
2022-09-02 11:53:38 +08:00
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
} else {
|
2022-09-15 16:14:34 +08:00
|
|
|
|
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
2024-05-23 09:16:28 +08:00
|
|
|
|
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue,salaryEmployees, dataValue, deparmentName, mobile, workcode,idNo, null);
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeSameIds)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
2022-09-06 17:13:33 +08:00
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
} else if (employeeSameIds.size() > 1) {
|
|
|
|
|
|
//存在离职和在职状态取在职状态
|
|
|
|
|
|
employeeSameIds = employeeSameIds.stream()
|
|
|
|
|
|
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
if (employeeSameIds.size() != 1) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
2022-09-15 16:14:34 +08:00
|
|
|
|
errorMessageMap.put("message", row + "员工信息不存在或者存在多个员工");
|
2022-09-02 11:53:38 +08:00
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeId = employeeSameIds.get(0).getEmployeeId();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-15 16:14:34 +08:00
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
}
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!isError){
|
|
|
|
|
|
List<Long> employeeIds = new ArrayList<>();
|
|
|
|
|
|
employeeIds.add(employeeId);
|
|
|
|
|
|
//如果福利核算信息查询不到唯一匹配数据,不支持导入
|
|
|
|
|
|
//根据员工id、个税扣缴义务人id、账单月份查询
|
2022-09-20 10:13:05 +08:00
|
|
|
|
//根据表头字段来区分正常缴纳和补缴两类数据
|
|
|
|
|
|
if (!headers.contains("补缴月份")) {
|
2023-08-07 16:46:17 +08:00
|
|
|
|
list = getInsuranceAccountDetailMapper().queryNormalList(billMonth.substring(0, 7), paymentOrganization, employeeIds.get(0));
|
2022-09-20 10:13:05 +08:00
|
|
|
|
} else {
|
2023-08-07 16:46:17 +08:00
|
|
|
|
list = getInsuranceAccountDetailMapper().querySupplementList(billMonth.substring(0, 7), paymentOrganization, employeeIds.get(0), supplementaryMonth.substring(0, 7));
|
2022-09-20 10:13:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (list.isEmpty()) {
|
2024-03-19 17:23:53 +08:00
|
|
|
|
if (headers.contains("补缴月份")) {
|
|
|
|
|
|
// 如果是补缴列表没有,则新增
|
|
|
|
|
|
if (supplementaryMonth.substring(0, 7).equals(billMonth.substring(0, 7))) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100481, "当前月走正常缴纳"));
|
|
|
|
|
|
}
|
|
|
|
|
|
//校验补缴人员是否存在福利档案基础信息,并且runStatus处于正在缴纳或者待减员
|
|
|
|
|
|
InsuranceArchivesBaseInfoPO insuranceBaseInfo = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(paymentOrganization, employeeId);
|
|
|
|
|
|
if (insuranceBaseInfo == null || !(insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) || insuranceBaseInfo.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue())) ) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补缴人员中存在未设置福利档案人员或相关人员不在福利在缴人员中,不可新建补缴信息!"));
|
|
|
|
|
|
}
|
|
|
|
|
|
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(paymentOrganization, billMonth.substring(0, 7));
|
|
|
|
|
|
if (!empIdsInPayMonthRange.contains(employeeId)) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99920, "无核算人员"));
|
|
|
|
|
|
}
|
2024-10-09 10:57:23 +08:00
|
|
|
|
DataCollectionEmployee employee = getSalaryEmployeeService(user).getEmployeeById(employeeId);
|
2024-03-19 17:23:53 +08:00
|
|
|
|
// 封装InsuranceAccountDetailPO
|
|
|
|
|
|
Date now = new Date();
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
insuranceAccountDetailPO.setBillStatus(0);
|
|
|
|
|
|
insuranceAccountDetailPO.setEmployeeId(employeeId);
|
2024-10-09 10:57:23 +08:00
|
|
|
|
if (employee != null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyName(employee.getSubcompanyName());
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyId(employee.getSubcompanyid());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentName(employee.getDepartmentName());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentId(employee.getDepartmentId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleName(employee.getJobtitleName());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleId(employee.getJobtitleId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcall(employee.getJobcall());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcallId(employee.getJobcallId());
|
|
|
|
|
|
insuranceAccountDetailPO.setStatus(employee.getStatus());
|
|
|
|
|
|
}
|
2024-03-19 17:23:53 +08:00
|
|
|
|
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setPaymentStatus(1);
|
|
|
|
|
|
insuranceAccountDetailPO.setResourceFrom(0);
|
|
|
|
|
|
insuranceAccountDetailPO.setSupplementaryProjects("0,1,2,3,4,5");
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPayOrg(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPayOrg(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setCreator(Long.valueOf(user.getUID()));
|
|
|
|
|
|
insuranceAccountDetailPO.setCreateTime(now);
|
|
|
|
|
|
insuranceAccountDetailPO.setUpdateTime(now);
|
|
|
|
|
|
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
|
|
|
|
|
insuranceAccountDetailPO.setDeleteType(0);
|
|
|
|
|
|
InsuranceAccountDetailPO insertPO = handleInsuranceAccountDetail4AddSupplementary(insuranceAccountDetailPO, map);
|
|
|
|
|
|
if(!checkBalancePayInsurance(insertPO)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "导入数据中存在福利档案中未设置的福利项缴纳数值!"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
insertInsuranceAccountDetailList.add(insertPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "本次福利核算不包含该人员"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
2022-09-06 17:13:33 +08:00
|
|
|
|
} else if (list.size() > 1) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员本次核算出现多组数据,请删除数据库中多余核算项"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//拼装待更新数据
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
2023-12-04 15:10:46 +08:00
|
|
|
|
InsuranceAccountDetailPO updatePO = handleInsuranceAccountDetail(list.get(0), map);
|
|
|
|
|
|
//判断导入福利项是否符合福利方案设置缴纳项
|
|
|
|
|
|
if(!checkBalancePayInsurance(updatePO)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "导入数据中存在福利档案中未设置的福利项缴纳数值!"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
updateInsuranceAccountDetailList.add(updatePO);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isError) {
|
|
|
|
|
|
failCount++;
|
|
|
|
|
|
errorDatas.add(map);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
successCount++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//将待更新列表加密
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.encryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
2024-03-19 17:23:53 +08:00
|
|
|
|
// 将待插入列表加密
|
|
|
|
|
|
encryptUtil.encryptList(insertInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//更新
|
2022-09-08 09:43:46 +08:00
|
|
|
|
for(InsuranceAccountDetailPO po : updateInsuranceAccountDetailList) {
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// getSiAccountBiz(user).updateByEmployeeIdAndBillMonth(po);
|
|
|
|
|
|
updateByEmployeeIdAndBillMonth(po);
|
2022-09-08 09:43:46 +08:00
|
|
|
|
}
|
2024-03-19 17:23:53 +08:00
|
|
|
|
// 插入
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(insertInsuranceAccountDetailList)) {
|
2024-08-14 11:17:56 +08:00
|
|
|
|
batchSaveAccountDetails(insertInsuranceAccountDetailList);
|
2024-03-19 17:23:53 +08:00
|
|
|
|
}
|
2022-09-08 09:43:46 +08:00
|
|
|
|
|
2022-11-17 10:09:01 +08:00
|
|
|
|
//刷新hrsa_bill_batch中数据统计信息
|
2024-03-19 17:23:53 +08:00
|
|
|
|
updateInsuranceAccountDetailList.addAll(insertInsuranceAccountDetailList);
|
2022-11-17 10:09:01 +08:00
|
|
|
|
if (updateInsuranceAccountDetailList.size() > 0) {
|
2022-12-07 17:50:25 +08:00
|
|
|
|
refreshBillBatch(updateInsuranceAccountDetailList.get(0).getPaymentOrganization(), updateInsuranceAccountDetailList.get(0).getBillMonth());
|
2024-02-20 16:50:45 +08:00
|
|
|
|
//记录操作日志
|
2024-02-22 09:33:35 +08:00
|
|
|
|
PaymentStatusEnum targetEnum = SalaryEnumUtil.enumMatchByValue(updateInsuranceAccountDetailList.get(0).getPaymentStatus(), PaymentStatusEnum.values(), PaymentStatusEnum.class);
|
2024-02-20 16:50:45 +08:00
|
|
|
|
encryptUtil.decryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getByBillMonth(updateInsuranceAccountDetailList.get(0).getBillMonth(), updateInsuranceAccountDetailList.get(0).getPaymentOrganization());
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(targetPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.EXCEL_IMPORT.getValue());
|
2024-02-22 09:33:35 +08:00
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-导入")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(targetEnum.getLabelId(), targetEnum.getDefaultLabel()));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-导入"
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(targetEnum.getLabelId(), targetEnum.getDefaultLabel()))
|
2024-02-20 16:50:45 +08:00
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
updateInsuranceAccountDetailList.forEach(loggerContext::setNewValues);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2022-11-17 10:09:01 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
apidatas.put("successCount", successCount);
|
|
|
|
|
|
apidatas.put("errorCount", failCount);
|
|
|
|
|
|
apidatas.put("errorData", excelComments);
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
IOUtils.closeQuietly(fileInputStream);
|
|
|
|
|
|
}
|
|
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-08-14 11:17:56 +08:00
|
|
|
|
|
|
|
|
|
|
public void batchSaveAccountDetails(List<InsuranceAccountDetailPO> insertInsuranceAccountDetailList) {
|
|
|
|
|
|
List<List<InsuranceAccountDetailPO>> partition = Lists.partition(insertInsuranceAccountDetailList, 20);
|
|
|
|
|
|
partition.forEach(part -> getInsuranceAccountDetailMapper().batchSaveAccountDetails(part));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-07 14:57:07 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 预览“福利核算导入”模板导入的数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> preview(InsuranceAcctImportParam param) {
|
|
|
|
|
|
//1、参数校验
|
|
|
|
|
|
String imageId = param.getImageId();
|
|
|
|
|
|
if (StringUtils.isBlank(imageId)) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(100593, "文件id为空"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
InputStream fileInputStream = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
|
|
|
|
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(imageId));
|
|
|
|
|
|
|
|
|
|
|
|
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
|
|
|
|
|
|
|
|
|
|
|
map.put("headers", headers);
|
|
|
|
|
|
map.put("list", ExcelParseHelper.parse2List(sheet, 1));
|
|
|
|
|
|
|
|
|
|
|
|
return map;
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
IOUtils.closeQuietly(fileInputStream);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-19 15:11:27 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 导出“福利核算-补缴导入”模板
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook exportSupplyImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
|
|
|
|
|
|
// 必须选择导入模板所需的薪资项目(福利项)
|
|
|
|
|
|
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 模板表头(默认必带"个税扣缴义务人"、"姓名")
|
|
|
|
|
|
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
|
|
|
|
|
"部门",
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
2024-05-29 15:32:19 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "证件号码"),
|
2022-09-19 15:11:27 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人"),
|
|
|
|
|
|
"账单月份",
|
|
|
|
|
|
"补缴月份");
|
2024-05-29 15:32:19 +08:00
|
|
|
|
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode","idNo", "taxAgentName", "billMonth", "supplementaryMonth");
|
2022-09-19 15:11:27 +08:00
|
|
|
|
// 查询福利核算项目
|
|
|
|
|
|
List<String> welfareNames = (List<String>) param.getWelfareNames();
|
|
|
|
|
|
headerList.addAll(welfareNames);
|
|
|
|
|
|
|
2022-09-19 17:59:12 +08:00
|
|
|
|
//查询当前已有的补缴数据
|
|
|
|
|
|
List<Map<String, Object>> resultMapList = getSupplyDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
2022-09-19 15:11:27 +08:00
|
|
|
|
// excel导出的数据
|
2022-09-19 17:59:12 +08:00
|
|
|
|
List<List<Object>> rows = Lists.newArrayListWithExpectedSize(resultMapList.size());
|
2022-09-19 15:11:27 +08:00
|
|
|
|
rows.add(headerList);
|
2022-09-19 17:59:12 +08:00
|
|
|
|
for (Map<String, Object> map : resultMapList) {
|
|
|
|
|
|
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
|
|
|
|
|
|
for (String dataIndex : dataIndexList) {
|
|
|
|
|
|
row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
|
|
|
|
|
|
}
|
|
|
|
|
|
rows.add(row);
|
|
|
|
|
|
}
|
2022-09-19 15:11:27 +08:00
|
|
|
|
|
2022-09-19 17:59:12 +08:00
|
|
|
|
|
|
|
|
|
|
String sheetName = "福利核算-补缴导入模板";
|
2022-09-19 15:11:27 +08:00
|
|
|
|
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-19 17:59:12 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取福利台账中的补缴数据
|
|
|
|
|
|
* @param billMonth 账单月份
|
|
|
|
|
|
* @param paymentOrganization 个税扣缴义务人id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private List<Map<String, Object>> getSupplyDataByBillMonth(String billMonth, Long paymentOrganization) {
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
2022-09-20 10:13:05 +08:00
|
|
|
|
|
2022-09-19 17:59:12 +08:00
|
|
|
|
DataCollectionEmployee employee = new DataCollectionEmployee();
|
|
|
|
|
|
|
|
|
|
|
|
TaxAgentPO taxAgentPO = taxAgentBiz.getById(paymentOrganization);
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> supplyDataList = getInsuranceAccountDetailMapper().querySupplementListByBillMonth(billMonth, paymentOrganization);
|
2022-10-20 17:33:29 +08:00
|
|
|
|
|
|
|
|
|
|
//过滤出福利档案基础信息表中runStatus为正在缴纳和待减员的人员
|
|
|
|
|
|
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
|
|
|
|
|
List<Long> canAccountIds = baseInfoPOList.stream()
|
|
|
|
|
|
.filter(f->f.getPaymentOrganization().equals(paymentOrganization)
|
|
|
|
|
|
&& (f.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())))
|
|
|
|
|
|
.map(InsuranceArchivesBaseInfoPO::getEmployeeId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
supplyDataList = supplyDataList.stream().filter(f -> canAccountIds.contains(f.getEmployeeId())).collect(Collectors.toList());
|
|
|
|
|
|
|
2022-09-19 17:59:12 +08:00
|
|
|
|
for(InsuranceAccountDetailPO po : supplyDataList) {
|
2022-09-20 10:13:05 +08:00
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
2023-03-07 17:14:25 +08:00
|
|
|
|
employee = getSalaryEmployeeService(user).getEmployeeById(po.getEmployeeId());
|
2022-09-20 10:13:05 +08:00
|
|
|
|
resultMap.put("username", employee.getUsername());
|
|
|
|
|
|
resultMap.put("departmentName", employee.getDepartmentName());
|
|
|
|
|
|
resultMap.put("mobile", employee.getMobile());
|
|
|
|
|
|
resultMap.put("workcode", employee.getWorkcode());
|
2024-05-29 15:32:19 +08:00
|
|
|
|
resultMap.put("idNo", employee.getIdNo());
|
2022-09-20 10:13:05 +08:00
|
|
|
|
resultMap.put("taxAgentName", taxAgentPO.getName());
|
|
|
|
|
|
resultMap.put("billMonth", billMonth);
|
|
|
|
|
|
resultMap.put("supplementaryMonth", po.getSupplementaryMonth());
|
|
|
|
|
|
|
|
|
|
|
|
resultList.add(resultMap);
|
2022-09-19 17:59:12 +08:00
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-05 11:02:59 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取福利台账中的补差数据
|
|
|
|
|
|
* @param billMonth 账单月份
|
|
|
|
|
|
* @param paymentOrganization 个税扣缴义务人id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private List<Map<String, Object>> getBalanceDataByBillMonth(String billMonth, Long paymentOrganization) {
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
DataCollectionEmployee employee = new DataCollectionEmployee();
|
|
|
|
|
|
|
|
|
|
|
|
TaxAgentPO taxAgentPO = taxAgentBiz.getById(paymentOrganization);
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> balanceDataList = getInsuranceAccountDetailMapper().queryBalanceListByBillMonth(billMonth, paymentOrganization);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for(InsuranceAccountDetailPO po : balanceDataList) {
|
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
|
|
|
|
|
employee = getSalaryEmployeeService(user).getEmployeeById(po.getEmployeeId());
|
|
|
|
|
|
resultMap.put("username", employee.getUsername());
|
|
|
|
|
|
resultMap.put("departmentName", employee.getDepartmentName());
|
|
|
|
|
|
resultMap.put("mobile", employee.getMobile());
|
|
|
|
|
|
resultMap.put("workcode", employee.getWorkcode());
|
|
|
|
|
|
resultMap.put("idNo", employee.getIdNo());
|
|
|
|
|
|
resultMap.put("taxAgentName", taxAgentPO.getName());
|
|
|
|
|
|
resultMap.put("billMonth", billMonth);
|
|
|
|
|
|
resultMap.put("supplementaryMonth", po.getSupplementaryMonth());
|
|
|
|
|
|
|
|
|
|
|
|
resultList.add(resultMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-30 15:40:15 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 获取福利台账中的正常缴纳数据
|
|
|
|
|
|
* @param billMonth 账单月份
|
|
|
|
|
|
* @param paymentOrganization 个税扣缴义务人id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
private List<Map<String, Object>> getNormalDataByBillMonth(String billMonth, Long paymentOrganization) {
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> resultList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
DataCollectionEmployee employee = new DataCollectionEmployee();
|
|
|
|
|
|
|
|
|
|
|
|
TaxAgentPO taxAgentPO = taxAgentBiz.getById(paymentOrganization);
|
|
|
|
|
|
|
2022-10-20 16:29:49 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> normalDataList = getInsuranceAccountDetailMapper().queryNormalListByBillMonth(billMonth, paymentOrganization);
|
2022-10-20 17:33:29 +08:00
|
|
|
|
//过滤出福利档案基础信息表中runStatus为正在缴纳和待减员的人员
|
2022-10-20 16:29:49 +08:00
|
|
|
|
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
|
|
|
|
|
List<Long> canAccountIds = baseInfoPOList.stream()
|
|
|
|
|
|
.filter(f->f.getPaymentOrganization().equals(paymentOrganization)
|
|
|
|
|
|
&& (f.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())))
|
|
|
|
|
|
.map(InsuranceArchivesBaseInfoPO::getEmployeeId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
normalDataList = normalDataList.stream().filter(f -> canAccountIds.contains(f.getEmployeeId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
for(InsuranceAccountDetailPO po : normalDataList) {
|
2022-09-30 15:40:15 +08:00
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
2023-03-07 17:14:25 +08:00
|
|
|
|
employee = getSalaryEmployeeService(user).getEmployeeById(po.getEmployeeId());
|
2022-09-30 15:40:15 +08:00
|
|
|
|
resultMap.put("username", employee.getUsername());
|
|
|
|
|
|
resultMap.put("departmentName", employee.getDepartmentName());
|
|
|
|
|
|
resultMap.put("mobile", employee.getMobile());
|
|
|
|
|
|
resultMap.put("workcode", employee.getWorkcode());
|
|
|
|
|
|
resultMap.put("taxAgentName", taxAgentPO.getName());
|
|
|
|
|
|
resultMap.put("billMonth", billMonth);
|
|
|
|
|
|
|
|
|
|
|
|
resultList.add(resultMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
return resultList;
|
|
|
|
|
|
}
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
2022-09-02 15:40:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 将更新的数据设置到老的insuranceAccountDetailPO对象中
|
|
|
|
|
|
*/
|
2022-09-06 17:13:33 +08:00
|
|
|
|
private InsuranceAccountDetailPO handleInsuranceAccountDetail(InsuranceAccountDetailPO insuranceAccountDetailPO, Map<String, Object> baseMap) {
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
|
|
|
|
|
//组装json数据,格式Map<String, Object>
|
2022-09-02 15:40:05 +08:00
|
|
|
|
Map<String, String> socialPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> socialComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherComMap = new HashMap<>();
|
2022-09-02 11:53:38 +08:00
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//筛选出福利核算项
|
|
|
|
|
|
Map<String, Object> toDealMap =
|
|
|
|
|
|
baseMap.entrySet().stream()
|
|
|
|
|
|
.filter(map -> !"姓名".equals(map.getKey())
|
|
|
|
|
|
&& !"部门".equals(map.getKey())
|
|
|
|
|
|
&& !"手机号".equals(map.getKey())
|
|
|
|
|
|
&& !"个税扣缴义务人".equals(map.getKey())
|
|
|
|
|
|
&& !"账单月份".equals(map.getKey()))
|
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
|
|
|
|
|
|
|
|
|
for(Map.Entry<String, Object> entry : toDealMap.entrySet()) {
|
2022-09-02 11:53:38 +08:00
|
|
|
|
//判断元素是否属于福利类
|
|
|
|
|
|
String keyName = entry.getKey();
|
|
|
|
|
|
//获取元素名后缀,方便之后判断“个人”或“单位”
|
2022-09-06 17:13:33 +08:00
|
|
|
|
String payScope = keyName.substring(keyName.length() - 2);
|
2022-09-02 11:53:38 +08:00
|
|
|
|
//获取福利类型
|
|
|
|
|
|
Integer welfareType;
|
2024-02-04 10:11:10 +08:00
|
|
|
|
// List<ICategoryPO> categoryPOList = siCategoryBiz.listByName(entry.getKey().substring(0, keyName.length() - 2));
|
|
|
|
|
|
List<ICategoryPO> categoryPOList = getSICategoryService(user).listByName(entry.getKey().substring(0, keyName.length() - 2));
|
2022-09-02 11:53:38 +08:00
|
|
|
|
if (categoryPOList.size() == 1) {
|
|
|
|
|
|
ICategoryPO iCategoryPO = categoryPOList.get(0);
|
|
|
|
|
|
welfareType = iCategoryPO.getWelfareType();
|
2022-09-06 17:13:33 +08:00
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
if ("个人".equals(payScope)) {
|
|
|
|
|
|
switch (welfareType) {
|
|
|
|
|
|
case 1:
|
2022-09-02 15:40:05 +08:00
|
|
|
|
socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
2022-09-02 15:40:05 +08:00
|
|
|
|
fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
2022-09-02 15:40:05 +08:00
|
|
|
|
otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
break;
|
2022-09-06 17:13:33 +08:00
|
|
|
|
default:
|
|
|
|
|
|
throw new SalaryRunTimeException("福利类型不存在");
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
} else if ("单位".equals(payScope)) {
|
|
|
|
|
|
switch (welfareType) {
|
|
|
|
|
|
case 1:
|
2022-09-02 15:40:05 +08:00
|
|
|
|
socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
2022-09-02 15:40:05 +08:00
|
|
|
|
fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
2022-09-02 15:40:05 +08:00
|
|
|
|
otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
2022-09-02 11:53:38 +08:00
|
|
|
|
break;
|
2022-09-06 17:13:33 +08:00
|
|
|
|
default:
|
|
|
|
|
|
throw new SalaryRunTimeException("福利类型不存在");
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//组装新的insuranceAccountDetailPO对象数据
|
2022-09-02 15:40:05 +08:00
|
|
|
|
if (!socialPerMap.isEmpty()) {
|
|
|
|
|
|
//对比新旧json中数据,并输出最终json
|
2022-09-06 17:13:33 +08:00
|
|
|
|
checkJsonMap(socialPerMap, insuranceAccountDetailPO.getSocialPerJson());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!socialComMap.isEmpty()) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
checkJsonMap(socialComMap, insuranceAccountDetailPO.getSocialComJson());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!fundPerMap.isEmpty()) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
checkJsonMap(fundPerMap, insuranceAccountDetailPO.getFundPerJson());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!fundComMap.isEmpty()) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
checkJsonMap(fundComMap, insuranceAccountDetailPO.getFundComJson());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!otherPerMap.isEmpty()) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
checkJsonMap(otherPerMap, insuranceAccountDetailPO.getOtherPerJson());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!otherComMap.isEmpty()) {
|
2022-09-06 17:13:33 +08:00
|
|
|
|
checkJsonMap(otherComMap, insuranceAccountDetailPO.getOtherComJson());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保个人合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(baseMap.get("社保个人合计").toString());
|
2023-04-23 18:05:32 +08:00
|
|
|
|
} else if (!socialPerMap.isEmpty()) {
|
2023-04-23 16:35:52 +08:00
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(sumOfMapValue(socialPerMap));
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金个人合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(baseMap.get("公积金个人合计").toString());
|
2023-04-23 18:05:32 +08:00
|
|
|
|
} else if (!fundPerMap.isEmpty()) {
|
2023-04-23 16:35:52 +08:00
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(sumOfMapValue(fundPerMap));
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利个人合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(baseMap.get("其他福利个人合计").toString());
|
2023-04-23 18:05:32 +08:00
|
|
|
|
} else if (!otherPerMap.isEmpty()) {
|
2023-04-23 16:35:52 +08:00
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(sumOfMapValue(otherPerMap));
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-04-23 16:35:52 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("个人合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setPerSum(baseMap.get("个人合计").toString());
|
|
|
|
|
|
} else {
|
2023-04-24 10:11:02 +08:00
|
|
|
|
insuranceAccountDetailPO.setPerSum(new BigDecimal(insuranceAccountDetailPO.getSocialPerSum() == null ? "0" : insuranceAccountDetailPO.getSocialPerSum())
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getFundPerSum() == null ? "0" : insuranceAccountDetailPO.getFundPerSum()))
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getOtherPerSum() == null ? "0" : insuranceAccountDetailPO.getOtherPerSum())).toString());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保单位合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(baseMap.get("社保单位合计").toString());
|
2023-04-23 18:05:32 +08:00
|
|
|
|
} else if (!socialComMap.isEmpty()) {
|
2023-04-23 16:35:52 +08:00
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(sumOfMapValue(socialComMap));
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金单位合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComSum(baseMap.get("公积金单位合计").toString());
|
2023-04-23 18:05:32 +08:00
|
|
|
|
} else if (!fundComMap.isEmpty()) {
|
2023-04-23 16:35:52 +08:00
|
|
|
|
insuranceAccountDetailPO.setFundComSum(sumOfMapValue(fundComMap));
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利单位合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(baseMap.get("其他福利单位合计").toString());
|
2023-04-23 18:05:32 +08:00
|
|
|
|
} else if (!otherComMap.isEmpty()) {
|
2023-04-23 16:35:52 +08:00
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(sumOfMapValue(otherComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("单位合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setComSum(baseMap.get("单位合计").toString());
|
|
|
|
|
|
} else {
|
2023-04-24 10:11:02 +08:00
|
|
|
|
insuranceAccountDetailPO.setComSum(new BigDecimal(insuranceAccountDetailPO.getSocialComSum() == null ? "0" : insuranceAccountDetailPO.getSocialComSum())
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getFundComSum() == null ? "0" : insuranceAccountDetailPO.getFundComSum()))
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getOtherComSum() == null ? "0" : insuranceAccountDetailPO.getOtherComSum())).toString());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("账单月份", "").toString())) {
|
2023-08-07 16:46:17 +08:00
|
|
|
|
insuranceAccountDetailPO.setBillMonth(baseMap.get("账单月份").toString().substring(0, 7));
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-16 14:21:15 +08:00
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialSum(baseMap.get("社保合计").toString());
|
2023-04-23 16:35:52 +08:00
|
|
|
|
} else {
|
2023-04-24 10:11:02 +08:00
|
|
|
|
insuranceAccountDetailPO.setSocialSum(new BigDecimal(insuranceAccountDetailPO.getSocialComSum() == null ? "0" : insuranceAccountDetailPO.getSocialComSum())
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getSocialPerSum() == null ? "0" : insuranceAccountDetailPO.getSocialPerSum()))
|
2023-04-23 16:35:52 +08:00
|
|
|
|
.toString());
|
2022-09-16 14:21:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setFundSum(baseMap.get("公积金合计").toString());
|
2023-04-23 16:35:52 +08:00
|
|
|
|
} else {
|
2023-04-24 10:11:02 +08:00
|
|
|
|
insuranceAccountDetailPO.setFundSum(new BigDecimal(insuranceAccountDetailPO.getFundComSum() == null ? "0" : insuranceAccountDetailPO.getFundComSum())
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getFundPerSum() == null ? "0" : insuranceAccountDetailPO.getFundPerSum()))
|
2023-04-23 16:35:52 +08:00
|
|
|
|
.toString());
|
2022-09-16 14:21:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherSum(baseMap.get("其他福利合计").toString());
|
2023-04-23 16:35:52 +08:00
|
|
|
|
} else {
|
2023-04-24 10:11:02 +08:00
|
|
|
|
insuranceAccountDetailPO.setOtherSum(new BigDecimal(insuranceAccountDetailPO.getOtherComSum() == null ? "0" : insuranceAccountDetailPO.getOtherComSum())
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getOtherPerSum() == null ? "0" : insuranceAccountDetailPO.getOtherPerSum()))
|
2023-04-23 16:35:52 +08:00
|
|
|
|
.toString());
|
2022-09-16 14:21:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("合计", "").toString())) {
|
|
|
|
|
|
insuranceAccountDetailPO.setTotal(baseMap.get("合计").toString());
|
2023-04-23 16:35:52 +08:00
|
|
|
|
} else {
|
2023-04-24 10:11:02 +08:00
|
|
|
|
insuranceAccountDetailPO.setTotal(new BigDecimal(insuranceAccountDetailPO.getPerSum() == null ? "0" : insuranceAccountDetailPO.getPerSum())
|
|
|
|
|
|
.add(new BigDecimal(insuranceAccountDetailPO.getComSum() == null ? "0" : insuranceAccountDetailPO.getComSum()))
|
2023-04-23 16:35:52 +08:00
|
|
|
|
.toString());
|
2022-09-16 14:21:15 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-20 10:13:05 +08:00
|
|
|
|
//如果导入的时补缴数据,还会包含补缴月份
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("补缴月份", "").toString())) {
|
2023-08-07 16:46:17 +08:00
|
|
|
|
insuranceAccountDetailPO.setSupplementaryMonth(baseMap.get("补缴月份").toString().substring(0, 7));
|
2022-09-20 10:13:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
insuranceAccountDetailPO.setUpdateTime(new Date());
|
|
|
|
|
|
|
2022-09-02 15:40:05 +08:00
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-19 17:23:53 +08:00
|
|
|
|
private InsuranceAccountDetailPO handleInsuranceAccountDetail4AddSupplementary(InsuranceAccountDetailPO po, Map<String, Object> baseMap) {
|
|
|
|
|
|
|
|
|
|
|
|
//组装json数据,格式Map<String, Object>
|
|
|
|
|
|
Map<String, String> socialPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> socialComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherComMap = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
//筛选出福利核算项
|
|
|
|
|
|
Map<String, Object> toDealMap =
|
|
|
|
|
|
baseMap.entrySet().stream()
|
|
|
|
|
|
.filter(map -> !"姓名".equals(map.getKey())
|
|
|
|
|
|
&& !"部门".equals(map.getKey())
|
|
|
|
|
|
&& !"手机号".equals(map.getKey())
|
|
|
|
|
|
&& !"个税扣缴义务人".equals(map.getKey())
|
|
|
|
|
|
&& !"账单月份".equals(map.getKey()))
|
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
|
|
|
|
|
|
|
|
|
for(Map.Entry<String, Object> entry : toDealMap.entrySet()) {
|
|
|
|
|
|
//判断元素是否属于福利类
|
|
|
|
|
|
String keyName = entry.getKey();
|
|
|
|
|
|
//获取元素名后缀,方便之后判断“个人”或“单位”
|
|
|
|
|
|
String payScope = keyName.substring(keyName.length() - 2);
|
|
|
|
|
|
//获取福利类型
|
|
|
|
|
|
Integer welfareType;
|
|
|
|
|
|
// List<ICategoryPO> categoryPOList = siCategoryBiz.listByName(entry.getKey().substring(0, keyName.length() - 2));
|
|
|
|
|
|
List<ICategoryPO> categoryPOList = getSICategoryService(user).listByName(entry.getKey().substring(0, keyName.length() - 2));
|
|
|
|
|
|
if (categoryPOList.size() == 1) {
|
|
|
|
|
|
ICategoryPO iCategoryPO = categoryPOList.get(0);
|
|
|
|
|
|
welfareType = iCategoryPO.getWelfareType();
|
|
|
|
|
|
|
|
|
|
|
|
if ("个人".equals(payScope)) {
|
|
|
|
|
|
switch (welfareType) {
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
throw new SalaryRunTimeException("福利类型不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
} else if ("单位".equals(payScope)) {
|
|
|
|
|
|
switch (welfareType) {
|
|
|
|
|
|
case 1:
|
|
|
|
|
|
socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 2:
|
|
|
|
|
|
fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
case 3:
|
|
|
|
|
|
otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
break;
|
|
|
|
|
|
default:
|
|
|
|
|
|
throw new SalaryRunTimeException("福利类型不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//组装新的insuranceAccountDetailPO对象数据
|
|
|
|
|
|
if (!socialPerMap.isEmpty()) {
|
|
|
|
|
|
//对比新旧json中数据,并输出最终json
|
|
|
|
|
|
checkJsonMap(socialPerMap, null);
|
|
|
|
|
|
po.setSocialPerJson(JSON.toJSONString(socialPerMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!socialComMap.isEmpty()) {
|
|
|
|
|
|
checkJsonMap(socialComMap, null);
|
|
|
|
|
|
po.setSocialComJson(JSON.toJSONString(socialComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!fundPerMap.isEmpty()) {
|
|
|
|
|
|
checkJsonMap(fundPerMap, null);
|
|
|
|
|
|
po.setFundPerJson(JSON.toJSONString(fundPerMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!fundComMap.isEmpty()) {
|
|
|
|
|
|
checkJsonMap(fundComMap, null);
|
|
|
|
|
|
po.setFundComJson(JSON.toJSONString(fundComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!otherPerMap.isEmpty()) {
|
|
|
|
|
|
checkJsonMap(otherPerMap, null);
|
|
|
|
|
|
po.setOtherPerJson(JSON.toJSONString(otherPerMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!otherComMap.isEmpty()) {
|
|
|
|
|
|
checkJsonMap(otherComMap, null);
|
|
|
|
|
|
po.setOtherComJson(JSON.toJSONString(otherComMap));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保个人合计", "").toString())) {
|
|
|
|
|
|
po.setSocialPerSum(baseMap.get("社保个人合计").toString());
|
|
|
|
|
|
} else if (!socialPerMap.isEmpty()) {
|
|
|
|
|
|
po.setSocialPerSum(sumOfMapValue(socialPerMap));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setSocialPerSum("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金个人合计", "").toString())) {
|
|
|
|
|
|
po.setFundPerSum(baseMap.get("公积金个人合计").toString());
|
|
|
|
|
|
} else if (!fundPerMap.isEmpty()) {
|
|
|
|
|
|
po.setFundPerSum(sumOfMapValue(fundPerMap));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setFundPerSum("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利个人合计", "").toString())) {
|
|
|
|
|
|
po.setOtherPerSum(baseMap.get("其他福利个人合计").toString());
|
|
|
|
|
|
} else if (!otherPerMap.isEmpty()) {
|
|
|
|
|
|
po.setOtherPerSum(sumOfMapValue(otherPerMap));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setOtherPerSum("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("个人合计", "").toString())) {
|
|
|
|
|
|
po.setPerSum(baseMap.get("个人合计").toString());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setPerSum(new BigDecimal(po.getSocialPerSum() == null ? "0" : po.getSocialPerSum())
|
|
|
|
|
|
.add(new BigDecimal(po.getFundPerSum() == null ? "0" : po.getFundPerSum()))
|
|
|
|
|
|
.add(new BigDecimal(po.getOtherPerSum() == null ? "0" : po.getOtherPerSum())).toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保单位合计", "").toString())) {
|
|
|
|
|
|
po.setSocialComSum(baseMap.get("社保单位合计").toString());
|
|
|
|
|
|
} else if (!socialComMap.isEmpty()) {
|
|
|
|
|
|
po.setSocialComSum(sumOfMapValue(socialComMap));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setSocialComSum("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金单位合计", "").toString())) {
|
|
|
|
|
|
po.setFundComSum(baseMap.get("公积金单位合计").toString());
|
|
|
|
|
|
} else if (!fundComMap.isEmpty()) {
|
|
|
|
|
|
po.setFundComSum(sumOfMapValue(fundComMap));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setFundComSum("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利单位合计", "").toString())) {
|
|
|
|
|
|
po.setOtherComSum(baseMap.get("其他福利单位合计").toString());
|
|
|
|
|
|
} else if (!otherComMap.isEmpty()) {
|
|
|
|
|
|
po.setOtherComSum(sumOfMapValue(otherComMap));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setOtherComSum("0");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("单位合计", "").toString())) {
|
|
|
|
|
|
po.setComSum(baseMap.get("单位合计").toString());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setComSum(new BigDecimal(po.getSocialComSum() == null ? "0" : po.getSocialComSum())
|
|
|
|
|
|
.add(new BigDecimal(po.getFundComSum() == null ? "0" : po.getFundComSum()))
|
|
|
|
|
|
.add(new BigDecimal(po.getOtherComSum() == null ? "0" : po.getOtherComSum())).toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("账单月份", "").toString())) {
|
|
|
|
|
|
po.setBillMonth(baseMap.get("账单月份").toString().substring(0, 7));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("社保合计", "").toString())) {
|
|
|
|
|
|
po.setSocialSum(baseMap.get("社保合计").toString());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setSocialSum(new BigDecimal(po.getSocialComSum() == null ? "0" : po.getSocialComSum())
|
|
|
|
|
|
.add(new BigDecimal(po.getSocialPerSum() == null ? "0" : po.getSocialPerSum()))
|
|
|
|
|
|
.toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("公积金合计", "").toString())) {
|
|
|
|
|
|
po.setFundSum(baseMap.get("公积金合计").toString());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setFundSum(new BigDecimal(po.getFundComSum() == null ? "0" : po.getFundComSum())
|
|
|
|
|
|
.add(new BigDecimal(po.getFundPerSum() == null ? "0" : po.getFundPerSum()))
|
|
|
|
|
|
.toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("其他福利合计", "").toString())) {
|
|
|
|
|
|
po.setOtherSum(baseMap.get("其他福利合计").toString());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setOtherSum(new BigDecimal(po.getOtherComSum() == null ? "0" : po.getOtherComSum())
|
|
|
|
|
|
.add(new BigDecimal(po.getOtherPerSum() == null ? "0" : po.getOtherPerSum()))
|
|
|
|
|
|
.toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("合计", "").toString())) {
|
|
|
|
|
|
po.setTotal(baseMap.get("合计").toString());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
po.setTotal(new BigDecimal(po.getPerSum() == null ? "0" : po.getPerSum())
|
|
|
|
|
|
.add(new BigDecimal(po.getComSum() == null ? "0" : po.getComSum()))
|
|
|
|
|
|
.toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//如果导入的时补缴数据,还会包含补缴月份
|
|
|
|
|
|
if (!StringUtils.isEmpty(baseMap.getOrDefault("补缴月份", "").toString())) {
|
|
|
|
|
|
po.setSupplementaryMonth(baseMap.get("补缴月份").toString().substring(0, 7));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
po.setUpdateTime(new Date());
|
|
|
|
|
|
|
|
|
|
|
|
return po;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-04-23 16:35:52 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* map中value值求和
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String sumOfMapValue(Map<String, String> welfarePay){
|
|
|
|
|
|
BigDecimal sum = new BigDecimal("0");
|
|
|
|
|
|
for (String value : welfarePay.values()) {
|
|
|
|
|
|
sum = sum.add(new BigDecimal(value));
|
|
|
|
|
|
}
|
|
|
|
|
|
return sum.toString();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-02 15:40:05 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 对比新旧两份数据,并更新数据
|
|
|
|
|
|
*/
|
2022-09-06 17:13:33 +08:00
|
|
|
|
private Map<String, String> checkJsonMap(Map<String, String> newMap, String oldJson) {
|
|
|
|
|
|
Map<String, String> oldMap = JSON.parseObject(oldJson, HashMap.class);
|
2022-09-14 14:36:05 +08:00
|
|
|
|
|
2023-01-12 17:23:26 +08:00
|
|
|
|
Map<String, String> toDelMap = new HashMap<>();
|
2022-09-14 14:36:05 +08:00
|
|
|
|
//校验newMap中的value值是否为整数或者小数
|
|
|
|
|
|
for(Map.Entry<String, String> newEntry : newMap.entrySet()) {
|
|
|
|
|
|
String newValue = newEntry.getValue();
|
|
|
|
|
|
int l = newValue.length();
|
|
|
|
|
|
|
|
|
|
|
|
if (newValue.length() > 0 && !isNumeric(newValue)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("请检查导入Excel中个人或单位对应的福利项数值是否为整数或小数!");
|
|
|
|
|
|
}
|
2023-01-12 17:23:26 +08:00
|
|
|
|
|
|
|
|
|
|
if ("".equals(newEntry.getValue())) {
|
|
|
|
|
|
toDelMap.put(newEntry.getKey(), newEntry.getValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (toDelMap.size() > 0) {
|
|
|
|
|
|
for (Map.Entry<String, String> delEntry : toDelMap.entrySet()) {
|
|
|
|
|
|
newMap.remove(delEntry.getKey());
|
|
|
|
|
|
}
|
2022-09-14 14:36:05 +08:00
|
|
|
|
}
|
2022-09-20 16:36:01 +08:00
|
|
|
|
|
2023-01-12 17:23:26 +08:00
|
|
|
|
|
2022-09-20 16:36:01 +08:00
|
|
|
|
if (oldMap == null) {
|
|
|
|
|
|
return newMap;
|
|
|
|
|
|
}
|
2022-09-14 14:36:05 +08:00
|
|
|
|
//保留oldMap无变动数据,更新newMap已变动数据
|
2022-09-02 15:40:05 +08:00
|
|
|
|
for (Map.Entry<String, String> oldEntry : oldMap.entrySet()) {
|
|
|
|
|
|
if (!newMap.containsKey(oldEntry.getKey())) {
|
|
|
|
|
|
newMap.put(oldEntry.getKey(), oldEntry.getValue());
|
2022-09-14 14:36:05 +08:00
|
|
|
|
} else if (newMap.containsKey(oldEntry.getKey()) && "".equals(newMap.get(oldEntry.getKey()))) {
|
|
|
|
|
|
newMap.put(oldEntry.getKey(), oldEntry.getValue());
|
2022-09-02 15:40:05 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-14 14:36:05 +08:00
|
|
|
|
|
2022-09-02 15:40:05 +08:00
|
|
|
|
return newMap;
|
2022-09-02 11:53:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-14 14:36:05 +08:00
|
|
|
|
/**
|
2022-09-21 10:47:07 +08:00
|
|
|
|
* 判断字符串是否为整数或者小数或者负数
|
2022-09-14 14:36:05 +08:00
|
|
|
|
*/
|
|
|
|
|
|
public static boolean isNumeric(String str){
|
|
|
|
|
|
|
2022-09-21 10:47:07 +08:00
|
|
|
|
// Pattern pattern = Pattern.compile("[0-9]*\\.?[0-9]+");
|
|
|
|
|
|
Pattern pattern = Pattern.compile("^-?\\d+(\\.\\d+)?$");
|
2022-09-14 14:36:05 +08:00
|
|
|
|
Matcher isNum = pattern.matcher(str);
|
|
|
|
|
|
if (!isNum.matches()) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
return true;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-02 11:53:38 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 校验福利核算的账单月份输入格式是否正确
|
|
|
|
|
|
*/
|
|
|
|
|
|
public boolean checkBillMonth(String billMonth) {
|
|
|
|
|
|
|
2022-09-06 17:13:33 +08:00
|
|
|
|
//校验内容:billMonth的长度是否为7、年月连接符是否为“-”
|
|
|
|
|
|
String connector;
|
2022-09-02 11:53:38 +08:00
|
|
|
|
if(billMonth.length() == 7){
|
|
|
|
|
|
connector = billMonth.substring(4,5);
|
|
|
|
|
|
return "-".equals(connector);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 10:55:57 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 导出“福利核算-线下对比导入模板”
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
2023-04-18 14:21:05 +08:00
|
|
|
|
public XSSFWorkbook exportComparisonWelfareTemplate(InsuranceAccountDetailParam param) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
Map<String, List<Object>> welColumnMap = createWelColumnMap(param);
|
|
|
|
|
|
|
|
|
|
|
|
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86185, "部门"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86187, "员工状态"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(100377, "数据来源"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(91325, "个税扣缴义务人"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(91324, "社保账号"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(91323, "社保方案名称"));
|
|
|
|
|
|
//组装社保基数
|
|
|
|
|
|
if (welColumnMap.get("socialBase") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("socialBase"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(91486, "公积金账号"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(91485, "公积金方案名称"));
|
|
|
|
|
|
//组装公积金基数
|
|
|
|
|
|
if (welColumnMap.get("fundBase") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("fundBase"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(91487, "补充公积金账号"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(91496, "其他福利方案名称"));
|
|
|
|
|
|
//组装其他福利基数
|
|
|
|
|
|
if (welColumnMap.get("otherBase") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("otherBase"));
|
|
|
|
|
|
}
|
|
|
|
|
|
//社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人)
|
|
|
|
|
|
if (welColumnMap.get("socialPer") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("socialPer"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100388, "社保个人合计"));
|
|
|
|
|
|
//住房公积金个人、补充住房公积金个人
|
|
|
|
|
|
if (welColumnMap.get("fundPer") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("fundPer"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100390, "公积金个人合计"));
|
|
|
|
|
|
//其他个人(比如企业年金个人)
|
|
|
|
|
|
if (welColumnMap.get("otherPer") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("otherPer"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100392, "其他福利个人合计"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100393, "个人合计"));
|
|
|
|
|
|
//社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位)
|
|
|
|
|
|
if (welColumnMap.get("socialCom") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("socialCom"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100394, "社保单位合计"));
|
|
|
|
|
|
//住房公积金单位、补充住房公积金单位
|
|
|
|
|
|
if (welColumnMap.get("fundCom") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("fundCom"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100395, "公积金单位合计"));
|
|
|
|
|
|
//其他单位(比如企业年金单位)
|
|
|
|
|
|
if (welColumnMap.get("otherCom") != null) {
|
|
|
|
|
|
headerList.addAll(welColumnMap.get("otherCom"));
|
|
|
|
|
|
}
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100396, "其他福利单位合计"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100397, "单位合计"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100398, "社保合计"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100399, "公积金合计"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(100400, "其他福利合计"));
|
|
|
|
|
|
headerList.add(SalaryI18nUtil.getI18nLabel(93278, "合计"));
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Object>> rows = new ArrayList<>();
|
|
|
|
|
|
rows.add(headerList);
|
|
|
|
|
|
String sheetName = "福利核算-线下对比导入模板";
|
|
|
|
|
|
|
|
|
|
|
|
return ExcelUtilPlus.genWorkbookV2(rows, sheetName);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, List<Object>> createWelColumnMap(InsuranceAccountDetailParam param) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
|
|
|
|
|
|
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
//查询线上福利核算记录
|
|
|
|
|
|
InsuranceExportParam insuranceExportParam = new InsuranceExportParam();
|
|
|
|
|
|
insuranceExportParam.setBillMonth(param.getBillMonth());
|
|
|
|
|
|
insuranceExportParam.setPaymentOrganization(param.getPaymentOrganization());
|
|
|
|
|
|
List<AccountExportPO> accountExportPOS = getInsuranceExportMapper().exportAccount(param.getPaymentStatus(), insuranceExportParam);
|
|
|
|
|
|
|
|
|
|
|
|
//整理线上核算记录相关的福利方案,并以此整理需要对比的福利项类别数据
|
|
|
|
|
|
Set<Long> welfareSchemeIds = new HashSet<>();
|
|
|
|
|
|
accountExportPOS.forEach(f -> {
|
|
|
|
|
|
welfareSchemeIds.add(f.getSocialSchemeId());
|
|
|
|
|
|
welfareSchemeIds.add(f.getFundSchemeId());
|
|
|
|
|
|
welfareSchemeIds.add(f.getOtherSchemeId());
|
|
|
|
|
|
});
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll();
|
|
|
|
|
|
List<Long> insuranceBaseIds = insuranceSchemeDetailPos.stream()
|
|
|
|
|
|
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1)
|
|
|
|
|
|
.map(InsuranceSchemeDetailPO::getInsuranceId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<Long> insurancePerPayIds = insuranceSchemeDetailPos.stream()
|
|
|
|
|
|
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 2)
|
|
|
|
|
|
.map(InsuranceSchemeDetailPO::getInsuranceId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<Long> insuranceComPayIds = insuranceSchemeDetailPos.stream()
|
|
|
|
|
|
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 1)
|
|
|
|
|
|
.map(InsuranceSchemeDetailPO::getInsuranceId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
Set<Long> insuranceBaseSet = new HashSet<>(insuranceBaseIds);
|
|
|
|
|
|
Set<Long> insurancePerPaySet = new HashSet<>(insurancePerPayIds);
|
|
|
|
|
|
Set<Long> insuranceComPaySet = new HashSet<>(insuranceComPayIds);
|
2022-09-27 10:55:57 +08:00
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
|
List<ICategoryPO> listAll = getICategoryMapper().listAll();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<ICategoryPO> socialWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> fundWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> otherWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<ICategoryPO> socialWelComList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
2023-12-08 11:16:18 +08:00
|
|
|
|
//组装社保基数
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> socialBaseColumns = new ArrayList<>();
|
|
|
|
|
|
List<Object> socialPerBaseColumns = new ArrayList<>();
|
|
|
|
|
|
List<Object> socialComBaseColumns = Lists.newArrayList();
|
2023-12-08 11:16:18 +08:00
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
for (ICategoryPO po : socialWelfareList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
socialPerBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人"));
|
|
|
|
|
|
socialComBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位"));
|
2023-12-08 11:16:18 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
socialBaseColumns.addAll(socialPerBaseColumns);
|
|
|
|
|
|
socialBaseColumns.addAll(socialComBaseColumns);
|
2023-12-08 11:16:18 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
for (ICategoryPO po : socialWelfareList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
socialBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数"));
|
2023-12-08 11:16:18 +08:00
|
|
|
|
}
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
|
2022-09-27 10:55:57 +08:00
|
|
|
|
//组装公积金基数
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> fundBaseColumns = new ArrayList<>();
|
|
|
|
|
|
List<Object> fundPerBaseColumns = Lists.newArrayList();
|
|
|
|
|
|
List<Object> fundComBaseColumns = Lists.newArrayList();
|
2023-12-08 11:16:18 +08:00
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
for (ICategoryPO po : fundWelfareList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
fundPerBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人"));
|
|
|
|
|
|
fundComBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位"));
|
2023-12-08 11:16:18 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
fundBaseColumns.addAll(fundPerBaseColumns);
|
|
|
|
|
|
fundBaseColumns.addAll(fundComBaseColumns);
|
2023-12-08 11:16:18 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
for (ICategoryPO po : fundWelfareList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
fundBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数"));
|
2023-12-08 11:16:18 +08:00
|
|
|
|
}
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
|
2022-09-27 10:55:57 +08:00
|
|
|
|
//组装其他福利基数
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> otherBaseColumns = new ArrayList<>();
|
|
|
|
|
|
List<Object> otherPerBaseColumns = new ArrayList<>();
|
|
|
|
|
|
List<Object> otherComBaseColumns = Lists.newArrayList();
|
2023-12-08 11:16:18 +08:00
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
for (ICategoryPO po : otherWelfareList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
otherPerBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"个人"));
|
|
|
|
|
|
otherComBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数") + SalaryI18nUtil.getI18nLabel(0,"单位"));
|
2023-12-08 11:16:18 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
otherBaseColumns.addAll(otherPerBaseColumns);
|
|
|
|
|
|
otherBaseColumns.addAll(otherComBaseColumns);
|
2023-12-08 11:16:18 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
for (ICategoryPO po : otherWelfareList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
otherBaseColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0, "申报基数"));
|
2023-12-08 11:16:18 +08:00
|
|
|
|
}
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
|
2022-09-27 10:55:57 +08:00
|
|
|
|
//社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人)
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> socialPerColumns = new ArrayList<>();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
for (ICategoryPO po : socialWelPerList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
socialPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人"));
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
//住房公积金个人、补充住房公积金个人
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> fundPerColumns = new ArrayList<>();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
for (ICategoryPO po : fundWelPerList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
fundPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人"));
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
//其他个人(比如企业年金个人)
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> otherPerColumns = new ArrayList<>();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
for (ICategoryPO po : otherWelPerList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
otherPerColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"个人"));
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
//社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位)
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> socialComColumns = new ArrayList<>();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
for (ICategoryPO po : socialWelComList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
socialComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位"));
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
//住房公积金单位、补充住房公积金单位
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> fundComColumns = new ArrayList<>();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
for (ICategoryPO po : fundWelComList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
fundComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位"));
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
2023-12-08 18:06:54 +08:00
|
|
|
|
|
2022-09-27 10:55:57 +08:00
|
|
|
|
//其他单位(比如企业年金单位)
|
2023-12-08 18:06:54 +08:00
|
|
|
|
List<Object> otherComColumns = new ArrayList<>();
|
2023-04-18 14:21:05 +08:00
|
|
|
|
for (ICategoryPO po : otherWelComList) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
otherComColumns.add(po.getInsuranceName() + SalaryI18nUtil.getI18nLabel(0,"单位"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, List<Object>> welColumnMap = new HashMap<>();
|
|
|
|
|
|
welColumnMap.put("socialPerBase", socialPerBaseColumns);
|
|
|
|
|
|
welColumnMap.put("fundPerBase", fundPerBaseColumns);
|
|
|
|
|
|
welColumnMap.put("otherPerBase", otherPerBaseColumns);
|
|
|
|
|
|
welColumnMap.put("socialComBase", socialComBaseColumns);
|
|
|
|
|
|
welColumnMap.put("fundComBase", fundComBaseColumns);
|
|
|
|
|
|
welColumnMap.put("otherComBase", otherComBaseColumns);
|
|
|
|
|
|
welColumnMap.put("socialBase", socialBaseColumns);
|
|
|
|
|
|
welColumnMap.put("fundBase", fundBaseColumns);
|
|
|
|
|
|
welColumnMap.put("otherBase", otherBaseColumns);
|
|
|
|
|
|
welColumnMap.put("socialPer", socialPerColumns);
|
|
|
|
|
|
welColumnMap.put("fundPer", fundPerColumns);
|
|
|
|
|
|
welColumnMap.put("otherPer", otherPerColumns);
|
|
|
|
|
|
welColumnMap.put("socialCom", socialComColumns);
|
|
|
|
|
|
welColumnMap.put("fundCom", fundComColumns);
|
|
|
|
|
|
welColumnMap.put("otherCom", otherComColumns);
|
|
|
|
|
|
return welColumnMap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, String> welColumnNameCodeMap(InsuranceAccountDetailParam param) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
|
|
|
|
|
|
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
|
2023-12-08 18:06:54 +08:00
|
|
|
|
//查询线上福利核算记录
|
|
|
|
|
|
InsuranceExportParam insuranceExportParam = new InsuranceExportParam();
|
|
|
|
|
|
insuranceExportParam.setBillMonth(param.getBillMonth());
|
|
|
|
|
|
insuranceExportParam.setPaymentOrganization(param.getPaymentOrganization());
|
|
|
|
|
|
List<AccountExportPO> accountExportPOS = getInsuranceExportMapper().exportAccount(param.getPaymentStatus(), insuranceExportParam);
|
|
|
|
|
|
|
|
|
|
|
|
//整理线上核算记录相关的福利方案,并以此整理需要对比的福利项类别数据
|
|
|
|
|
|
Set<Long> welfareSchemeIds = new HashSet<>();
|
|
|
|
|
|
accountExportPOS.forEach(f -> {
|
|
|
|
|
|
welfareSchemeIds.add(f.getSocialSchemeId());
|
|
|
|
|
|
welfareSchemeIds.add(f.getFundSchemeId());
|
|
|
|
|
|
welfareSchemeIds.add(f.getOtherSchemeId());
|
|
|
|
|
|
});
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll();
|
|
|
|
|
|
List<Long> insuranceBaseIds = insuranceSchemeDetailPos.stream()
|
|
|
|
|
|
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1)
|
|
|
|
|
|
.map(InsuranceSchemeDetailPO::getInsuranceId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<Long> insurancePerPayIds = insuranceSchemeDetailPos.stream()
|
|
|
|
|
|
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 2)
|
|
|
|
|
|
.map(InsuranceSchemeDetailPO::getInsuranceId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<Long> insuranceComPayIds = insuranceSchemeDetailPos.stream()
|
|
|
|
|
|
.filter(f -> welfareSchemeIds.contains(f.getPrimaryId()) && f.getIsPayment() == 1 && f.getPaymentScope() == 1)
|
|
|
|
|
|
.map(InsuranceSchemeDetailPO::getInsuranceId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
Set<Long> insuranceBaseSet = new HashSet<>(insuranceBaseIds);
|
|
|
|
|
|
Set<Long> insurancePerPaySet = new HashSet<>(insurancePerPayIds);
|
|
|
|
|
|
Set<Long> insuranceComPaySet = new HashSet<>(insuranceComPayIds);
|
|
|
|
|
|
|
|
|
|
|
|
List<ICategoryPO> listAll = getICategoryMapper().listAll();
|
|
|
|
|
|
List<ICategoryPO> socialWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> fundWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> otherWelfareList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceBaseSet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<ICategoryPO> socialWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> fundWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> otherWelPerList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insurancePerPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
List<ICategoryPO> socialWelComList = listAll.stream().filter(e -> e.getWelfareType() == 1 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> fundWelComList = listAll.stream().filter(e -> e.getWelfareType() == 2 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
List<ICategoryPO> otherWelComList = listAll.stream().filter(e -> e.getWelfareType() == 3 && e.getIsUse() == 1 && insuranceComPaySet.contains(e.getId())).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
//组装社保基数
|
|
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
for (ICategoryPO po : socialWelfareList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0,"个人"), po.getId() + "socialPerBase");
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0,"单位"), po.getId() + "socialComBase");
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (ICategoryPO po : socialWelfareList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "socialBase");
|
|
|
|
|
|
}
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-08 18:06:54 +08:00
|
|
|
|
//组装公积金基数
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
for (ICategoryPO po : fundWelfareList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0,"个人"), po.getId() + "fundPerBase");
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0,"单位"), po.getId() + "fundComBase");
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (ICategoryPO po : fundWelfareList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "fundBase");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-27 10:55:57 +08:00
|
|
|
|
|
2023-12-08 18:06:54 +08:00
|
|
|
|
//组装其他福利基数
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
for (ICategoryPO po : otherWelfareList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0,"个人"), po.getId() + "otherPerBase");
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0,"单位"), po.getId() + "otherComBase");
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (ICategoryPO po : otherWelfareList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "申报基数"), po.getId() + "otherBase");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//社保个人(生育保险个人、工伤保险个人、失业保险个人、养老保险个人、医疗保险个人)
|
|
|
|
|
|
for (ICategoryPO po : socialWelPerList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
2023-12-21 13:33:21 +08:00
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "个人"), po.getId() + "socialPer");
|
2023-12-08 18:06:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
//住房公积金个人、补充住房公积金个人
|
|
|
|
|
|
for (ICategoryPO po : fundWelPerList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
2023-12-21 13:33:21 +08:00
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "个人"), po.getId() + "fundPer");
|
2023-12-08 18:06:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
//其他个人(比如企业年金个人)
|
|
|
|
|
|
for (ICategoryPO po : otherWelPerList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
2023-12-21 13:33:21 +08:00
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "个人"), po.getId() + "otherPer");
|
2023-12-08 18:06:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
//社保单位(生育保险单位、工伤保险单位、失业保险单位、养老保险单位、医疗保险单位)
|
|
|
|
|
|
for (ICategoryPO po : socialWelComList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
2023-12-21 13:33:21 +08:00
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "单位"), po.getId() + "socialCom");
|
2023-12-08 18:06:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
//住房公积金单位、补充住房公积金单位
|
|
|
|
|
|
for (ICategoryPO po : fundWelComList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
2023-12-21 13:33:21 +08:00
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "单位"), po.getId() + "fundCom");
|
2023-12-08 18:06:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//其他单位(比如企业年金单位)
|
|
|
|
|
|
for (ICategoryPO po : otherWelComList) {
|
|
|
|
|
|
result.put(Util.formatMultiLang(po.getInsuranceName(), String.valueOf(user.getLanguage()))
|
2023-12-21 13:33:21 +08:00
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(0, "单位"), po.getId() + "otherCom");
|
2023-12-08 18:06:54 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
2022-09-27 10:55:57 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2022-09-27 17:36:06 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 将通过“福利核算-线下对比导入”模板导入的数据更新到hrsa_excel_bill_detail表中
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> importExcelInsuranceDetail(ExcelInsuranceImportParam importParam) {
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
|
|
|
|
//查询对于人员信息导入筛选的全局配置
|
|
|
|
|
|
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
|
|
|
|
|
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
|
|
|
|
|
//检验参数
|
|
|
|
|
|
//excel文件id
|
|
|
|
|
|
String imageId = Util.null2String(importParam.getImageId());
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(imageId)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("文件不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 获取租户下所有的人员
|
2023-09-06 10:04:58 +08:00
|
|
|
|
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listAll(UseEmployeeTypeEnum.ALL);
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
|
|
|
|
|
// 失败的数量
|
|
|
|
|
|
int failCount = 0;
|
|
|
|
|
|
// 成功的数量
|
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
|
InputStream fileInputStream = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(importParam.getImageId()));
|
|
|
|
|
|
|
|
|
|
|
|
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
|
|
|
|
|
|
// 错误提示信息
|
|
|
|
|
|
List<Map> excelComments = Lists.newArrayList();
|
|
|
|
|
|
// 存在错误的那行数据
|
|
|
|
|
|
List<Map<String, Object>> errorDatas = Lists.newArrayList();
|
|
|
|
|
|
// 表头
|
|
|
|
|
|
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
|
|
|
|
|
// 处理数值
|
|
|
|
|
|
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(headers)) {
|
2022-11-17 13:39:50 +08:00
|
|
|
|
throw new SalaryRunTimeException("表头为空");
|
2022-09-27 17:36:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isEmpty(data)) {
|
2022-11-17 13:39:50 +08:00
|
|
|
|
throw new SalaryRunTimeException("无数据");
|
2022-09-27 17:36:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String billMonth = importParam.getBillMonth();
|
2023-12-08 18:06:54 +08:00
|
|
|
|
|
2023-12-21 13:33:21 +08:00
|
|
|
|
// Map<String, String> welColumnNameCodeMap = welColumnNameCodeMap(InsuranceAccountDetailParam.builder()
|
|
|
|
|
|
// .billMonth(billMonth)
|
|
|
|
|
|
// .paymentOrganization(importParam.getPaymentOrganization())
|
|
|
|
|
|
// .paymentStatus(PaymentStatusEnum.COMMON.getValue())
|
|
|
|
|
|
// .build());
|
|
|
|
|
|
Map<String, String> welColumnNameCodeMap = new HashMap<>();
|
2022-09-27 17:36:06 +08:00
|
|
|
|
//存储待更新的InsuranceAccountDetailPO数据
|
|
|
|
|
|
List<ExcelInsuranceDetailPO> addCompareList = new ArrayList<>();
|
|
|
|
|
|
//记录待删除hrsa_excel_bill_detail.id
|
|
|
|
|
|
List<Long> idList = new ArrayList<>();
|
|
|
|
|
|
//遍历excel表具体数据
|
|
|
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
|
|
|
|
|
|
String row = "第" + (i + 2) + "行";
|
|
|
|
|
|
|
|
|
|
|
|
boolean isError = false;
|
|
|
|
|
|
Map<String, Object> map = data.get(i);
|
|
|
|
|
|
Long employeeId = 0L;
|
|
|
|
|
|
|
|
|
|
|
|
List<ExcelInsuranceDetailPO> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
String taxAgentName = (String) map.getOrDefault("个税扣缴义务人", "");
|
|
|
|
|
|
Long paymentOrganization = 0L;
|
|
|
|
|
|
List<TaxAgentPO> taxAgentPoList = getTaxAgentMapper().listByName(taxAgentName);
|
|
|
|
|
|
|
|
|
|
|
|
if (taxAgentPoList.size() == 1) {
|
|
|
|
|
|
paymentOrganization = taxAgentPoList.get(0).getId();
|
2023-12-21 13:33:21 +08:00
|
|
|
|
welColumnNameCodeMap = welColumnNameCodeMap(InsuranceAccountDetailParam.builder()
|
|
|
|
|
|
.billMonth(billMonth)
|
|
|
|
|
|
.paymentOrganization(paymentOrganization.toString())
|
|
|
|
|
|
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
|
|
|
|
|
|
.build());
|
2022-09-27 17:36:06 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//遍历表头
|
|
|
|
|
|
for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
|
String header = headers.get(j);
|
|
|
|
|
|
String dataKey = header;
|
|
|
|
|
|
if (dataKey == null) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
String dataValue = (String) map.getOrDefault(dataKey.toString(), "");
|
|
|
|
|
|
String deparmentName = (String) map.getOrDefault("部门", "");
|
|
|
|
|
|
String mobile = (String) map.getOrDefault("手机号", "");
|
|
|
|
|
|
String workcode = (String) map.getOrDefault("工号", "");
|
2024-05-23 09:16:28 +08:00
|
|
|
|
String idNo = (String) map.getOrDefault("证件号码", "");
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
|
|
|
|
|
|
//当人员信息导入筛选的全局配置为"0"时,姓名才是必填项
|
|
|
|
|
|
if (StringUtils.isEmpty(dataValue) && "0".equals(confValue)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
2024-05-23 09:16:28 +08:00
|
|
|
|
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue,salaryEmployees, dataValue, deparmentName, mobile, workcode, idNo,null);
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeSameIds)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (employeeSameIds.size() > 1) {
|
|
|
|
|
|
//存在离职和在职状态取在职状态
|
|
|
|
|
|
employeeSameIds = employeeSameIds.stream()
|
|
|
|
|
|
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
if (employeeSameIds.size() != 1) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + "员工信息不存在或者存在多个员工");
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeId = employeeSameIds.get(0).getEmployeeId();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isError){
|
|
|
|
|
|
List<Long> employeeIds = new ArrayList<>();
|
|
|
|
|
|
employeeIds.add(employeeId);
|
|
|
|
|
|
//根据员工id、个税扣缴义务人id、账单月份查询,如果当前对比表中存在数据,则记录为待删除数据
|
|
|
|
|
|
list = getExcelInsuranceDetailMapper().queryCompareList(billMonth, paymentOrganization, employeeIds.get(0));
|
|
|
|
|
|
|
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
|
List<Long> ids = list.stream().map(ExcelInsuranceDetailPO::getId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
idList.addAll(ids);
|
|
|
|
|
|
}
|
|
|
|
|
|
//拼装待更新数据
|
2023-12-08 18:06:54 +08:00
|
|
|
|
addCompareList.add(handleExcelInsuranceDetail(billMonth, employeeId, paymentOrganization, map, welColumnNameCodeMap));
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isError) {
|
|
|
|
|
|
failCount++;
|
|
|
|
|
|
errorDatas.add(map);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
successCount++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//将待更新列表加密
|
2022-12-13 13:34:22 +08:00
|
|
|
|
encryptUtil.encryptList(addCompareList, ExcelInsuranceDetailPO.class);
|
2022-09-27 17:36:06 +08:00
|
|
|
|
//删除
|
|
|
|
|
|
if (idList.size() > 0) {
|
|
|
|
|
|
getExcelInsuranceDetailMapper().batchDelByIds(idList);
|
|
|
|
|
|
}
|
|
|
|
|
|
//新增
|
2023-08-01 15:37:32 +08:00
|
|
|
|
List<List<ExcelInsuranceDetailPO>> partition = Lists.partition((List<ExcelInsuranceDetailPO>) addCompareList, 20);
|
|
|
|
|
|
partition.forEach(getExcelInsuranceDetailMapper()::batchSave);
|
|
|
|
|
|
|
|
|
|
|
|
// getExcelInsuranceDetailMapper().batchSave(addCompareList);
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
|
|
|
|
|
apidatas.put("successCount", successCount);
|
|
|
|
|
|
apidatas.put("errorCount", failCount);
|
|
|
|
|
|
apidatas.put("errorData", excelComments);
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
IOUtils.closeQuietly(fileInputStream);
|
|
|
|
|
|
}
|
|
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 将excel导入的数据行组装成ExcelInsuranceDetailPO对象
|
|
|
|
|
|
* @param billMonth 对比的账单月份
|
|
|
|
|
|
* @param baseMap excel导入的对比数据
|
|
|
|
|
|
*/
|
2023-12-08 18:06:54 +08:00
|
|
|
|
private ExcelInsuranceDetailPO handleExcelInsuranceDetail(String billMonth, Long employeeId, Long paymentOrganization, Map<String, Object> baseMap, Map<String, String> welColumnNameCodeMap) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
|
|
|
|
|
|
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
|
|
|
|
|
ExcelInsuranceDetailPO excelInsuranceDetailPO = new ExcelInsuranceDetailPO();
|
2022-09-30 10:55:46 +08:00
|
|
|
|
excelInsuranceDetailPO.setId(IdGenerator.generate());
|
2022-09-27 17:36:06 +08:00
|
|
|
|
//组装json数据,格式Map<String, Object>
|
|
|
|
|
|
Map<String, String> socialPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherPerMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> socialComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundComMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherComMap = new HashMap<>();
|
2022-09-29 11:13:49 +08:00
|
|
|
|
//组装福利基数
|
2022-09-27 17:36:06 +08:00
|
|
|
|
Map<String, String> socialPaymentBaseMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundPaymentBaseMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherPaymentBaseMap = new HashMap<>();
|
|
|
|
|
|
|
2023-12-08 18:06:54 +08:00
|
|
|
|
Map<String, String> socialPaymentComBaseMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> fundPaymentComBaseMap = new HashMap<>();
|
|
|
|
|
|
Map<String, String> otherPaymentComBaseMap = new HashMap<>();
|
|
|
|
|
|
|
2022-09-27 17:36:06 +08:00
|
|
|
|
//筛选出福利核算项
|
|
|
|
|
|
Map<String, Object> toDealMap =
|
|
|
|
|
|
baseMap.entrySet().stream()
|
|
|
|
|
|
.filter(map -> !"姓名".equals(map.getKey())
|
|
|
|
|
|
&& !"部门".equals(map.getKey())
|
|
|
|
|
|
&& !"手机号".equals(map.getKey())
|
|
|
|
|
|
&& !"个税扣缴义务人".equals(map.getKey())
|
|
|
|
|
|
&& !"员工状态".equals(map.getKey())
|
|
|
|
|
|
&& !"数据来源".equals(map.getKey())
|
|
|
|
|
|
&& !"工号".equals(map.getKey()))
|
|
|
|
|
|
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
|
|
|
|
|
|
|
|
|
|
|
|
for(Map.Entry<String, Object> entry : toDealMap.entrySet()) {
|
2023-12-08 18:06:54 +08:00
|
|
|
|
// //判断元素是否属于福利类
|
|
|
|
|
|
// String keyName = entry.getKey();
|
|
|
|
|
|
// //获取元素名后缀,方便之后判断“个人”或“单位”或者“基数”
|
|
|
|
|
|
// String payScope = keyName.substring(keyName.length() - 2);
|
|
|
|
|
|
// //获取福利类型
|
|
|
|
|
|
// Integer welfareType;
|
|
|
|
|
|
// //根据元素名后缀,区分截取内容
|
|
|
|
|
|
// String targetWelfareName;
|
|
|
|
|
|
// if ("基数".equals(payScope)) {
|
|
|
|
|
|
// targetWelfareName = entry.getKey().substring(0, keyName.length() - 4);
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// targetWelfareName = entry.getKey().substring(0, keyName.length() - 2);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// List<ICategoryPO> categoryPOList = siCategoryBiz.listByName(targetWelfareName);
|
|
|
|
|
|
// if (categoryPOList.size() == 1) {
|
|
|
|
|
|
// ICategoryPO iCategoryPO = categoryPOList.get(0);
|
|
|
|
|
|
// welfareType = iCategoryPO.getWelfareType();
|
|
|
|
|
|
//
|
|
|
|
|
|
// switch (payScope) {
|
|
|
|
|
|
// case "个人":
|
|
|
|
|
|
// switch (welfareType) {
|
|
|
|
|
|
// case 1:
|
|
|
|
|
|
// socialPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2:
|
|
|
|
|
|
// fundPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 3:
|
|
|
|
|
|
// otherPerMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// default:
|
|
|
|
|
|
// throw new SalaryRunTimeException("福利类型不存在");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case "单位":
|
|
|
|
|
|
// switch (welfareType) {
|
|
|
|
|
|
// case 1:
|
|
|
|
|
|
// socialComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2:
|
|
|
|
|
|
// fundComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 3:
|
|
|
|
|
|
// otherComMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// default:
|
|
|
|
|
|
// throw new SalaryRunTimeException("福利类型不存在");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case "基数":
|
|
|
|
|
|
// switch (welfareType) {
|
|
|
|
|
|
// case 1:
|
|
|
|
|
|
// socialPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 2:
|
|
|
|
|
|
// fundPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// case 3:
|
|
|
|
|
|
// otherPaymentBaseMap.put(iCategoryPO.getId().toString(), entry.getValue().toString());
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// default:
|
|
|
|
|
|
// throw new SalaryRunTimeException("福利类型不存在");
|
|
|
|
|
|
// }
|
|
|
|
|
|
// break;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
2022-09-27 17:36:06 +08:00
|
|
|
|
|
2023-12-08 18:06:54 +08:00
|
|
|
|
if (welColumnNameCodeMap.get(entry.getKey()) != null) {
|
|
|
|
|
|
String code = welColumnNameCodeMap.get(entry.getKey());
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
if (code.contains("socialPerBase")) {
|
|
|
|
|
|
code = code.replace("socialPerBase", "");
|
|
|
|
|
|
socialPaymentBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("socialComBase")) {
|
|
|
|
|
|
code = code.replace("socialComBase", "");
|
|
|
|
|
|
socialPaymentComBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("fundPerBase")) {
|
|
|
|
|
|
code = code.replace("fundPerBase", "");
|
|
|
|
|
|
fundPaymentBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("fundComBase")) {
|
|
|
|
|
|
code = code.replace("fundComBase", "");
|
|
|
|
|
|
fundPaymentComBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("otherPerBase")) {
|
|
|
|
|
|
code = code.replace("otherPerBase", "");
|
|
|
|
|
|
otherPaymentBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("otherComBase")) {
|
|
|
|
|
|
code = code.replace("otherComBase", "");
|
|
|
|
|
|
otherPaymentComBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
if (code.contains("socialBase")) {
|
|
|
|
|
|
code = code.replace("socialBase", "");
|
|
|
|
|
|
socialPaymentBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("fundBase")) {
|
|
|
|
|
|
code = code.replace("fundBase", "");
|
|
|
|
|
|
fundPaymentBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("otherBase")) {
|
|
|
|
|
|
code = code.replace("otherBase", "");
|
|
|
|
|
|
otherPaymentBaseMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (code.contains("socialPer") && !code.contains("socialPerBase")) {
|
|
|
|
|
|
code = code.replace("socialPer", "");
|
|
|
|
|
|
socialPerMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("fundPer") && !code.contains("fundPerBase")) {
|
|
|
|
|
|
code = code.replace("fundPer", "");
|
|
|
|
|
|
fundPerMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("otherPer") && !code.contains("otherPerBase")) {
|
|
|
|
|
|
code = code.replace("otherPer", "");
|
|
|
|
|
|
otherPerMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
2022-09-27 17:36:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-12-08 18:06:54 +08:00
|
|
|
|
if (code.contains("socialCom") && !code.contains("socialComBase")) {
|
|
|
|
|
|
code = code.replace("socialCom", "");
|
|
|
|
|
|
socialComMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("fundCom") && !code.contains("fundComBase")) {
|
|
|
|
|
|
code = code.replace("fundCom", "");
|
|
|
|
|
|
fundComMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (code.contains("otherCom") && !code.contains("otherComBase")) {
|
|
|
|
|
|
code = code.replace("otherCom", "");
|
|
|
|
|
|
otherComMap.put(code, entry.getValue().toString());
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-09-27 17:36:06 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//设置社保个人和公司缴纳明细
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialPerJson(JSON.toJSONString(socialPerMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialComJson(JSON.toJSONString(socialComMap));
|
|
|
|
|
|
//设置公积金个人和公司缴纳明细
|
|
|
|
|
|
excelInsuranceDetailPO.setFundPerJson(JSON.toJSONString(fundPerMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setFundComJson(JSON.toJSONString(fundComMap));
|
|
|
|
|
|
//设置其他福利个人和公司缴纳明细
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherPerJson(JSON.toJSONString(otherPerMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherComJson(JSON.toJSONString(otherComMap));
|
|
|
|
|
|
//设置社保、公积金、其他福利缴纳基数
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialPaymentBaseString(JSON.toJSONString(socialPaymentBaseMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setFundPaymentBaseString(JSON.toJSONString(fundPaymentBaseMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherPaymentBaseString(JSON.toJSONString(otherPaymentBaseMap));
|
|
|
|
|
|
|
2023-12-08 18:06:54 +08:00
|
|
|
|
excelInsuranceDetailPO.setSocialPaymentComBaseString(JSON.toJSONString(socialPaymentComBaseMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setFundPaymentComBaseString(JSON.toJSONString(fundPaymentComBaseMap));
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherPaymentComBaseString(JSON.toJSONString(otherPaymentComBaseMap));
|
|
|
|
|
|
|
2022-09-27 17:36:06 +08:00
|
|
|
|
//组装新的insuranceAccountDetailPO对象数据
|
|
|
|
|
|
excelInsuranceDetailPO.setEmployeeId(employeeId);
|
|
|
|
|
|
excelInsuranceDetailPO.setBillMonth(billMonth);
|
|
|
|
|
|
excelInsuranceDetailPO.setBillStatus(1);
|
|
|
|
|
|
excelInsuranceDetailPO.setPaymentStatus(0);
|
|
|
|
|
|
excelInsuranceDetailPO.setResourceFrom(1);
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialAccount(baseMap.getOrDefault("社保账号", "").toString());
|
|
|
|
|
|
if (baseMap.getOrDefault("社保方案名称", "") != null) {
|
|
|
|
|
|
List<InsuranceSchemePO> socialSchemeList = getInsuranceSchemeMapper().listByName(baseMap.get("社保方案名称").toString());
|
|
|
|
|
|
if (socialSchemeList.size() == 1) {
|
|
|
|
|
|
//设置社保方案id
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialSchemeId(socialSchemeList.get(0).getId());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
excelInsuranceDetailPO.setFundAccount(baseMap.getOrDefault("公积金账号", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setSupplementFundAccount(baseMap.getOrDefault("补充公积金账号", "").toString());
|
|
|
|
|
|
if (baseMap.getOrDefault("公积金方案名称", "") != null) {
|
|
|
|
|
|
List<InsuranceSchemePO> fundSchemeList = getInsuranceSchemeMapper().listByName(baseMap.get("公积金方案名称").toString());
|
|
|
|
|
|
if (fundSchemeList.size() == 1) {
|
|
|
|
|
|
//设置公积金方案id
|
|
|
|
|
|
excelInsuranceDetailPO.setFundSchemeId(fundSchemeList.get(0).getId());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (baseMap.getOrDefault("其他福利方案名称", "") != null) {
|
|
|
|
|
|
List<InsuranceSchemePO> otherSchemeList = getInsuranceSchemeMapper().listByName(baseMap.get("其他福利方案名称").toString());
|
|
|
|
|
|
if (otherSchemeList.size() == 1) {
|
|
|
|
|
|
//其他福利方案id
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherSchemeId(otherSchemeList.get(0).getId());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialPerSum(baseMap.getOrDefault("社保个人合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setFundPerSum(baseMap.getOrDefault("公积金个人合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherPerSum(baseMap.getOrDefault("其他福利个人合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setPerSum(baseMap.getOrDefault("个人合计", "").toString());
|
|
|
|
|
|
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialComSum(baseMap.getOrDefault("社保单位合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setFundComSum(baseMap.getOrDefault("公积金单位合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherComSum(baseMap.getOrDefault("其他福利单位合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setComSum(baseMap.getOrDefault("单位合计", "").toString());
|
|
|
|
|
|
|
|
|
|
|
|
excelInsuranceDetailPO.setSocialSum(baseMap.getOrDefault("社保合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setFundSum(baseMap.getOrDefault("公积金合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setOtherSum(baseMap.getOrDefault("其他福利合计", "").toString());
|
|
|
|
|
|
excelInsuranceDetailPO.setTotal(baseMap.getOrDefault("合计", "").toString());
|
|
|
|
|
|
|
2022-09-30 10:55:46 +08:00
|
|
|
|
excelInsuranceDetailPO.setCreator((long) user.getUID());
|
2022-09-27 17:36:06 +08:00
|
|
|
|
excelInsuranceDetailPO.setCreateTime(new Date());
|
|
|
|
|
|
excelInsuranceDetailPO.setUpdateTime(new Date());
|
|
|
|
|
|
excelInsuranceDetailPO.setDeleteType(0);
|
|
|
|
|
|
excelInsuranceDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
|
|
|
|
|
excelInsuranceDetailPO.setPaymentOrganization(paymentOrganization);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return excelInsuranceDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-11-24 09:31:44 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 刷新_bill_batch表中的统计信息
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void refreshBillBatch(Long paymentOrganization, String billMonth) {
|
|
|
|
|
|
ExecutorService taskExecutor = Executors.newCachedThreadPool();
|
|
|
|
|
|
taskExecutor.execute(() -> {
|
|
|
|
|
|
|
|
|
|
|
|
if (paymentOrganization != null && billMonth != null) {
|
|
|
|
|
|
InsuranceAccountDetailParam refreshParam =new InsuranceAccountDetailParam();
|
|
|
|
|
|
refreshParam.setBillMonth(billMonth);
|
|
|
|
|
|
refreshParam.setPaymentOrganization(paymentOrganization.toString());
|
|
|
|
|
|
PageInfo<InsuranceAccountViewListDTO> pageInfos = overView(refreshParam);
|
|
|
|
|
|
TaxAgentPO taxAgentPo = getTaxAgentMapper().getById(paymentOrganization);
|
|
|
|
|
|
if (taxAgentPo != null) {
|
|
|
|
|
|
List<InsuranceAccountViewListDTO> viewListDTOList = pageInfos.getList();
|
|
|
|
|
|
viewListDTOList.stream().filter(f -> f.getPayOrg().equals(taxAgentPo.getName())).collect(Collectors.toList());
|
|
|
|
|
|
InsuranceAccountBatchPO batchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization);
|
2022-12-12 15:40:01 +08:00
|
|
|
|
batchPO = encryptUtil.decrypt(batchPO, InsuranceAccountBatchPO.class);
|
2022-11-24 09:31:44 +08:00
|
|
|
|
//更新
|
|
|
|
|
|
if (viewListDTOList.size() > 0 && batchPO != null) {
|
|
|
|
|
|
InsuranceAccountViewListDTO viewListDTO = viewListDTOList.get(0);
|
|
|
|
|
|
batchPO.setSocialNum(viewListDTO.getSocialNum());
|
|
|
|
|
|
batchPO.setFundNum(viewListDTO.getFundNum());
|
|
|
|
|
|
batchPO.setOtherNum(viewListDTO.getOtherNum());
|
|
|
|
|
|
|
|
|
|
|
|
batchPO.setSocialPay(viewListDTO.getSocialPaySum().replace(",", ""));
|
|
|
|
|
|
batchPO.setFundPay(viewListDTO.getFundPaySum().replace(",", ""));
|
|
|
|
|
|
batchPO.setOtherPay(viewListDTO.getOtherPaySum().replace(",", ""));
|
|
|
|
|
|
|
|
|
|
|
|
batchPO.setUpdateTime(new Date());
|
2022-12-12 15:40:01 +08:00
|
|
|
|
batchPO = encryptUtil.encrypt(batchPO, InsuranceAccountBatchPO.class);
|
2022-11-24 09:31:44 +08:00
|
|
|
|
getInsuranceAccountBatchMapper().updateById(batchPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
2022-11-18 16:07:20 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 将通过id获取InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> getPaymentById(Long id) {
|
|
|
|
|
|
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(id);
|
|
|
|
|
|
if (insuranceAccountDetailPO == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException("该条核算数据不存在!");
|
|
|
|
|
|
}
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
|
2022-11-18 16:07:20 +08:00
|
|
|
|
String socialPerJson = insuranceAccountDetailPO.getSocialPerJson();
|
|
|
|
|
|
String socialComJson = insuranceAccountDetailPO.getSocialComJson();
|
|
|
|
|
|
String fundPerJson = insuranceAccountDetailPO.getFundPerJson();
|
|
|
|
|
|
String fundComJson = insuranceAccountDetailPO.getFundComJson();
|
|
|
|
|
|
String otherPerJson = insuranceAccountDetailPO.getOtherPerJson();
|
|
|
|
|
|
String otherComJson = insuranceAccountDetailPO.getOtherComJson();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> dataMap = new HashMap<>();
|
|
|
|
|
|
List<SearchConditionGroup> addGroups = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
getPaymentGroup(socialPerJson, "个人", "社保", dataMap, addGroups);
|
|
|
|
|
|
getPaymentGroup(socialComJson, "公司", "社保", dataMap, addGroups);
|
|
|
|
|
|
getPaymentGroup(fundPerJson, "个人", "公积金", dataMap, addGroups);
|
|
|
|
|
|
getPaymentGroup(fundComJson, "公司", "公积金", dataMap, addGroups);
|
|
|
|
|
|
getPaymentGroup(otherPerJson, "个人", "其他福利", dataMap, addGroups);
|
|
|
|
|
|
getPaymentGroup(otherComJson, "公司", "其他福利", dataMap, addGroups);
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> resultMap = new HashMap<>();
|
2022-11-24 10:43:20 +08:00
|
|
|
|
// resultMap.put("data", dataMap);
|
|
|
|
|
|
// resultMap.put("items", addGroups);
|
2024-06-13 13:59:43 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取当前放方案信息
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialSchemePO = new InsuranceArchivesSocialSchemePO();
|
|
|
|
|
|
InsuranceArchivesFundSchemePO fundSchemePO = new InsuranceArchivesFundSchemePO();
|
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherSchemePO = new InsuranceArchivesOtherSchemePO();
|
|
|
|
|
|
|
2024-06-05 15:30:57 +08:00
|
|
|
|
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPOS = new ArrayList<>();
|
|
|
|
|
|
List<Long> schemeIdList = new ArrayList<>();
|
2024-06-13 13:59:43 +08:00
|
|
|
|
if (insuranceAccountDetailPO.getSocialSchemeId() == null) {
|
|
|
|
|
|
List<InsuranceArchivesSocialSchemePO> socialSchemePOList = getSocialSchemeMapper().getSocialByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
|
|
|
|
|
.employeeId(insuranceAccountDetailPO.getEmployeeId())
|
|
|
|
|
|
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
|
|
|
|
|
|
.build());
|
|
|
|
|
|
if (socialSchemePOList.size() > 0) {
|
|
|
|
|
|
encryptUtil.decryptList(socialSchemePOList, InsuranceArchivesSocialSchemePO.class);
|
|
|
|
|
|
socialSchemePO = socialSchemePOList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
schemeIdList.add(socialSchemePO.getSocialSchemeId());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
schemeIdList.add(insuranceAccountDetailPO.getSocialSchemeId());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (insuranceAccountDetailPO.getFundSchemeId() == null) {
|
|
|
|
|
|
List<InsuranceArchivesFundSchemePO> fundSchemePOList = getFundSchemeMapper().getFundByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
|
|
|
|
|
.employeeId(insuranceAccountDetailPO.getEmployeeId())
|
|
|
|
|
|
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
|
|
|
|
|
|
.build());
|
|
|
|
|
|
if (fundSchemePOList.size() > 0) {
|
|
|
|
|
|
encryptUtil.decryptList(fundSchemePOList, InsuranceArchivesFundSchemePO.class);
|
|
|
|
|
|
fundSchemePO = fundSchemePOList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
schemeIdList.add(fundSchemePO.getFundSchemeId());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
schemeIdList.add(insuranceAccountDetailPO.getFundSchemeId());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (insuranceAccountDetailPO.getOtherSchemeId() == null) {
|
|
|
|
|
|
List<InsuranceArchivesOtherSchemePO> otherSchemePOList = getOtherSchemeMapper().getOtherByEmployeeIdAndPayOrg(InsuranceArchivesEmployeePO.builder()
|
|
|
|
|
|
.employeeId(insuranceAccountDetailPO.getEmployeeId())
|
|
|
|
|
|
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization())
|
|
|
|
|
|
.build());
|
|
|
|
|
|
if (otherSchemePOList.size() > 0) {
|
|
|
|
|
|
encryptUtil.decryptList(otherSchemePOList, InsuranceArchivesOtherSchemePO.class);
|
|
|
|
|
|
otherSchemePO = otherSchemePOList.get(0);
|
|
|
|
|
|
}
|
|
|
|
|
|
schemeIdList.add(otherSchemePO.getOtherSchemeId());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
schemeIdList.add(insuranceAccountDetailPO.getOtherSchemeId());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-06-05 15:30:57 +08:00
|
|
|
|
schemeIdList = schemeIdList.stream().filter(schemeId -> schemeId != null).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(schemeIdList)) {
|
|
|
|
|
|
insuranceSchemeDetailPOS = getInsuranceSchemeDetailMapper().listBySchemeIds(schemeIdList);
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String, Integer> schemeValidNumMap = SalaryEntityUtil.convert2Map(insuranceSchemeDetailPOS, po -> po.getInsuranceId() + "-" + po.getPaymentScope(), InsuranceSchemeDetailPO::getValidNum);
|
2022-11-24 10:43:20 +08:00
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> perList = new ArrayList<>();
|
|
|
|
|
|
List<Map<String, String>> comList = new ArrayList<>();
|
|
|
|
|
|
for (SearchConditionGroup group : addGroups) {
|
|
|
|
|
|
|
2022-11-24 11:04:12 +08:00
|
|
|
|
if (group.getItems() != null && group.getItems().size() > 0) {
|
|
|
|
|
|
for (SearchConditionItem item : group.getItems()) {
|
|
|
|
|
|
Map<String, String> map = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
String[] domkey = item.getDomkey();
|
|
|
|
|
|
String insuranceId = domkey[0].substring(3);
|
|
|
|
|
|
if (group.getTitle().contains("个人")) {
|
|
|
|
|
|
map.put("title", group.getTitle());
|
2023-11-29 11:04:14 +08:00
|
|
|
|
map.put("titleSign", getTotalSign(group.getTitle()));
|
2022-11-24 11:04:12 +08:00
|
|
|
|
map.put("paymentScope", "个人");
|
2023-11-29 13:50:25 +08:00
|
|
|
|
map.put("paymentScopeSign", "per");
|
2022-11-24 11:04:12 +08:00
|
|
|
|
map.put("insuranceName", item.getLabel());
|
|
|
|
|
|
map.put("insuranceId", insuranceId);
|
|
|
|
|
|
map.put("insuranceValue", dataMap.get(domkey[0]));
|
2024-06-05 15:30:57 +08:00
|
|
|
|
map.put("validNum", schemeValidNumMap.getOrDefault(insuranceId + "-2", 2).toString());
|
2022-12-23 16:34:12 +08:00
|
|
|
|
if (map.get("insuranceValue") != null && !"".equals(map.get("insuranceValue"))) {
|
|
|
|
|
|
|
|
|
|
|
|
perList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-11-24 11:04:12 +08:00
|
|
|
|
} else if (group.getTitle().contains("公司")) {
|
|
|
|
|
|
map.put("title", group.getTitle());
|
2023-11-29 11:04:14 +08:00
|
|
|
|
map.put("titleSign", getTotalSign(group.getTitle()));
|
2022-11-24 11:04:12 +08:00
|
|
|
|
map.put("paymentScope", "公司");
|
2023-11-29 13:50:25 +08:00
|
|
|
|
map.put("paymentScopeSign", "com");
|
2022-11-24 11:04:12 +08:00
|
|
|
|
map.put("insuranceName", item.getLabel());
|
|
|
|
|
|
map.put("insuranceId", insuranceId);
|
|
|
|
|
|
map.put("insuranceValue", dataMap.get(domkey[0]));
|
2024-06-05 15:30:57 +08:00
|
|
|
|
map.put("validNum", schemeValidNumMap.getOrDefault(insuranceId + "-1", 2).toString());
|
2022-12-23 16:34:12 +08:00
|
|
|
|
if (map.get("insuranceValue") != null && !"".equals(map.get("insuranceValue"))) {
|
|
|
|
|
|
|
|
|
|
|
|
comList.add(map);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-11-24 11:04:12 +08:00
|
|
|
|
}
|
2022-11-24 10:43:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-11-24 11:04:12 +08:00
|
|
|
|
|
2022-11-24 10:43:20 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, String>> resultList = new ArrayList<>();
|
|
|
|
|
|
resultList.addAll(perList);
|
|
|
|
|
|
resultList.addAll(comList);
|
2023-11-24 14:05:03 +08:00
|
|
|
|
// resultMap.put("data", resultList);
|
|
|
|
|
|
//20231123逻辑变更,对于补差的待编辑内容,扩充其人员档案设置的福利项内容
|
|
|
|
|
|
if (insuranceAccountDetailPO.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
|
|
|
|
|
List<Map<String, String>> balancePaymentGroup = getSIBalanceService(user).getPaymentGroup(BalanceAccountBaseParam.builder()
|
|
|
|
|
|
.employeeId(insuranceAccountDetailPO.getEmployeeId())
|
|
|
|
|
|
.paymentOrganization(insuranceAccountDetailPO.getPaymentOrganization()).build());
|
|
|
|
|
|
if (balancePaymentGroup != null && balancePaymentGroup.size() > 0) {
|
|
|
|
|
|
//抽取已有福利项生成map
|
|
|
|
|
|
Map<String, Object> targetMap = new HashMap<>();
|
|
|
|
|
|
for (Map<String, String> resultItem : resultList) {
|
|
|
|
|
|
targetMap.put(resultItem.get("insuranceId") + "-" + resultItem.get("paymentScope"), resultItem);
|
|
|
|
|
|
}
|
|
|
|
|
|
//对比可进行缴纳福利项与上面的已有福利项生成map
|
|
|
|
|
|
for (Map<String, String> balancePayItem : balancePaymentGroup) {
|
2024-06-05 15:30:57 +08:00
|
|
|
|
Map<String, Object> target = (Map<String, Object>)targetMap.get(balancePayItem.get("insuranceId") + "-" + balancePayItem.get("paymentScope"));
|
2023-11-24 14:05:03 +08:00
|
|
|
|
if (targetMap.get(balancePayItem.get("insuranceId") + "-" + balancePayItem.get("paymentScope")) == null) {
|
|
|
|
|
|
balancePayItem.put("insuranceValue", "");
|
2024-06-05 15:30:57 +08:00
|
|
|
|
balancePayItem.put("validNum", balancePayItem.get("validNum"));
|
2023-11-24 14:05:03 +08:00
|
|
|
|
resultList.add(balancePayItem);
|
2024-06-05 15:30:57 +08:00
|
|
|
|
} else {
|
|
|
|
|
|
target.put("validNum", balancePayItem.get("validNum"));
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
2024-06-05 15:30:57 +08:00
|
|
|
|
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-11-24 10:43:20 +08:00
|
|
|
|
resultMap.put("data", resultList);
|
2022-11-18 16:07:20 +08:00
|
|
|
|
return resultMap;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-11-29 11:04:14 +08:00
|
|
|
|
public String getTotalSign(String total) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(total)) {
|
|
|
|
|
|
return total.contains(SalaryI18nUtil.getI18nLabel(0,"社保")) ? "social" : (total.contains(SalaryI18nUtil.getI18nLabel(0,"公积金")) ? "fund" : "other" );
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return "";
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-11-18 16:07:20 +08:00
|
|
|
|
public void getPaymentGroup(String baseJson, String groupType, String welfareType, Map<String, String> dataMap, List<SearchConditionGroup> addGroups) {
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(baseJson)) {
|
|
|
|
|
|
addGroups.add(new SearchConditionGroup(welfareType + groupType +"缴纳", true, null));
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
String groupPrefix = "个人".equals(groupType) ? "per" : "com";
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, String> toDealMap = JSON.parseObject(baseJson, new HashMap<String, String>().getClass());
|
|
|
|
|
|
Map<String, String> baseJsonMap = new HashMap<>();
|
|
|
|
|
|
List<SearchConditionItem> inputItems = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
for (Map.Entry<String, String> entry : toDealMap.entrySet()) {
|
|
|
|
|
|
//获取福利项信息
|
2024-02-04 10:11:10 +08:00
|
|
|
|
// ICategoryPO iCategoryPO = siCategoryBiz.getByID(Long.valueOf(entry.getKey()));
|
|
|
|
|
|
ICategoryPO iCategoryPO = getSICategoryService(user).getICategoryPOByID(Long.valueOf(entry.getKey()));
|
2022-11-18 16:07:20 +08:00
|
|
|
|
if (iCategoryPO != null) {
|
|
|
|
|
|
String name = groupPrefix + iCategoryPO.getId().toString();
|
|
|
|
|
|
String label = iCategoryPO.getInsuranceName();
|
|
|
|
|
|
inputItems.add(SalaryFormItemUtil.inputNumberItem(user, "precision:2", 2, 12, 2, label, name));
|
|
|
|
|
|
}
|
|
|
|
|
|
baseJsonMap.put(groupPrefix + entry.getKey(), entry.getValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
dataMap.putAll(baseJsonMap);
|
|
|
|
|
|
addGroups.add(new SearchConditionGroup(welfareType + groupType +"缴纳", true, inputItems));
|
|
|
|
|
|
}
|
2022-09-27 10:55:57 +08:00
|
|
|
|
|
2022-11-18 17:56:21 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 编辑InsuranceAccountDetailPO中的社保、公积金、其他福利个人和公司缴纳数据
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void editAccount(EditAccountDetailParam param) {
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = getInsuranceAccountDetailMapper().getById(param.getId());
|
|
|
|
|
|
if (insuranceAccountDetailPO == null) {
|
|
|
|
|
|
throw new SalaryRunTimeException("该条核算数据不存在!");
|
|
|
|
|
|
}
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
|
2022-11-18 17:56:21 +08:00
|
|
|
|
|
2024-02-22 09:33:35 +08:00
|
|
|
|
InsuranceAccountDetailPO oldTargetPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
BeanUtils.copyProperties(insuranceAccountDetailPO, oldTargetPO);
|
|
|
|
|
|
|
2022-11-18 17:56:21 +08:00
|
|
|
|
accountSocialByData(insuranceAccountDetailPO, param);
|
|
|
|
|
|
accountFundByData(insuranceAccountDetailPO, param);
|
|
|
|
|
|
accountOtherByData(insuranceAccountDetailPO, param);
|
|
|
|
|
|
account(insuranceAccountDetailPO);
|
|
|
|
|
|
|
2022-12-12 17:56:26 +08:00
|
|
|
|
encryptUtil.encrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
|
2022-11-18 17:56:21 +08:00
|
|
|
|
getInsuranceAccountDetailMapper().updateById(insuranceAccountDetailPO);
|
2022-11-24 14:19:58 +08:00
|
|
|
|
|
|
|
|
|
|
//刷新_bill_batch表中的统计信息
|
|
|
|
|
|
refreshBillBatch(insuranceAccountDetailPO.getPaymentOrganization(), insuranceAccountDetailPO.getBillMonth());
|
2024-02-20 16:50:45 +08:00
|
|
|
|
//记录操作日志
|
2024-02-22 09:33:35 +08:00
|
|
|
|
PaymentStatusEnum targetEnum = SalaryEnumUtil.enumMatchByValue(insuranceAccountDetailPO.getPaymentStatus(), PaymentStatusEnum.values(), PaymentStatusEnum.class);
|
2024-02-20 16:50:45 +08:00
|
|
|
|
encryptUtil.decrypt(insuranceAccountDetailPO, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getByBillMonth(insuranceAccountDetailPO.getBillMonth(), insuranceAccountDetailPO.getPaymentOrganization());
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
2024-07-10 15:01:49 +08:00
|
|
|
|
DataCollectionEmployee empInfo = getSalaryEmployeeService(user).getEmployeeById(insuranceAccountDetailPO.getEmployeeId());
|
2024-02-20 16:50:45 +08:00
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(targetPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth() + "-" + empInfo.getUsername());
|
2024-02-22 09:33:35 +08:00
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-编辑")
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(targetEnum.getLabelId(), targetEnum.getDefaultLabel()));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-编辑"
|
|
|
|
|
|
+ SalaryI18nUtil.getI18nLabel(targetEnum.getLabelId(), targetEnum.getDefaultLabel()))
|
2024-02-20 16:50:45 +08:00
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + targetPO.getBillMonth() + "-" + empInfo.getUsername());
|
2024-02-22 09:33:35 +08:00
|
|
|
|
loggerContext.setOldValues(oldTargetPO);
|
2024-02-20 16:50:45 +08:00
|
|
|
|
loggerContext.setNewValues(insuranceAccountDetailPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2022-11-18 17:56:21 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountFundByData(InsuranceAccountDetailPO insuranceAccountDetailPO, EditAccountDetailParam baseParam) {
|
|
|
|
|
|
//公积金个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getFundPerJson())) {
|
|
|
|
|
|
List<BigDecimal> fundPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> fundPerson = JSON.parseObject(baseParam.getFundPerJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
fundPerson.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
fundPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerJson(baseParam.getFundPerJson());
|
|
|
|
|
|
BigDecimal fundPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundPer) {
|
|
|
|
|
|
fundPerSum = fundPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(fundPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//公积金单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getFundComJson())) {
|
|
|
|
|
|
List<BigDecimal> fundCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> fundComMap = JSON.parseObject(baseParam.getFundComJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
fundComMap.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
fundCom.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComJson(baseParam.getFundComJson());
|
|
|
|
|
|
BigDecimal fundComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundCom) {
|
|
|
|
|
|
fundComSum = fundComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountOtherByData(InsuranceAccountDetailPO insuranceAccountDetailPO, EditAccountDetailParam baseParam) {
|
|
|
|
|
|
//其他福利个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getOtherPerJson())) {
|
|
|
|
|
|
List<BigDecimal> otherPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> otherPerMap = JSON.parseObject(baseParam.getOtherPerJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
otherPerMap.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
otherPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerJson(baseParam.getOtherPerJson());
|
|
|
|
|
|
BigDecimal otherPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherPer) {
|
|
|
|
|
|
otherPerSum = otherPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//其他福利单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getOtherComJson())) {
|
|
|
|
|
|
List<BigDecimal> otherCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> otherComMap = JSON.parseObject(baseParam.getOtherComJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
otherComMap.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
otherCom.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComJson(baseParam.getOtherComJson());
|
|
|
|
|
|
BigDecimal otherComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherCom) {
|
|
|
|
|
|
otherComSum = otherComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountSocialByData(InsuranceAccountDetailPO insuranceAccountDetailPO, EditAccountDetailParam baseParam) {
|
|
|
|
|
|
//社保个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getSocialPerJson())) {
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(baseParam.getSocialPerJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
archivesPerson.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(baseParam.getSocialPerJson());
|
|
|
|
|
|
BigDecimal socialPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialPer) {
|
|
|
|
|
|
socialPerSum = socialPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//社保单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getSocialComJson())) {
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> archivesCom = JSON.parseObject(baseParam.getSocialComJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
archivesCom.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(baseParam.getSocialComJson());
|
|
|
|
|
|
BigDecimal socialComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialCom) {
|
|
|
|
|
|
socialComSum = socialComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO account(InsuranceAccountDetailPO insuranceAccountDetailPO) {
|
|
|
|
|
|
//个人合计
|
|
|
|
|
|
BigDecimal socialPerson =
|
|
|
|
|
|
StringUtils.isBlank(insuranceAccountDetailPO.getSocialPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getSocialPerSum());
|
|
|
|
|
|
BigDecimal fundPerson =
|
|
|
|
|
|
StringUtils.isBlank(insuranceAccountDetailPO.getFundPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getFundPerSum());
|
|
|
|
|
|
BigDecimal otherPerson =
|
|
|
|
|
|
StringUtils.isBlank(insuranceAccountDetailPO.getOtherPerSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getOtherPerSum());
|
|
|
|
|
|
BigDecimal perSum = socialPerson.add(fundPerson).add(otherPerson);
|
|
|
|
|
|
insuranceAccountDetailPO.setPerSum(perSum.toPlainString());
|
|
|
|
|
|
//单位合计
|
|
|
|
|
|
BigDecimal socialCom =
|
|
|
|
|
|
StringUtils.isBlank(insuranceAccountDetailPO.getSocialComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getSocialComSum());
|
|
|
|
|
|
BigDecimal fundCom = StringUtils.isBlank(insuranceAccountDetailPO.getFundComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getFundComSum());
|
|
|
|
|
|
BigDecimal otherCom =
|
|
|
|
|
|
StringUtils.isBlank(insuranceAccountDetailPO.getOtherComSum()) ? new BigDecimal("0") : new BigDecimal(insuranceAccountDetailPO.getOtherComSum());
|
|
|
|
|
|
BigDecimal comSum = socialCom.add(fundCom).add(otherCom);
|
|
|
|
|
|
insuranceAccountDetailPO.setComSum(comSum.toPlainString());
|
|
|
|
|
|
//社保合计
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialSum(socialPerson.add(socialCom).toPlainString());
|
|
|
|
|
|
//公积金合计
|
|
|
|
|
|
insuranceAccountDetailPO.setFundSum(fundPerson.add(fundCom).toPlainString());
|
|
|
|
|
|
//其他福利合计
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherSum(otherPerson.add(otherCom).toPlainString());
|
|
|
|
|
|
//合计
|
|
|
|
|
|
insuranceAccountDetailPO.setTotal(perSum.add(comSum).toPlainString());
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
2022-12-06 11:44:04 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 导出“福利核算-补差导入”模板
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public XSSFWorkbook exportBalanceImportTemplate(InsuranceAcctDetailImportTemplateParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
|
|
|
|
|
|
// 必须选择导入模板所需的薪资项目(福利项)
|
|
|
|
|
|
if (CollectionUtils.isEmpty(param.getWelfareNames())) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(99019, "参数错误,请选择导入模板所需的福利项目核算项"));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 模板表头(默认必带"个税扣缴义务人"、"姓名")
|
|
|
|
|
|
List<Object> headerList = Lists.newArrayList(SalaryI18nUtil.getI18nLabel(85429, "姓名"),
|
|
|
|
|
|
"部门",
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86186, "手机号"),
|
|
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "工号"),
|
2024-05-29 15:32:19 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86317, "证件号码"),
|
2022-12-06 11:44:04 +08:00
|
|
|
|
SalaryI18nUtil.getI18nLabel(86184, "个税扣缴义务人")
|
|
|
|
|
|
);
|
2024-05-29 15:32:19 +08:00
|
|
|
|
List<String> dataIndexList = Lists.newArrayList("username", "departmentName", "mobile", "workcode","idNo", "taxAgentName");
|
2022-12-06 11:44:04 +08:00
|
|
|
|
// 查询福利核算项目
|
|
|
|
|
|
List<String> welfareNames = (List<String>) param.getWelfareNames();
|
|
|
|
|
|
headerList.addAll(welfareNames);
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Object>> rows = new ArrayList<>();
|
2024-05-29 15:32:19 +08:00
|
|
|
|
//查询当前已有的补差数据
|
2024-06-05 11:02:59 +08:00
|
|
|
|
List<Map<String, Object>> resultMapList = getBalanceDataByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
2024-05-29 15:32:19 +08:00
|
|
|
|
// excel导出的数据
|
2022-12-06 11:44:04 +08:00
|
|
|
|
rows.add(headerList);
|
2024-05-29 15:32:19 +08:00
|
|
|
|
for (Map<String, Object> map : resultMapList) {
|
|
|
|
|
|
List<Object> row = Lists.newArrayListWithExpectedSize(headerList.size());
|
|
|
|
|
|
for (String dataIndex : dataIndexList) {
|
|
|
|
|
|
row.add(map.getOrDefault(dataIndex, StringUtils.EMPTY));
|
|
|
|
|
|
}
|
|
|
|
|
|
rows.add(row);
|
|
|
|
|
|
}
|
2022-12-06 11:44:04 +08:00
|
|
|
|
|
|
|
|
|
|
String sheetName = "福利核算-补差导入模板";
|
|
|
|
|
|
return ExcelUtil.genWorkbookV2(rows, sheetName);
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 将福利台账-补差模板导入的数据更新到数据库
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> importBalanceInsuranceDetail(InsuranceAcctImportParam importParam) {
|
|
|
|
|
|
long currentEmployeeId = user.getUID();
|
|
|
|
|
|
// Boolean openDevolution = getTaxAgentService(user).isOpenDevolution();
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, Object> apidatas = new HashMap<String, Object>();
|
|
|
|
|
|
|
|
|
|
|
|
//查询对于人员信息导入筛选的全局配置
|
|
|
|
|
|
SalarySysConfPO salarySysConfPO = getSalarySysConfMapper().getOneByCode("matchEmployeeMode");
|
|
|
|
|
|
String confValue = (salarySysConfPO != null && salarySysConfPO.getConfValue() != null && !"".equals(salarySysConfPO.getConfValue())) ? salarySysConfPO.getConfValue() : "0";
|
|
|
|
|
|
//检验参数
|
|
|
|
|
|
//excel文件id
|
|
|
|
|
|
String imageId = Util.null2String(importParam.getImageId());
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isBlank(imageId)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("文件不存在");
|
|
|
|
|
|
}
|
|
|
|
|
|
// // 获取所有个税扣缴义务人
|
|
|
|
|
|
// List<TaxAgentPO> taxAgents = getTaxAgentService(user).listAll();
|
|
|
|
|
|
// Map<String, Long> taxAgentNameMap = SalaryEntityUtil.convert2Map(taxAgents, TaxAgentPO::getName, TaxAgentPO::getId);
|
|
|
|
|
|
|
|
|
|
|
|
// 获取租户下所有的人员
|
2023-03-07 17:14:25 +08:00
|
|
|
|
List<DataCollectionEmployee> salaryEmployees = getSalaryEmployeeService(user).listEmployee();
|
2022-12-07 17:09:53 +08:00
|
|
|
|
|
2023-03-07 14:21:01 +08:00
|
|
|
|
List<ICategoryPO> insuranceCategoryPOS = getICategoryMapper().listAll();
|
2022-12-07 17:09:53 +08:00
|
|
|
|
// 失败的数量
|
|
|
|
|
|
int failCount = 0;
|
|
|
|
|
|
// 成功的数量
|
|
|
|
|
|
int successCount = 0;
|
|
|
|
|
|
InputStream fileInputStream = null;
|
|
|
|
|
|
try {
|
|
|
|
|
|
fileInputStream = ImageFileManager.getInputStreamById(Integer.parseInt(importParam.getImageId()));
|
|
|
|
|
|
|
|
|
|
|
|
Sheet sheet = ExcelSupport.parseFile(fileInputStream, 0, EXCEL_TYPE_XLSX);
|
|
|
|
|
|
|
|
|
|
|
|
// 错误提示信息
|
|
|
|
|
|
List<Map> excelComments = Lists.newArrayList();
|
|
|
|
|
|
// 存在错误的那行数据
|
|
|
|
|
|
List<Map<String, Object>> errorDatas = Lists.newArrayList();
|
|
|
|
|
|
// 表头
|
|
|
|
|
|
List<String> headers = ExcelSupport.getSheetHeader(sheet, 0);
|
|
|
|
|
|
// 处理数值
|
|
|
|
|
|
List<Map<String, Object>> data = ExcelParseHelper.parse2Map(sheet, 1);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(headers)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("表头为空");
|
|
|
|
|
|
}
|
|
|
|
|
|
if (CollectionUtils.isEmpty(data)) {
|
|
|
|
|
|
throw new SalaryRunTimeException("无数据");
|
|
|
|
|
|
}
|
|
|
|
|
|
//存储待更新的InsuranceAccountDetailPO数据
|
|
|
|
|
|
List<InsuranceAccountDetailPO> updateInsuranceAccountDetailList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
//存储待新增的InsuranceAccountDetailPO数据
|
|
|
|
|
|
List<InsuranceAccountDetailPO> createInsuranceAccountDetailList = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
String billMonth = importParam.getBillMonth();
|
|
|
|
|
|
//遍历excel表具体数据
|
|
|
|
|
|
for (int i = 0; i < data.size(); i++) {
|
|
|
|
|
|
|
|
|
|
|
|
String row = "第" + (i + 2) + "行";
|
|
|
|
|
|
|
|
|
|
|
|
boolean isError = false;
|
|
|
|
|
|
Map<String, Object> map = data.get(i);
|
|
|
|
|
|
Long employeeId = 0L;
|
|
|
|
|
|
// Long taxAgentId = 0L;
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String taxAgentName = (String) map.getOrDefault("个税扣缴义务人", "");
|
|
|
|
|
|
|
|
|
|
|
|
Long paymentOrganization = 0L;
|
|
|
|
|
|
List<TaxAgentPO> taxAgentPoList = getTaxAgentMapper().listByName(taxAgentName);
|
|
|
|
|
|
|
|
|
|
|
|
if (taxAgentPoList.size() == 1) {
|
|
|
|
|
|
paymentOrganization = taxAgentPoList.get(0).getId();
|
|
|
|
|
|
} else {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, SalaryI18nUtil.getI18nLabel(102840, "个税扣缴义务人错误,系统内不存在该个税扣缴义务人")));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-07 16:46:17 +08:00
|
|
|
|
if (billMonth.length() < 7 || !SalaryDateUtil.checkYearMonth(billMonth.substring(0, 7))) {
|
2022-12-07 17:09:53 +08:00
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "账单月份输入有误,请参照“2022-09”这种格式进行检查"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
List<Map<String, Object>> singleAccount = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
|
|
//遍历表头
|
|
|
|
|
|
for (int j = 0; j < headers.size(); j++) {
|
|
|
|
|
|
String header = headers.get(j);
|
|
|
|
|
|
String dataKey = header;
|
|
|
|
|
|
if (dataKey == null) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
//组装单条数据基础数据
|
|
|
|
|
|
Map<String, Object> cellData = new HashMap<>();
|
|
|
|
|
|
cellData.put(dataKey, Optional.ofNullable(map.get(dataKey)).orElse("").toString());
|
|
|
|
|
|
cellData.put("index", j);
|
|
|
|
|
|
singleAccount.add(cellData);
|
|
|
|
|
|
//抽取人员信息进行校验
|
|
|
|
|
|
String name = (String) map.getOrDefault("姓名", "");
|
|
|
|
|
|
String departmentName = (String) map.getOrDefault("部门", "");
|
|
|
|
|
|
String mobile = (String) map.getOrDefault("手机号", "");
|
|
|
|
|
|
String workcode = (String) map.getOrDefault("工号", "");
|
2024-05-23 09:16:28 +08:00
|
|
|
|
String idNo = (String) map.getOrDefault("证件号码", "");
|
2022-12-07 17:09:53 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(SalaryI18nUtil.getI18nLabel(85429, "姓名"), dataKey.toString())) {
|
|
|
|
|
|
//当人员信息导入筛选的全局配置为"0"时,姓名才是必填项
|
|
|
|
|
|
if (StringUtils.isEmpty(name) && "0".equals(confValue)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(102838, "姓名不能为空"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//筛选导入人员信息可以在人力资源池中匹配到的人员信息
|
2024-05-23 09:16:28 +08:00
|
|
|
|
List<DataCollectionEmployee> employeeSameIds = getSalaryEmployeeService(user).matchImportEmployee(confValue,salaryEmployees, name, departmentName, mobile, workcode,idNo, null);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeSameIds)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "姓名错误,系统内不存在该姓名"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
|
|
|
|
|
|
} else if (employeeSameIds.size() > 1) {
|
|
|
|
|
|
//存在离职和在职状态取在职状态
|
|
|
|
|
|
employeeSameIds = employeeSameIds.stream()
|
|
|
|
|
|
.filter(e -> UserStatusEnum.getNormalStatus().contains(e.getStatus()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
if (employeeSameIds.size() != 1) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + "员工信息不存在或者存在多个员工");
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeId = CollectionUtils.isNotEmpty(employeeSameIds) && employeeSameIds.size() == 1 ? employeeSameIds.get(0).getEmployeeId() : null;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeId = employeeSameIds.get(0).getEmployeeId();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!isError){
|
|
|
|
|
|
|
|
|
|
|
|
//如果福利核算信息查询不到唯一匹配数据,不支持导入
|
|
|
|
|
|
//根据员工id、个税扣缴义务人id、账单月份查询补差数据
|
|
|
|
|
|
list = getInsuranceAccountDetailMapper().queryBalanceList(InsuranceAccountDetailPO.builder()
|
|
|
|
|
|
.employeeId(employeeId)
|
|
|
|
|
|
.paymentOrganization(paymentOrganization)
|
2023-08-07 16:46:17 +08:00
|
|
|
|
.billMonth(billMonth.substring(0, 7))
|
2022-12-07 17:09:53 +08:00
|
|
|
|
.build());
|
|
|
|
|
|
|
|
|
|
|
|
if (list.isEmpty()) {
|
|
|
|
|
|
//新增数据情况
|
|
|
|
|
|
InsuranceAccountDetailPO createPO = buildBalanceAccountDetail(paymentOrganization, insuranceCategoryPOS, singleAccount, billMonth, employeeId, currentEmployeeId);
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
|
|
|
|
|
if(!checkBalancePayInsurance(createPO)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "补差数据中存在福利档案中未设置的福利项缴纳数值,请检查补差缴纳信息!"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(checkBalance(createPO) && !isError) {
|
2022-12-19 17:26:44 +08:00
|
|
|
|
createInsuranceAccountDetailList.add(createPO);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-07 17:09:53 +08:00
|
|
|
|
} else if (list.size() > 1) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月已存在多组补差数据,请删除数据库中多余项"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//更新数据情况
|
|
|
|
|
|
//拼装待更新数据
|
2022-12-15 17:11:38 +08:00
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
2022-12-19 17:26:44 +08:00
|
|
|
|
InsuranceAccountDetailPO updatePO = handleInsuranceAccountDetail(list.get(0), map);
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
|
|
|
|
|
if(!checkBalancePayInsurance(updatePO)) {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(0, "补差数据中存在福利档案中未设置的福利项缴纳数值,请检查补差缴纳信息!"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if(checkBalance(updatePO) && !isError) {
|
2022-12-19 17:26:44 +08:00
|
|
|
|
updateInsuranceAccountDetailList.add(updatePO);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
isError = true;
|
|
|
|
|
|
Map<String, String> errorMessageMap = Maps.newHashMap();
|
|
|
|
|
|
errorMessageMap.put("message", row + SalaryI18nUtil.getI18nLabel(100579, "该人员在当前账单月不存在补差数据中的福利类,请检查补差缴纳信息!"));
|
|
|
|
|
|
excelComments.add(errorMessageMap);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-07 17:09:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (isError) {
|
|
|
|
|
|
failCount++;
|
|
|
|
|
|
errorDatas.add(map);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
successCount++;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
Long paymentOrganization = null;
|
|
|
|
|
|
if (updateInsuranceAccountDetailList.size() > 0) {
|
|
|
|
|
|
paymentOrganization = updateInsuranceAccountDetailList.get(0).getPaymentOrganization();
|
|
|
|
|
|
//将待更新列表加密
|
2022-12-15 17:11:38 +08:00
|
|
|
|
encryptUtil.encryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
//更新
|
|
|
|
|
|
for(InsuranceAccountDetailPO po : updateInsuranceAccountDetailList) {
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// getSiAccountBiz(user).updateByEmployeeIdAndBillMonth(po);
|
|
|
|
|
|
updateByEmployeeIdAndBillMonth(po);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
}
|
2024-02-22 09:33:35 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
encryptUtil.decryptList(updateInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization);
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(targetPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.EXCEL_IMPORT.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-补差导入更新"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-补差导入更新")
|
|
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
updateInsuranceAccountDetailList.forEach(loggerContext::setNewValues);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (createInsuranceAccountDetailList.size() > 0) {
|
|
|
|
|
|
paymentOrganization = createInsuranceAccountDetailList.get(0).getPaymentOrganization();
|
2022-12-19 11:43:20 +08:00
|
|
|
|
//去除员工id+个税扣缴义务人下重复的数据
|
|
|
|
|
|
createInsuranceAccountDetailList = createInsuranceAccountDetailList.stream()
|
|
|
|
|
|
.collect(Collectors.collectingAndThen(Collectors.toCollection(()
|
|
|
|
|
|
-> new TreeSet<>(Comparator.comparing(f -> f.getPaymentOrganization() + "-" + f.getEmployeeId()))), ArrayList::new));
|
2022-12-07 17:09:53 +08:00
|
|
|
|
//将待新增列表加密
|
2022-12-15 17:11:38 +08:00
|
|
|
|
encryptUtil.encryptList(createInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
//新增
|
|
|
|
|
|
List<List<InsuranceAccountDetailPO>> createPartition = Lists.partition((List<InsuranceAccountDetailPO>) createInsuranceAccountDetailList, 20);
|
|
|
|
|
|
createPartition.forEach(getInsuranceAccountDetailMapper()::batchSaveAccountDetails);
|
2024-02-22 09:33:35 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
encryptUtil.decryptList(createInsuranceAccountDetailList, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization);
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(targetPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.EXCEL_IMPORT.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-补差导入新增"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-补差导入新增")
|
|
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
createInsuranceAccountDetailList.forEach(loggerContext::setNewValues);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//刷新bill_batch表中统计信息
|
|
|
|
|
|
refreshBillBatch(paymentOrganization, importParam.getBillMonth());
|
|
|
|
|
|
|
|
|
|
|
|
apidatas.put("successCount", successCount);
|
|
|
|
|
|
apidatas.put("errorCount", failCount);
|
|
|
|
|
|
apidatas.put("errorData", excelComments);
|
|
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
|
IOUtils.closeQuietly(fileInputStream);
|
|
|
|
|
|
}
|
|
|
|
|
|
return apidatas;
|
|
|
|
|
|
}
|
2023-03-16 11:17:18 +08:00
|
|
|
|
|
2023-04-04 17:21:29 +08:00
|
|
|
|
|
2023-03-16 11:17:18 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listCommonSum(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
// 正常缴纳列表
|
|
|
|
|
|
queryParam.setPageSize(10000000);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
// PageInfo<InsuranceAccountDetailPO> pageInfo = getSiAccountBiz(user).listCommonPage(queryParam);
|
|
|
|
|
|
PageInfo<InsuranceAccountDetailPO> pageInfo = siBatchListCommonPage(queryParam);
|
2023-03-16 11:17:18 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = pageInfo.getList();
|
|
|
|
|
|
// 数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(insuranceAccountDetailPOS, employeeId, false);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
// Map<String, Object> maxSizeRecord = records.stream().reduce(new HashMap<>(), (a, b) -> a.size() > b.size() ? a : b);
|
|
|
|
|
|
Map<String, Object> sumRow = countSum(records);
|
|
|
|
|
|
datas.put("sumRow", sumRow);
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listSupplementarySum(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
queryParam.setPageSize(10000000);
|
|
|
|
|
|
|
2023-04-17 10:27:31 +08:00
|
|
|
|
// //过滤出福利档案基础信息表中runStatus为正在缴纳和待减员的人员
|
|
|
|
|
|
// List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
|
|
|
|
|
// List<Long> canAccountIds = baseInfoPOList.stream()
|
|
|
|
|
|
// .filter(f->f.getPaymentOrganization().toString().equals(queryParam.getPaymentOrganization())
|
|
|
|
|
|
// && (f.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()) || f.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue())))
|
|
|
|
|
|
// .map(InsuranceArchivesBaseInfoPO::getEmployeeId)
|
|
|
|
|
|
// .collect(Collectors.toList());
|
|
|
|
|
|
// queryParam.setEmployeeIds(canAccountIds);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
|
|
|
|
|
|
//补缴缴纳列表
|
|
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//系统人员核算明细
|
2023-04-04 17:21:29 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(list, employeeId, false);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
// Map<String, Object> maxSizeRecord = records.stream().reduce(new HashMap<>(), (a, b) -> a.size() > b.size() ? a : b);
|
|
|
|
|
|
Map<String, Object> sumRow = countSum(records);
|
|
|
|
|
|
datas.put("sumRow", sumRow);
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listRecessionSum(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
queryParam.setPageSize(10000000);
|
|
|
|
|
|
// 分权逻辑
|
|
|
|
|
|
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
|
|
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
|
|
|
|
|
|
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(taxAgents)) {
|
|
|
|
|
|
//防止普通用户查询
|
|
|
|
|
|
queryParam.setTaxAgents(Collections.singletonList(-1L));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
queryParam.setTaxAgents(taxAgents);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//退差列表
|
|
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.RECESSION.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//系统人员核算明细
|
2023-04-04 17:21:29 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(list, employeeId, false);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
Map<String, Object> sumRow = countSum(records);
|
|
|
|
|
|
datas.put("sumRow", sumRow);
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public Map<String, Object> listBalanceSum(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
Long employeeId = (long) user.getUID();
|
|
|
|
|
|
Map<String, Object> datas = new HashMap<>();
|
|
|
|
|
|
queryParam.setPageSize(10000000);
|
|
|
|
|
|
// 分权逻辑
|
|
|
|
|
|
Boolean needAuth = getTaxAgentService(user).isNeedAuth((long) user.getUID());
|
|
|
|
|
|
if (needAuth) {
|
|
|
|
|
|
Collection<TaxAgentPO> taxAgentPOS = getTaxAgentService(user).listAllTaxAgents((long) user.getUID());
|
|
|
|
|
|
List<Long> taxAgents = taxAgentPOS.stream().map(TaxAgentPO::getId).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(taxAgents)) {
|
|
|
|
|
|
//防止普通用户查询
|
|
|
|
|
|
queryParam.setTaxAgents(Collections.singletonList(-1L));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
queryParam.setTaxAgents(taxAgents);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//补差列表
|
|
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//系统人员核算明细
|
2023-04-04 17:21:29 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
2023-09-06 10:04:58 +08:00
|
|
|
|
//非系统人员核算明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
//数据组装
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<Map<String, Object>> records = getService(user).buildCommonRecords(list, employeeId, false);
|
2023-04-04 17:21:29 +08:00
|
|
|
|
Map<String, Object> sumRow = countSum(records);
|
|
|
|
|
|
datas.put("sumRow", sumRow);
|
|
|
|
|
|
return datas;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Map<String, Object> countSum(List<Map<String, Object>> records ){
|
2023-03-16 11:17:18 +08:00
|
|
|
|
// 获取需要统计的列
|
|
|
|
|
|
String[] keys = {"Base", "Com", "Sum", "Per", "total"};
|
2023-04-04 17:21:29 +08:00
|
|
|
|
Set<String> numKeys = new HashSet<>();
|
|
|
|
|
|
// for(String key : maxSizeRecord.keySet()){
|
|
|
|
|
|
// if(StringUtils.containsAny(key,keys)){
|
|
|
|
|
|
// numKeys.add(key);
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
for(int i =0; i < records.size(); i++){
|
|
|
|
|
|
Map<String, Object> record = records.get(i);
|
|
|
|
|
|
for(String key : record.keySet()){
|
|
|
|
|
|
if(StringUtils.containsAny(key,keys)){
|
|
|
|
|
|
numKeys.add(key);
|
|
|
|
|
|
}
|
2023-03-16 11:17:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String, Object> sumRow = new HashMap<>();
|
|
|
|
|
|
for(String numKey : numKeys){
|
|
|
|
|
|
BigDecimal value = new BigDecimal(0);
|
|
|
|
|
|
for(Map<String, Object> record : records){
|
2023-03-28 11:00:18 +08:00
|
|
|
|
BigDecimal addValue = null;
|
2023-03-28 13:59:57 +08:00
|
|
|
|
if(record.get(numKey) == null || StringUtils.isBlank(record.get(numKey).toString())){
|
2023-03-28 11:00:18 +08:00
|
|
|
|
addValue = new BigDecimal(0);
|
|
|
|
|
|
}else{
|
|
|
|
|
|
addValue = new BigDecimal(record.get(numKey).toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
value = value.add(addValue);
|
2023-03-16 11:17:18 +08:00
|
|
|
|
}
|
2023-09-06 10:04:58 +08:00
|
|
|
|
// sumRow.put(numKey,value);
|
|
|
|
|
|
sumRow.put(numKey,String.format("%.2f", value));
|
|
|
|
|
|
|
2023-03-16 11:17:18 +08:00
|
|
|
|
}
|
2023-04-04 17:21:29 +08:00
|
|
|
|
return sumRow;
|
2023-03-16 11:17:18 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2023-04-04 17:21:29 +08:00
|
|
|
|
|
2022-12-19 17:26:44 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 检查补差数据中的福利缴纳费用相关福利类别,是否在正常缴纳中有设置缴纳
|
|
|
|
|
|
* @param po
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2023-11-24 17:42:34 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public boolean checkBalance(InsuranceAccountDetailPO po) {
|
2022-12-19 17:26:44 +08:00
|
|
|
|
InsuranceAccountDetailPO commonAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
|
|
|
|
|
|
.billMonth(po.getBillMonth())
|
|
|
|
|
|
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
|
|
|
|
|
|
.employeeId(po.getEmployeeId())
|
|
|
|
|
|
.paymentOrganization(po.getPaymentOrganization())
|
|
|
|
|
|
.build());
|
|
|
|
|
|
if (commonAccountPO != null) {
|
2022-12-20 15:20:42 +08:00
|
|
|
|
|
|
|
|
|
|
encryptUtil.decrypt(commonAccountPO, InsuranceAccountDetailPO.class);
|
2022-12-20 09:25:55 +08:00
|
|
|
|
boolean commonSocialNullFlag = (StringUtils.isBlank(commonAccountPO.getSocialSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getSocialSum()));
|
|
|
|
|
|
boolean commonFundNullFlag = (StringUtils.isBlank(commonAccountPO.getFundSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getFundSum()));
|
|
|
|
|
|
boolean commonOtherNullFlag = (StringUtils.isBlank(commonAccountPO.getOtherSum()) || SalaryEntityUtil.StringEqZERO(commonAccountPO.getOtherSum()));
|
2022-12-19 17:26:44 +08:00
|
|
|
|
|
2022-12-20 09:25:55 +08:00
|
|
|
|
boolean balanceSocialNullFlag = (StringUtils.isBlank(po.getSocialSum()) || SalaryEntityUtil.StringEqZERO(po.getSocialSum()));
|
|
|
|
|
|
boolean balanceFundNullFlag = (StringUtils.isBlank(po.getFundSum()) || SalaryEntityUtil.StringEqZERO(po.getFundSum()));
|
|
|
|
|
|
boolean balanceOtherNullFlag = (StringUtils.isBlank(po.getOtherSum()) || SalaryEntityUtil.StringEqZERO(po.getOtherSum()));
|
2022-12-19 17:26:44 +08:00
|
|
|
|
//在正常缴纳数据中未设置的福利类别(社保、公积金、其他福利),不允许在补差数据中缴纳
|
2022-12-20 09:25:55 +08:00
|
|
|
|
if ((commonSocialNullFlag && !balanceSocialNullFlag) || (commonFundNullFlag && !balanceFundNullFlag) || (commonOtherNullFlag && !balanceOtherNullFlag)) {
|
2022-12-19 17:26:44 +08:00
|
|
|
|
return false;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
|
2023-11-24 14:05:03 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 检查补差数据中的福利缴纳费用相关福利项,是否在正常缴纳中方案所设置可缴纳
|
|
|
|
|
|
* @param po
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2023-11-24 17:42:34 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public boolean checkBalancePayInsurance(InsuranceAccountDetailPO po) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
InsuranceAccountDetailPO commonAccountPO = getInsuranceAccountDetailMapper().getOneByBpep(InsuranceAccountDetailPO.builder()
|
|
|
|
|
|
.billMonth(po.getBillMonth())
|
|
|
|
|
|
.paymentStatus(PaymentStatusEnum.COMMON.getValue())
|
|
|
|
|
|
.employeeId(po.getEmployeeId())
|
|
|
|
|
|
.paymentOrganization(po.getPaymentOrganization())
|
|
|
|
|
|
.build());
|
|
|
|
|
|
if (commonAccountPO != null) {
|
|
|
|
|
|
encryptUtil.decrypt(commonAccountPO, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
//判断社保缴纳福利项是否合规
|
|
|
|
|
|
boolean socialPayFlag = true;
|
|
|
|
|
|
Map<String, String> socialPerPayMap = JSON.parseObject(po.getSocialPerJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
Map<String, String> socialComPayMap = JSON.parseObject(po.getSocialComJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//目标员工设置了方案时,比较方案中缴纳的福利项和补差中设置(有效值)的福利项
|
2023-11-24 17:42:34 +08:00
|
|
|
|
if (commonAccountPO.getSocialSchemeId() != null) {
|
|
|
|
|
|
List<String> payInsuranceIdAndScopeList = payInsuranceIdAndScopeList(commonAccountPO.getSocialSchemeId());
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if (socialPerPayMap != null) {
|
|
|
|
|
|
for (Map.Entry<String, String> entry : socialPerPayMap.entrySet()) {
|
|
|
|
|
|
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
|
&& StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
socialPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2023-12-05 10:21:47 +08:00
|
|
|
|
|
|
|
|
|
|
if (socialPayFlag && socialComPayMap != null) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
for (Map.Entry<String, String> entry : socialComPayMap.entrySet()) {
|
|
|
|
|
|
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
|
&& StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
socialPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//目标员工未设置方案时,判断补差中是否设置(有效值)的福利项
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if (socialPerPayMap != null) {
|
|
|
|
|
|
for (Map.Entry<String, String> entry : socialPerPayMap.entrySet()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
socialPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
2023-12-05 10:21:47 +08:00
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
2023-12-05 10:21:47 +08:00
|
|
|
|
|
|
|
|
|
|
if (socialPayFlag && socialComPayMap != null) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
for (Map.Entry<String, String> entry : socialComPayMap.entrySet()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
socialPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断公积金缴纳福利项是否合规
|
|
|
|
|
|
boolean fundPayFlag = true;
|
|
|
|
|
|
Map<String, String> fundPerPayMap = JSON.parseObject(po.getFundPerJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
Map<String, String> fundComPayMap = JSON.parseObject(po.getFundComJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//目标员工设置了方案时,比较方案中缴纳的福利项和补差中设置(有效值)的福利项
|
2023-11-24 17:42:34 +08:00
|
|
|
|
if (commonAccountPO.getFundSchemeId() != null) {
|
|
|
|
|
|
List<String> payInsuranceIdAndScopeList = payInsuranceIdAndScopeList(commonAccountPO.getFundSchemeId());
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if (fundPerPayMap != null) {
|
|
|
|
|
|
for (Map.Entry<String, String> entry : fundPerPayMap.entrySet()) {
|
|
|
|
|
|
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
|
&& StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
fundPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
2023-12-05 10:21:47 +08:00
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
2023-12-05 10:21:47 +08:00
|
|
|
|
|
|
|
|
|
|
if (fundPayFlag && fundComPayMap != null) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
for (Map.Entry<String, String> entry : fundComPayMap.entrySet()) {
|
|
|
|
|
|
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
|
&& StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
fundPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//目标员工未设置方案时,判断补差中是否设置(有效值)的福利项
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if (fundPerPayMap != null) {
|
|
|
|
|
|
for (Map.Entry<String, String> entry : fundPerPayMap.entrySet()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
fundPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
2023-12-05 10:21:47 +08:00
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
2023-12-05 10:21:47 +08:00
|
|
|
|
|
|
|
|
|
|
if (fundPayFlag && fundComPayMap != null) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
for (Map.Entry<String, String> entry : fundComPayMap.entrySet()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
fundPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//判断其他福利缴纳福利项是否合规
|
|
|
|
|
|
boolean otherPayFlag = true;
|
|
|
|
|
|
Map<String, String> otherPerPayMap = JSON.parseObject(po.getOtherPerJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
Map<String, String> otherComPayMap = JSON.parseObject(po.getOtherComJson(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//目标员工设置了方案时,比较方案中缴纳的福利项和补差中设置(有效值)的福利项
|
2023-11-24 17:42:34 +08:00
|
|
|
|
if (commonAccountPO.getOtherSchemeId() != null) {
|
|
|
|
|
|
List<String> payInsuranceIdAndScopeList = payInsuranceIdAndScopeList(commonAccountPO.getOtherSchemeId());
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if (otherPerPayMap != null) {
|
|
|
|
|
|
for (Map.Entry<String, String> entry : otherPerPayMap.entrySet()) {
|
|
|
|
|
|
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
|
&& StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
otherPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
2023-12-05 10:21:47 +08:00
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
2023-12-05 10:21:47 +08:00
|
|
|
|
|
|
|
|
|
|
if (otherPayFlag && otherComPayMap != null) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
for (Map.Entry<String, String> entry : otherComPayMap.entrySet()) {
|
|
|
|
|
|
if (!payInsuranceIdAndScopeList.contains(entry.getKey() + "-" + PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
|
&& StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
otherPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} else {
|
|
|
|
|
|
//目标员工未设置方案时,判断补差中是否设置(有效值)的福利项
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if(otherPerPayMap != null) {
|
|
|
|
|
|
for (Map.Entry<String, String> entry : otherPerPayMap.entrySet()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
otherPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
|
2023-12-05 10:21:47 +08:00
|
|
|
|
}
|
2023-11-24 14:05:03 +08:00
|
|
|
|
}
|
2023-12-05 10:21:47 +08:00
|
|
|
|
if (otherPayFlag && otherComPayMap != null) {
|
2023-11-24 14:05:03 +08:00
|
|
|
|
for (Map.Entry<String, String> entry : otherComPayMap.entrySet()) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(entry.getValue())) {
|
|
|
|
|
|
otherPayFlag = false;
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//在社保、公积金、其他福利档案中未设置的福利项被补差设置有效数值时,不允许更新
|
|
|
|
|
|
if (socialPayFlag && fundPayFlag && otherPayFlag) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<String> payInsuranceIdAndScopeList(Long schemeId) {
|
|
|
|
|
|
//查询该福利方案下开启缴纳的福利项
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(schemeId);
|
|
|
|
|
|
List<String> insuranceIdList = new ArrayList<>();
|
|
|
|
|
|
if (detailPOS != null && detailPOS.size() > 0) {
|
|
|
|
|
|
//开启缴纳的
|
|
|
|
|
|
insuranceIdList = detailPOS.stream().filter(f -> f.getIsPayment().equals(IsPaymentEnum.YES.getValue())).map(m -> {
|
|
|
|
|
|
return m.getInsuranceId() .toString() + "-" + m.getPaymentScope().toString();
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceIdList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-07 17:09:53 +08:00
|
|
|
|
public InsuranceAccountDetailPO buildBalanceAccountDetail(Long paymentOrganization, List<ICategoryPO> insuranceCategoryPOS,
|
|
|
|
|
|
List<Map<String, Object>> singleAccount, String billMonth, Long employeeId, Long creator) {
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
insuranceAccountDetailPO.setId(IdGenerator.generate());
|
|
|
|
|
|
insuranceAccountDetailPO.setEmployeeId(employeeId);
|
2024-10-09 10:57:23 +08:00
|
|
|
|
DataCollectionEmployee employee = getSalaryEmployeeService(user).getEmployeeById(employeeId);
|
|
|
|
|
|
if (employee != null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyName(employee.getSubcompanyName());
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyId(employee.getSubcompanyid());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentName(employee.getDepartmentName());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentId(employee.getDepartmentId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleName(employee.getJobtitleName());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleId(employee.getJobtitleId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcall(employee.getJobcall());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcallId(employee.getJobcallId());
|
|
|
|
|
|
insuranceAccountDetailPO.setStatus(employee.getStatus());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2023-08-07 16:46:17 +08:00
|
|
|
|
insuranceAccountDetailPO.setBillMonth(billMonth.substring(0, 7));
|
2022-12-07 17:09:53 +08:00
|
|
|
|
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.BALANCE.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.IMPORT.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
insuranceAccountDetailPO.setCreator(creator);
|
|
|
|
|
|
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceAccountDetailPO.setUpdateTime(new Date());
|
|
|
|
|
|
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
|
|
|
|
|
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPayOrg(paymentOrganization);
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPayOrg(paymentOrganization);
|
|
|
|
|
|
|
|
|
|
|
|
InsuranceArchivesBaseInfoPO baseInfoPO = getInsuranceBaseInfoMapper().getOneByEmployeeIdAndPayOrg(employeeId, paymentOrganization);
|
|
|
|
|
|
if (baseInfoPO != null) {
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialSchemePO = getSocialSchemeMapper().getOneById(baseInfoPO.getSocialArchivesId());
|
|
|
|
|
|
|
|
|
|
|
|
InsuranceArchivesFundSchemePO fundSchemePO = getFundSchemeMapper().getOneById(baseInfoPO.getFundArchivesId());
|
|
|
|
|
|
if (socialSchemePO != null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialAccount(socialSchemePO.getSocialAccount());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fundSchemePO != null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setFundAccount(fundSchemePO.getFundAccount());
|
|
|
|
|
|
insuranceAccountDetailPO.setSupplementFundAccount(fundSchemePO.getSupplementFundAccount());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//获取改员工社保档案
|
|
|
|
|
|
accountBalanceSocial(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
|
|
|
|
|
|
accountBalanceFund(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
|
|
|
|
|
|
// 其他福利档案
|
|
|
|
|
|
accountBalanceOther(singleAccount, insuranceAccountDetailPO, insuranceCategoryPOS, creator);
|
2023-11-24 17:42:34 +08:00
|
|
|
|
account(insuranceAccountDetailPO);
|
2022-12-07 17:09:53 +08:00
|
|
|
|
if (insuranceAccountDetailPO.getOtherSchemeId() == null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherSchemeId(0L);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (insuranceAccountDetailPO.getSocialSchemeId() == null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialSchemeId(0L);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (insuranceAccountDetailPO.getFundSchemeId() == null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setFundSchemeId(0L);
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountBalanceSocial(List<Map<String, Object>> singleAccount, InsuranceAccountDetailPO insuranceAccountDetailPO,
|
|
|
|
|
|
List<ICategoryPO> insuranceCategoryPOS, Long employeeId) {
|
|
|
|
|
|
//社保-个人
|
|
|
|
|
|
List<ICategoryPO> socialCategory = insuranceCategoryPOS.stream().filter(po -> po.getWelfareType().equals(WelfareTypeEnum.SOCIAL_SECURITY.getValue()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> socialPerJsonMap = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < singleAccount.size(); i++) {
|
|
|
|
|
|
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
|
|
|
|
|
Optional<ICategoryPO> personalOptional = socialCategory.stream()
|
|
|
|
|
|
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"))).findFirst();
|
|
|
|
|
|
if (personalOptional.isPresent() && StringUtils
|
|
|
|
|
|
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人")))) {
|
|
|
|
|
|
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"));
|
2022-12-23 17:50:12 +08:00
|
|
|
|
if (perNumString.length() > 0 && !isNumeric(perNumString)) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-12-07 17:09:53 +08:00
|
|
|
|
perNumString = perNumString.replace(",", "");
|
|
|
|
|
|
BigDecimal result = new BigDecimal(perNumString);
|
|
|
|
|
|
socialPerJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
|
|
|
|
|
|
BigDecimal socialPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialPer) {
|
|
|
|
|
|
socialPerSum = socialPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
|
|
|
|
|
|
|
|
|
|
|
//社保-单位
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> sociaComJsonMap = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < singleAccount.size(); i++) {
|
|
|
|
|
|
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
|
|
|
|
|
Optional<ICategoryPO> personalOptional = socialCategory.stream()
|
|
|
|
|
|
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"))).findFirst();
|
|
|
|
|
|
if (personalOptional.isPresent() && StringUtils
|
|
|
|
|
|
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位")))) {
|
|
|
|
|
|
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"));
|
2022-12-23 17:50:12 +08:00
|
|
|
|
|
|
|
|
|
|
if (perNumString.length() > 0 && !isNumeric(perNumString)) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
perNumString = perNumString.replace(",", "");
|
|
|
|
|
|
BigDecimal result = new BigDecimal(perNumString);
|
|
|
|
|
|
sociaComJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(sociaComJsonMap));
|
|
|
|
|
|
BigDecimal socialComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal decimal : socialCom) {
|
|
|
|
|
|
socialComSum = socialComSum.add(decimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountBalanceFund(List<Map<String, Object>> singleAccount, InsuranceAccountDetailPO insuranceAccountDetailPO,
|
|
|
|
|
|
List<ICategoryPO> insuranceCategoryPOS, Long employeeId) {
|
|
|
|
|
|
//公积金-个人
|
|
|
|
|
|
List<ICategoryPO> fundCategory = insuranceCategoryPOS.stream().filter(po -> po.getWelfareType().equals(WelfareTypeEnum.ACCUMULATION_FUND.getValue()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<BigDecimal> fundPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> fundPerJsonMap = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < singleAccount.size(); i++) {
|
|
|
|
|
|
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
|
|
|
|
|
Optional<ICategoryPO> personalOptional = fundCategory.stream()
|
|
|
|
|
|
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"))).findFirst();
|
|
|
|
|
|
if (personalOptional.isPresent() && StringUtils
|
|
|
|
|
|
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人")))) {
|
|
|
|
|
|
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"));
|
2022-12-23 17:50:12 +08:00
|
|
|
|
if (perNumString.length() > 0 && !isNumeric(perNumString)) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
perNumString = perNumString.replace(",", "");
|
|
|
|
|
|
BigDecimal result = new BigDecimal(perNumString);
|
|
|
|
|
|
fundPerJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
|
|
|
|
|
fundPer.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap));
|
|
|
|
|
|
BigDecimal funPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundPer) {
|
|
|
|
|
|
funPerSum = funPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(funPerSum.toPlainString());
|
|
|
|
|
|
|
|
|
|
|
|
//公积金-单位
|
|
|
|
|
|
List<BigDecimal> fundComList = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> fundComJsonMap = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < singleAccount.size(); i++) {
|
|
|
|
|
|
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
|
|
|
|
|
Optional<ICategoryPO> personalOptional = fundCategory.stream()
|
|
|
|
|
|
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"))).findFirst();
|
|
|
|
|
|
if (personalOptional.isPresent() && StringUtils
|
|
|
|
|
|
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位")))) {
|
|
|
|
|
|
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"));
|
2022-12-23 17:50:12 +08:00
|
|
|
|
if (perNumString.length() > 0 && !isNumeric(perNumString)) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
perNumString = perNumString.replace(",", "");
|
|
|
|
|
|
BigDecimal result = new BigDecimal(perNumString);
|
|
|
|
|
|
fundComJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
|
|
|
|
|
fundComList.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComJsonMap));
|
|
|
|
|
|
BigDecimal fundComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundComList) {
|
|
|
|
|
|
fundComSum = fundComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountBalanceOther(List<Map<String, Object>> singleAccount, InsuranceAccountDetailPO insuranceAccountDetailPO,
|
|
|
|
|
|
List<ICategoryPO> insuranceCategoryPOS, Long employeeId) {
|
|
|
|
|
|
List<ICategoryPO> otherCategory = insuranceCategoryPOS.stream().filter(po -> po.getWelfareType().equals(WelfareTypeEnum.OTHER.getValue()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
// 其他福利-个人
|
|
|
|
|
|
List<BigDecimal> otherPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> otherPerJsonMap = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < singleAccount.size(); i++) {
|
|
|
|
|
|
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
|
|
|
|
|
Optional<ICategoryPO> personalOptional = otherCategory.stream()
|
|
|
|
|
|
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"))).findFirst();
|
|
|
|
|
|
if (personalOptional.isPresent() && StringUtils
|
|
|
|
|
|
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人")))) {
|
|
|
|
|
|
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(87159, "个人"));
|
2022-12-23 17:50:12 +08:00
|
|
|
|
if (perNumString.length() > 0 && !isNumeric(perNumString)) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
perNumString = perNumString.replace(",", "");
|
|
|
|
|
|
BigDecimal result = new BigDecimal(perNumString);
|
|
|
|
|
|
otherPerJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
|
|
|
|
|
otherPer.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerJsonMap));
|
|
|
|
|
|
BigDecimal otherPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherPer) {
|
|
|
|
|
|
otherPerSum = otherPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
|
|
|
|
|
|
|
|
|
|
|
|
// 其他福利-单位
|
|
|
|
|
|
List<BigDecimal> otherComList = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> otherComJsonMap = new HashMap<>();
|
|
|
|
|
|
for (int i = 0; i < singleAccount.size(); i++) {
|
|
|
|
|
|
Map<String, Object> stringObjectMap = singleAccount.get(i);
|
|
|
|
|
|
Optional<ICategoryPO> personalOptional = otherCategory.stream()
|
|
|
|
|
|
.filter(social -> stringObjectMap.containsKey(social.getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"))).findFirst();
|
|
|
|
|
|
if (personalOptional.isPresent() && StringUtils
|
|
|
|
|
|
.isNotBlank((String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位")))) {
|
|
|
|
|
|
String perNumString = (String) stringObjectMap.get(personalOptional.get().getInsuranceName() + SalaryI18nUtil.getI18nLabel(100289, "单位"));
|
2022-12-23 17:50:12 +08:00
|
|
|
|
if (perNumString.length() > 0 && !isNumeric(perNumString)) {
|
|
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2022-12-07 17:09:53 +08:00
|
|
|
|
perNumString = perNumString.replace(",", "");
|
|
|
|
|
|
BigDecimal result = new BigDecimal(perNumString);
|
|
|
|
|
|
otherComJsonMap.put(String.valueOf(personalOptional.get().getId()), result.toPlainString());
|
|
|
|
|
|
otherComList.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComJsonMap));
|
|
|
|
|
|
BigDecimal otherComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherComList) {
|
|
|
|
|
|
otherComSum = otherComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
2024-01-19 11:35:11 +08:00
|
|
|
|
/*****以下代码为SIAccountBiz中逻辑迁移,旨在减少Biz类的使用*****/
|
2024-01-17 16:07:27 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 新建核算并归档
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public String saveAndFile(AccountParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
if (param.isFlag()) {
|
|
|
|
|
|
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
SalaryAssert.isNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(0, "所属月份存在核算数据"));
|
|
|
|
|
|
|
|
|
|
|
|
InsuranceAccountBatchPO build = InsuranceAccountBatchPO.builder()
|
|
|
|
|
|
.paymentOrganization(param.getPaymentOrganization())
|
|
|
|
|
|
.accountant(user.getLastname())
|
|
|
|
|
|
.billMonth(param.getBillMonth())
|
|
|
|
|
|
.billStatus(BillStatusEnum.NOT_ARCHIVED.getValue())
|
|
|
|
|
|
.remarks(param.getRemarks())
|
|
|
|
|
|
.creator((long) user.getUID())
|
|
|
|
|
|
.tenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY)
|
|
|
|
|
|
.createTime(new Date())
|
|
|
|
|
|
.updateTime(new Date())
|
|
|
|
|
|
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
|
|
|
|
|
|
.paymentOrganization(param.getPaymentOrganization())
|
|
|
|
|
|
.socialPay("0")
|
|
|
|
|
|
.fundPay("0")
|
|
|
|
|
|
.otherPay("0")
|
|
|
|
|
|
.build();
|
|
|
|
|
|
encryptUtil.encrypt(build, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
getInsuranceAccountBatchMapper().insert(build);
|
2024-02-20 16:50:45 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
encryptUtil.decrypt(targetPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountBatchPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(targetPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "新增福利台账"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "新增福利台账")
|
|
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + targetPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setNewValues(targetPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Long> employeeIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(param.getPaymentOrganization());
|
|
|
|
|
|
if (CollectionUtils.isEmpty(employeeIds)) {
|
|
|
|
|
|
List<InsuranceAccountDetailPO> list = Lists.newArrayList(getInsuranceAccountDetailMapper().queryNormalListByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
|
|
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
list.stream().forEach(f -> {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().deleteById(f.getId());
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel(0, "没有需要核算的人员"));
|
|
|
|
|
|
// AccountParam selectParam = new AccountParam();
|
|
|
|
|
|
// selectParam.setBillMonth(param.getBillMonth());
|
|
|
|
|
|
// selectParam.setPaymentOrganization(param.getPaymentOrganization());
|
|
|
|
|
|
ExecutorService taskExecutor = Executors.newCachedThreadPool();
|
|
|
|
|
|
taskExecutor.execute(() -> {
|
|
|
|
|
|
siAccounting(param);
|
|
|
|
|
|
if (param.isFileFlag()) {
|
|
|
|
|
|
siFile(param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
// 回滚
|
|
|
|
|
|
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
|
|
|
|
|
|
list = encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
list.stream().forEach(f -> {
|
|
|
|
|
|
getInsuranceAccountBatchMapper().deleteById(f.getId());
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
throw new SalaryRunTimeException(e.getMessage());
|
|
|
|
|
|
}
|
|
|
|
|
|
return String.valueOf(user.getUID());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public void siAccounting(AccountParam param) {
|
|
|
|
|
|
//福利核算进度
|
|
|
|
|
|
ProgressDTO salaryAcctProgressDTO = getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth());
|
|
|
|
|
|
if (salaryAcctProgressDTO != null && salaryAcctProgressDTO.isStatus() && salaryAcctProgressDTO.getProgress().compareTo(BigDecimal.ONE) < 0) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log.info("开始核算,当前操作人为:{}", user.getLastname());
|
|
|
|
|
|
log.info("核算时间:{}, 核算月份:{}, 个税扣缴义务人:{}, 是否首次核算:{}", new Date(), param.getBillMonth(), param.getPaymentOrganization(), param.isFlag());
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<Long> ids;
|
|
|
|
|
|
List<Long> validIds = new ArrayList<>();
|
|
|
|
|
|
if (CollectionUtils.isEmpty(param.getIds())) {
|
|
|
|
|
|
List<Long> empIds = getInsuranceAccountDetailMapper().selectEmpByPaymentOrg(param.getPaymentOrganization());
|
|
|
|
|
|
// 获取薪资核算人员规则
|
|
|
|
|
|
SalarySysConfPO salaryAcctEmployeeRule = getSalarySysConfService(user).getOneByCode(SalarySysConstant.SALARY_ACCT_EMPLOYEE_RULE);
|
|
|
|
|
|
List<String> status = new ArrayList<>();
|
|
|
|
|
|
if(Objects.isNull(salaryAcctEmployeeRule) || StringUtils.equals(salaryAcctEmployeeRule.getConfValue(), SalaryAcctEmployeeRuleEnum.BYPAYENDTIME.getValue()) ){
|
|
|
|
|
|
// 包含停缴
|
|
|
|
|
|
status = Arrays.asList(EmployeeStatusEnum.PAYING.getValue(),EmployeeStatusEnum.STAY_DEL.getValue(),
|
|
|
|
|
|
EmployeeStatusEnum.STOP_PAYMENT_FROM_DEL.getValue());
|
|
|
|
|
|
}else{
|
|
|
|
|
|
status = Arrays.asList(EmployeeStatusEnum.PAYING.getValue(),EmployeeStatusEnum.STAY_DEL.getValue());
|
|
|
|
|
|
}
|
|
|
|
|
|
List<String> finalStatus = status;
|
|
|
|
|
|
//过滤出需要核算的人员,即福利档案基础信息表中runStatus为正在缴纳和待减员的人员
|
|
|
|
|
|
List<InsuranceArchivesBaseInfoPO> baseInfoPOList = getInsuranceBaseInfoMapper().listAll();
|
|
|
|
|
|
List<Long> canAccountIds = baseInfoPOList.stream()
|
|
|
|
|
|
.filter(f->f.getPaymentOrganization().equals(param.getPaymentOrganization())
|
|
|
|
|
|
&& (finalStatus.contains(f.getRunStatus()) ))
|
|
|
|
|
|
.map(InsuranceArchivesBaseInfoPO::getEmployeeId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
//20231122逻辑优化,过滤出不在起始缴纳月和最后缴纳月区间的人员
|
|
|
|
|
|
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(param.getPaymentOrganization(), param.getBillMonth());
|
|
|
|
|
|
empIds = empIds.stream().filter(f->canAccountIds.contains(f) && empIdsInPayMonthRange.contains(f)).collect(Collectors.toList());
|
|
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// List<InsuranceArchivesSocialSchemePO> socials = siArchivesBiz.getSocialByEmployeeIds(empIds);
|
|
|
|
|
|
List<InsuranceArchivesSocialSchemePO> socials = getSIArchivesService(user).getSocialByEmployeeIds(empIds);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
//过滤出目标个税扣缴义务人相关信息
|
|
|
|
|
|
socials = socials.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
|
|
|
|
|
|
List<Long> emp1 = socials.stream()
|
|
|
|
|
|
.filter(s -> !(StringUtils.isBlank(s.getSocialEndTime()) && StringUtils.isBlank(s.getSocialStartTime())) &&
|
|
|
|
|
|
(StringUtils.isBlank(s.getSocialEndTime()) || (SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getSocialEndTime() + "-01")))) )
|
|
|
|
|
|
.map(InsuranceArchivesSocialSchemePO::getEmployeeId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// List<InsuranceArchivesFundSchemePO> funds = siArchivesBiz.getFundByEmployeeIds(empIds);
|
|
|
|
|
|
List<InsuranceArchivesFundSchemePO> funds = getSIArchivesService(user).getFundByEmployeeIds(empIds);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
//过滤出目标个税扣缴义务人相关信息
|
|
|
|
|
|
funds = funds.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
|
|
|
|
|
|
List<Long> emp2 = funds.stream()
|
|
|
|
|
|
.filter(s -> !(StringUtils.isBlank(s.getFundStartTime()) && StringUtils.isBlank(s.getFundEndTime())) &&
|
|
|
|
|
|
(StringUtils.isBlank(s.getFundEndTime()) || (SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getFundEndTime() + "-01")))))
|
|
|
|
|
|
.map(InsuranceArchivesFundSchemePO::getEmployeeId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// List<InsuranceArchivesOtherSchemePO> others = siArchivesBiz.getOtherByEmployeeIds(empIds);
|
|
|
|
|
|
List<InsuranceArchivesOtherSchemePO> others = getSIArchivesService(user).getOtherByEmployeeIds(empIds);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
//过滤出目标个税扣缴义务人相关信息
|
|
|
|
|
|
others = others.stream().filter(f -> f.getPaymentOrganization().equals(param.getPaymentOrganization())).collect(Collectors.toList());
|
|
|
|
|
|
List<Long> emp3 = others.stream()
|
|
|
|
|
|
.filter(s -> !(StringUtils.isBlank(s.getOtherStartTime()) && StringUtils.isBlank(s.getOtherEndTime())) &&
|
|
|
|
|
|
(StringUtils.isBlank(s.getOtherEndTime()) || (SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01") != null && !SalaryDateUtil.stringToDate(param.getBillMonth() + "-01").after(SalaryDateUtil.stringToDate(s.getOtherEndTime() + "-01")))))
|
|
|
|
|
|
.map(InsuranceArchivesOtherSchemePO::getEmployeeId)
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
validIds.addAll(emp1);
|
|
|
|
|
|
validIds.addAll(emp2);
|
|
|
|
|
|
validIds.addAll(emp3);
|
|
|
|
|
|
|
|
|
|
|
|
List<Long> finalValidIds = validIds.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
|
ids = empIds.stream().filter(finalValidIds::contains).collect(Collectors.toList());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
ids = param.getIds();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 初始化进度
|
|
|
|
|
|
ProgressDTO initProgress = new ProgressDTO()
|
|
|
|
|
|
.setTitle(SalaryI18nUtil.getI18nLabel(0, "核算中"))
|
|
|
|
|
|
.setTitleLabelId(97515L)
|
|
|
|
|
|
.setTotalQuantity(ids.size())
|
|
|
|
|
|
.setCalculatedQuantity(NumberUtils.INTEGER_ZERO)
|
|
|
|
|
|
.setProgress(BigDecimal.ZERO)
|
|
|
|
|
|
.setStatus(true)
|
|
|
|
|
|
.setMessage(StringUtils.EMPTY);
|
|
|
|
|
|
getSalaryAcctProgressService(user).initProgress(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), initProgress);
|
|
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(ids)) {
|
|
|
|
|
|
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), true);
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
log.info("开始生成福利核算数据,待处理人员数量:{}", ids.size());
|
2024-10-09 10:57:23 +08:00
|
|
|
|
siCommonAccount(param.getBillMonth(), ids, param.getPaymentOrganization(), param.isFlag());
|
2024-01-17 16:07:27 +08:00
|
|
|
|
log.info("福利核算数据生成完毕,开始数据处理");
|
|
|
|
|
|
|
|
|
|
|
|
handleData(ids, param);
|
|
|
|
|
|
log.info("福利核算数据处理完毕!");
|
|
|
|
|
|
|
|
|
|
|
|
List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
|
|
|
|
|
|
partition.forEach(part -> {
|
|
|
|
|
|
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
});
|
|
|
|
|
|
log.info("更新福利核算进度······");
|
|
|
|
|
|
getSalaryAcctProgressService(user).finish(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), true);
|
|
|
|
|
|
log.info("福利核算进度完成!");
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
log.error("account run fail", e);
|
|
|
|
|
|
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel(0, "福利核算出错") + ": " + e.getMessage());
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
list.stream().forEach(f -> {
|
|
|
|
|
|
getInsuranceAccountBatchMapper().deleteById(f.getId());
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-10-09 10:57:23 +08:00
|
|
|
|
public void siCommonAccount(String billMonth, List<Long> ids, Long paymentOrganization, boolean isFirstFlag) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
|
|
|
|
|
|
// Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = siArchivesBiz.buildBatchAccount(ids, paymentOrganization);
|
|
|
|
|
|
Map<Long, InsuranceArchivesAccountPO> insuranceArchivesAccountPOS = getSIArchivesService(user).buildBatchAccount(ids, paymentOrganization);
|
2024-10-09 10:57:23 +08:00
|
|
|
|
List<InsuranceAccountDetailPO> historyDetailData = new ArrayList<>();
|
|
|
|
|
|
List<DataCollectionEmployee> employeeList = new ArrayList<>();
|
|
|
|
|
|
if (!isFirstFlag) {
|
|
|
|
|
|
// 不是首次核算,需要把社保历史数据取出
|
|
|
|
|
|
historyDetailData.addAll(getInsuranceAccountDetailMapper().list(InsuranceAccountDetailParam.builder().billMonth(billMonth).paymentOrganization(paymentOrganization.toString()).employeeIds(ids).build()));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
employeeList = getSalaryEmployeeService(user).listByIds(ids);
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<Long, InsuranceAccountDetailPO> historyDetailDataMap = SalaryEntityUtil.convert2Map(historyDetailData, InsuranceAccountDetailPO::getEmployeeId);
|
|
|
|
|
|
Map<Long, DataCollectionEmployee> employeeMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
|
|
|
|
|
|
2024-01-17 16:07:27 +08:00
|
|
|
|
List<InsuranceAccountDetailTempPO> list = new ArrayList<>();
|
|
|
|
|
|
int count = 0;
|
|
|
|
|
|
for (Map.Entry<Long, InsuranceArchivesAccountPO> entry : insuranceArchivesAccountPOS.entrySet()) {
|
|
|
|
|
|
Long k = entry.getKey();
|
|
|
|
|
|
InsuranceArchivesAccountPO v = entry.getValue();
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
insuranceAccountDetailPO.setBillMonth(billMonth);
|
|
|
|
|
|
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setCreator((long) user.getUID());
|
|
|
|
|
|
insuranceAccountDetailPO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setEmployeeId(k);
|
|
|
|
|
|
insuranceAccountDetailPO.setUpdateTime(new Date());
|
|
|
|
|
|
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.COMMON.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
|
|
|
|
|
insuranceAccountDetailPO.setPaymentOrganization(paymentOrganization);
|
2024-10-09 10:57:23 +08:00
|
|
|
|
if (isFirstFlag) {
|
|
|
|
|
|
// 初次核算
|
|
|
|
|
|
DataCollectionEmployee employee = employeeMap.get(k);
|
|
|
|
|
|
if (employee != null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyName(employee.getSubcompanyName());
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyId(employee.getSubcompanyid());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentName(employee.getDepartmentName());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentId(employee.getDepartmentId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleName(employee.getJobtitleName());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleId(employee.getJobtitleId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcall(employee.getJobcall());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcallId(employee.getJobcallId());
|
|
|
|
|
|
insuranceAccountDetailPO.setStatus(employee.getStatus());
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
InsuranceAccountDetailPO historyDetail = historyDetailDataMap.get(k);
|
|
|
|
|
|
if (historyDetail != null) {
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyName(historyDetail.getSubcompanyName());
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyId(historyDetail.getSubcompanyId());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentName(historyDetail.getDepartmentName());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentId(historyDetail.getDepartmentId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleName(historyDetail.getJobtitleName());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleId(historyDetail.getJobtitleId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcall(historyDetail.getJobcall());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcallId(historyDetail.getJobcallId());
|
|
|
|
|
|
insuranceAccountDetailPO.setStatus(historyDetail.getStatus());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-01-17 16:07:27 +08:00
|
|
|
|
|
|
|
|
|
|
//核算社保
|
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, v, billMonth);
|
|
|
|
|
|
//核算公积金
|
|
|
|
|
|
accountFund(insuranceAccountDetailPO, v, billMonth);
|
|
|
|
|
|
//核算其他福利
|
|
|
|
|
|
accountOther(insuranceAccountDetailPO, v, billMonth);
|
|
|
|
|
|
//计算合计
|
|
|
|
|
|
account(insuranceAccountDetailPO);
|
|
|
|
|
|
//临时表PO
|
|
|
|
|
|
InsuranceAccountDetailTempPO insuranceAccountDetailTempPO = new InsuranceAccountDetailTempPO();
|
|
|
|
|
|
BeanUtils.copyProperties(insuranceAccountDetailPO, insuranceAccountDetailTempPO);
|
|
|
|
|
|
list.add(insuranceAccountDetailTempPO);
|
|
|
|
|
|
count++;
|
|
|
|
|
|
|
|
|
|
|
|
if (count % 50 == 0 || count >= ids.size()) {
|
|
|
|
|
|
if (count >= ids.size()) {
|
|
|
|
|
|
getSalaryAcctProgressService(user).updateProgress(SalaryCacheKey.ACCT_PROGRESS + billMonth, BigDecimal.valueOf(0.99), false);
|
|
|
|
|
|
log.info("更新福利核算进度,当前进度为:{}", getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + billMonth));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
getSalaryAcctProgressService(user).getAndAddCalculatedQty(SalaryCacheKey.ACCT_PROGRESS + billMonth, count >= ids.size() ? count % 50 : 50);
|
|
|
|
|
|
log.info("更新福利核算进度,当前进度为:{}", getSalaryAcctProgressService(user).getProgress(SalaryCacheKey.ACCT_PROGRESS + billMonth));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
//临时表入库前先对(可能存在的)历史数据进行删除
|
|
|
|
|
|
List<List<Long>> partition = Lists.partition((List<Long>) ids, 100);
|
|
|
|
|
|
partition.forEach(part -> {
|
|
|
|
|
|
getSIAccountDetailTempMapper().batchDelByEmpIdsAndMonthAndPayOrg(part, billMonth, paymentOrganization);
|
|
|
|
|
|
});
|
|
|
|
|
|
//临时表数据入库
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(list)) {
|
|
|
|
|
|
encryptUtil.encryptList(list, InsuranceAccountDetailTempPO.class);
|
2024-10-14 14:34:46 +08:00
|
|
|
|
List<List<InsuranceAccountDetailTempPO>> lists = splitList(list, 20);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
lists.forEach(subList -> {
|
|
|
|
|
|
getSIAccountDetailTempMapper().batchSaveAccountTempDetails(subList);
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountOther(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
|
|
|
|
|
|
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
|
2024-01-17 16:07:27 +08:00
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
|
InsuranceArchivesOtherSchemePO otherPO = accountPO.getOther();
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPayOrg(otherPO.getPaymentOrganization());
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherSchemeId(otherPO.getOtherSchemeId());
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPaymentBaseString(otherPO.getOtherPaymentBaseString());
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPaymentComBaseString(otherPO.getOtherPaymentComBaseString());
|
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), otherPO.getOtherStartTime(), otherPO.getOtherEndTime());
|
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), otherPO.getNonPayment()) || otherPO.getNonPayment() == null) && otherPO.getOtherSchemeId() != null && inDataRange) {
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(otherPO.getOtherSchemeId());
|
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
|
//方案中包含的需要缴纳其他的个人福利
|
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> otherPerson = detailPOS.stream()
|
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//需要核算其他的福利id 个人
|
|
|
|
|
|
List<Long> needArchivesPerson = new ArrayList<>();
|
|
|
|
|
|
if (archivesPerson != null) {
|
|
|
|
|
|
archivesPerson.forEach((id, value) -> {
|
|
|
|
|
|
if (otherPerson.containsKey(Long.valueOf(id))) {
|
|
|
|
|
|
needArchivesPerson.add(Long.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//避免福利档案的方案未设置基数,导致核算时遗漏这些福利项的核算,遍历下方案相关福利项,并将遗漏的福利项id添加
|
|
|
|
|
|
if(otherPerson.size() > 0) {
|
|
|
|
|
|
otherPerson.forEach((id, object) -> {
|
|
|
|
|
|
if (!needArchivesPerson.contains(id)) {
|
|
|
|
|
|
needArchivesPerson.add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(otherPerson, billMonth, otherPO.getOtherStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> otherPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> otherPerJsonMap = new HashMap<>();
|
|
|
|
|
|
needArchivesPerson.stream().forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = otherPerson.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
2024-01-17 16:07:27 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (po.getPaymentCycle() != null && po.getPaymentCycle() == 1) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
otherPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
otherPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerJson(JSON.toJSONString(otherPerJsonMap));
|
|
|
|
|
|
BigDecimal otherPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherPer) {
|
|
|
|
|
|
otherPerSum = otherPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
|
|
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳公积金的单位福利
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> otherCom = detailPOS.stream()
|
|
|
|
|
|
.filter(
|
|
|
|
|
|
item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesCom = new HashMap<>();
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
archivesCom = JSON.parseObject(otherPO.getOtherPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
archivesCom = JSON.parseObject(otherPO.getOtherPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
}
|
|
|
|
|
|
//需要核算其他的福利id 单位
|
|
|
|
|
|
List<Long> needArchivesCom = new ArrayList<>();
|
|
|
|
|
|
if (archivesCom != null) {
|
|
|
|
|
|
archivesCom.forEach((id, value) -> {
|
|
|
|
|
|
if (otherCom.containsKey(Long.valueOf(id))) {
|
|
|
|
|
|
needArchivesCom.add(Long.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//避免福利档案的方案未设置基数,导致核算时遗漏这些福利项的核算,遍历下方案相关福利项,并将遗漏的福利项id添加
|
|
|
|
|
|
if(otherCom.size() > 0) {
|
|
|
|
|
|
otherCom.forEach((id, object) -> {
|
|
|
|
|
|
if (!needArchivesCom.contains(id)) {
|
|
|
|
|
|
needArchivesCom.add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(otherCom, billMonth, otherPO.getOtherStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> otherComList = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> otherComJsonMap = new HashMap<>();
|
|
|
|
|
|
HashMap<String, String> finalArchivesCom = archivesCom;
|
|
|
|
|
|
needArchivesCom.stream().forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = otherCom.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e)));
|
2024-01-17 16:07:27 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
otherComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
otherComList.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComJson(JSON.toJSONString(otherComJsonMap));
|
|
|
|
|
|
BigDecimal otherComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherComList) {
|
|
|
|
|
|
otherComSum = otherComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountFund(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
|
|
|
|
|
|
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
|
2024-01-17 16:07:27 +08:00
|
|
|
|
if (accountPO.getFund() != null) {
|
|
|
|
|
|
InsuranceArchivesFundSchemePO fundPO = accountPO.getFund();
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPayOrg(fundPO.getPaymentOrganization());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundAccount(fundPO.getFundAccount());
|
|
|
|
|
|
insuranceAccountDetailPO.setSupplementFundAccount(fundPO.getSupplementFundAccount());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundSchemeId(fundPO.getFundSchemeId());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPaymentBaseString(fundPO.getFundPaymentBaseString());
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPaymentComBaseString(fundPO.getFundPaymentComBaseString());
|
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), fundPO.getFundStartTime(), fundPO.getFundEndTime());
|
|
|
|
|
|
if ((NonPaymentEnum.YES.getValue().equals(fundPO.getNonPayment()) || fundPO.getNonPayment() == null) && fundPO.getFundSchemeId() != null && inDataRange) {
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(fundPO.getFundSchemeId());
|
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> fundperson = detailPOS.stream()
|
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//需要核算公积金的福利id 个人
|
|
|
|
|
|
List<Long> needArchivesPerson = new ArrayList<>();
|
|
|
|
|
|
if (archivesPerson != null) {
|
|
|
|
|
|
archivesPerson.forEach((id, value) -> {
|
|
|
|
|
|
if (fundperson.containsKey(Long.valueOf(id))) {
|
|
|
|
|
|
needArchivesPerson.add(Long.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//避免福利档案的方案未设置基数,导致核算时遗漏这些福利项的核算,遍历下方案相关福利项,并将遗漏的福利项id添加
|
|
|
|
|
|
if(fundperson.size() > 0) {
|
|
|
|
|
|
fundperson.forEach((id, object) -> {
|
|
|
|
|
|
if (!needArchivesPerson.contains(id)) {
|
|
|
|
|
|
needArchivesPerson.add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(fundperson, billMonth, fundPO.getFundStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> fundPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> fundPerJsonMap = new HashMap<>();
|
|
|
|
|
|
needArchivesPerson.stream().forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = fundperson.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
2024-01-17 16:07:27 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
fundPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
fundPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerJson(JSON.toJSONString(fundPerJsonMap));
|
|
|
|
|
|
BigDecimal funPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundPer) {
|
|
|
|
|
|
funPerSum = funPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(funPerSum.toPlainString());
|
|
|
|
|
|
|
|
|
|
|
|
//方案中包含的需要缴纳公积金的单位福利
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> fundCom = detailPOS.stream()
|
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue())
|
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesCom = new HashMap<>();
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
archivesCom = JSON.parseObject(fundPO.getFundPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
archivesCom = JSON.parseObject(fundPO.getFundPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
}
|
|
|
|
|
|
//需要核算公积金的福利id 单位
|
|
|
|
|
|
List<Long> needArchivesCom = new ArrayList<>();
|
|
|
|
|
|
if (archivesCom != null) {
|
|
|
|
|
|
archivesCom.forEach((id, value) -> {
|
|
|
|
|
|
if (fundCom.containsKey(Long.valueOf(id))) {
|
|
|
|
|
|
needArchivesCom.add(Long.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//避免福利档案的方案未设置基数,导致核算时遗漏这些福利项的核算,遍历下方案相关福利项,并将遗漏的福利项id添加
|
|
|
|
|
|
if(fundCom.size() > 0) {
|
|
|
|
|
|
fundCom.forEach((id, object) -> {
|
|
|
|
|
|
if (!needArchivesCom.contains(id)) {
|
|
|
|
|
|
needArchivesCom.add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(fundCom, billMonth, fundPO.getFundStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> fundComList = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> fundComJsonMap = new HashMap<>();
|
|
|
|
|
|
HashMap<String, String> finalArchivesCom = archivesCom;
|
|
|
|
|
|
needArchivesCom.stream().forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = fundCom.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e)));
|
2024-01-17 16:07:27 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
fundComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
fundComList.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComJson(JSON.toJSONString(fundComJsonMap));
|
|
|
|
|
|
BigDecimal fundComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundComList) {
|
|
|
|
|
|
fundComSum = fundComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountSocial(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, String billMonth) {
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// boolean welBaseDiffSign = siArchivesBiz.isDiffWelBase();
|
|
|
|
|
|
boolean welBaseDiffSign = getSIArchivesService(user).isDiffWelBase();
|
2024-01-17 16:07:27 +08:00
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentComBaseString(socialPO.getSocialPaymentComBaseString());
|
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(insuranceAccountDetailPO.getBillMonth(), socialPO.getSocialStartTime(), socialPO.getSocialEndTime());
|
|
|
|
|
|
if ((NonPaymentEnum.YES.getValue().equals(socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) {
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
|
|
|
|
|
|
.filter(item ->
|
|
|
|
|
|
Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) &&
|
|
|
|
|
|
Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue()) &&
|
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1")))
|
|
|
|
|
|
)
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//需要核算社保的福利id 个人
|
|
|
|
|
|
List<Long> needArchivesPerson = new ArrayList<>();
|
|
|
|
|
|
if (archivesPerson != null) {
|
|
|
|
|
|
archivesPerson.forEach((id, value) -> {
|
|
|
|
|
|
if (schemeperson.containsKey(Long.valueOf(id))) {
|
|
|
|
|
|
needArchivesPerson.add(Long.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//避免福利档案的方案未设置基数,导致核算时遗漏这些福利项的核算,遍历下方案相关福利项,并将遗漏的福利项id添加
|
|
|
|
|
|
if(schemeperson.size() > 0) {
|
|
|
|
|
|
schemeperson.forEach((id, object) -> {
|
|
|
|
|
|
if (!needArchivesPerson.contains(id)) {
|
|
|
|
|
|
needArchivesPerson.add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> socialPerJsonMap = new HashMap<>();
|
|
|
|
|
|
needArchivesPerson.forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeperson.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
2024-01-17 16:07:27 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
|
|
|
|
|
|
BigDecimal socialPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialPer) {
|
|
|
|
|
|
socialPerSum = socialPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
|
|
|
|
|
//方案中包含的需要缴纳社保的单位福利
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
|
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
|
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesCom = new HashMap<>();
|
|
|
|
|
|
if (welBaseDiffSign) {
|
|
|
|
|
|
archivesCom = JSON.parseObject(socialPO.getSocialPaymentComBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
}
|
|
|
|
|
|
//需要核算社保的福利id 单位
|
|
|
|
|
|
List<Long> needArchivesCom = new ArrayList<>();
|
|
|
|
|
|
if (archivesCom != null) {
|
|
|
|
|
|
archivesCom.forEach((id, value) -> {
|
|
|
|
|
|
if (schemeCom.containsKey(Long.valueOf(id))) {
|
|
|
|
|
|
needArchivesCom.add(Long.valueOf(id));
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//避免福利档案的方案未设置基数,导致核算时遗漏这些福利项的核算,遍历下方案相关福利项,并将遗漏的福利项id添加
|
|
|
|
|
|
if(schemeCom.size() > 0) {
|
|
|
|
|
|
schemeCom.forEach((id, object) -> {
|
|
|
|
|
|
if (!needArchivesCom.contains(id)) {
|
|
|
|
|
|
needArchivesCom.add(id);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> sociaComJsonMap = new HashMap<>();
|
|
|
|
|
|
HashMap<String, String> finalArchivesCom = archivesCom;
|
|
|
|
|
|
needArchivesCom.stream().forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeCom.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(StringUtils.isBlank(po.getPaymentProportion()) ? "0" : po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(finalArchivesCom) || StringUtils.isBlank(finalArchivesCom.get(String.valueOf(e)))) ? "0" : finalArchivesCom.get(String.valueOf(e)));
|
2024-01-17 16:07:27 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(sociaComJsonMap));
|
|
|
|
|
|
BigDecimal socialComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal decimal : socialCom) {
|
|
|
|
|
|
socialComSum = socialComSum.add(decimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 对于核算月和福利起始缴纳月处于同年时,要避免根据周期缴纳福利费用时,可能出现的多余费用缴纳情况
|
|
|
|
|
|
* @param schemeDetail 福利方案明细
|
|
|
|
|
|
* @param billMonth 核算月
|
|
|
|
|
|
* @param startMonth 福利起始缴纳月
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public Map<Long, InsuranceSchemeDetailPO> checkCycleSettingWithStartMonth(Map<Long, InsuranceSchemeDetailPO> schemeDetail, String billMonth, String startMonth) {
|
|
|
|
|
|
String billYear = billMonth.substring(0,4);
|
|
|
|
|
|
if (StringUtils.isNotBlank(startMonth) && billYear.equals(startMonth.substring(0,4))) {
|
|
|
|
|
|
int startMonthIndex = Integer.parseInt(startMonth.split("-")[1]) - 1;
|
|
|
|
|
|
schemeDetail.forEach((k, v) -> {
|
|
|
|
|
|
if (v.getPaymentCycle() != null && v.getPaymentCycle().equals(1) && startMonthIndex != 0) {
|
|
|
|
|
|
StringBuilder newCycleSetting = new StringBuilder(v.getCycleSetting());
|
|
|
|
|
|
newCycleSetting.setCharAt(startMonthIndex - 1, '1');
|
|
|
|
|
|
v.setCycleSetting(newCycleSetting.toString());
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
return schemeDetail;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<List<InsuranceAccountDetailTempPO>> splitList(List<InsuranceAccountDetailTempPO> list, int groupSize) {
|
|
|
|
|
|
int length = list.size();
|
|
|
|
|
|
// 计算可以分成多少组
|
|
|
|
|
|
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));
|
|
|
|
|
|
}
|
|
|
|
|
|
return newList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 根据个税扣缴义务人和账单月,获取三类福利档案中符合缴纳开始结束月区间的人员id
|
|
|
|
|
|
* @param paymentOrganization
|
|
|
|
|
|
* @param billMonth
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public List<Long> listCanPayEmpIds(Long paymentOrganization, String billMonth) {
|
|
|
|
|
|
List<Long> listCanPayEmpIds = new ArrayList<>();
|
|
|
|
|
|
//社保档案中可进行缴纳的人员
|
|
|
|
|
|
List<Long> socialCanPayEmpIds = getSocialSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
|
|
|
|
|
|
//公积金档案中可进行缴纳的人员
|
|
|
|
|
|
List<Long> fundCanPayEmpIds = getFundSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
|
|
|
|
|
|
//其他福利档案中可进行缴纳的人员
|
|
|
|
|
|
List<Long> otherCanPayEmpIds = getOtherSchemeMapper().listCanPayEmpIds(paymentOrganization, billMonth);
|
|
|
|
|
|
if (socialCanPayEmpIds != null && socialCanPayEmpIds.size() > 0) {
|
|
|
|
|
|
listCanPayEmpIds.addAll(socialCanPayEmpIds);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (fundCanPayEmpIds != null && fundCanPayEmpIds.size() > 0) {
|
|
|
|
|
|
listCanPayEmpIds.addAll(fundCanPayEmpIds);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (otherCanPayEmpIds != null && otherCanPayEmpIds.size() > 0) {
|
|
|
|
|
|
listCanPayEmpIds.addAll(otherCanPayEmpIds);
|
|
|
|
|
|
}
|
|
|
|
|
|
//去重
|
|
|
|
|
|
listCanPayEmpIds = listCanPayEmpIds.stream().distinct().collect(Collectors.toList());
|
|
|
|
|
|
return listCanPayEmpIds;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void handleData(List<Long> ids, AccountParam param) {
|
|
|
|
|
|
String billMonth = param.getBillMonth();
|
|
|
|
|
|
try {
|
|
|
|
|
|
List<InsuranceAccountDetailTempPO> list = new ArrayList<>();
|
|
|
|
|
|
List<List<Long>> partitionDetailTempInfo = Lists.partition((List<Long>) ids, 100);
|
|
|
|
|
|
partitionDetailTempInfo.forEach(part -> list.addAll(
|
|
|
|
|
|
getSIAccountDetailTempMapper().getListByEmployeeIdsAndBillMonth(part, billMonth, param.getPaymentOrganization())));
|
|
|
|
|
|
|
|
|
|
|
|
encryptUtil.decryptList(list, InsuranceAccountDetailTempPO.class);
|
|
|
|
|
|
Integer paymentStatus = 0;
|
|
|
|
|
|
log.info("核算明细临时表 hrsa_bill_detail_temp待处理数量:{}", list.size());
|
|
|
|
|
|
List<List<Long>> partitionIds = Lists.partition((List<Long>) ids, 100);
|
|
|
|
|
|
log.info("bill_detail入库前删除数据数量:{}", ids.size());
|
|
|
|
|
|
for (List<Long> part : partitionIds) {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchDelAccountDetails(part, billMonth, param.getPaymentOrganization(), paymentStatus);
|
|
|
|
|
|
|
|
|
|
|
|
//删除账单月份+个税扣缴义务人+人员id下的调差数据
|
|
|
|
|
|
getInsuranceCompensationMapper().deleteByBillMonthPayOrgEmpIds(InsuranceCompensationPO.builder()
|
|
|
|
|
|
.billMonth(billMonth)
|
|
|
|
|
|
.paymentOrganization(param.getPaymentOrganization())
|
|
|
|
|
|
.employeeIds(part)
|
|
|
|
|
|
.build());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
//生成bill_detail入库数据
|
|
|
|
|
|
List<InsuranceAccountDetailPO> collect = list.stream().map(item -> {
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
BeanUtils.copyProperties(item, insuranceAccountDetailPO);
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
|
|
|
log.info("bill_detail入库数据数量:{}", collect.size());
|
|
|
|
|
|
batchSaveAccountInspectDetail(collect);
|
|
|
|
|
|
encryptUtil.encryptList(collect, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
List<List<InsuranceAccountDetailPO>> lists = splitDetailList(collect, 20);
|
|
|
|
|
|
lists.forEach(subList -> {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchSaveAccountDetails(subList);
|
|
|
|
|
|
});
|
|
|
|
|
|
updateBatchAccount(param);
|
|
|
|
|
|
}
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
log.error("福利核算数据处理失败", e);
|
|
|
|
|
|
getSalaryAcctProgressService(user).fail(SalaryCacheKey.ACCT_PROGRESS + param.getBillMonth(), SalaryI18nUtil.getI18nLabel(0, "福利核算出错") + ": " + e.getMessage());
|
|
|
|
|
|
throw e;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void batchSaveAccountInspectDetail(List<InsuranceAccountDetailPO> list) {
|
|
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectAllPOS = accountInspect(list, true);
|
|
|
|
|
|
batchDelInspectDetail(insuranceAccountInspectAllPOS);
|
|
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = accountInspect(list, false);
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(insuranceAccountInspectPOS)) {
|
|
|
|
|
|
batchSaveInspectDetail(insuranceAccountInspectPOS);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
public void batchDelInspectDetail(List<InsuranceAccountInspectPO> list) {
|
|
|
|
|
|
List<List<InsuranceAccountInspectPO>> lists = Lists.partition(list, 100);
|
|
|
|
|
|
lists.forEach(getInsuranceAccountInspectMapper()::batchDelInspectDetails);
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void batchSaveInspectDetail(List<InsuranceAccountInspectPO> list) {
|
|
|
|
|
|
List<List<InsuranceAccountInspectPO>> lists = Lists.partition(list, 100);
|
|
|
|
|
|
lists.forEach(getInsuranceAccountInspectMapper()::batchSaveInspectDetails);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public List<InsuranceAccountInspectPO> accountInspect(List<InsuranceAccountDetailPO> list, boolean isAll) {
|
|
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = new ArrayList<>();
|
|
|
|
|
|
for (InsuranceAccountDetailPO e : list) {
|
|
|
|
|
|
if (isAll || detailCheck(e.getSocialPerJson()) || detailCheck(e.getSocialComJson())
|
|
|
|
|
|
|| detailCheck(e.getFundPerJson()) || detailCheck(e.getFundComJson())
|
|
|
|
|
|
|| detailCheck(e.getOtherPerJson()) || detailCheck(e.getOtherComJson())) {
|
|
|
|
|
|
InsuranceAccountInspectPO insuranceAccountInspectPO = InsuranceAccountInspectPO.builder().build();
|
|
|
|
|
|
insuranceAccountInspectPO.setSupplementaryProjects(e.getSupplementaryProjects());
|
|
|
|
|
|
insuranceAccountInspectPO.setInspectStatus(InspectStatusEnum.IGNORE.getValue());
|
|
|
|
|
|
insuranceAccountInspectPO.setBillMonth(e.getBillMonth());
|
|
|
|
|
|
insuranceAccountInspectPO.setCreator(e.getCreator());
|
|
|
|
|
|
insuranceAccountInspectPO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceAccountInspectPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
|
|
|
|
|
insuranceAccountInspectPO.setEmployeeId(e.getEmployeeId());
|
|
|
|
|
|
insuranceAccountInspectPO.setPaymentStatus(e.getPaymentStatus());
|
|
|
|
|
|
insuranceAccountInspectPO.setSupplementaryMonth(e.getSupplementaryMonth());
|
|
|
|
|
|
insuranceAccountInspectPO.setTenantKey(e.getTenantKey());
|
|
|
|
|
|
insuranceAccountInspectPO.setUpdateTime(new Date());
|
|
|
|
|
|
insuranceAccountInspectPOS.add(insuranceAccountInspectPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceAccountInspectPOS;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public boolean detailCheck(String baseString) {
|
|
|
|
|
|
if (StringUtils.isEmpty(baseString)) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
Map<String, String> baseStringMap = JSON.parseObject(baseString, new TypeReference<Map<String, String>>() {
|
|
|
|
|
|
});
|
|
|
|
|
|
if (baseStringMap == null || baseStringMap.size() == 0) {
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}
|
|
|
|
|
|
return baseStringMap.values().stream().anyMatch(item -> StringUtils.isEmpty(item) || Pattern.matches("^([0].?[0]*)$", item));
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private List<List<InsuranceAccountDetailPO>> splitDetailList(List<InsuranceAccountDetailPO> list, int groupSize) {
|
|
|
|
|
|
int length = list.size();
|
|
|
|
|
|
// 计算可以分成多少组
|
|
|
|
|
|
int num = (length + groupSize - 1) / groupSize;
|
|
|
|
|
|
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));
|
|
|
|
|
|
}
|
|
|
|
|
|
return newList;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新台账接口
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void updateBatchAccount(AccountParam param) {
|
|
|
|
|
|
String billMonth = param.getBillMonth();
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(billMonth, param.getPaymentOrganization());
|
|
|
|
|
|
Map<Long, List<InsuranceAccountDetailPO>> map = insuranceAccountDetailPOS.stream().filter(item -> item.getEmployeeId() != null)
|
|
|
|
|
|
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getEmployeeId));
|
|
|
|
|
|
int socialAccountPerson = 0;
|
|
|
|
|
|
int funcAccountPerson = 0;
|
|
|
|
|
|
int otherAccountPerson = 0;
|
|
|
|
|
|
BigDecimal socialSum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal fundSum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal otherSum = new BigDecimal("0");
|
|
|
|
|
|
for (Map.Entry<Long, List<InsuranceAccountDetailPO>> entry : map.entrySet()) {
|
|
|
|
|
|
List<InsuranceAccountDetailPO> v = entry.getValue();
|
|
|
|
|
|
BigDecimal socialTemp = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal fundTemp = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal otherTemp = new BigDecimal("0");
|
|
|
|
|
|
encryptUtil.decryptList(v, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
boolean socialPersonFlag = false;
|
|
|
|
|
|
boolean fundPersonFlag = false;
|
|
|
|
|
|
boolean otherPersonFlag = false;
|
|
|
|
|
|
for (InsuranceAccountDetailPO item : v) {
|
|
|
|
|
|
// 判断社保是否为0
|
|
|
|
|
|
socialPersonFlag = (StringUtils.isBlank(item.getSocialSum()) || SalaryEntityUtil.StringEqZERO(item.getSocialSum()));
|
|
|
|
|
|
BigDecimal socialPerson = socialPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getSocialSum());
|
|
|
|
|
|
fundPersonFlag = (StringUtils.isBlank(item.getFundSum()) || SalaryEntityUtil.StringEqZERO(item.getFundSum()));
|
|
|
|
|
|
BigDecimal fundPerson = fundPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getFundSum());
|
|
|
|
|
|
otherPersonFlag = (StringUtils.isBlank(item.getOtherSum()) || SalaryEntityUtil.StringEqZERO(item.getOtherSum()));
|
|
|
|
|
|
BigDecimal otherPerson = otherPersonFlag ? new BigDecimal("0") : new BigDecimal(item.getOtherSum());
|
|
|
|
|
|
socialTemp = socialTemp.add(socialPerson);
|
|
|
|
|
|
fundTemp = fundTemp.add(fundPerson);
|
|
|
|
|
|
otherTemp = otherTemp.add(otherPerson);
|
|
|
|
|
|
if (!socialPersonFlag && !item.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
|
|
|
|
|
socialAccountPerson += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!fundPersonFlag && !item.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
|
|
|
|
|
funcAccountPerson += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!otherPersonFlag && !item.getPaymentStatus().equals(PaymentStatusEnum.BALANCE.getValue())) {
|
|
|
|
|
|
otherAccountPerson += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (!"0".equals(socialTemp.toPlainString())) {
|
|
|
|
|
|
socialSum = socialSum.add(socialTemp);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!"0".equals(fundTemp.toPlainString())) {
|
|
|
|
|
|
fundSum = fundSum.add(fundTemp);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!"0".equals(otherTemp.toPlainString())) {
|
|
|
|
|
|
otherSum = otherSum.add(otherTemp);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, param.getPaymentOrganization());
|
|
|
|
|
|
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
|
|
|
|
|
|
insuranceAccountBatchPO.setAccountant(user.getLastname());
|
|
|
|
|
|
insuranceAccountBatchPO.setUpdateTime(new Date());
|
|
|
|
|
|
insuranceAccountBatchPO.setSocialPay(socialSum.toPlainString());
|
|
|
|
|
|
insuranceAccountBatchPO.setSocialNum(socialAccountPerson);
|
|
|
|
|
|
insuranceAccountBatchPO.setFundNum(funcAccountPerson);
|
|
|
|
|
|
insuranceAccountBatchPO.setFundPay(fundSum.toPlainString());
|
|
|
|
|
|
insuranceAccountBatchPO.setOtherNum(otherAccountPerson);
|
|
|
|
|
|
insuranceAccountBatchPO.setOtherPay(otherSum.toPlainString());
|
|
|
|
|
|
encryptUtil.encrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
getInsuranceAccountBatchMapper().updateById(insuranceAccountBatchPO);
|
2024-02-23 16:11:11 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(insuranceAccountBatchPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountBatchPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "更新福利台账"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "更新福利台账")
|
|
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setNewValues(insuranceAccountBatchPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void siFile(String billMonth, Long paymentOrganization) {
|
|
|
|
|
|
|
|
|
|
|
|
//开始归档数据
|
|
|
|
|
|
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillStatus(billMonth, BillStatusEnum.NOT_ARCHIVED.getValue(), paymentOrganization);
|
|
|
|
|
|
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(0, "月份账单不存在"));
|
|
|
|
|
|
SalaryAssert.isFalse(Objects.equals(insuranceAccountBatchPO.getBillStatus(), BillStatusEnum.ARCHIVED.getValue()), SalaryI18nUtil.getI18nLabel(0, "月份账单已归档"));
|
|
|
|
|
|
insuranceAccountBatchPO.setBillStatus(BillStatusEnum.ARCHIVED.getValue());
|
|
|
|
|
|
encryptUtil.encrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
getInsuranceAccountBatchMapper().updateById(insuranceAccountBatchPO);
|
2024-02-20 16:50:45 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(insuranceAccountBatchPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountBatchPO> loggerContext = new LoggerContext<>();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId("" + insuranceAccountBatchPO.getId());
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.UPDATE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账-归档"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账-归档")
|
|
|
|
|
|
+ ": " + taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setNewValues(insuranceAccountBatchPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2024-01-17 16:07:27 +08:00
|
|
|
|
}
|
2024-01-19 11:35:11 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public PageInfo<InsuranceAccountBatchPO> siBatchListPage(InsuranceAccountBatchParam queryParam) {
|
|
|
|
|
|
List<InsuranceAccountBatchPO> list = getInsuranceAccountBatchMapper().list(queryParam);
|
2024-09-26 10:35:46 +08:00
|
|
|
|
list = getAuthService(user).auth(list, AuthFilterTypeEnum.DATA_OPT, InsuranceAccountBatchPO.class);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
PageInfo<InsuranceAccountBatchPO> page = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
|
|
|
|
|
|
list, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
encryptUtil.decryptList(page.getList(), InsuranceAccountBatchPO.class);
|
|
|
|
|
|
return page;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public PageInfo<InsuranceAccountDetailPO> siBatchListCommonPage(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
queryParam.setPaymentStatus(PaymentStatusEnum.COMMON.getValue());
|
|
|
|
|
|
//排序配置
|
|
|
|
|
|
OrderRuleVO orderRule = getSalarySysConfService(user).orderRule();
|
|
|
|
|
|
queryParam.setOrderRule(orderRule);
|
|
|
|
|
|
//系统人员福利台账明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> list = getInsuranceAccountDetailMapper().list(queryParam);
|
|
|
|
|
|
//非系统各人员台账明细
|
|
|
|
|
|
List<InsuranceAccountDetailPO> extList = getInsuranceAccountDetailMapper().extList(queryParam);
|
|
|
|
|
|
list.addAll(extList);
|
|
|
|
|
|
PageInfo<InsuranceAccountDetailPO> pageInfo = SalaryPageUtil.buildPage(queryParam.getCurrent(), queryParam.getPageSize(),
|
|
|
|
|
|
list, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
encryptUtil.decryptList(pageInfo.getList(), InsuranceAccountDetailPO.class);
|
|
|
|
|
|
return pageInfo;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void siDelete(AccountParam param) {
|
|
|
|
|
|
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
|
|
|
|
|
|
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(0, "参数错误"));
|
|
|
|
|
|
// if (insuranceAccountBatchPO.getBillStatus().equals(BillStatusEnum.ARCHIVED.getValue())) {
|
|
|
|
|
|
// int num = checkIfBusinessAccounting(insuranceAccountBatchPO);
|
|
|
|
|
|
// //表示已经被核算过不能重新核算
|
|
|
|
|
|
// if (num > 0) {
|
|
|
|
|
|
// throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "已被薪酬核算给核算过,无法删除!"));
|
|
|
|
|
|
// }
|
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
|
|
// if(param.getPaymentOrganization()==null){
|
|
|
|
|
|
// throw new SalaryRunTimeException("个税扣缴义务人为空");
|
|
|
|
|
|
// }
|
|
|
|
|
|
getInsuranceAccountBatchMapper().deleteById(insuranceAccountBatchPO.getId());
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchDeleteNotFile(param.getBillMonth(), param.getPaymentOrganization());
|
|
|
|
|
|
//删除账单月份+个税扣缴义务人下的调差数据
|
|
|
|
|
|
getInsuranceCompensationMapper().deleteByBillMonthAndPayOrg(param.getBillMonth(), param.getPaymentOrganization());
|
2024-02-20 16:50:45 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(insuranceAccountBatchPO.getPaymentOrganization());
|
|
|
|
|
|
LoggerContext<InsuranceAccountBatchPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId()));
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "删除福利台账"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "删除福利台账")
|
|
|
|
|
|
+ ":" + taxAgentInfo.getName() + "-" + insuranceAccountBatchPO.getBillMonth());
|
|
|
|
|
|
loggerContext.setNewValues(insuranceAccountBatchPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void siSaveSupplementaryAccount(SaveSupplementaryAccountParam param) {
|
|
|
|
|
|
if (StringUtils.isBlank(param.getBillMonth()) || CollectionUtils.isEmpty(param.getBillMonthList()) || CollectionUtils.isEmpty(param.getProjects())
|
|
|
|
|
|
|| CollectionUtils.isEmpty(param.getIncludes())) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "参数错误"));
|
|
|
|
|
|
}
|
|
|
|
|
|
//需要补缴的月份
|
|
|
|
|
|
if (param.getBillMonthList().contains(param.getBillMonth())) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "当前月走正常缴纳"));
|
|
|
|
|
|
}
|
|
|
|
|
|
//需要补缴的员工id
|
|
|
|
|
|
List<Long> employeeIds = param.getIncludes();
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(param.getExcludes())) {
|
|
|
|
|
|
employeeIds = employeeIds.stream().filter(item -> !param.getExcludes().contains(item)).collect(Collectors.toList());
|
|
|
|
|
|
}
|
|
|
|
|
|
//校验补缴人员是否存在福利档案基础信息,并且runStatus处于正在缴纳或者待减员
|
|
|
|
|
|
List<InsuranceArchivesBaseInfoPO> insuranceBaseInfoList = getInsuranceBaseInfoMapper().getSocialByPaymentOrganization(param.getPaymentOrganization());
|
|
|
|
|
|
List<Long> finalEmployeeIds = employeeIds;
|
|
|
|
|
|
List<InsuranceArchivesBaseInfoPO> filterList = insuranceBaseInfoList.stream().filter(e -> {
|
|
|
|
|
|
for (Long uId : finalEmployeeIds) {
|
|
|
|
|
|
if (e.getEmployeeId().equals(uId) && (e.getRunStatus().equals(EmployeeStatusEnum.STAY_DEL.getValue()) || e.getRunStatus().equals(EmployeeStatusEnum.PAYING.getValue()))) {
|
|
|
|
|
|
return true;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return false;
|
|
|
|
|
|
}).collect(Collectors.toList());
|
|
|
|
|
|
if (filterList.size() != employeeIds.size()) {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "补缴人员中存在未设置福利档案人员或相关人员不在福利在缴人员中,不可新建补缴信息!"));
|
|
|
|
|
|
}
|
|
|
|
|
|
//20231122逻辑优化,过滤出不在起始缴纳月和最后缴纳月区间的人员
|
|
|
|
|
|
List<Long> empIdsInPayMonthRange = listCanPayEmpIds(param.getPaymentOrganization(), param.getBillMonth());
|
|
|
|
|
|
employeeIds = employeeIds.stream().filter(f -> empIdsInPayMonthRange.contains(f)).collect(Collectors.toList());
|
|
|
|
|
|
|
|
|
|
|
|
SalaryAssert.notEmpty(employeeIds, SalaryI18nUtil.getI18nLabel(0, "无核算人员"));
|
2024-10-09 10:57:23 +08:00
|
|
|
|
|
|
|
|
|
|
// 获取员工信息
|
|
|
|
|
|
List<DataCollectionEmployee> employeeList = getSalaryEmployeeService(user).listByIds(employeeIds);
|
|
|
|
|
|
Map<Long, DataCollectionEmployee> empMap = SalaryEntityUtil.convert2Map(employeeList, DataCollectionEmployee::getEmployeeId);
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
List<SupplementAccountBaseParam> baseList = new ArrayList<>();
|
|
|
|
|
|
employeeIds.stream().forEach(id -> {
|
2024-10-09 10:57:23 +08:00
|
|
|
|
DataCollectionEmployee employee = empMap.get(id);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
param.getBillMonthList().stream().forEach(month -> {
|
|
|
|
|
|
SupplementAccountBaseParam supplementAccountBaseParam = SupplementAccountBaseParam.builder()
|
|
|
|
|
|
.supplementaryMonth(month)
|
|
|
|
|
|
.employeeId(id)
|
|
|
|
|
|
.paymentOrganization(param.getPaymentOrganization())
|
|
|
|
|
|
.projects(param.getProjects())
|
|
|
|
|
|
.billMonth(param.getBillMonth())
|
|
|
|
|
|
.supplementType(param.getSupplementType())
|
|
|
|
|
|
.build();
|
2024-10-09 10:57:23 +08:00
|
|
|
|
if (employee != null) {
|
|
|
|
|
|
supplementAccountBaseParam.setSubcompanyName(employee.getSubcompanyName());
|
|
|
|
|
|
supplementAccountBaseParam.setSubcompanyId(employee.getSubcompanyid());
|
|
|
|
|
|
supplementAccountBaseParam.setDepartmentName(employee.getDepartmentName());
|
|
|
|
|
|
supplementAccountBaseParam.setDepartmentId(employee.getDepartmentId());
|
|
|
|
|
|
supplementAccountBaseParam.setJobtitleName(employee.getJobtitleName());
|
|
|
|
|
|
supplementAccountBaseParam.setJobtitleId(employee.getJobtitleId());
|
|
|
|
|
|
supplementAccountBaseParam.setJobcall(employee.getJobcall());
|
|
|
|
|
|
supplementAccountBaseParam.setJobcallId(employee.getJobcallId());
|
|
|
|
|
|
supplementAccountBaseParam.setStatus(employee.getStatus());
|
|
|
|
|
|
}
|
2024-01-19 11:35:11 +08:00
|
|
|
|
if ("2".equals(param.getSupplementType())) {
|
|
|
|
|
|
supplementAccountBaseParam.setSocialPaymentBaseString(param.getSocialPaymentBaseString());
|
|
|
|
|
|
supplementAccountBaseParam.setFundPaymentBaseString(param.getFundPaymentBaseString());
|
|
|
|
|
|
supplementAccountBaseParam.setOtherPaymentBaseString(param.getOtherPaymentBaseString());
|
|
|
|
|
|
} else if("3".equals(param.getSupplementType())) {
|
|
|
|
|
|
supplementAccountBaseParam.setSocialPaymentPerString(param.getSocialPaymentPerString());
|
|
|
|
|
|
supplementAccountBaseParam.setSocialPaymentComString(param.getSocialPaymentComString());
|
|
|
|
|
|
supplementAccountBaseParam.setFundPaymentPerString(param.getFundPaymentPerString());
|
|
|
|
|
|
supplementAccountBaseParam.setFundPaymentComString(param.getFundPaymentComString());
|
|
|
|
|
|
supplementAccountBaseParam.setOtherPaymentPerString(param.getOtherPaymentPerString());
|
|
|
|
|
|
supplementAccountBaseParam.setOtherPaymentComString(param.getOtherPaymentComString());
|
|
|
|
|
|
}
|
|
|
|
|
|
baseList.add(supplementAccountBaseParam);
|
|
|
|
|
|
});
|
|
|
|
|
|
});
|
|
|
|
|
|
//核算开始
|
|
|
|
|
|
accountSupplement(baseList, employeeIds, param.getPaymentOrganization());
|
|
|
|
|
|
|
|
|
|
|
|
updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* @param baseList 员工id-账单月份-补缴月份(单挑)-补缴项 集合
|
|
|
|
|
|
* @param employeeIds 需要补缴的员工id
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String accountSupplement(List<SupplementAccountBaseParam> baseList, List<Long> employeeIds, Long paymentOrganization) {
|
|
|
|
|
|
//(k,v) k-员工id v-员工对应的福利档案数据
|
2024-02-02 15:23:26 +08:00
|
|
|
|
// Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = siArchivesBiz.buildBatchAccount(employeeIds, paymentOrganization);
|
|
|
|
|
|
Map<Long, InsuranceArchivesAccountPO> longInsuranceArchivesAccountPOMap = getSIArchivesService(user).buildBatchAccount(employeeIds, paymentOrganization);
|
2024-01-19 11:35:11 +08:00
|
|
|
|
//核算结果集
|
|
|
|
|
|
List<InsuranceAccountDetailPO> pos = new ArrayList<>();
|
|
|
|
|
|
baseList.forEach(baseParam -> {
|
|
|
|
|
|
//判断人员id+账单月份+补缴月份在表中的唯一性
|
|
|
|
|
|
List<InsuranceAccountDetailPO> supplementList = getInsuranceAccountDetailMapper().querySupplementList(baseParam.getBillMonth(), baseParam.getPaymentOrganization(), baseParam.getEmployeeId(), baseParam.getSupplementaryMonth());
|
|
|
|
|
|
if (supplementList.size() > 0) {
|
|
|
|
|
|
throw new SalaryRunTimeException("当前人员和账单月份已存在该补缴月份的数据!无法再次创建!");
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = accountSingleEmployeeBill(baseParam, longInsuranceArchivesAccountPOMap.get(baseParam.getEmployeeId()));
|
|
|
|
|
|
pos.add(insuranceAccountDetailPO);
|
|
|
|
|
|
});
|
|
|
|
|
|
batchSaveSupplementAccount(pos);
|
|
|
|
|
|
return SalaryI18nUtil.getI18nLabel(0, "核算完成,数据保存成功");
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountSingleEmployeeBill(SupplementAccountBaseParam baseParam, InsuranceArchivesAccountPO accountPO) {
|
|
|
|
|
|
InsuranceAccountDetailPO insuranceAccountDetailPO = new InsuranceAccountDetailPO();
|
|
|
|
|
|
List<Integer> projects = baseParam.getProjects();
|
|
|
|
|
|
insuranceAccountDetailPO.setBillMonth(baseParam.getBillMonth());
|
|
|
|
|
|
insuranceAccountDetailPO.setBillStatus(BillStatusEnum.NOT_ARCHIVED.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setCreator((long) user.getUID());
|
|
|
|
|
|
insuranceAccountDetailPO.setCreateTime(new Date());
|
|
|
|
|
|
insuranceAccountDetailPO.setUpdateTime(new Date());
|
|
|
|
|
|
insuranceAccountDetailPO.setDeleteType(DeleteTypeEnum.NOT_DELETED.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setId(IdGenerator.generate());
|
|
|
|
|
|
insuranceAccountDetailPO.setEmployeeId(baseParam.getEmployeeId());
|
2024-10-09 10:57:23 +08:00
|
|
|
|
insuranceAccountDetailPO.setSubcompanyName(baseParam.getSubcompanyName());
|
|
|
|
|
|
insuranceAccountDetailPO.setSubcompanyId(baseParam.getSubcompanyId());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentName(baseParam.getDepartmentName());
|
|
|
|
|
|
insuranceAccountDetailPO.setDepartmentId(baseParam.getDepartmentId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleName(baseParam.getJobtitleName());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobtitleId(baseParam.getJobtitleId());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcall(baseParam.getJobcall());
|
|
|
|
|
|
insuranceAccountDetailPO.setJobcallId(baseParam.getJobcallId());
|
|
|
|
|
|
insuranceAccountDetailPO.setStatus(baseParam.getStatus());
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
insuranceAccountDetailPO.setPaymentStatus(PaymentStatusEnum.REPAIR.getValue());
|
|
|
|
|
|
insuranceAccountDetailPO.setSupplementaryMonth(baseParam.getSupplementaryMonth());
|
|
|
|
|
|
insuranceAccountDetailPO.setPaymentOrganization(baseParam.getPaymentOrganization());
|
|
|
|
|
|
insuranceAccountDetailPO.setSupplementaryProjects(
|
|
|
|
|
|
String.join(",",
|
|
|
|
|
|
baseParam.getProjects() == null ? new ArrayList<>() : baseParam.getProjects().stream().map(String::valueOf).collect(Collectors.toList())));
|
|
|
|
|
|
insuranceAccountDetailPO.setTenantKey(SalaryDefaultTenantConstant.DEFAULT_TENANT_KEY);
|
|
|
|
|
|
insuranceAccountDetailPO.setResourceFrom(ResourceFromEnum.SYSTEM.getValue());
|
|
|
|
|
|
//缴纳组织=个税扣缴义务人
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(baseParam.getPaymentOrganization());
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.ALL.getValue())) {
|
|
|
|
|
|
if ("2".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
|
accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (accountPO.getFund() != null) {
|
|
|
|
|
|
accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
|
accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
accountSupSocialByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
|
accountSupFundByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
|
accountSupOtherByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return account(insuranceAccountDetailPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
|
|
|
|
|
|
if ("2".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
|
accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
accountSupSocialByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
accountSocial(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (!projects.contains(ProjectTypeEnum.SOCIAL.getValue())) {
|
|
|
|
|
|
List<Long> ids = new ArrayList<>();
|
|
|
|
|
|
List<ICategoryPO> list = getICategoryMapper().listByDataType(DataTypeEnum.SYSTEM.getValue());
|
|
|
|
|
|
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.ENDOWMENT_INSURANCE.getValue())) {
|
|
|
|
|
|
ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(0, "养老保险").equals(item.getInsuranceName())).findFirst()
|
|
|
|
|
|
.get();
|
|
|
|
|
|
ids.add(insuranceCategoryPO.getId());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.MEDICAL_INSURANCE.getValue())) {
|
|
|
|
|
|
ICategoryPO insuranceCategoryPO = list.stream().filter(item -> SalaryI18nUtil.getI18nLabel(0, "医疗保险").equals(item.getInsuranceName())).findFirst()
|
|
|
|
|
|
.get();
|
|
|
|
|
|
ids.add(insuranceCategoryPO.getId());
|
|
|
|
|
|
}
|
|
|
|
|
|
if ("2".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
|
accountPO.getSocial().setSocialPaymentBaseString(baseParam.getSocialPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
accountSupEndowmentInsuranceByData(insuranceAccountDetailPO, baseParam, ids);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
accountEndowmentInsurance(insuranceAccountDetailPO, accountPO, ids, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.FUND.getValue())) {
|
|
|
|
|
|
if ("2".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
if (accountPO.getFund() != null) {
|
|
|
|
|
|
accountPO.getFund().setFundPaymentBaseString(baseParam.getFundPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
accountSupFundByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
accountFund(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
if (projects.contains(ProjectTypeEnum.OTHER.getValue())) {
|
|
|
|
|
|
|
|
|
|
|
|
if ("2".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
if (accountPO.getOther() != null) {
|
|
|
|
|
|
accountPO.getOther().setOtherPaymentBaseString(baseParam.getOtherPaymentBaseString());
|
|
|
|
|
|
}
|
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
} else if ("3".equals(baseParam.getSupplementType())) {
|
|
|
|
|
|
accountSupOtherByData(insuranceAccountDetailPO, baseParam);
|
|
|
|
|
|
} else {
|
|
|
|
|
|
accountOther(insuranceAccountDetailPO, accountPO, baseParam.getSupplementaryMonth());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return account(insuranceAccountDetailPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountSupFundByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam) {
|
|
|
|
|
|
//公积金个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getFundPaymentPerString())) {
|
|
|
|
|
|
List<BigDecimal> fundPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> fundPerson = JSON.parseObject(baseParam.getFundPaymentPerString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
fundPerson.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
fundPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerJson(baseParam.getFundPaymentPerString());
|
|
|
|
|
|
BigDecimal fundPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundPer) {
|
|
|
|
|
|
fundPerSum = fundPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundPerSum(fundPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//公积金单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getFundPaymentComString())) {
|
|
|
|
|
|
List<BigDecimal> fundCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> fundComMap = JSON.parseObject(baseParam.getFundPaymentComString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
fundComMap.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
fundCom.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComJson(baseParam.getFundPaymentComString());
|
|
|
|
|
|
BigDecimal fundComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : fundCom) {
|
|
|
|
|
|
fundComSum = fundComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setFundComSum(fundComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountSupOtherByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam) {
|
|
|
|
|
|
//其他福利个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getOtherPaymentPerString())) {
|
|
|
|
|
|
List<BigDecimal> otherPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> otherPerMap = JSON.parseObject(baseParam.getOtherPaymentPerString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
otherPerMap.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
otherPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerJson(baseParam.getOtherPaymentPerString());
|
|
|
|
|
|
BigDecimal otherPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherPer) {
|
|
|
|
|
|
otherPerSum = otherPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherPerSum(otherPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//其他福利单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getOtherPaymentComString())) {
|
|
|
|
|
|
List<BigDecimal> otherCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> otherComMap = JSON.parseObject(baseParam.getOtherPaymentComString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
otherComMap.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
otherCom.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComJson(baseParam.getOtherPaymentComString());
|
|
|
|
|
|
BigDecimal otherComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : otherCom) {
|
|
|
|
|
|
otherComSum = otherComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setOtherComSum(otherComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountSupSocialByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam) {
|
|
|
|
|
|
//社保个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getSocialPaymentPerString())) {
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(baseParam.getSocialPaymentPerString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
archivesPerson.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(baseParam.getSocialPaymentPerString());
|
|
|
|
|
|
BigDecimal socialPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialPer) {
|
|
|
|
|
|
socialPerSum = socialPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//社保单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getSocialPaymentComString())) {
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> archivesCom = JSON.parseObject(baseParam.getSocialPaymentComString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
archivesCom.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(baseParam.getSocialPaymentComString());
|
|
|
|
|
|
BigDecimal socialComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialCom) {
|
|
|
|
|
|
socialComSum = socialComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public InsuranceAccountDetailPO accountEndowmentInsurance(InsuranceAccountDetailPO insuranceAccountDetailPO, InsuranceArchivesAccountPO accountPO, List<Long> categoryIds, String billMonth) {
|
|
|
|
|
|
if (accountPO.getSocial() != null) {
|
|
|
|
|
|
InsuranceArchivesSocialSchemePO socialPO = accountPO.getSocial();
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPayOrg(socialPO.getPaymentOrganization());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialAccount(socialPO.getSocialAccount());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialSchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentBaseString(socialPO.getSocialPaymentBaseString());
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPaymentComBaseString(socialPO.getSocialPaymentComBaseString());
|
|
|
|
|
|
//判断是否在起始缴纳月和最后缴纳月之间
|
|
|
|
|
|
Boolean inDataRange = SalaryDateUtil.monthInRange(billMonth, socialPO.getSocialStartTime(), socialPO.getSocialEndTime());
|
|
|
|
|
|
|
|
|
|
|
|
if ((Objects.equals(NonPaymentEnum.YES.getValue(), socialPO.getNonPayment()) || socialPO.getNonPayment() == null) && socialPO.getSocialSchemeId() != null && inDataRange) {
|
|
|
|
|
|
List<InsuranceSchemeDetailPO> detailPOS = getInsuranceSchemeDetailMapper().queryListBySchemeId(socialPO.getSocialSchemeId());
|
|
|
|
|
|
encryptUtil.decryptList(detailPOS, InsuranceSchemeDetailPO.class);
|
|
|
|
|
|
//方案中包含的需要缴纳社保的个人福利
|
|
|
|
|
|
int monthIndex = Integer.parseInt(billMonth.split("-")[1]) - 1;
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeperson = detailPOS.stream()
|
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment())
|
|
|
|
|
|
&& Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_PERSON.getValue())
|
|
|
|
|
|
&& (item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//需要核算社保的福利id 个人
|
|
|
|
|
|
List<Long> needArchivesPerson = new ArrayList<>();
|
|
|
|
|
|
if (archivesPerson != null) {
|
|
|
|
|
|
categoryIds.forEach(item -> {
|
|
|
|
|
|
if (archivesPerson.containsKey(String.valueOf(item)) && schemeperson.containsKey(item)) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(archivesPerson.get(String.valueOf(item)))) {
|
|
|
|
|
|
needArchivesPerson.add(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
}
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeperson, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> socialPerJsonMap = new HashMap<>();
|
|
|
|
|
|
needArchivesPerson.forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeperson.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesPerson) || StringUtils.isBlank(archivesPerson.get(String.valueOf(e)))) ? "0" : archivesPerson.get(String.valueOf(e)));
|
2024-01-19 11:35:11 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
socialPerJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerJsonMap));
|
|
|
|
|
|
BigDecimal socialPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialPer) {
|
|
|
|
|
|
socialPerSum = socialPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
|
|
|
|
|
//方案中包含的需要缴纳社保的单位福利
|
|
|
|
|
|
Map<Long, InsuranceSchemeDetailPO> schemeCom = detailPOS.stream()
|
|
|
|
|
|
.filter(item -> Objects.equals(IsPaymentEnum.YES.getValue(), item.getIsPayment()) && Objects.equals(item.getPaymentScope(), PaymentScopeEnum.SCOPE_COMPANY.getValue()) &&
|
|
|
|
|
|
(item.getPaymentCycle() == null || item.getPaymentCycle() == 0 || (item.getPaymentCycle() == 1 && String.valueOf(item.getCycleSetting().charAt(monthIndex)).equals("1"))))
|
|
|
|
|
|
.collect(
|
|
|
|
|
|
Collectors.toMap(InsuranceSchemeDetailPO::getInsuranceId, Function.identity()));
|
|
|
|
|
|
//档案中包含的基数信息
|
|
|
|
|
|
HashMap<String, String> archivesCom = JSON.parseObject(socialPO.getSocialPaymentBaseString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
//需要核算社保的福利id 单位
|
|
|
|
|
|
List<Long> needArchivesCom = new ArrayList<>();
|
|
|
|
|
|
if (archivesCom != null) {
|
|
|
|
|
|
categoryIds.forEach(item -> {
|
|
|
|
|
|
if (archivesCom.containsKey(String.valueOf(item)) && schemeCom.containsKey(item)) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(archivesCom.get(String.valueOf(item)))) {
|
|
|
|
|
|
needArchivesCom.add(item);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
//判断核算周期、核算月、福利起始缴纳月的关系
|
|
|
|
|
|
checkCycleSettingWithStartMonth(schemeCom, billMonth, socialPO.getSocialStartTime());
|
|
|
|
|
|
}
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
|
Map<String, String> sociaComJsonMap = new HashMap<>();
|
|
|
|
|
|
needArchivesCom.forEach(e -> {
|
|
|
|
|
|
InsuranceSchemeDetailPO po = schemeCom.get(e);
|
|
|
|
|
|
BigDecimal paymentProportion = new BigDecimal(po.getPaymentProportion()).divide(new BigDecimal("100"));
|
2024-04-01 20:25:23 +08:00
|
|
|
|
BigDecimal paymentNum = new BigDecimal((ObjectUtil.isEmpty(archivesCom) || StringUtils.isBlank(archivesCom.get(String.valueOf(e)))) ? "0" : archivesCom.get(String.valueOf(e)));
|
2024-01-19 11:35:11 +08:00
|
|
|
|
BigDecimal fixedCost = StringUtils.isBlank(po.getFixedCost()) ? new BigDecimal("0") : new BigDecimal(po.getFixedCost());
|
|
|
|
|
|
Integer newScale = po.getValidNum() == null ? 0 : po.getValidNum();
|
|
|
|
|
|
BigDecimal result = new BigDecimal("0");
|
|
|
|
|
|
if (Objects.equals(po.getPaymentCycle(), 1)) {
|
|
|
|
|
|
int monthValue = 1;
|
|
|
|
|
|
for (int i = monthIndex - 1; i >= 0; i--) {
|
|
|
|
|
|
String cycleValue = po.getCycleSetting().charAt(i) + "";
|
|
|
|
|
|
if (Integer.parseInt(cycleValue) == 1) {
|
|
|
|
|
|
break;
|
|
|
|
|
|
}
|
|
|
|
|
|
monthValue++;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (po.getAccountType() == 1) {
|
|
|
|
|
|
paymentNum = paymentNum.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
fixedCost = fixedCost.multiply(new BigDecimal(monthValue));
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
} else {
|
|
|
|
|
|
for (int i = 0; i < monthValue; i++) {
|
|
|
|
|
|
result = result.add(SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost)));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
result = SalaryEntityUtil.carryRule(newScale, po.getRententionRule(), paymentNum.multiply(paymentProportion).add(fixedCost));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
sociaComJsonMap.put(String.valueOf(e), result.toPlainString());
|
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(sociaComJsonMap));
|
|
|
|
|
|
BigDecimal socialComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal decimal : socialCom) {
|
|
|
|
|
|
socialComSum = socialComSum.add(decimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
return insuranceAccountDetailPO;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountSupEndowmentInsuranceByData(InsuranceAccountDetailPO insuranceAccountDetailPO, SupplementAccountBaseParam baseParam, List<Long> ids) {
|
|
|
|
|
|
//社保个人
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getSocialPaymentPerString())) {
|
|
|
|
|
|
List<BigDecimal> socialPer = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> archivesPerson = JSON.parseObject(baseParam.getSocialPaymentPerString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
HashMap<String, String> socialPerson = new HashMap<>();
|
|
|
|
|
|
archivesPerson.forEach((k, v) -> {
|
|
|
|
|
|
if (ids.contains(Long.valueOf(k))) {
|
|
|
|
|
|
socialPerson.put(k, v);
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
socialPer.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerJson(JSON.toJSONString(socialPerson));
|
|
|
|
|
|
BigDecimal socialPerSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialPer) {
|
|
|
|
|
|
socialPerSum = socialPerSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialPerSum(socialPerSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
//社保单位
|
|
|
|
|
|
if (StringUtils.isNotBlank(baseParam.getSocialPaymentComString())) {
|
|
|
|
|
|
List<BigDecimal> socialCom = new ArrayList<>();
|
|
|
|
|
|
HashMap<String, String> archivesCom = JSON.parseObject(baseParam.getSocialPaymentComString(), new HashMap<String, String>().getClass());
|
|
|
|
|
|
HashMap<String, String> socialComMap = new HashMap<>();
|
|
|
|
|
|
archivesCom.forEach((k, v) -> {
|
|
|
|
|
|
if (ids.contains(Long.valueOf(k))) {
|
|
|
|
|
|
socialComMap.put(k, v);
|
|
|
|
|
|
BigDecimal result = new BigDecimal(v);
|
|
|
|
|
|
socialCom.add(result);
|
|
|
|
|
|
}
|
|
|
|
|
|
});
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComJson(JSON.toJSONString(socialComMap));
|
|
|
|
|
|
BigDecimal socialComSum = new BigDecimal("0");
|
|
|
|
|
|
for (BigDecimal bigDecimal : socialCom) {
|
|
|
|
|
|
socialComSum = socialComSum.add(bigDecimal);
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountDetailPO.setSocialComSum(socialComSum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void batchSaveSupplementAccount(List<InsuranceAccountDetailPO> pos) {
|
|
|
|
|
|
if (CollectionUtils.isEmpty(pos)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
batchSaveAccountInspectDetail(pos);
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchDelSupplementAccountDetails(pos);
|
|
|
|
|
|
encryptUtil.encryptList(pos, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
List<List<InsuranceAccountDetailPO>> lists = splitDetailList(pos, 20);
|
|
|
|
|
|
lists.forEach(subList -> {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchSaveAccountDetails(subList);
|
|
|
|
|
|
});
|
|
|
|
|
|
//删除日志
|
|
|
|
|
|
// pos.stream().forEach(item -> {
|
|
|
|
|
|
// LoggerContext insuranceSchemeContext = new LoggerContext();
|
|
|
|
|
|
// insuranceSchemeContext.setTargetId(String.valueOf(item.getId()));
|
|
|
|
|
|
// insuranceSchemeContext.setTargetName(String.valueOf(item.getEmployeeId()));
|
|
|
|
|
|
// insuranceSchemeContext.setOperateType(OperateTypeEnum.DELETE.getValue());
|
|
|
|
|
|
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(100448, "删除核算记录"));
|
|
|
|
|
|
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(100448, "删除核算记录"));
|
|
|
|
|
|
// insuranceSchemeContext.setNewValues(item);
|
|
|
|
|
|
// siAccountLoggerTemplate.write(insuranceSchemeContext);
|
|
|
|
|
|
// });
|
|
|
|
|
|
//插入日志
|
|
|
|
|
|
// pos.stream().forEach(item -> {
|
|
|
|
|
|
// LoggerContext insuranceSchemeContext = new LoggerContext();
|
|
|
|
|
|
// insuranceSchemeContext.setTargetId(String.valueOf(item.getId()));
|
|
|
|
|
|
// insuranceSchemeContext.setTargetName(String.valueOf(item.getEmployeeId()));
|
|
|
|
|
|
// insuranceSchemeContext.setOperateType(OperateTypeEnum.ADD.getValue());
|
|
|
|
|
|
// insuranceSchemeContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(100494, "新建核算记录"));
|
|
|
|
|
|
// insuranceSchemeContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(100494, "新建核算记录"));
|
|
|
|
|
|
// insuranceSchemeContext.setNewValues(item);
|
|
|
|
|
|
// siAccountLoggerTemplate.write(insuranceSchemeContext);
|
|
|
|
|
|
// });
|
2024-02-22 09:33:35 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
encryptUtil.decryptList(pos, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
InsuranceAccountBatchPO targetPO = getInsuranceAccountBatchMapper().getByBillMonth(pos.get(0).getBillMonth(), pos.get(0).getPaymentOrganization());
|
|
|
|
|
|
TaxAgentPO taxAgentInfo = getTaxAgentMapper().getById(targetPO.getPaymentOrganization());
|
|
|
|
|
|
pos.forEach(targetDetailPO -> {
|
|
|
|
|
|
DataCollectionEmployee empInfo = getEmployMapper().getEmployeeById(targetDetailPO.getEmployeeId());
|
|
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext<>();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId("" + targetPO.getId());
|
|
|
|
|
|
loggerContext.setTargetName(taxAgentInfo.getName() + "-" + targetPO.getBillMonth() + "-" + empInfo.getUsername());
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.ADD.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-新增补缴"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-新增补缴")
|
|
|
|
|
|
+ ": " + taxAgentInfo.getName() + "-" + targetPO.getBillMonth() + "-" + empInfo.getUsername());
|
|
|
|
|
|
loggerContext.setNewValues(targetDetailPO);
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
|
|
|
|
|
});
|
2024-01-19 11:35:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void siDeleteCommonAccount(SaveCommonAccountParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
//根据id批量删除
|
|
|
|
|
|
if (param.getIds().size() > 0) {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchDelAccountDetailsByIds(param.getIds());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "请勾选需要删除的数据项!"));
|
|
|
|
|
|
}
|
2024-02-22 09:33:35 +08:00
|
|
|
|
//记录操作日志
|
|
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(param.getIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
|
|
|
loggerContext.setTargetName(param.getIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-删除正常缴纳核算记录"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-删除正常缴纳核算记录"));
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-02-22 09:33:35 +08:00
|
|
|
|
public void siDeleteSupplementaryAccount(SaveCommonAccountParam param) {
|
|
|
|
|
|
ValidUtil.doValidator(param);
|
|
|
|
|
|
//根据id批量删除
|
|
|
|
|
|
if (param.getIds().size() > 0) {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().batchDelAccountDetailsByIds(param.getIds());
|
|
|
|
|
|
} else {
|
|
|
|
|
|
throw new SalaryRunTimeException(SalaryI18nUtil.getI18nLabel(0, "请勾选需要删除的数据项!"));
|
2024-01-19 11:35:11 +08:00
|
|
|
|
}
|
2024-02-22 09:33:35 +08:00
|
|
|
|
getInsuranceAccountDetailMapper().batchDelAccountDetailsByIds(param.getIds());
|
|
|
|
|
|
//记录操作日志
|
|
|
|
|
|
LoggerContext<InsuranceAccountDetailPO> loggerContext = new LoggerContext();
|
|
|
|
|
|
loggerContext.setUser(user);
|
|
|
|
|
|
loggerContext.setTargetId(param.getIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
|
|
|
loggerContext.setTargetName(param.getIds().stream().map(String::valueOf).collect(Collectors.joining(",")));
|
|
|
|
|
|
loggerContext.setOperateType(OperateTypeEnum.DELETE.getValue());
|
|
|
|
|
|
loggerContext.setOperateTypeName(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-删除补缴核算记录"));
|
|
|
|
|
|
loggerContext.setOperatedesc(SalaryI18nUtil.getI18nLabel(0, "福利台账明细表-删除补缴核算记录"));
|
|
|
|
|
|
SalaryElogConfig.siAccountLoggerTemplate.write(loggerContext);
|
|
|
|
|
|
|
|
|
|
|
|
updateBatchAccount(AccountParam.builder().billMonth(param.getBillMonth()).paymentOrganization(param.getPaymentOrganization()).build());
|
2024-01-19 11:35:11 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountInspect(Collection<Long> ids, String billMonth, Long paymentOrganization) {
|
|
|
|
|
|
List<InsuranceAccountInspectPO> insuranceAccountInspectPOS = allInspects(ids, billMonth);
|
|
|
|
|
|
SalaryAssert.notEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel(0, "无核算数据"));
|
|
|
|
|
|
List<InsuranceAccountInspectPO> commonInspects = insuranceAccountInspectPOS.stream()
|
|
|
|
|
|
.filter(e -> Objects.equals(e.getPaymentStatus(), PaymentStatusEnum.COMMON.getValue()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
List<InsuranceAccountInspectPO> supplementInspects = insuranceAccountInspectPOS.stream()
|
|
|
|
|
|
.filter(e -> Objects.equals(e.getPaymentStatus(), PaymentStatusEnum.REPAIR.getValue()))
|
|
|
|
|
|
.collect(Collectors.toList());
|
|
|
|
|
|
//核算正常缴纳
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(commonInspects)) {
|
|
|
|
|
|
SaveCommonAccountParam param = new SaveCommonAccountParam();
|
|
|
|
|
|
param.setBillMonth(billMonth);
|
|
|
|
|
|
param.setIncludes(commonInspects.stream().map(InsuranceAccountInspectPO::getEmployeeId).collect(Collectors.toList()));
|
|
|
|
|
|
siSaveCommonAccount(param);
|
|
|
|
|
|
}
|
|
|
|
|
|
//核算补缴
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(supplementInspects)) {
|
|
|
|
|
|
List<SupplementAccountBaseParam> baseList = new ArrayList<>();
|
|
|
|
|
|
supplementInspects.forEach(e -> {
|
|
|
|
|
|
SupplementAccountBaseParam base = new SupplementAccountBaseParam();
|
|
|
|
|
|
base.setBillMonth(billMonth);
|
|
|
|
|
|
base.setProjects(
|
|
|
|
|
|
e.getSupplementaryProjects() == null ? null : Arrays.stream(e.getSupplementaryProjects().split(",")).map(Integer::valueOf).collect(Collectors.toList()));
|
|
|
|
|
|
base.setEmployeeId(e.getEmployeeId());
|
|
|
|
|
|
base.setSupplementaryMonth(e.getSupplementaryMonth());
|
|
|
|
|
|
baseList.add(base);
|
|
|
|
|
|
});
|
|
|
|
|
|
accountSupplement(baseList, baseList.stream().map(SupplementAccountBaseParam::getEmployeeId).collect(Collectors.toList()), paymentOrganization);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public PageInfo<InsuranceAccountViewListDTO> siOverView(InsuranceAccountDetailParam queryParam) {
|
|
|
|
|
|
|
|
|
|
|
|
List<InsuranceAccountDetailPO> insuranceAccountDetailPOS = getInsuranceAccountDetailMapper().selectList(queryParam.getBillMonth(), StringUtil.isBlank(queryParam.getPaymentOrganization()) ? null : Long.valueOf(queryParam.getPaymentOrganization()));
|
|
|
|
|
|
encryptUtil.decryptList(insuranceAccountDetailPOS, InsuranceAccountDetailPO.class);
|
|
|
|
|
|
//获取扣缴义务人信息
|
|
|
|
|
|
List<TaxAgentPO> paymentList = getTaxAgentMapper().listAll();
|
|
|
|
|
|
SalaryAssert.notEmpty(paymentList, SalaryI18nUtil.getI18nLabel(0, "该租户无扣缴义务人"));
|
|
|
|
|
|
Map<Long, TaxAgentPO> paymentMap = paymentList.stream().collect(Collectors.toMap(TaxAgentPO::getId, Function.identity()));
|
|
|
|
|
|
List<InsuranceAccountViewListDTO> insuranceAccountViewListDTOS = buildRecords(insuranceAccountDetailPOS, paymentMap);
|
|
|
|
|
|
|
|
|
|
|
|
PageInfo<InsuranceAccountViewListDTO> insuranceAccountViewListDTOPage = new PageInfo<>(insuranceAccountViewListDTOS, InsuranceAccountViewListDTO.class);
|
|
|
|
|
|
insuranceAccountViewListDTOPage.setTotal(insuranceAccountViewListDTOS.size());
|
|
|
|
|
|
return insuranceAccountViewListDTOPage;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public List<InsuranceAccountViewListDTO> buildRecords(List<InsuranceAccountDetailPO> list, Map<Long, TaxAgentPO> paymentMap) {
|
|
|
|
|
|
Map<Long, InsuranceAccountViewListDTO> result = new HashMap<>();
|
|
|
|
|
|
//根据组织分组,对社保进行统计
|
|
|
|
|
|
Map<Long, List<InsuranceAccountDetailPO>> socialCollect = list.stream().filter(item -> item.getSocialPayOrg() != null)
|
|
|
|
|
|
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getSocialPayOrg));
|
|
|
|
|
|
socialCollect.forEach((k, v) -> {
|
|
|
|
|
|
if (result.get(k) == null) {
|
|
|
|
|
|
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
|
|
|
|
|
|
temp.setPayOrg(paymentMap.get(k).getName());
|
|
|
|
|
|
result.put(k, temp);
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
|
|
|
|
|
|
accountSocialView(insuranceAccountViewListDTO, v);
|
|
|
|
|
|
});
|
|
|
|
|
|
//根据组织分组,对公积金进行统计
|
|
|
|
|
|
Map<Long, List<InsuranceAccountDetailPO>> fundCollect = list.stream().filter(item -> item.getSocialPayOrg() != null)
|
|
|
|
|
|
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getSocialPayOrg));
|
|
|
|
|
|
fundCollect.forEach((k, v) -> {
|
|
|
|
|
|
if (result.get(k) == null) {
|
|
|
|
|
|
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
|
|
|
|
|
|
temp.setPayOrg(paymentMap.get(k).getName());
|
|
|
|
|
|
result.put(k, temp);
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
|
|
|
|
|
|
accountFundView(insuranceAccountViewListDTO, v);
|
|
|
|
|
|
});
|
|
|
|
|
|
//根据组织分组,对其他福利进行统计
|
|
|
|
|
|
Map<Long, List<InsuranceAccountDetailPO>> otherCollect = list.stream().filter(item -> item.getSocialPayOrg() != null)
|
|
|
|
|
|
.collect(Collectors.groupingBy(InsuranceAccountDetailPO::getSocialPayOrg));
|
|
|
|
|
|
otherCollect.forEach((k, v) -> {
|
|
|
|
|
|
if (result.get(k) == null) {
|
|
|
|
|
|
InsuranceAccountViewListDTO temp = new InsuranceAccountViewListDTO();
|
|
|
|
|
|
temp.setPayOrg(paymentMap.get(k).getName());
|
|
|
|
|
|
result.put(k, temp);
|
|
|
|
|
|
}
|
|
|
|
|
|
InsuranceAccountViewListDTO insuranceAccountViewListDTO = result.get(k);
|
|
|
|
|
|
accountOtherView(insuranceAccountViewListDTO, v);
|
|
|
|
|
|
});
|
|
|
|
|
|
//对各组织进行金额合计
|
|
|
|
|
|
List<InsuranceAccountViewListDTO> viewDTOS = new ArrayList<>();
|
|
|
|
|
|
result.forEach((k, v) -> {
|
|
|
|
|
|
BigDecimal socialPaySum = StringUtils.isBlank(v.getSocialPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getSocialPaySum());
|
|
|
|
|
|
BigDecimal fundPaySum = StringUtils.isBlank(v.getFundPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getFundPaySum());
|
|
|
|
|
|
BigDecimal otherPaySum = StringUtils.isBlank(v.getOtherPaySum()) ? new BigDecimal("0") : new BigDecimal(v.getOtherPaySum());
|
|
|
|
|
|
v.setIndex(k);
|
|
|
|
|
|
BigDecimal sum = socialPaySum.add(fundPaySum).add(otherPaySum);
|
|
|
|
|
|
v.setSum(sum.toPlainString());
|
|
|
|
|
|
viewDTOS.add(v);
|
|
|
|
|
|
});
|
|
|
|
|
|
//合计
|
|
|
|
|
|
InsuranceAccountViewListDTO insuranceAccountViewListDTO = new InsuranceAccountViewListDTO();
|
|
|
|
|
|
int socialNum = 0;
|
|
|
|
|
|
int fundNum = 0;
|
|
|
|
|
|
int otherNum = 0;
|
|
|
|
|
|
BigDecimal socialSum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal fundSum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal otherSum = new BigDecimal("0");
|
|
|
|
|
|
BigDecimal sum = new BigDecimal("0");
|
|
|
|
|
|
for (InsuranceAccountViewListDTO item : viewDTOS) {
|
|
|
|
|
|
if (item.getSocialNum() != null) {
|
|
|
|
|
|
socialNum += item.getSocialNum();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.getFundNum() != null) {
|
|
|
|
|
|
fundNum += item.getFundNum();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (item.getOtherNum() != null) {
|
|
|
|
|
|
otherNum += item.getOtherNum();
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialPaySum())) {
|
|
|
|
|
|
socialSum = socialSum.add(new BigDecimal(item.getSocialPaySum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundPaySum())) {
|
|
|
|
|
|
fundSum = fundSum.add(new BigDecimal(item.getFundPaySum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherPaySum())) {
|
|
|
|
|
|
otherSum = otherSum.add(new BigDecimal(item.getOtherPaySum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSum())) {
|
|
|
|
|
|
sum = sum.add(new BigDecimal(item.getSum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
insuranceAccountViewListDTO.setSum(sum.toPlainString());
|
|
|
|
|
|
insuranceAccountViewListDTO.setSocialPaySum(socialSum.toPlainString());
|
|
|
|
|
|
insuranceAccountViewListDTO.setPayOrg(SalaryI18nUtil.getI18nLabel(0, "合计"));
|
|
|
|
|
|
insuranceAccountViewListDTO.setFundPaySum(fundSum.toPlainString());
|
|
|
|
|
|
insuranceAccountViewListDTO.setOtherPaySum(otherSum.toPlainString());
|
|
|
|
|
|
insuranceAccountViewListDTO.setSocialNum(socialNum);
|
|
|
|
|
|
insuranceAccountViewListDTO.setFundNum(fundNum);
|
|
|
|
|
|
insuranceAccountViewListDTO.setOtherNum(otherNum);
|
|
|
|
|
|
viewDTOS.add(insuranceAccountViewListDTO);
|
|
|
|
|
|
viewDTOS.forEach(e -> {
|
|
|
|
|
|
e.setSocialPaySum(StringUtils.isBlank(e.getSocialPaySum()) ? "0" : e.getSocialPaySum());
|
|
|
|
|
|
e.setSocialNum(e.getSocialNum() == null ? 0 : e.getSocialNum());
|
|
|
|
|
|
e.setFundNum(e.getFundNum() == null ? 0 : e.getFundNum());
|
|
|
|
|
|
e.setFundPaySum(StringUtils.isBlank(e.getFundPaySum()) ? "0" : e.getFundPaySum());
|
|
|
|
|
|
e.setOtherPaySum(StringUtils.isBlank(e.getOtherPaySum()) ? "0" : e.getOtherPaySum());
|
|
|
|
|
|
e.setOtherNum(e.getOtherNum() == null ? 0 : e.getOtherNum());
|
|
|
|
|
|
e.setSum(SalaryEntityUtil.thousandthConvert(e.getSum()));
|
|
|
|
|
|
e.setSocialPaySum(SalaryEntityUtil.thousandthConvert(e.getSocialPaySum()));
|
|
|
|
|
|
e.setOtherPaySum(SalaryEntityUtil.thousandthConvert(e.getOtherPaySum()));
|
|
|
|
|
|
e.setFundPaySum(SalaryEntityUtil.thousandthConvert(e.getFundPaySum()));
|
|
|
|
|
|
});
|
|
|
|
|
|
return viewDTOS;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-01 17:40:19 +08:00
|
|
|
|
@Override
|
|
|
|
|
|
public void cacheWelfareField(List<String> welfareNames) {
|
|
|
|
|
|
String cacheKey = user.getUID() + SalaryItemConstant.SI_ACCOUNT_IMPORT_FIELD_SIGN;
|
|
|
|
|
|
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(welfareNames));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
public void cacheBalanceWelfareField(List<String> welfareNames) {
|
|
|
|
|
|
String cacheKey = user.getUID() + SalaryItemConstant.SI_ACCOUNT_BALANCE_IMPORT_FIELD_SIGN;
|
|
|
|
|
|
Util_DataCache.setObjVal(cacheKey, JsonUtil.toJsonString(welfareNames));
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-19 11:35:11 +08:00
|
|
|
|
public void accountOtherView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
|
|
|
|
|
|
int otherNum = 0;
|
|
|
|
|
|
BigDecimal otherPaySum = new BigDecimal("0");
|
|
|
|
|
|
for (InsuranceAccountDetailPO item : pos) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getOtherSum()) && SalaryEntityUtil.string2DoubleDefault0(item.getOtherSum()) != 0.0) {
|
|
|
|
|
|
if (!PaymentStatusEnum.BALANCE.getValue().equals(item.getPaymentStatus())) {
|
|
|
|
|
|
otherNum += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
otherPaySum = otherPaySum.add(new BigDecimal(item.getOtherSum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
dto.setOtherNum(otherNum);
|
|
|
|
|
|
dto.setOtherPaySum(otherPaySum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountFundView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
|
|
|
|
|
|
int fundNum = 0;
|
|
|
|
|
|
BigDecimal fundPaySum = new BigDecimal("0");
|
|
|
|
|
|
for (InsuranceAccountDetailPO item : pos) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getFundSum()) && SalaryEntityUtil.string2DoubleDefault0(item.getFundSum()) != 0.0) {
|
|
|
|
|
|
if (!PaymentStatusEnum.BALANCE.getValue().equals(item.getPaymentStatus())) {
|
|
|
|
|
|
fundNum += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
fundPaySum = fundPaySum.add(new BigDecimal(item.getFundSum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
dto.setFundNum(fundNum);
|
|
|
|
|
|
dto.setFundPaySum(fundPaySum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public void accountSocialView(InsuranceAccountViewListDTO dto, List<InsuranceAccountDetailPO> pos) {
|
|
|
|
|
|
int socialNum = 0;
|
|
|
|
|
|
BigDecimal socialPaySum = new BigDecimal("0");
|
|
|
|
|
|
for (InsuranceAccountDetailPO item : pos) {
|
|
|
|
|
|
if (StringUtils.isNotBlank(item.getSocialSum()) && SalaryEntityUtil.string2DoubleDefault0(item.getSocialSum()) != 0.0 ) {
|
|
|
|
|
|
if (!PaymentStatusEnum.BALANCE.getValue().equals(item.getPaymentStatus())) {
|
|
|
|
|
|
socialNum += 1;
|
|
|
|
|
|
}
|
|
|
|
|
|
socialPaySum = socialPaySum.add(new BigDecimal(item.getSocialSum()));
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
dto.setSocialNum(socialNum);
|
|
|
|
|
|
dto.setSocialPaySum(socialPaySum.toPlainString());
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 查询台账id是否已经薪资核算核算过
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public int checkIfBusinessAccounting(InsuranceAccountBatchPO param) {
|
|
|
|
|
|
List<SIAccountUtilDTO> list = getSIAccountUtilMapper().checkIfBusinessaccounting(param.getId());
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
|
|
|
|
|
|
return (int) list.stream().filter( f -> {
|
|
|
|
|
|
String billMonthBySob = sdf.format(convertSalaryMonthToBillMonth(f.getSalaryMonth(), f.getSocialSecurityCycleType()));
|
|
|
|
|
|
return f.getBillmonth().equals(billMonthBySob.substring(0, 7));
|
|
|
|
|
|
}).count();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public Date convertSalaryMonthToBillMonth(Date salaryMonth, Integer socialSecurityCycleType) {
|
|
|
|
|
|
Calendar calendar = Calendar.getInstance();
|
|
|
|
|
|
calendar.setTime(salaryMonth);
|
|
|
|
|
|
calendar.add(Calendar.MONTH, socialSecurityCycleType - 3);
|
|
|
|
|
|
return calendar.getTime();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新薪资台账
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param param
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void updateById(InsuranceAccountBatchPO param) {
|
|
|
|
|
|
getInsuranceAccountBatchMapper().updateById(param);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 更新福利台账
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void updateByEmployeeIdAndBillMonth(InsuranceAccountDetailPO insuranceAccountDetailPO) {
|
|
|
|
|
|
getInsuranceAccountDetailMapper().updateByEmployeeIdAndBillMonth(insuranceAccountDetailPO);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****以上代码为SIAccountBiz中方法逻辑迁移,旨在减少Biz类的使用*****/
|
|
|
|
|
|
|
2022-04-11 19:07:35 +08:00
|
|
|
|
}
|