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

750 lines
41 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.report.po.SalaryAcctResultReportPO;
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.report.SalaryAcctResultReportMapper;
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-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.JsonUtil;
import com.engine.salary.util.db.MapperProxyFactory;
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;
import weaver.general.BaseBean;
2022-08-11 10:27:15 +08:00
import java.util.Date;
2022-10-10 09:43:57 +08:00
import java.util.HashMap;
import java.util.List;
2022-10-10 09:43:57 +08:00
import java.util.Map;
import java.util.concurrent.*;
import java.util.concurrent.locks.ReentrantLock;
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-10 09:43:57 +08:00
private static final ExecutorService fixedThreadPool = newFixedThreadPool(13);
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
/**
* 操作是否需要申报功能
*
* @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();
SalarySysConfPO taxDeclarationFunction = getSalarySysConfMapper().getOneByCode("taxDeclarationFunction");
if (taxDeclarationFunction == null) {
taxDeclarationFunction = SalarySysConfPO.builder().id(IdGenerator.generate()).confKey("taxDeclarationFunction").confValue(flag.getValue()).title(flag.getDefaultLabel()).module("taxDeclaration").orderWeight(0).createTime(date).updateTime(date).deleteType(0).build();
getSalarySysConfMapper().insertIgnoreNull(taxDeclarationFunction);
} else {
TaxDeclarationFunctionEnum oldFunctionEnum = TaxDeclarationFunctionEnum.parseByValue(taxDeclarationFunction.getConfValue());
//不改变
if (flag == oldFunctionEnum) {
return true;
}
//关闭
if (flag == TaxDeclarationFunctionEnum.CLOSURE) {
taxDeclarationFunction.setConfValue(flag.getValue());
taxDeclarationFunction.setTitle(flag.getDefaultLabel());
taxDeclarationFunction.setUpdateTime(new Date());
}
//重启
if (flag == TaxDeclarationFunctionEnum.OPEN && oldFunctionEnum == TaxDeclarationFunctionEnum.CLOSURE) {
taxDeclarationFunction.setConfValue(flag.getValue());
taxDeclarationFunction.setTitle(flag.getDefaultLabel());
taxDeclarationFunction.setUpdateTime(new Date());
}
getSalarySysConfMapper().updateIgnoreNull(taxDeclarationFunction);
}
return true;
}
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<>();
boolean flag = false;
resultMap.put("isSuccess", false);
try {
if (ObjectUtils.isNotEmpty(Util_DataCache.getObjVal(AES_ENCRYPT_IN_PROGRESS))) {
resultMap.put("msg", "数据库处理上次操作中,请稍后操作。");
return resultMap;
}
Util_DataCache.setObjVal(AES_ENCRYPT_IN_PROGRESS, 1);
String isOpenEncrypt = param.getIsOpenEncrypt();
if (StringUtils.isNotEmpty(isOpenEncrypt)) {
saveSettingByType(isOpenEncrypt, OPEN_APPLICATION_ENCRYPT, "开启加密设置", "app");
2022-10-10 10:00:59 +08:00
//对数据库数据加解密
2022-10-10 09:43:57 +08:00
flag = encryptOrDecryptDbWithAsync(isOpenEncrypt);
}
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
resultMap.put("isSuccess", flag);
return resultMap;
} catch (Exception e) {
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
resultMap.put("isSuccess", flag);
resultMap.put("msg", "系统异常请联系管理员");
return resultMap;
} finally {
Util_DataCache.clearVal(AES_ENCRYPT_IN_PROGRESS);
}
}
/**
* 保存或者修改应用设置
*
* @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());
break;
default:
break;
}
});
}
//默认加密开启
if (StringUtils.isEmpty(appSettingVO.getIsOpenEncrypt())) {
appSettingVO.setIsOpenEncrypt("1");
2022-09-28 10:08:51 +08:00
}
return appSettingVO;
}
2022-10-10 09:43:57 +08:00
private Boolean encryptOrDecryptDbWithAsync(String isOpenEncrypt) {
BaseBean baseBean = new BaseBean();
baseBean.writeLog("应用设置加解密数据开始");
//多线程批量更新需要加密的表
try {
Future<Integer> submit = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getSalaryAcctResultMapper().batchUpdate(salaryAcctResultPos);
baseBean.writeLog("hrsa_salary_acct_result:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_salary_acct_result:" + e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit1 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getExcelAcctResultMapper().batchUpdate(excelAcctResultPos);
baseBean.writeLog("hrsa_excel_acct_result:", flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_excel_acct_result:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit2 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getTaxDeclarationDetailMapper().batchUpdate(taxDeclarationDetailPos);
baseBean.writeLog("hrsa_tax_declaration_detail:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_tax_declaration_detail:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit3 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getInsuranceSchemeDetailMapper().batchUpdate(insuranceSchemeDetailPos);
baseBean.writeLog("hrsa_scheme_detail:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_scheme_detail:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit4 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getSocialSchemeMapper().batchUpdate(insuranceArchivesSocialSchemePos);
baseBean.writeLog("hrsa_social_archives:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_social_archives:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit5 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getFundSchemeMapper().batchUpdate(insuranceArchivesFundSchemePos);
baseBean.writeLog("hrsa_fund_archives:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_fund_archives:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit6 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getOtherSchemeMapper().batchUpdate(insuranceArchivesOtherSchemePos);
baseBean.writeLog("hrsa_other_archives:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_other_archives:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit7 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getInsuranceAccountBatchMapper().batchUpdate(insuranceAccountBatchPos);
baseBean.writeLog("hrsa_bill_batch:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_bill_batch:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit8 = fixedThreadPool.submit(() -> {
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()));
po.setSocialPerJson(AESEncryptUtil.closeEncryptSetting(po.getSocialComJson()));
po.setSocialComSum(AESEncryptUtil.closeEncryptSetting(po.getSocialComSum()));
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()));
po.setSocialComJson(AESEncryptUtil.closeEncryptSetting(po.getSocialComJson()));
po.setSocialComSum(AESEncryptUtil.closeEncryptSetting(po.getSocialComSum()));
po.setFundComJson(AESEncryptUtil.closeEncryptSetting(po.getFundComJson()));
po.setFundComSum(AESEncryptUtil.closeEncryptSetting(po.getFundComSum()));
po.setOtherComJson(AESEncryptUtil.closeEncryptSetting(po.getOtherComJson()));
po.setOtherComSum(AESEncryptUtil.closeEncryptSetting(po.getOtherComSum()));
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()));
po.setSocialPerJson(AESEncryptUtil.encrypt(po.getSocialComJson()));
po.setSocialComSum(AESEncryptUtil.encrypt(po.getSocialComSum()));
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()));
po.setSocialComJson(AESEncryptUtil.encrypt(po.getSocialComJson()));
po.setSocialComSum(AESEncryptUtil.encrypt(po.getSocialComSum()));
po.setFundComJson(AESEncryptUtil.encrypt(po.getFundComJson()));
po.setFundComSum(AESEncryptUtil.encrypt(po.getFundComSum()));
po.setOtherComJson(AESEncryptUtil.encrypt(po.getOtherComJson()));
po.setOtherComSum(AESEncryptUtil.encrypt(po.getOtherComSum()));
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()));
}
});
int flag = getInsuranceAccountDetailMapper().batchUpdate(insuranceAccountDetailPos);
baseBean.writeLog("hrsa_bill_detail:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_bill_detail:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit9 = fixedThreadPool.submit(() -> {
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()));
}
});
int flag = getSalaryArchiveItemMapper().batchUpdate(salaryArchiveItemPos);
baseBean.writeLog("hrsa_salary_archive_item:" + flag);
}
} catch (Exception e) {
baseBean.writeLog("hrsa_salary_archive_item:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit10 = fixedThreadPool.submit(() -> {
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()));
}
});
getAddUpDeductionMapper().updateData(addUpDeductions);
baseBean.writeLog("hrsa_add_up_deduction");
}
} catch (Exception e) {
baseBean.writeLog("hrsa_add_up_deduction:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit11 = fixedThreadPool.submit(() -> {
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()));
}
});
getOtherDeductionMapper().updateData(otherDeductionPos);
baseBean.writeLog("hrsa_other_deduction");
}
} catch (Exception e) {
baseBean.writeLog("hrsa_other_deduction:", e.getMessage());
return 0;
}
return 1;
});
Future<Integer> submit12 = fixedThreadPool.submit(() -> {
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()));
} 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()));
}
});
getAddUpSituationMapper().updateData(addUpSituations);
baseBean.writeLog("hrsa_add_up_situation");
}
} catch (Exception e) {
baseBean.writeLog("hrsa_add_up_situation:", e.getMessage());
return 0;
}
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();
return flag == 13;
} catch (Exception e) {
baseBean.writeLog("应用设置加解密数据异常", e.getMessage());
return false;
}
}
2022-08-11 10:27:15 +08:00
}