weaver-hrm-salary/src/com/engine/salary/sys/service/impl/SalarySysConfServiceImpl.java

917 lines
50 KiB
Java
Raw Normal View History

2022-08-11 10:27:15 +08:00
package com.engine.salary.sys.service.impl;
import com.api.formmode.mybatis.util.SqlProxyHandle;
2022-10-10 09:43:57 +08:00
import com.cloudstore.dev.api.util.Util_DataCache;
2022-08-11 10:27:15 +08:00
import com.engine.core.impl.Service;
2022-10-10 09:43:57 +08:00
import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.AddUpSituation;
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
import com.engine.salary.entity.salaryacct.po.ExcelAcctResultPO;
import com.engine.salary.entity.salaryacct.po.SalaryAcctResultPO;
import com.engine.salary.entity.salaryarchive.po.SalaryArchiveItemPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountBatchPO;
import com.engine.salary.entity.siaccount.po.InsuranceAccountDetailPO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesFundSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesOtherSchemePO;
import com.engine.salary.entity.siarchives.po.InsuranceArchivesSocialSchemePO;
import com.engine.salary.entity.sischeme.po.InsuranceSchemeDetailPO;
import com.engine.salary.entity.taxdeclaration.po.TaxDeclarationDetailPO;
import com.engine.salary.exception.SalaryRunTimeException;
2022-10-10 09:43:57 +08:00
import com.engine.salary.mapper.archive.SalaryArchiveItemMapper;
import com.engine.salary.mapper.datacollection.AddUpDeductionMapper;
import com.engine.salary.mapper.datacollection.AddUpSituationMapper;
import com.engine.salary.mapper.datacollection.OtherDeductionMapper;
import com.engine.salary.mapper.salaryacct.ExcelAcctResultMapper;
import com.engine.salary.mapper.salaryacct.SalaryAcctResultMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountBatchMapper;
import com.engine.salary.mapper.siaccount.InsuranceAccountDetailMapper;
import com.engine.salary.mapper.siarchives.FundSchemeMapper;
import com.engine.salary.mapper.siarchives.OtherSchemeMapper;
import com.engine.salary.mapper.siarchives.SocialSchemeMapper;
import com.engine.salary.mapper.sischeme.InsuranceSchemeDetailMapper;
2022-08-11 10:27:15 +08:00
import com.engine.salary.mapper.sys.SalarySysConfMapper;
2022-10-10 09:43:57 +08:00
import com.engine.salary.mapper.taxdeclaration.TaxDeclarationDetailMapper;
2022-10-17 19:04:14 +08:00
import com.engine.salary.sys.constant.SalarySysConstant;
2022-09-27 17:43:43 +08:00
import com.engine.salary.sys.entity.param.AppSettingSaveParam;
2022-09-19 16:44:32 +08:00
import com.engine.salary.sys.entity.param.OrderRuleParam;
2022-08-11 10:27:15 +08:00
import com.engine.salary.sys.entity.po.SalarySysConfPO;
2022-09-28 10:08:51 +08:00
import com.engine.salary.sys.entity.vo.AppSettingVO;
2022-09-19 16:44:32 +08:00
import com.engine.salary.sys.entity.vo.OrderRuleVO;
2022-10-10 09:43:57 +08:00
import com.engine.salary.sys.enums.*;
2022-08-11 10:27:15 +08:00
import com.engine.salary.sys.service.SalarySysConfService;
2022-10-10 09:43:57 +08:00
import com.engine.salary.util.db.MapperProxyFactory;
2022-10-12 10:44:39 +08:00
import com.google.common.collect.Lists;
2022-10-17 11:14:21 +08:00
import com.weaver.util.threadPool.ThreadPoolUtil;
import com.weaver.util.threadPool.constant.ModulePoolEnum;
import com.weaver.util.threadPool.entity.LocalRunnable;
2022-08-11 10:27:15 +08:00
import dm.jdbc.util.IdGenerator;
2022-10-10 09:43:57 +08:00
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
2022-10-12 10:44:39 +08:00
import org.apache.ibatis.session.SqlSession;
import weaver.conn.mybatis.MyBatisFactory;
2022-10-10 09:43:57 +08:00
import weaver.general.BaseBean;
2022-08-11 10:27:15 +08:00
2022-10-12 14:24:01 +08:00
import java.util.*;
2022-10-10 09:43:57 +08:00
import java.util.concurrent.*;
2022-08-11 10:27:15 +08:00
2022-09-19 16:44:32 +08:00
import static com.engine.salary.sys.constant.SalarySysConstant.*;
2022-10-10 09:43:57 +08:00
import static java.util.concurrent.Executors.*;
2022-09-19 13:41:09 +08:00
2022-08-11 10:27:15 +08:00
/**
* 薪酬系统配置类
* <p>Copyright: Copyright (c) 2022</p>
* <p>Company: 泛微软件</p>
*
* @author qiantao
* @version 1.0
**/
public class SalarySysConfServiceImpl extends Service implements SalarySysConfService {
private SalarySysConfMapper getSalarySysConfMapper() {
return SqlProxyHandle.getProxy(SalarySysConfMapper.class);
}
2022-10-17 11:14:21 +08:00
private static final ExecutorService fixedThreadPool = newFixedThreadPool(3);
2022-10-10 09:43:57 +08:00
private SalaryAcctResultMapper getSalaryAcctResultMapper() {
return MapperProxyFactory.getProxy(SalaryAcctResultMapper.class);
}
private ExcelAcctResultMapper getExcelAcctResultMapper() {
return MapperProxyFactory.getProxy(ExcelAcctResultMapper.class);
}
private TaxDeclarationDetailMapper getTaxDeclarationDetailMapper() {
return MapperProxyFactory.getProxy(TaxDeclarationDetailMapper.class);
}
private InsuranceSchemeDetailMapper getInsuranceSchemeDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceSchemeDetailMapper.class);
}
private SocialSchemeMapper getSocialSchemeMapper() {
return MapperProxyFactory.getProxy(SocialSchemeMapper.class);
}
private FundSchemeMapper getFundSchemeMapper() {
return MapperProxyFactory.getProxy(FundSchemeMapper.class);
}
private OtherSchemeMapper getOtherSchemeMapper() {
return MapperProxyFactory.getProxy(OtherSchemeMapper.class);
}
private InsuranceAccountBatchMapper getInsuranceAccountBatchMapper() {
return MapperProxyFactory.getProxy(InsuranceAccountBatchMapper.class);
}
private InsuranceAccountDetailMapper getInsuranceAccountDetailMapper() {
return MapperProxyFactory.getProxy(InsuranceAccountDetailMapper.class);
}
private SalaryArchiveItemMapper getSalaryArchiveItemMapper() {
return MapperProxyFactory.getProxy(SalaryArchiveItemMapper.class);
}
private AddUpDeductionMapper getAddUpDeductionMapper() {
return MapperProxyFactory.getProxy(AddUpDeductionMapper.class);
}
private OtherDeductionMapper getOtherDeductionMapper() {
return MapperProxyFactory.getProxy(OtherDeductionMapper.class);
}
private AddUpSituationMapper getAddUpSituationMapper() {
return MapperProxyFactory.getProxy(AddUpSituationMapper.class);
}
2022-08-11 10:27:15 +08:00
2022-10-17 19:04:14 +08:00
static SalarySysConfServiceImpl salarySysConfService = new SalarySysConfServiceImpl();
2022-08-11 10:27:15 +08:00
/**
* 操作是否需要申报功能
*
* @param flag 开启 0/关闭 1/重新开启 2
* @return 执行结果
*/
2022-10-10 09:43:57 +08:00
@Override
2022-08-11 10:27:15 +08:00
public boolean operateTaxDeclarationFunction(TaxDeclarationFunctionEnum flag) {
Date date = new Date();
2022-11-08 11:22:56 +08:00
SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode(TAX_DECLARATION_FUNCTION);
2022-08-11 10:27:15 +08:00
if (taxDeclarationFunction == null) {
2022-11-08 11:22:56 +08:00
taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey(TAX_DECLARATION_FUNCTION).confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build();
2022-08-11 10:27:15 +08:00
getSalarySysConfMapper().insertIgnoreNull(taxDeclarationFunction);
} else {
TaxDeclarationFunctionEnum oldFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue());
//不改变
if (flag == oldFunctionEnum) {
return true;
}
//关闭
2022-11-10 09:46:30 +08:00
if (flag == TaxDeclarationFunctionEnum.CLOSURE || flag == TaxDeclarationFunctionEnum.OPEN) {
2022-08-11 10:27:15 +08:00
taxDeclarationFunction.setConfValue(flag.getValue());
taxDeclarationFunction.setTitle(flag.getDefaultLabel());
taxDeclarationFunction.setUpdateTime(new Date());
}
2022-11-10 09:46:30 +08:00
//重启 (从关闭到开启)
2022-08-11 10:27:15 +08:00
if (flag == TaxDeclarationFunctionEnum.OPEN && oldFunctionEnum == TaxDeclarationFunctionEnum.CLOSURE) {
2022-11-10 09:46:30 +08:00
taxDeclarationFunction.setConfValue(TaxDeclarationFunctionEnum.REBOOT.getValue());
taxDeclarationFunction.setTitle(TaxDeclarationFunctionEnum.REBOOT.getDefaultLabel());
2022-08-11 10:27:15 +08:00
taxDeclarationFunction.setUpdateTime(new Date());
}
getSalarySysConfMapper().updateIgnoreNull(taxDeclarationFunction);
}
return true;
}
2022-08-24 20:00:57 +08:00
2022-11-08 11:22:56 +08:00
/**
2022-11-10 09:46:30 +08:00
* @description 获取申报功能状态
2022-11-08 11:22:56 +08:00
* @return Boolean
* @author Harryxzy
* @date 2022/11/7 17:05
*/
2022-11-10 09:46:30 +08:00
public TaxDeclarationFunctionEnum getTaxDeclaration(){
2022-11-08 11:22:56 +08:00
SalarySysConfPO taxDeclarationFunction = salarySysConfService.getOneByCode(TAX_DECLARATION_FUNCTION);
2022-11-10 09:46:30 +08:00
if(taxDeclarationFunction == null){
// 默认开启
return TaxDeclarationFunctionEnum.OPEN;
2022-11-08 11:22:56 +08:00
}
2022-11-10 09:46:30 +08:00
TaxDeclarationFunctionEnum taxDeclarationFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue());
return taxDeclarationFunctionEnum;
2022-11-08 11:22:56 +08:00
}
2022-08-24 20:00:57 +08:00
@Override
public SalarySysConfPO getOneByCode(String code) {
return getSalarySysConfMapper().getOneByCode(code);
}
@Override
public List<SalarySysConfPO> listSome(SalarySysConfPO po) {
return getSalarySysConfMapper().listSome(po);
}
@Override
public void save(SalarySysConfPO salarySysConfPO) {
salarySysConfPO.setId(IdGenerator.generate());
salarySysConfPO.setUpdateTime(new Date());
salarySysConfPO.setCreateTime(new Date());
salarySysConfPO.setDeleteType(0);
salarySysConfPO.setOrderWeight(0);
2022-09-19 13:41:09 +08:00
salarySysConfPO.setModule(CUSTOM_CODE);
getSalarySysConfMapper().insertIgnoreNull(salarySysConfPO);
}
@Override
public void update(SalarySysConfPO salarySysConfPO) {
SalarySysConfPO po = getSalarySysConfMapper().getById(salarySysConfPO.getId());
if (po == null) {
throw new SalaryRunTimeException("系统配置不存在");
}
salarySysConfPO.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(salarySysConfPO);
}
2022-09-15 15:41:48 +08:00
@Override
public SalarySysConfPO getById(Long id) {
SalarySysConfPO po = getSalarySysConfMapper().getById(id);
if (po == null) {
throw new SalaryRunTimeException("系统配置不存在");
}
return po;
}
2022-09-19 13:41:09 +08:00
@Override
public void updateByCode(SalarySysConfPO po) {
SalarySysConfPO sysConfPO = getSalarySysConfMapper().getOneByCode(po.getConfKey());
if (sysConfPO == null) {
throw new SalaryRunTimeException("系统配置不存在");
}
sysConfPO.setConfValue(po.getConfValue());
sysConfPO.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(sysConfPO);
}
@Override
2022-09-19 16:44:32 +08:00
public OrderRuleVO orderRule() {
SalarySysConfPO rulePO = getSalarySysConfMapper().getOneByCode(ORDER_RULE_CODE);
SalarySysConfPO orderPO = getSalarySysConfMapper().getOneByCode(ASCORDESC_CODE);
OrderRuleVO orderRuleVO = OrderRuleVO.builder().build();
if (rulePO == null) {
2022-09-19 18:21:34 +08:00
orderRuleVO.setOrderRule(OrderRuleEnum.DSPORDER.getValue());
2022-09-19 16:44:32 +08:00
} else {
2022-09-19 18:21:34 +08:00
orderRuleVO.setOrderRule(OrderRuleEnum.parseByValue(rulePO.getConfValue()).getValue());
2022-09-19 16:44:32 +08:00
}
if (orderPO == null) {
2022-09-19 18:21:34 +08:00
orderRuleVO.setAscOrDesc(AscOrDescEnum.ASC.getValue());
2022-09-19 16:44:32 +08:00
} else {
2022-09-19 18:21:34 +08:00
orderRuleVO.setAscOrDesc(AscOrDescEnum.parseByValue(orderPO.getConfValue()).getValue());
2022-09-19 16:44:32 +08:00
}
return orderRuleVO;
}
@Override
public void updateOrderRule(OrderRuleParam param) {
if (param == null || OrderRuleEnum.parseByValue(param.getOrderRule()) == null || AscOrDescEnum.parseByValue(param.getAscOrDesc()) == null) {
throw new SalaryRunTimeException("配置内容异常!");
}
//更新排序规则
SalarySysConfPO orderRulePo = getSalarySysConfMapper().getOneByCode(ORDER_RULE_CODE);
if (orderRulePo == null) {
SalarySysConfPO build = SalarySysConfPO.builder()
.id(IdGenerator.generate())
.confKey(ORDER_RULE_CODE)
.confValue(param.getOrderRule())
.title("排序规则")
.orderWeight(0)
.module("basic")
.updateTime(new Date())
.createTime(new Date())
.deleteType(0)
.build();
getSalarySysConfMapper().insertIgnoreNull(build);
} else {
orderRulePo.setConfValue(param.getOrderRule());
orderRulePo.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(orderRulePo);
}
//更新顺序配置
SalarySysConfPO ascOrDescPo = getSalarySysConfMapper().getOneByCode(ASCORDESC_CODE);
if (ascOrDescPo == null) {
SalarySysConfPO build = SalarySysConfPO.builder()
.id(IdGenerator.generate())
.confKey(ASCORDESC_CODE)
.confValue(param.getAscOrDesc())
.title("排序顺序")
.orderWeight(0)
.module("basic")
.updateTime(new Date())
.createTime(new Date())
.deleteType(0)
.build();
getSalarySysConfMapper().insertIgnoreNull(build);
} else {
ascOrDescPo.setConfValue(param.getAscOrDesc());
ascOrDescPo.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(ascOrDescPo);
2022-09-19 13:41:09 +08:00
}
}
2022-09-22 10:10:18 +08:00
@Override
public void saveMatchEmployeeModeRule(String rule) {
if (MatchEmployeeModeEnum.parseByValue(rule) == null) {
throw new SalaryRunTimeException("无效规则!");
}
2022-10-10 09:43:57 +08:00
saveSettingByType(rule, MATCH_EMPLOYEE_MODE, "定位人员规则", "basic");
2022-09-22 10:10:18 +08:00
}
2022-09-27 17:43:43 +08:00
@Override
public void saveAppSetting(AppSettingSaveParam param) {
String openAcctResultSum = param.getOpenAcctResultSum();
2022-10-10 09:43:57 +08:00
saveSettingByType(openAcctResultSum, OPEN_ACCT_RESULT_SUM, "开启核算结果合并", "app");
}
@Override
public Map<String, Object> saveEncryptSetting(AppSettingSaveParam param) {
Map<String, Object> resultMap = new HashMap<>();
2022-10-17 11:14:21 +08:00
resultMap.put("isSuccess", true);
2022-10-12 14:24:01 +08:00
String progressId = UUID.randomUUID().toString();
resultMap.put("progressId", progressId);
2022-10-17 19:04:14 +08:00
SalarySysConfPO sysConfPo = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
if (ObjectUtils.isNotEmpty(sysConfPo) && sysConfPo.getConfValue().equals(param.getIsOpenEncrypt())) {
return resultMap;
} else if (ObjectUtils.isEmpty(sysConfPo) && OpenEnum.OPEN.getValue().equals(param.getIsOpenEncrypt())) {
return resultMap;
}
2022-10-10 09:43:57 +08:00
try {
if (ObjectUtils.isNotEmpty(Util_DataCache.getObjVal(AES_ENCRYPT_IN_PROGRESS))) {
resultMap.put("msg", "数据库处理上次操作中,请稍后操作。");
return resultMap;
}
Util_DataCache.setObjVal(AES_ENCRYPT_IN_PROGRESS, 1);
2022-10-12 14:36:21 +08:00
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "in_progress");
2022-10-10 09:43:57 +08:00
String isOpenEncrypt = param.getIsOpenEncrypt();
if (StringUtils.isNotEmpty(isOpenEncrypt)) {
2022-10-12 11:17:30 +08:00
if (isOpenEncrypt.equals(OpenEnum.OPEN.getValue())) {
//对数据库数据加解密
2022-10-17 11:14:21 +08:00
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.erkai, "saveEncryptSetting", new LocalRunnable() {
@Override
public void execute() {
2022-10-17 11:46:59 +08:00
saveSettingByType(isOpenEncrypt, OPEN_APPLICATION_ENCRYPT, "开启加密设置", "app");
2022-10-17 11:14:21 +08:00
Boolean aBoolean = encryptOrDecryptDbWithAsync(isOpenEncrypt, progressId);
}
});
2022-10-12 14:24:01 +08:00
} else if (isOpenEncrypt.equals(OpenEnum.OFF.getValue())) {
2022-10-17 11:14:21 +08:00
ThreadPoolUtil.fixedPoolExecute(ModulePoolEnum.erkai, "saveEncryptSetting", new LocalRunnable() {
@Override
public void execute() {
Boolean aBoolean = encryptOrDecryptDbWithAsync(isOpenEncrypt, progressId);
2022-10-17 11:46:59 +08:00
saveSettingByType(isOpenEncrypt, OPEN_APPLICATION_ENCRYPT, "开启加密设置", "app");
2022-10-17 11:14:21 +08:00
}
});
2022-10-12 11:17:30 +08:00
//不要调换方法的位置
}
2022-10-10 09:43:57 +08:00
}
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
2022-10-17 11:14:21 +08:00
resultMap.put("isSuccess", true);
2022-10-10 09:43:57 +08:00
return resultMap;
} catch (Exception e) {
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
2022-10-17 11:14:21 +08:00
resultMap.put("isSuccess", false);
2022-10-10 09:43:57 +08:00
resultMap.put("msg", "系统异常请联系管理员");
return resultMap;
}
}
2022-10-12 14:24:01 +08:00
@Override
public Map<String, Object> getEncryptProgress(String progressId) {
Map<String, Object> resultMap = new HashMap<>();
String progressStatue = (String) Util_DataCache.getObjVal(ENCRYPT_IN_PROGRESS + progressId);
if (StringUtils.isNotEmpty(progressStatue)) {
resultMap.put("progress_statue", progressStatue);
} else {
resultMap.put("progress_statue", "success");
}
return resultMap;
}
2022-11-10 09:46:30 +08:00
@Override
public Date getTaxDeclarationRebootDate() {
Date date = getSalarySysConfMapper().getTaxDeclarationRebootDate();
return date;
}
2022-10-10 09:43:57 +08:00
/**
* 保存或者修改应用设置
*
* @param confValue
* @param confKey
* @param title
* @param app
*/
private void saveSettingByType(String confValue, String confKey, String title, String app) {
SalarySysConfPO po = getOneByCode(confKey);
2022-09-27 17:43:43 +08:00
if (po == null) {
SalarySysConfPO build = SalarySysConfPO.builder()
.id(IdGenerator.generate())
2022-10-10 09:43:57 +08:00
.confKey(confKey)
.confValue(confValue)
.title(title)
2022-09-27 17:43:43 +08:00
.orderWeight(0)
2022-10-10 09:43:57 +08:00
.module(app)
2022-09-27 17:43:43 +08:00
.updateTime(new Date())
.createTime(new Date())
.deleteType(0)
.build();
getSalarySysConfMapper().insertIgnoreNull(build);
} else {
2022-10-10 09:43:57 +08:00
po.setConfValue(confValue);
2022-09-27 17:43:43 +08:00
po.setUpdateTime(new Date());
getSalarySysConfMapper().updateIgnoreNull(po);
}
}
2022-09-28 10:08:51 +08:00
@Override
public AppSettingVO appSetting() {
AppSettingVO appSettingVO = AppSettingVO.builder().build();
2022-10-10 09:43:57 +08:00
//返回按钮状态
SalarySysConfPO condition = new SalarySysConfPO();
condition.setDeleteType(0);
List<SalarySysConfPO> salarySysConfPOS = getSalarySysConfMapper().listSome(condition);
if (CollectionUtils.isNotEmpty(salarySysConfPOS)) {
salarySysConfPOS.forEach(salarySysConfPO -> {
switch (salarySysConfPO.getConfKey()) {
case OPEN_ACCT_RESULT_SUM:
appSettingVO.setOpenAcctResultSum(salarySysConfPO.getConfValue());
break;
case OPEN_APPLICATION_ENCRYPT:
appSettingVO.setIsOpenEncrypt(salarySysConfPO.getConfValue());
2022-11-08 13:58:21 +08:00
break;
2022-10-10 09:43:57 +08:00
default:
break;
}
});
}
2022-11-10 09:46:30 +08:00
List<SalarySysConfPO> taxDeclarationFunction = getSalarySysConfMapper().listSome(SalarySysConfPO.builder().deleteType(0).confKey(TAX_DECLARATION_FUNCTION).build());
if(taxDeclarationFunction == null || taxDeclarationFunction.size() == 0){
// 默认开启报税功能
appSettingVO.setIsOpenTaxDeclaration("1");
}else{
appSettingVO.setIsOpenTaxDeclaration(taxDeclarationFunction.get(0).getConfValue());
}
2022-10-10 09:43:57 +08:00
//默认加密开启
if (StringUtils.isEmpty(appSettingVO.getIsOpenEncrypt())) {
appSettingVO.setIsOpenEncrypt("1");
2022-09-28 10:08:51 +08:00
}
return appSettingVO;
}
2022-10-12 14:24:01 +08:00
private Boolean encryptOrDecryptDbWithAsync(String isOpenEncrypt, String progressId) {
2022-10-10 09:43:57 +08:00
BaseBean baseBean = new BaseBean();
baseBean.writeLog("应用设置加解密数据开始");
2022-10-12 14:24:01 +08:00
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "in_progress");
2022-10-10 09:43:57 +08:00
//多线程批量更新需要加密的表
try {
Future<Integer> submit = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<SalaryAcctResultPO> salaryAcctResultPos = getSalaryAcctResultMapper().listAll();
if (CollectionUtils.isNotEmpty(salaryAcctResultPos)) {
salaryAcctResultPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setResultValue(AESEncryptUtil.closeEncryptSetting(po.getResultValue()));
} else {
po.setResultValue(AESEncryptUtil.encrypt(po.getResultValue()));
}
});
2022-10-17 14:18:01 +08:00
List<List<SalaryAcctResultPO>> partition = Lists.partition(salaryAcctResultPos, 50);
2022-10-12 10:44:39 +08:00
SalaryAcctResultMapper mapper = sqlSession.getMapper(SalaryAcctResultMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_salary_acct_result");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_salary_acct_result:" + e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit1 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<ExcelAcctResultPO> excelAcctResultPos = getExcelAcctResultMapper().listSome(new ExcelAcctResultPO());
if (CollectionUtils.isNotEmpty(excelAcctResultPos)) {
excelAcctResultPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setResultValue(AESEncryptUtil.closeEncryptSetting(po.getResultValue()));
} else {
po.setResultValue(AESEncryptUtil.encrypt(po.getResultValue()));
}
});
2022-10-17 14:18:01 +08:00
List<List<ExcelAcctResultPO>> partition = Lists.partition(excelAcctResultPos, 50);
2022-10-12 10:44:39 +08:00
ExcelAcctResultMapper mapper = sqlSession.getMapper(ExcelAcctResultMapper.class);
partition.forEach(mapper::batchUpdate);
baseBean.writeLog("hrsa_excel_acct_result:");
sqlSession.commit();
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_excel_acct_result:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit2 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<TaxDeclarationDetailPO> taxDeclarationDetailPos = getTaxDeclarationDetailMapper().listAll();
if (CollectionUtils.isNotEmpty(taxDeclarationDetailPos)) {
taxDeclarationDetailPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setFieldValue(AESEncryptUtil.closeEncryptSetting(po.getFieldValue()));
} else {
po.setFieldValue(AESEncryptUtil.encrypt(po.getFieldValue()));
}
});
2022-10-17 14:18:01 +08:00
List<List<TaxDeclarationDetailPO>> partition = Lists.partition(taxDeclarationDetailPos, 50);
2022-10-12 10:44:39 +08:00
TaxDeclarationDetailMapper mapper = sqlSession.getMapper(TaxDeclarationDetailMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_tax_declaration_detail");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_tax_declaration_detail:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit3 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<InsuranceSchemeDetailPO> insuranceSchemeDetailPos = getInsuranceSchemeDetailMapper().listAll();
if (CollectionUtils.isNotEmpty(insuranceSchemeDetailPos)) {
insuranceSchemeDetailPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setUpperLimit(AESEncryptUtil.closeEncryptSetting(po.getUpperLimit()));
po.setFixedCost(AESEncryptUtil.closeEncryptSetting(po.getFixedCost()));
po.setLowerLimit(AESEncryptUtil.closeEncryptSetting(po.getLowerLimit()));
} else {
po.setUpperLimit(AESEncryptUtil.encrypt(po.getUpperLimit()));
po.setFixedCost(AESEncryptUtil.encrypt(po.getFixedCost()));
po.setLowerLimit(AESEncryptUtil.encrypt(po.getLowerLimit()));
}
});
2022-10-17 14:18:01 +08:00
List<List<InsuranceSchemeDetailPO>> partition = Lists.partition(insuranceSchemeDetailPos, 50);
2022-10-12 10:44:39 +08:00
InsuranceSchemeDetailMapper mapper = sqlSession.getMapper(InsuranceSchemeDetailMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_scheme_detail");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_scheme_detail:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit4 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<InsuranceArchivesSocialSchemePO> insuranceArchivesSocialSchemePos = getSocialSchemeMapper().listAll();
if (CollectionUtils.isNotEmpty(insuranceArchivesSocialSchemePos)) {
insuranceArchivesSocialSchemePos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setSocialPaymentBaseString(AESEncryptUtil.closeEncryptSetting(po.getSocialPaymentBaseString()));
} else {
po.setSocialPaymentBaseString(AESEncryptUtil.encrypt(po.getSocialPaymentBaseString()));
}
});
2022-10-17 14:18:01 +08:00
List<List<InsuranceArchivesSocialSchemePO>> partition = Lists.partition(insuranceArchivesSocialSchemePos, 50);
2022-10-12 10:44:39 +08:00
SocialSchemeMapper mapper = sqlSession.getMapper(SocialSchemeMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_social_archives:");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_social_archives:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit5 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<InsuranceArchivesFundSchemePO> insuranceArchivesFundSchemePos = getFundSchemeMapper().listAll();
if (CollectionUtils.isNotEmpty(insuranceArchivesFundSchemePos)) {
insuranceArchivesFundSchemePos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setFundPaymentBaseString(AESEncryptUtil.closeEncryptSetting(po.getFundPaymentBaseString()));
} else {
po.setFundPaymentBaseString(AESEncryptUtil.encrypt(po.getFundPaymentBaseString()));
}
});
2022-10-17 14:18:01 +08:00
List<List<InsuranceArchivesFundSchemePO>> partition = Lists.partition(insuranceArchivesFundSchemePos, 50);
2022-10-12 10:44:39 +08:00
FundSchemeMapper mapper = sqlSession.getMapper(FundSchemeMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_fund_archives:");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_fund_archives:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit6 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<InsuranceArchivesOtherSchemePO> insuranceArchivesOtherSchemePos = getOtherSchemeMapper().listAll();
if (CollectionUtils.isNotEmpty(insuranceArchivesOtherSchemePos)) {
insuranceArchivesOtherSchemePos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setOtherPaymentBaseString(AESEncryptUtil.closeEncryptSetting(po.getOtherPaymentBaseString()));
} else {
po.setOtherPaymentBaseString(AESEncryptUtil.encrypt(po.getOtherPaymentBaseString()));
}
});
2022-10-17 14:18:01 +08:00
List<List<InsuranceArchivesOtherSchemePO>> partition = Lists.partition(insuranceArchivesOtherSchemePos, 50);
2022-10-12 10:44:39 +08:00
OtherSchemeMapper mapper = sqlSession.getMapper(OtherSchemeMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_other_archives");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_other_archives:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit7 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<InsuranceAccountBatchPO> insuranceAccountBatchPos = getInsuranceAccountBatchMapper().listAll();
if (CollectionUtils.isNotEmpty(insuranceAccountBatchPos)) {
insuranceAccountBatchPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setOtherPay(AESEncryptUtil.closeEncryptSetting(po.getOtherPay()));
po.setSocialPay(AESEncryptUtil.closeEncryptSetting(po.getSocialPay()));
po.setFundPay(AESEncryptUtil.closeEncryptSetting(po.getFundPay()));
} else {
po.setOtherPay(AESEncryptUtil.encrypt(po.getOtherPay()));
po.setSocialPay(AESEncryptUtil.encrypt(po.getSocialPay()));
po.setFundPay(AESEncryptUtil.encrypt(po.getFundPay()));
}
});
2022-10-17 14:18:01 +08:00
List<List<InsuranceAccountBatchPO>> partition = Lists.partition(insuranceAccountBatchPos, 50);
2022-10-12 10:44:39 +08:00
InsuranceAccountBatchMapper mapper = sqlSession.getMapper(InsuranceAccountBatchMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_bill_batch:");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_bill_batch:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit8 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<InsuranceAccountDetailPO> insuranceAccountDetailPos = getInsuranceAccountDetailMapper().listAll();
if (CollectionUtils.isNotEmpty(insuranceAccountDetailPos)) {
insuranceAccountDetailPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setSocialPaymentBaseString(AESEncryptUtil.closeEncryptSetting(po.getSocialPaymentBaseString()));
po.setFundPaymentBaseString(AESEncryptUtil.closeEncryptSetting(po.getFundPaymentBaseString()));
po.setOtherPaymentBaseString(AESEncryptUtil.closeEncryptSetting(po.getOtherPaymentBaseString()));
2022-10-17 13:53:37 +08:00
po.setSocialPerJson(AESEncryptUtil.closeEncryptSetting(po.getSocialPerJson()));
po.setSocialPerSum(AESEncryptUtil.closeEncryptSetting(po.getSocialPerSum()));
2022-10-10 09:43:57 +08:00
po.setFundPerJson(AESEncryptUtil.closeEncryptSetting(po.getFundPerJson()));
po.setFundPerSum(AESEncryptUtil.closeEncryptSetting(po.getFundPerSum()));
po.setOtherPerJson(AESEncryptUtil.closeEncryptSetting(po.getOtherPerJson()));
po.setOtherPerSum(AESEncryptUtil.closeEncryptSetting(po.getOtherPerSum()));
po.setPerSum(AESEncryptUtil.closeEncryptSetting(po.getPerSum()));
2022-10-18 11:42:54 +08:00
po.setSocialComJson(AESEncryptUtil.closeEncryptSetting(po.getSocialComJson()));
po.setSocialComSum(AESEncryptUtil.closeEncryptSetting(po.getSocialComSum()));
2022-10-10 09:43:57 +08:00
po.setComSum(AESEncryptUtil.closeEncryptSetting(po.getComSum()));
po.setSocialSum(AESEncryptUtil.closeEncryptSetting(po.getSocialSum()));
po.setFundSum(AESEncryptUtil.closeEncryptSetting(po.getFundSum()));
po.setOtherSum(AESEncryptUtil.closeEncryptSetting(po.getOtherSum()));
po.setTotal(AESEncryptUtil.closeEncryptSetting(po.getTotal()));
} else {
po.setSocialPaymentBaseString(AESEncryptUtil.encrypt(po.getSocialPaymentBaseString()));
po.setFundPaymentBaseString(AESEncryptUtil.encrypt(po.getFundPaymentBaseString()));
po.setOtherPaymentBaseString(AESEncryptUtil.encrypt(po.getOtherPaymentBaseString()));
2022-10-17 13:53:37 +08:00
po.setSocialPerJson(AESEncryptUtil.encrypt(po.getSocialPerJson()));
po.setSocialPerSum(AESEncryptUtil.encrypt(po.getSocialPerSum()));
2022-10-10 09:43:57 +08:00
po.setFundPerJson(AESEncryptUtil.encrypt(po.getFundPerJson()));
po.setFundPerSum(AESEncryptUtil.encrypt(po.getFundPerSum()));
po.setOtherPerJson(AESEncryptUtil.encrypt(po.getOtherPerJson()));
po.setOtherPerSum(AESEncryptUtil.encrypt(po.getOtherPerSum()));
po.setPerSum(AESEncryptUtil.encrypt(po.getPerSum()));
2022-10-18 11:42:54 +08:00
po.setSocialComJson(AESEncryptUtil.encrypt(po.getSocialComJson()));
po.setSocialComSum(AESEncryptUtil.encrypt(po.getSocialComSum()));
2022-10-10 09:43:57 +08:00
po.setComSum(AESEncryptUtil.encrypt(po.getComSum()));
po.setSocialSum(AESEncryptUtil.encrypt(po.getSocialSum()));
po.setFundSum(AESEncryptUtil.encrypt(po.getFundSum()));
po.setOtherSum(AESEncryptUtil.encrypt(po.getOtherSum()));
po.setTotal(AESEncryptUtil.encrypt(po.getTotal()));
}
});
2022-10-17 14:18:01 +08:00
List<List<InsuranceAccountDetailPO>> partition = Lists.partition(insuranceAccountDetailPos, 50);
2022-10-12 10:44:39 +08:00
InsuranceAccountDetailMapper mapper = sqlSession.getMapper(InsuranceAccountDetailMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_bill_detail:");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_bill_detail:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit9 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<SalaryArchiveItemPO> salaryArchiveItemPos = getSalaryArchiveItemMapper().listAll();
if (CollectionUtils.isNotEmpty(salaryArchiveItemPos)) {
salaryArchiveItemPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setItemValue(AESEncryptUtil.closeEncryptSetting(po.getItemValue()));
} else {
po.setItemValue(AESEncryptUtil.encrypt(po.getItemValue()));
}
});
2022-10-17 14:18:01 +08:00
List<List<SalaryArchiveItemPO>> partition = Lists.partition(salaryArchiveItemPos, 50);
2022-10-12 10:44:39 +08:00
SalaryArchiveItemMapper mapper = sqlSession.getMapper(SalaryArchiveItemMapper.class);
partition.forEach(mapper::batchUpdate);
sqlSession.commit();
baseBean.writeLog("hrsa_salary_archive_item:");
2022-10-10 09:43:57 +08:00
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_salary_archive_item:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit10 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<AddUpDeduction> addUpDeductions = getAddUpDeductionMapper().listAll();
if (CollectionUtils.isNotEmpty(addUpDeductions)) {
addUpDeductions.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setAddUpChildEducation(AESEncryptUtil.closeEncryptSetting(po.getAddUpChildEducation()));
po.setAddUpContinuingEducation(AESEncryptUtil.closeEncryptSetting(po.getAddUpContinuingEducation()));
po.setAddUpHousingLoanInterest(AESEncryptUtil.closeEncryptSetting(po.getAddUpHousingLoanInterest()));
po.setAddUpHousingRent(AESEncryptUtil.closeEncryptSetting(po.getAddUpHousingRent()));
po.setAddUpSupportElderly(AESEncryptUtil.closeEncryptSetting(po.getAddUpSupportElderly()));
} else {
po.setAddUpChildEducation(AESEncryptUtil.encrypt(po.getAddUpChildEducation()));
po.setAddUpContinuingEducation(AESEncryptUtil.encrypt(po.getAddUpContinuingEducation()));
po.setAddUpHousingLoanInterest(AESEncryptUtil.encrypt(po.getAddUpHousingLoanInterest()));
po.setAddUpHousingRent(AESEncryptUtil.encrypt(po.getAddUpHousingRent()));
po.setAddUpSupportElderly(AESEncryptUtil.encrypt(po.getAddUpSupportElderly()));
}
});
2022-10-17 14:18:01 +08:00
List<List<AddUpDeduction>> partition = Lists.partition(addUpDeductions, 50);
2022-10-12 10:44:39 +08:00
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
partition.forEach(mapper::updateData);
sqlSession.commit();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_add_up_deduction");
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_add_up_deduction:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit11 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<OtherDeductionPO> otherDeductionPos = getOtherDeductionMapper().listSome(new OtherDeductionPO());
if (CollectionUtils.isNotEmpty(otherDeductionPos)) {
otherDeductionPos.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setBusinessHealthyInsurance(AESEncryptUtil.closeEncryptSetting(po.getBusinessHealthyInsurance()));
po.setTaxDelayEndowmentInsurance(AESEncryptUtil.closeEncryptSetting(po.getTaxDelayEndowmentInsurance()));
po.setOtherDeduction(AESEncryptUtil.closeEncryptSetting(po.getOtherDeduction()));
po.setDeductionAllowedDonation(AESEncryptUtil.closeEncryptSetting(po.getDeductionAllowedDonation()));
} else {
po.setBusinessHealthyInsurance(AESEncryptUtil.encrypt(po.getBusinessHealthyInsurance()));
po.setTaxDelayEndowmentInsurance(AESEncryptUtil.encrypt(po.getTaxDelayEndowmentInsurance()));
po.setOtherDeduction(AESEncryptUtil.encrypt(po.getOtherDeduction()));
po.setDeductionAllowedDonation(AESEncryptUtil.encrypt(po.getDeductionAllowedDonation()));
}
});
2022-10-17 14:18:01 +08:00
List<List<OtherDeductionPO>> partition = Lists.partition(otherDeductionPos, 50);
2022-10-12 10:44:39 +08:00
OtherDeductionMapper mapper = sqlSession.getMapper(OtherDeductionMapper.class);
partition.forEach(mapper::updateData);
sqlSession.commit();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_other_deduction");
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_other_deduction:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
Future<Integer> submit12 = fixedThreadPool.submit(() -> {
2022-10-12 14:24:01 +08:00
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
2022-10-10 09:43:57 +08:00
try {
List<AddUpSituation> addUpSituations = getAddUpSituationMapper().listAll();
if (CollectionUtils.isNotEmpty(addUpSituations)) {
addUpSituations.forEach(po -> {
if (OpenEnum.OFF.getValue().equals(isOpenEncrypt)) {
po.setAddUpIncome(AESEncryptUtil.closeEncryptSetting(po.getAddUpIncome()));
po.setAddUpSubtraction(AESEncryptUtil.closeEncryptSetting(po.getAddUpSubtraction()));
po.setAddUpSocialSecurityTotal(AESEncryptUtil.closeEncryptSetting(po.getAddUpSocialSecurityTotal()));
po.setAddUpAccumulationFundTotal(AESEncryptUtil.closeEncryptSetting(po.getAddUpAccumulationFundTotal()));
po.setAddUpChildEducation(AESEncryptUtil.closeEncryptSetting(po.getAddUpChildEducation()));
po.setAddUpContinuingEducation(AESEncryptUtil.closeEncryptSetting(po.getAddUpContinuingEducation()));
po.setAddUpHousingLoanInterest(AESEncryptUtil.closeEncryptSetting(po.getAddUpHousingLoanInterest()));
po.setAddUpHousingRent(AESEncryptUtil.closeEncryptSetting(po.getAddUpHousingRent()));
po.setAddUpSupportElderly(AESEncryptUtil.closeEncryptSetting(po.getAddUpSupportElderly()));
po.setAddUpEnterpriseAndOther(AESEncryptUtil.closeEncryptSetting(po.getAddUpEnterpriseAndOther()));
po.setAddUpOtherDeduction(AESEncryptUtil.closeEncryptSetting(po.getAddUpOtherDeduction()));
po.setAddUpTaxExemptIncome(AESEncryptUtil.closeEncryptSetting(po.getAddUpTaxExemptIncome()));
po.setAddUpAllowedDonation(AESEncryptUtil.closeEncryptSetting(po.getAddUpAllowedDonation()));
po.setAddUpAdvanceTax(AESEncryptUtil.closeEncryptSetting(po.getAddUpAdvanceTax()));
2022-10-17 19:04:14 +08:00
po.setAddUpIllnessMedical(AESEncryptUtil.closeEncryptSetting(po.getAddUpIllnessMedical()));
po.setAddUpTaxSavings(AESEncryptUtil.closeEncryptSetting(po.getAddUpTaxSavings()));
po.setAddUpInfantCare(AESEncryptUtil.closeEncryptSetting(po.getAddUpInfantCare()));
2022-10-10 09:43:57 +08:00
} else {
po.setAddUpIncome(AESEncryptUtil.encrypt(po.getAddUpIncome()));
po.setAddUpSubtraction(AESEncryptUtil.encrypt(po.getAddUpSubtraction()));
po.setAddUpSocialSecurityTotal(AESEncryptUtil.encrypt(po.getAddUpSocialSecurityTotal()));
po.setAddUpAccumulationFundTotal(AESEncryptUtil.encrypt(po.getAddUpAccumulationFundTotal()));
po.setAddUpChildEducation(AESEncryptUtil.encrypt(po.getAddUpChildEducation()));
po.setAddUpContinuingEducation(AESEncryptUtil.encrypt(po.getAddUpContinuingEducation()));
po.setAddUpHousingLoanInterest(AESEncryptUtil.encrypt(po.getAddUpHousingLoanInterest()));
po.setAddUpHousingRent(AESEncryptUtil.encrypt(po.getAddUpHousingRent()));
po.setAddUpSupportElderly(AESEncryptUtil.encrypt(po.getAddUpSupportElderly()));
po.setAddUpEnterpriseAndOther(AESEncryptUtil.encrypt(po.getAddUpEnterpriseAndOther()));
po.setAddUpOtherDeduction(AESEncryptUtil.encrypt(po.getAddUpOtherDeduction()));
po.setAddUpTaxExemptIncome(AESEncryptUtil.encrypt(po.getAddUpTaxExemptIncome()));
po.setAddUpAllowedDonation(AESEncryptUtil.encrypt(po.getAddUpAllowedDonation()));
po.setAddUpAdvanceTax(AESEncryptUtil.encrypt(po.getAddUpAdvanceTax()));
2022-10-17 19:04:14 +08:00
po.setAddUpIllnessMedical(AESEncryptUtil.encrypt(po.getAddUpIllnessMedical()));
po.setAddUpTaxSavings(AESEncryptUtil.encrypt(po.getAddUpTaxSavings()));
po.setAddUpInfantCare(AESEncryptUtil.encrypt(po.getAddUpInfantCare()));
2022-10-10 09:43:57 +08:00
}
});
2022-10-17 14:15:20 +08:00
List<List<AddUpSituation>> partition = Lists.partition(addUpSituations, 50);
2022-10-12 10:44:39 +08:00
AddUpSituationMapper mapper = sqlSession.getMapper(AddUpSituationMapper.class);
partition.forEach(mapper::updateData);
sqlSession.commit();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_add_up_situation");
}
} catch (Exception e) {
2022-10-12 10:44:39 +08:00
sqlSession.rollback();
2022-10-10 09:43:57 +08:00
baseBean.writeLog("hrsa_add_up_situation:", e.getMessage());
return 0;
2022-10-12 14:24:01 +08:00
} finally {
sqlSession.close();
2022-10-10 09:43:57 +08:00
}
return 1;
});
int flag = submit.get() + submit1.get() + submit2.get() + submit3.get() + submit4.get() + submit5.get() + submit6.get() + submit7.get() + submit8.get() + submit9.get() + submit10.get() + submit11.get() + submit12.get();
2022-10-17 14:15:20 +08:00
if (flag == 13) {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "success", 30);
} else {
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
}
2022-10-17 11:14:21 +08:00
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
2022-10-10 09:43:57 +08:00
return flag == 13;
} catch (Exception e) {
2022-10-17 11:14:21 +08:00
Util_DataCache.setObjVal(ENCRYPT_IN_PROGRESS + progressId, "fail", 30);
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
2022-10-10 09:43:57 +08:00
baseBean.writeLog("应用设置加解密数据异常", e.getMessage());
return false;
2022-10-17 11:14:21 +08:00
} finally {
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
2022-10-10 09:43:57 +08:00
}
}
2022-08-11 10:27:15 +08:00
}