feat: 加密统一,累计附加扣除&社保福利模块

This commit is contained in:
fcli 2022-12-12 15:40:01 +08:00
parent 5e893160b4
commit 93db32b758
7 changed files with 47 additions and 30 deletions

View File

@ -1,9 +1,6 @@
package com.engine.salary.biz;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
import com.engine.salary.encrypt.datacollection.AddUpDeductionRecordStrDTOEncrypt;
import com.engine.salary.encrypt.datacollection.AddUpDeductionStrDTOEncrypt;
import com.engine.salary.entity.datacollection.AddUpDeduction;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
import com.engine.salary.entity.datacollection.dto.AddUpDeductionRecordDTO;
@ -34,7 +31,7 @@ public class AddUpDeductionBiz extends BaseBean {
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
List<AddUpDeductionDTO> list = mapper.list(param);
AddUpDeductionStrDTOEncrypt.decryptAddUpDeductionList(list);
list = encryptUtil.decryptList(list, AddUpDeductionDTO.class);
return list;
} finally {
sqlSession.close();
@ -70,7 +67,7 @@ public class AddUpDeductionBiz extends BaseBean {
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
AddUpDeduction byId = mapper.getById(id);
return AddUpDeductionEncrypt.decryptAddUpDeduction(byId);
return encryptUtil.decrypt(byId, AddUpDeduction.class);
} finally {
sqlSession.close();
}
@ -87,7 +84,7 @@ public class AddUpDeductionBiz extends BaseBean {
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
List<AddUpDeductionRecordDTO> addUpDeductionRecordStrDTOS = mapper.recordList(param);
return AddUpDeductionRecordStrDTOEncrypt.decryptAddUpDeductionRecordDTO(addUpDeductionRecordStrDTOS);
return encryptUtil.decryptList(addUpDeductionRecordStrDTOS, AddUpDeductionRecordDTO.class);
} finally {
sqlSession.close();
}
@ -106,7 +103,7 @@ public class AddUpDeductionBiz extends BaseBean {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
AddUpDeductionEncrypt.encryptAddUpDeductionList(param);
encryptUtil.encryptList(param, AddUpDeduction.class);
List<List<AddUpDeduction>> partition = Lists.partition(param, 100);
partition.forEach(mapper::insertData);
sqlSession.commit();
@ -128,7 +125,7 @@ public class AddUpDeductionBiz extends BaseBean {
SqlSession sqlSession = MyBatisFactory.sqlSessionFactory.openSession();
try {
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
AddUpDeductionEncrypt.encryptAddUpDeductionList(param);
encryptUtil.encryptList(param, AddUpDeduction.class);
List<List<AddUpDeduction>> partition = Lists.partition(param, 100);
partition.forEach(mapper::updateData);
sqlSession.commit();

View File

@ -8,9 +8,9 @@ import com.engine.core.impl.Service;
import com.engine.salary.cache.SalaryCacheKey;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.AESEncryptUtil;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt;
import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailTempPOEncrypt;
import com.engine.salary.encrypt.siaccount.SiAccountEncrypt;
import com.engine.salary.encrypt.sischeme.InsuranceSchemeDetailPOEncrypt;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.salaryacct.dto.SalaryAcctProgressDTO;
@ -77,6 +77,8 @@ public class SIAccountBiz extends Service {
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
private EncryptUtil encryptUtil = new EncryptUtil();
private TaxAgentService getTaxAgentService() {
return ServiceUtil.getService(TaxAgentServiceImpl.class, user);
}
@ -121,7 +123,7 @@ public class SIAccountBiz extends Service {
public PageInfo<InsuranceAccountBatchPO> listPage(InsuranceAccountBatchParam queryParam) {
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
List<InsuranceAccountBatchPO> list = getInsuranceAccountBatchMapper().list(queryParam);
list = SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
list = encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
PageInfo<InsuranceAccountBatchPO> pageInfo = new PageInfo<>(list, InsuranceAccountBatchPO.class);
return pageInfo;
}
@ -152,10 +154,9 @@ public class SIAccountBiz extends Service {
public String save(boolean flag, AccountParam param, Long employeeId, String currentUserName) {
if (flag) {
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
insuranceAccountBatchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
SalaryAssert.isNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(100461, "所属月份存在核算数据"));
InsuranceAccountBatchPO build = InsuranceAccountBatchPO.builder()
.paymentOrganization(param.getPaymentOrganization())
.accountant(currentUserName)
@ -169,7 +170,7 @@ public class SIAccountBiz extends Service {
.deleteType(DeleteTypeEnum.NOT_DELETED.getValue())
.paymentOrganization(param.getPaymentOrganization())
.build();
SiAccountEncrypt.encryptInsuranceAccountBatch(build);
encryptUtil.encrypt(build, InsuranceAccountBatchPO.class);
getInsuranceAccountBatchMapper().insert(build);
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(build.getId()));
@ -185,7 +186,7 @@ public class SIAccountBiz extends Service {
} catch (Exception e) {
// 回滚
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
list = SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
list = encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
getInsuranceAccountBatchMapper().deleteById(f.getId());
@ -206,7 +207,7 @@ public class SIAccountBiz extends Service {
// employeeIds = employeeIds.stream().filter(employeeIdsInTaxAgent::contains).collect(Collectors.toList());
if (CollectionUtils.isEmpty(employeeIds)) {
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), paymentOrganization));
SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
getInsuranceAccountDetailMapper().deleteById(f.getId());
@ -349,7 +350,7 @@ public class SIAccountBiz extends Service {
} catch (Exception e) {
log.error("account run fail", e);
List<InsuranceAccountBatchPO> list = Lists.newArrayList(getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization()));
list = SiAccountEncrypt.decryptInsuranceAccountBatchList(list);
list = encryptUtil.decryptList(list, InsuranceAccountBatchPO.class);
if (CollectionUtils.isNotEmpty(list)) {
list.stream().forEach(f -> {
getInsuranceAccountBatchMapper().deleteById(f.getId());
@ -905,7 +906,7 @@ public class SIAccountBiz extends Service {
}
}
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, param.getPaymentOrganization());
SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
DataCollectionEmployee simpleEmployee = MapperProxyFactory.getProxy(EmployMapper.class).getEmployeeById(employeeId);
insuranceAccountBatchPO.setAccountant(currentUserName);
@ -916,7 +917,7 @@ public class SIAccountBiz extends Service {
insuranceAccountBatchPO.setFundPay(fundSum.toPlainString());
insuranceAccountBatchPO.setOtherNum(otherAccountPerson);
insuranceAccountBatchPO.setOtherPay(otherSum.toPlainString());
SiAccountEncrypt.encryptInsuranceAccountBatch(insuranceAccountBatchPO);
encryptUtil.encrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
getInsuranceAccountBatchMapper().updateById(insuranceAccountBatchPO);
// LoggerContext insuranceSchemeContext = new LoggerContext();
// insuranceSchemeContext.setTargetId(String.valueOf(insuranceAccountBatchPO.getId()));
@ -948,7 +949,7 @@ public class SIAccountBiz extends Service {
public void delete(AccountParam param, Long employeeId) {
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(param.getBillMonth(), param.getPaymentOrganization());
SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(84026, "参数错误"));
// if(param.getPaymentOrganization()==null){
// throw new SalaryRunTimeException("个税扣缴义务人为空");
@ -1550,11 +1551,11 @@ public class SIAccountBiz extends Service {
// SalaryAssert.isEmpty(insuranceAccountInspectPOS, SalaryI18nUtil.getI18nLabel( 100500, "当前核算月存在核算异常数据"));
//开始归档数据
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillStatus(billMonth, BillStatusEnum.NOT_ARCHIVED.getValue(), paymentOrganization);
SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
SalaryAssert.notNull(insuranceAccountBatchPO, SalaryI18nUtil.getI18nLabel(100503, "月份账单不存在"));
SalaryAssert.isFalse(insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.ARCHIVED.getValue(), SalaryI18nUtil.getI18nLabel(100504, "月份账单已归档"));
SalaryAssert.isFalse(Objects.equals(insuranceAccountBatchPO.getBillStatus(), BillStatusEnum.ARCHIVED.getValue()), SalaryI18nUtil.getI18nLabel(100504, "月份账单已归档"));
insuranceAccountBatchPO.setBillStatus(BillStatusEnum.ARCHIVED.getValue());
SiAccountEncrypt.encryptInsuranceAccountBatch(insuranceAccountBatchPO);
encryptUtil.encrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
getInsuranceAccountBatchMapper().updateById(insuranceAccountBatchPO);
//日志记录
// LoggerContext insuranceSchemeContext = new LoggerContext();

View File

@ -13,6 +13,7 @@ import java.util.List;
* fund_pay
*/
public class SiAccountEncrypt {
@Deprecated
public static List<InsuranceAccountBatchPO> encryptInsuranceAccountBatchList(List<InsuranceAccountBatchPO> list) {
list.forEach(item -> {
item.setOtherPay(AESEncryptUtil.encrypt(item.getOtherPay()));
@ -22,6 +23,7 @@ public class SiAccountEncrypt {
return list;
}
@Deprecated
public static List<InsuranceAccountBatchPO> decryptInsuranceAccountBatchList(List<InsuranceAccountBatchPO> list) {
if(list == null || list.size() == 0) {
return list;
@ -34,6 +36,7 @@ public class SiAccountEncrypt {
return list;
}
@Deprecated
public static InsuranceAccountBatchPO encryptInsuranceAccountBatch(InsuranceAccountBatchPO item) {
if(item == null) {
return item;
@ -44,6 +47,7 @@ public class SiAccountEncrypt {
return item;
}
@Deprecated
public static InsuranceAccountBatchPO decryptInsuranceAccountBatch(InsuranceAccountBatchPO item) {
if(item == null) {
return item;

View File

@ -85,6 +85,7 @@ public class AddUpDeduction {
* 累计婴幼儿照护
*/
@SalaryFormulaVar(defaultLabel = "累计婴幼儿照护", labelId = 117732, dataType = "number")
@Encrypt
private String addUpInfantCare;
/**

View File

@ -1,6 +1,7 @@
package com.engine.salary.entity.datacollection.dto;
import com.cloudstore.eccom.pc.table.WeaTableType;
import com.engine.salary.annotation.Encrypt;
import com.engine.salary.annotation.SalaryTable;
import com.engine.salary.annotation.SalaryTableColumn;
import com.engine.salary.annotation.TableTitle;
@ -73,6 +74,7 @@ public class AddUpDeductionRecordDTO {
@ExcelProperty(index = 5)
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
@TableTitle(title = "累计子女教育", dataIndex = "addUpChildEducation", key = "addUpChildEducation")
@Encrypt
private String addUpChildEducation;
/**
@ -81,6 +83,7 @@ public class AddUpDeductionRecordDTO {
@ExcelProperty(index = 6)
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
@TableTitle(title = "累计继续教育", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation")
@Encrypt
private String addUpContinuingEducation;
/**
@ -89,6 +92,7 @@ public class AddUpDeductionRecordDTO {
@ExcelProperty(index = 7)
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
@TableTitle(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest")
@Encrypt
private String addUpHousingLoanInterest;
/**
@ -97,6 +101,7 @@ public class AddUpDeductionRecordDTO {
@ExcelProperty(index = 8)
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
@TableTitle(title = "累计住房租金", dataIndex = "addUpHousingRent", key = "addUpHousingRent")
@Encrypt
private String addUpHousingRent;
/**
@ -105,16 +110,19 @@ public class AddUpDeductionRecordDTO {
@ExcelProperty(index = 9)
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
@TableTitle(title = "累计赡养老人", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly")
@Encrypt
private String addUpSupportElderly;
@ExcelProperty(index = 10)
@SalaryTableColumn(text = "累计大病医疗", width = "10%", column = "addUpIllnessMedical")
@TableTitle(title = "累计大病医疗", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical")
@Encrypt
private String addUpIllnessMedical;
@ExcelProperty(index = 11)
@SalaryTableColumn(text = "累计婴幼儿照护", width = "10%", column = "addUpInfantCare")
@TableTitle(title = "累计婴幼儿照护", dataIndex = "addUpInfantCare", key = "addUpInfantCare")
@Encrypt
private String addUpInfantCare;
}

View File

@ -1,5 +1,6 @@
package com.engine.salary.entity.siaccount.po;
import com.engine.salary.annotation.Encrypt;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
@ -54,16 +55,19 @@ public class InsuranceAccountBatchPO {
/**
* 社保缴费总额(单位+个人)
*/
@Encrypt
private String socialPay;
/**
* 公积金缴费总额(单位+个人)
*/
@Encrypt
private String fundPay;
/**
* 其他福利缴费总额(单位+个人)
*/
@Encrypt
private String otherPay;
/**

View File

@ -12,9 +12,9 @@ import com.engine.core.impl.Service;
import com.engine.salary.biz.*;
import com.engine.salary.component.SalaryWeaTable;
import com.engine.salary.constant.SalaryDefaultTenantConstant;
import com.engine.salary.encrypt.EncryptUtil;
import com.engine.salary.encrypt.siaccount.ExcelInsuranceDetailPOEncrypt;
import com.engine.salary.encrypt.siaccount.InsuranceAccountDetailPOEncrypt;
import com.engine.salary.encrypt.siaccount.SiAccountEncrypt;
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
import com.engine.salary.entity.siaccount.bo.InsuranceAccountBO;
import com.engine.salary.entity.siaccount.dto.InsuranceAccountBatchListDTO;
@ -95,6 +95,8 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
private SIArchivesBiz siArchivesBiz = new SIArchivesBiz();
private EncryptUtil encryptUtil = new EncryptUtil();
public RecordsBuildService getService(User user) {
return ServiceUtil.getService(RecordsBuildServiceImpl.class, user);
}
@ -422,7 +424,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
datePickerItem.getOtherParams().put("maxDate", maxDate);
List<InsuranceAccountBatchPO> billMonthList = getInsuranceAccountBatchMapper().listByTimeRange(minDate, maxDate);
SiAccountEncrypt.decryptInsuranceAccountBatchList(billMonthList);
encryptUtil.decryptList(billMonthList, InsuranceAccountBatchPO.class);
if (CollectionUtils.isEmpty(billMonthList)) {
datePickerItem.getOtherParams().put("disabledData", Collections.emptyList());
} else {
@ -541,7 +543,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
public InsuranceAccountTabDTO tabList(AccountParam build) {
InsuranceAccountTabDTO insuranceAccountTabDTO = InsuranceAccountTabDTO.builder().build();
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(build.getBillMonth(), build.getPaymentOrganization());
insuranceAccountBatchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
boolean isShow = false;
if (insuranceAccountBatchPO == null || insuranceAccountBatchPO.getBillStatus() == BillStatusEnum.NOT_ARCHIVED.getValue()) {
isShow = true;
@ -772,7 +774,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
@Override
public List<Map<String, Object>> welfareData(String billMonth, List<Long> employeeIds, Long taxAgentId) {
InsuranceAccountBatchPO insuranceAccountBatchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, taxAgentId);
insuranceAccountBatchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(insuranceAccountBatchPO);
insuranceAccountBatchPO = encryptUtil.decrypt(insuranceAccountBatchPO, InsuranceAccountBatchPO.class);
if (insuranceAccountBatchPO == null || Objects.equals(BillStatusEnum.NOT_ARCHIVED.getValue(), insuranceAccountBatchPO.getBillStatus())) {
return Lists.newArrayList();
}
@ -1349,7 +1351,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<InsuranceAccountViewListDTO> viewListDTOList = pageInfos.getList();
viewListDTOList.stream().filter(f -> f.getPayOrg().equals(taxAgentPo.getName())).collect(Collectors.toList());
InsuranceAccountBatchPO batchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization);
batchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(batchPO);
batchPO = encryptUtil.decrypt(batchPO, InsuranceAccountBatchPO.class);
//更新
if (viewListDTOList.size() > 0 && batchPO != null) {
InsuranceAccountViewListDTO viewListDTO = viewListDTOList.get(0);
@ -1362,7 +1364,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
batchPO.setOtherPay(viewListDTO.getOtherPaySum().replace(",", ""));
batchPO.setUpdateTime(new Date());
batchPO = SiAccountEncrypt.encryptInsuranceAccountBatch(batchPO);
batchPO = encryptUtil.encrypt(batchPO, InsuranceAccountBatchPO.class);
getInsuranceAccountBatchMapper().updateById(batchPO);
}
}
@ -2207,7 +2209,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
List<InsuranceAccountViewListDTO> viewListDTOList = pageInfos.getList();
viewListDTOList.stream().filter(f -> f.getPayOrg().equals(taxAgentPo.getName())).collect(Collectors.toList());
InsuranceAccountBatchPO batchPO = getInsuranceAccountBatchMapper().getByBillMonth(billMonth, paymentOrganization);
batchPO = SiAccountEncrypt.decryptInsuranceAccountBatch(batchPO);
batchPO = encryptUtil.decrypt(batchPO, InsuranceAccountBatchPO.class);
//更新
if (viewListDTOList.size() > 0 && batchPO != null) {
InsuranceAccountViewListDTO viewListDTO = viewListDTOList.get(0);
@ -2220,7 +2222,7 @@ public class SIAccountServiceImpl extends Service implements SIAccountService {
batchPO.setOtherPay(viewListDTO.getOtherPaySum().replace(",", ""));
batchPO.setUpdateTime(new Date());
batchPO = SiAccountEncrypt.encryptInsuranceAccountBatch(batchPO);
batchPO = encryptUtil.encrypt(batchPO, InsuranceAccountBatchPO.class);
getInsuranceAccountBatchMapper().updateById(batchPO);
}
}