加密方法
This commit is contained in:
parent
389022e0ea
commit
8dc2ddc3c8
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.engine.salary.annotation;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 加密字段,用于标注需加解密的字段
|
||||||
|
* <p>Copyright: Copyright (c) 2022</p>
|
||||||
|
* <p>Company: 泛微软件</p>
|
||||||
|
*
|
||||||
|
* @author qiantao
|
||||||
|
* @version 1.0
|
||||||
|
**/
|
||||||
|
@Target(ElementType.FIELD)
|
||||||
|
@Retention(RetentionPolicy.RUNTIME)
|
||||||
|
public @interface Encrypt {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.engine.salary.biz;
|
package com.engine.salary.biz;
|
||||||
|
|
||||||
|
import com.engine.salary.encrypt.EncryptUtil;
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
|
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionRecordStrDTOEncrypt;
|
import com.engine.salary.encrypt.datacollection.AddUpDeductionRecordStrDTOEncrypt;
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionStrDTOEncrypt;
|
import com.engine.salary.encrypt.datacollection.AddUpDeductionStrDTOEncrypt;
|
||||||
|
|
@ -19,6 +20,8 @@ import java.util.stream.Collectors;
|
||||||
|
|
||||||
public class AddUpDeductionBiz extends BaseBean {
|
public class AddUpDeductionBiz extends BaseBean {
|
||||||
|
|
||||||
|
private final EncryptUtil encryptUtil = new EncryptUtil();
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 关联查询查询列表
|
* 关联查询查询列表
|
||||||
|
|
@ -49,7 +52,7 @@ public class AddUpDeductionBiz extends BaseBean {
|
||||||
try {
|
try {
|
||||||
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
|
AddUpDeductionMapper mapper = sqlSession.getMapper(AddUpDeductionMapper.class);
|
||||||
List<AddUpDeduction> addUpDeductions = mapper.listSome(param);
|
List<AddUpDeduction> addUpDeductions = mapper.listSome(param);
|
||||||
return AddUpDeductionEncrypt.decryptAddUpDeductionList(addUpDeductions);
|
return encryptUtil.decryptList(addUpDeductions, AddUpDeduction.class);
|
||||||
} finally {
|
} finally {
|
||||||
sqlSession.close();
|
sqlSession.close();
|
||||||
}
|
}
|
||||||
|
|
@ -135,11 +138,6 @@ public class AddUpDeductionBiz extends BaseBean {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理导入数据
|
* 处理导入数据
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,16 @@
|
||||||
|
package com.engine.salary.encrypt;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Builder;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@Builder
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class EncryptSetting {
|
||||||
|
|
||||||
|
public boolean open;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,131 @@
|
||||||
|
package com.engine.salary.encrypt;
|
||||||
|
|
||||||
|
|
||||||
|
import com.engine.common.util.ServiceUtil;
|
||||||
|
import com.engine.salary.annotation.Encrypt;
|
||||||
|
import com.engine.salary.exception.SalaryRunTimeException;
|
||||||
|
import com.engine.salary.sys.service.SalarySysConfService;
|
||||||
|
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.commons.collections4.CollectionUtils;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import weaver.hrm.User;
|
||||||
|
|
||||||
|
import java.lang.reflect.Field;
|
||||||
|
import java.util.*;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
public class EncryptUtil {
|
||||||
|
|
||||||
|
private SalarySysConfService getSalarySysConfService(User user) {
|
||||||
|
return ServiceUtil.getService(SalarySysConfServiceImpl.class, user);
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T encrypt(T data, Class<T> clazz) {
|
||||||
|
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
|
||||||
|
if (!encryptIsOpen) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<Field> fieldList = Arrays.stream(clazz.getDeclaredFields()).filter(field -> field.isAnnotationPresent(Encrypt.class)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(fieldList)) {
|
||||||
|
for (Field field : fieldList) {
|
||||||
|
Field declaredField = data.getClass().getDeclaredField(field.getName());
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
String fieldValue = (String) declaredField.get(data);
|
||||||
|
if (StringUtils.isNotBlank(fieldValue)) {
|
||||||
|
String encryptValue = AESEncryptUtil.encrypt(fieldValue);
|
||||||
|
declaredField.set(data, encryptValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("加密异常", e);
|
||||||
|
throw new SalaryRunTimeException("加密异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> encryptList(List<T> dataList, Class<T> clazz) {
|
||||||
|
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
|
||||||
|
if (!encryptIsOpen) {
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<Field> fieldList = Arrays.stream(clazz.getDeclaredFields()).filter(field -> field.isAnnotationPresent(Encrypt.class)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(fieldList)) {
|
||||||
|
List<Map<String, String>> values = new ArrayList<>();
|
||||||
|
for (T data : dataList) {
|
||||||
|
for (Field field : fieldList) {
|
||||||
|
Field declaredField = data.getClass().getDeclaredField(field.getName());
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
String fieldValue = (String) declaredField.get(data);
|
||||||
|
if (StringUtils.isNotBlank(fieldValue)) {
|
||||||
|
String encryptValue = AESEncryptUtil.encrypt(fieldValue);
|
||||||
|
declaredField.set(data, encryptValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("批量加密异常", e);
|
||||||
|
throw new SalaryRunTimeException("批量加密异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> T decrypt(T data, Class<T> clazz) {
|
||||||
|
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
|
||||||
|
if (!encryptIsOpen) {
|
||||||
|
return data;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<Field> fieldList = Arrays.stream(clazz.getDeclaredFields()).filter(field -> field.isAnnotationPresent(Encrypt.class)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(fieldList)) {
|
||||||
|
for (Field field : fieldList) {
|
||||||
|
Field declaredField = data.getClass().getDeclaredField(field.getName());
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
String fieldValue = (String) declaredField.get(data);
|
||||||
|
if (StringUtils.isNotBlank(fieldValue)) {
|
||||||
|
String encryptValue = AESEncryptUtil.decrypt(fieldValue);
|
||||||
|
declaredField.set(data, encryptValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return data;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("解密异常", e);
|
||||||
|
throw new SalaryRunTimeException("解密异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public <T> List<T> decryptList(List<T> dataList, Class<T> clazz) {
|
||||||
|
boolean encryptIsOpen = getSalarySysConfService(null).encryptIsOpen();
|
||||||
|
if (!encryptIsOpen) {
|
||||||
|
return dataList;
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
List<Field> fieldList = Arrays.stream(clazz.getDeclaredFields()).filter(field -> field.isAnnotationPresent(Encrypt.class)).collect(Collectors.toList());
|
||||||
|
if (CollectionUtils.isNotEmpty(fieldList)) {
|
||||||
|
for (T data : dataList) {
|
||||||
|
for (Field field : fieldList) {
|
||||||
|
Field declaredField = data.getClass().getDeclaredField(field.getName());
|
||||||
|
declaredField.setAccessible(true);
|
||||||
|
String fieldValue = (String) declaredField.get(data);
|
||||||
|
if (StringUtils.isNotBlank(fieldValue)) {
|
||||||
|
String encryptValue = AESEncryptUtil.decrypt(fieldValue);
|
||||||
|
declaredField.set(data, encryptValue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return dataList;
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("批量解密异常", e);
|
||||||
|
throw new SalaryRunTimeException("批量解密异常");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
package com.engine.salary.entity.datacollection;
|
package com.engine.salary.entity.datacollection;
|
||||||
|
|
||||||
|
import com.engine.salary.annotation.Encrypt;
|
||||||
import com.engine.salary.annotation.SalaryFormulaVar;
|
import com.engine.salary.annotation.SalaryFormulaVar;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Builder;
|
import lombok.Builder;
|
||||||
|
|
@ -42,36 +43,42 @@ public class AddUpDeduction {
|
||||||
* 累计子女教育
|
* 累计子女教育
|
||||||
*/
|
*/
|
||||||
@SalaryFormulaVar(defaultLabel = "累计子女教育", labelId = 86321, dataType = "number")
|
@SalaryFormulaVar(defaultLabel = "累计子女教育", labelId = 86321, dataType = "number")
|
||||||
|
@Encrypt
|
||||||
private String addUpChildEducation;
|
private String addUpChildEducation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计继续教育
|
* 累计继续教育
|
||||||
*/
|
*/
|
||||||
@SalaryFormulaVar(defaultLabel = "累计继续教育", labelId = 86323, dataType = "number")
|
@SalaryFormulaVar(defaultLabel = "累计继续教育", labelId = 86323, dataType = "number")
|
||||||
|
@Encrypt
|
||||||
private String addUpContinuingEducation;
|
private String addUpContinuingEducation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计住房贷款利息
|
* 累计住房贷款利息
|
||||||
*/
|
*/
|
||||||
@SalaryFormulaVar(defaultLabel = "累计住房贷款利息", labelId = 86324, dataType = "number")
|
@SalaryFormulaVar(defaultLabel = "累计住房贷款利息", labelId = 86324, dataType = "number")
|
||||||
|
@Encrypt
|
||||||
private String addUpHousingLoanInterest;
|
private String addUpHousingLoanInterest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计住房租金
|
* 累计住房租金
|
||||||
*/
|
*/
|
||||||
@SalaryFormulaVar(defaultLabel = "累计住房租金", labelId = 86325, dataType = "number")
|
@SalaryFormulaVar(defaultLabel = "累计住房租金", labelId = 86325, dataType = "number")
|
||||||
|
@Encrypt
|
||||||
private String addUpHousingRent;
|
private String addUpHousingRent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计赡养老人
|
* 累计赡养老人
|
||||||
*/
|
*/
|
||||||
@SalaryFormulaVar(defaultLabel = "累计赡养老人", labelId = 86326, dataType = "number")
|
@SalaryFormulaVar(defaultLabel = "累计赡养老人", labelId = 86326, dataType = "number")
|
||||||
|
@Encrypt
|
||||||
private String addUpSupportElderly;
|
private String addUpSupportElderly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 累计大病医疗
|
* 累计大病医疗
|
||||||
*/
|
*/
|
||||||
@SalaryFormulaVar(defaultLabel = "累计大病医疗", labelId = 105142, dataType = "number")
|
@SalaryFormulaVar(defaultLabel = "累计大病医疗", labelId = 105142, dataType = "number")
|
||||||
|
@Encrypt
|
||||||
private String addUpIllnessMedical;
|
private String addUpIllnessMedical;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,7 @@
|
||||||
package com.engine.salary.entity.datacollection.dto;
|
package com.engine.salary.entity.datacollection.dto;
|
||||||
|
|
||||||
import com.cloudstore.eccom.pc.table.WeaTableType;
|
import com.cloudstore.eccom.pc.table.WeaTableType;
|
||||||
import com.engine.salary.annotation.SalaryTable;
|
import com.engine.salary.annotation.*;
|
||||||
import com.engine.salary.annotation.SalaryTableColumn;
|
|
||||||
import com.engine.salary.annotation.SalaryTableOperate;
|
|
||||||
import com.engine.salary.annotation.TableTitle;
|
|
||||||
import com.engine.salary.util.excel.ExcelProperty;
|
import com.engine.salary.util.excel.ExcelProperty;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
|
|
@ -108,6 +105,7 @@ public class AddUpDeductionDTO {
|
||||||
@ExcelProperty(index = 7, msg = "第8列,累计子女教育解析错误,请输入数字")
|
@ExcelProperty(index = 7, msg = "第8列,累计子女教育解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
|
@SalaryTableColumn(text = "累计子女教育", width = "10%", column = "addUpChildEducation")
|
||||||
@TableTitle(title = "累计子女教育", dataIndex = "addUpChildEducation", key = "addUpChildEducation")
|
@TableTitle(title = "累计子女教育", dataIndex = "addUpChildEducation", key = "addUpChildEducation")
|
||||||
|
@Encrypt
|
||||||
private String addUpChildEducation;
|
private String addUpChildEducation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -116,6 +114,7 @@ public class AddUpDeductionDTO {
|
||||||
@ExcelProperty(index = 8, msg = "第9列,累计继续教育教育解析错误,请输入数字")
|
@ExcelProperty(index = 8, msg = "第9列,累计继续教育教育解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
|
@SalaryTableColumn(text = "累计继续教育", width = "10%", column = "addUpContinuingEducation")
|
||||||
@TableTitle(title = "累计继续教育", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation")
|
@TableTitle(title = "累计继续教育", dataIndex = "addUpContinuingEducation", key = "addUpContinuingEducation")
|
||||||
|
@Encrypt
|
||||||
private String addUpContinuingEducation;
|
private String addUpContinuingEducation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -124,6 +123,7 @@ public class AddUpDeductionDTO {
|
||||||
@ExcelProperty(index = 9, msg = "第10列,累计住房贷款利息解析错误,请输入数字")
|
@ExcelProperty(index = 9, msg = "第10列,累计住房贷款利息解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
|
@SalaryTableColumn(text = "累计住房贷款利息", width = "10%", column = "addUpHousingLoanInterest")
|
||||||
@TableTitle(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest")
|
@TableTitle(title = "累计住房贷款利息", dataIndex = "addUpHousingLoanInterest", key = "addUpHousingLoanInterest")
|
||||||
|
@Encrypt
|
||||||
private String addUpHousingLoanInterest;
|
private String addUpHousingLoanInterest;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -132,6 +132,7 @@ public class AddUpDeductionDTO {
|
||||||
@ExcelProperty(index = 10, msg = "第11列,累计住房租金解析错误,请输入数字")
|
@ExcelProperty(index = 10, msg = "第11列,累计住房租金解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
|
@SalaryTableColumn(text = "累计住房租金", width = "10%", column = "addUpHousingRent")
|
||||||
@TableTitle(title = "累计住房租金", dataIndex = "addUpHousingRent", key = "addUpHousingRent")
|
@TableTitle(title = "累计住房租金", dataIndex = "addUpHousingRent", key = "addUpHousingRent")
|
||||||
|
@Encrypt
|
||||||
private String addUpHousingRent;
|
private String addUpHousingRent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -140,6 +141,7 @@ public class AddUpDeductionDTO {
|
||||||
@ExcelProperty(index = 11, msg = "第12列,累计赡养老人解析错误,请输入数字")
|
@ExcelProperty(index = 11, msg = "第12列,累计赡养老人解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
|
@SalaryTableColumn(text = "累计赡养老人", width = "10%", column = "addUpSupportElderly")
|
||||||
@TableTitle(title = "累计赡养老人", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly")
|
@TableTitle(title = "累计赡养老人", dataIndex = "addUpSupportElderly", key = "addUpSupportElderly")
|
||||||
|
@Encrypt
|
||||||
private String addUpSupportElderly;
|
private String addUpSupportElderly;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -148,11 +150,13 @@ public class AddUpDeductionDTO {
|
||||||
@ExcelProperty(index = 12, msg = "第13列,累计大病医疗解析错误,请输入数字")
|
@ExcelProperty(index = 12, msg = "第13列,累计大病医疗解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计大病医疗", width = "10%", column = "addUpIllnessMedical")
|
@SalaryTableColumn(text = "累计大病医疗", width = "10%", column = "addUpIllnessMedical")
|
||||||
@TableTitle(title = "累计大病医疗", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical")
|
@TableTitle(title = "累计大病医疗", dataIndex = "addUpIllnessMedical", key = "addUpIllnessMedical")
|
||||||
|
@Encrypt
|
||||||
private String addUpIllnessMedical;
|
private String addUpIllnessMedical;
|
||||||
|
|
||||||
@ExcelProperty(index = 13, msg = "第14列,累计婴幼儿照护解析错误,请输入数字")
|
@ExcelProperty(index = 13, msg = "第14列,累计婴幼儿照护解析错误,请输入数字")
|
||||||
@SalaryTableColumn(text = "累计婴幼儿照护", width = "10%", column = "addUpInfantCare")
|
@SalaryTableColumn(text = "累计婴幼儿照护", width = "10%", column = "addUpInfantCare")
|
||||||
@TableTitle(title = "累计婴幼儿照护", dataIndex = "addUpInfantCare", key = "addUpInfantCare")
|
@TableTitle(title = "累计婴幼儿照护", dataIndex = "addUpInfantCare", key = "addUpInfantCare")
|
||||||
|
@Encrypt
|
||||||
private String addUpInfantCare;
|
private String addUpInfantCare;
|
||||||
|
|
||||||
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
|
@SalaryTableColumn(text = "操作", width = "20%", column = "operate")
|
||||||
|
|
|
||||||
|
|
@ -12,9 +12,9 @@ import com.engine.core.impl.Service;
|
||||||
import com.engine.salary.biz.AddUpDeductionBiz;
|
import com.engine.salary.biz.AddUpDeductionBiz;
|
||||||
import com.engine.salary.biz.EmployBiz;
|
import com.engine.salary.biz.EmployBiz;
|
||||||
import com.engine.salary.common.LocalDateRange;
|
import com.engine.salary.common.LocalDateRange;
|
||||||
|
import com.engine.salary.encrypt.EncryptUtil;
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
|
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionRecordStrDTOEncrypt;
|
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.AddUpDeduction;
|
||||||
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
import com.engine.salary.entity.datacollection.DataCollectionEmployee;
|
||||||
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
|
import com.engine.salary.entity.datacollection.dto.AddUpDeductionDTO;
|
||||||
|
|
@ -857,8 +857,8 @@ public class AddUpDeductionServiceImpl extends Service implements AddUpDeduction
|
||||||
|
|
||||||
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
SalaryPageUtil.start(queryParam.getCurrent(), queryParam.getPageSize());
|
||||||
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
|
List<AddUpDeductionDTO> list = getAddUpDeductionMapper().list(queryParam);
|
||||||
AddUpDeductionStrDTOEncrypt.decryptAddUpDeductionList(list);
|
List<AddUpDeductionDTO> addUpDeductionDTOS = new EncryptUtil().decryptList(list, AddUpDeductionDTO.class);
|
||||||
return new PageInfo<>(list, AddUpDeductionDTO.class);
|
return new PageInfo<>(addUpDeductionDTOS, AddUpDeductionDTO.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
||||||
|
|
@ -5,9 +5,6 @@ import com.engine.common.service.impl.HrmCommonServiceImpl;
|
||||||
import com.engine.common.util.ServiceUtil;
|
import com.engine.common.util.ServiceUtil;
|
||||||
import com.engine.core.impl.Service;
|
import com.engine.core.impl.Service;
|
||||||
import com.engine.salary.constant.SalaryAuthConstant;
|
import com.engine.salary.constant.SalaryAuthConstant;
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpDeductionEncrypt;
|
|
||||||
import com.engine.salary.encrypt.datacollection.AddUpSituationEncrypt;
|
|
||||||
import com.engine.salary.encrypt.datacollection.OtherDeductionPOEncrypt;
|
|
||||||
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
import com.engine.salary.entity.datacollection.AddUpDeduction;
|
||||||
import com.engine.salary.entity.datacollection.AddUpSituation;
|
import com.engine.salary.entity.datacollection.AddUpSituation;
|
||||||
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
import com.engine.salary.entity.datacollection.po.OtherDeductionPO;
|
||||||
|
|
@ -493,19 +490,16 @@ public class TaxAgentServiceImpl extends Service implements TaxAgentService {
|
||||||
|
|
||||||
// 被累计专项附加扣除引用
|
// 被累计专项附加扣除引用
|
||||||
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(Collections.singleton(id)).build());
|
List<AddUpDeduction> addUpDeductionList = getAddUpDeductionMapper().listSome(AddUpDeduction.builder().taxAgentIds(Collections.singleton(id)).build());
|
||||||
AddUpDeductionEncrypt.decryptAddUpDeductionList(addUpDeductionList);
|
|
||||||
if (CollectionUtils.isNotEmpty(addUpDeductionList)) {
|
if (CollectionUtils.isNotEmpty(addUpDeductionList)) {
|
||||||
throw new SalaryRunTimeException("存在累计专项附加扣除引用");
|
throw new SalaryRunTimeException("存在累计专项附加扣除引用");
|
||||||
}
|
}
|
||||||
// 被其他免税扣除引用
|
// 被其他免税扣除引用
|
||||||
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(Collections.singleton(id)).build());
|
List<OtherDeductionPO> otherDeductionList = getOtherDeductionMapper().listSome(OtherDeductionPO.builder().taxAgentIds(Collections.singleton(id)).build());
|
||||||
OtherDeductionPOEncrypt.decryptOtherDeductionPOList(otherDeductionList);
|
|
||||||
if (CollectionUtils.isNotEmpty(otherDeductionList)) {
|
if (CollectionUtils.isNotEmpty(otherDeductionList)) {
|
||||||
throw new SalaryRunTimeException("存在其他免税扣除引用");
|
throw new SalaryRunTimeException("存在其他免税扣除引用");
|
||||||
}
|
}
|
||||||
// 被往期累计情况引用
|
// 被往期累计情况引用
|
||||||
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(Collections.singleton(id)).build());
|
List<AddUpSituation> addUpSituationList = getAddUpSituationMapper().listSome(AddUpSituation.builder().taxAgentIds(Collections.singleton(id)).build());
|
||||||
AddUpSituationEncrypt.decryptAddUpSituationList(addUpSituationList);
|
|
||||||
if (CollectionUtils.isNotEmpty(addUpSituationList)) {
|
if (CollectionUtils.isNotEmpty(addUpSituationList)) {
|
||||||
throw new SalaryRunTimeException("存在往期累计情况引用");
|
throw new SalaryRunTimeException("存在往期累计情况引用");
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -81,6 +81,8 @@ public interface SalarySysConfService {
|
||||||
*/
|
*/
|
||||||
Map<String, Object> getEncryptProgress(String progressId);
|
Map<String, Object> getEncryptProgress(String progressId);
|
||||||
|
|
||||||
|
boolean encryptIsOpen();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取个税申报功能重启日期
|
* @description 获取个税申报功能重启日期
|
||||||
* @return Date
|
* @return Date
|
||||||
|
|
|
||||||
|
|
@ -134,7 +134,6 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
||||||
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
|
return MapperProxyFactory.getProxy(SpecialAddDeductionMapper.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
static SalarySysConfServiceImpl salarySysConfService = new SalarySysConfServiceImpl();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 操作是否需要申报功能
|
* 操作是否需要申报功能
|
||||||
|
|
@ -173,14 +172,14 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取申报功能状态
|
|
||||||
* @return Boolean
|
* @return Boolean
|
||||||
|
* @description 获取申报功能状态
|
||||||
* @author Harryxzy
|
* @author Harryxzy
|
||||||
* @date 2022/11/7 17:05
|
* @date 2022/11/7 17:05
|
||||||
*/
|
*/
|
||||||
public TaxDeclarationFunctionEnum getTaxDeclaration(){
|
public TaxDeclarationFunctionEnum getTaxDeclaration() {
|
||||||
SalarySysConfPO taxDeclarationFunction = salarySysConfService.getOneByCode(TAX_DECLARATION_FUNCTION);
|
SalarySysConfPO taxDeclarationFunction = getOneByCode(TAX_DECLARATION_FUNCTION);
|
||||||
if(taxDeclarationFunction == null){
|
if (taxDeclarationFunction == null) {
|
||||||
// 默认开启
|
// 默认开启
|
||||||
return TaxDeclarationFunctionEnum.OPEN;
|
return TaxDeclarationFunctionEnum.OPEN;
|
||||||
}
|
}
|
||||||
|
|
@ -331,7 +330,7 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
||||||
resultMap.put("isSuccess", true);
|
resultMap.put("isSuccess", true);
|
||||||
String progressId = UUID.randomUUID().toString();
|
String progressId = UUID.randomUUID().toString();
|
||||||
resultMap.put("progressId", progressId);
|
resultMap.put("progressId", progressId);
|
||||||
SalarySysConfPO sysConfPo = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
|
SalarySysConfPO sysConfPo = getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
|
||||||
if (ObjectUtils.isNotEmpty(sysConfPo) && sysConfPo.getConfValue().equals(param.getIsOpenEncrypt())) {
|
if (ObjectUtils.isNotEmpty(sysConfPo) && sysConfPo.getConfValue().equals(param.getIsOpenEncrypt())) {
|
||||||
return resultMap;
|
return resultMap;
|
||||||
} else if (ObjectUtils.isEmpty(sysConfPo) && OpenEnum.OPEN.getValue().equals(param.getIsOpenEncrypt())) {
|
} else if (ObjectUtils.isEmpty(sysConfPo) && OpenEnum.OPEN.getValue().equals(param.getIsOpenEncrypt())) {
|
||||||
|
|
@ -377,6 +376,15 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean encryptIsOpen() {
|
||||||
|
SalarySysConfPO sysConfPo = getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
|
||||||
|
if (sysConfPo != null && sysConfPo.getConfValue().equals(OpenEnum.OFF.getValue())) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Object> getEncryptProgress(String progressId) {
|
public Map<String, Object> getEncryptProgress(String progressId) {
|
||||||
Map<String, Object> resultMap = new HashMap<>();
|
Map<String, Object> resultMap = new HashMap<>();
|
||||||
|
|
@ -451,10 +459,10 @@ public class SalarySysConfServiceImpl extends Service implements SalarySysConfSe
|
||||||
}
|
}
|
||||||
|
|
||||||
List<SalarySysConfPO> taxDeclarationFunction = getSalarySysConfMapper().listSome(SalarySysConfPO.builder().deleteType(0).confKey(TAX_DECLARATION_FUNCTION).build());
|
List<SalarySysConfPO> taxDeclarationFunction = getSalarySysConfMapper().listSome(SalarySysConfPO.builder().deleteType(0).confKey(TAX_DECLARATION_FUNCTION).build());
|
||||||
if(taxDeclarationFunction == null || taxDeclarationFunction.size() == 0 || (taxDeclarationFunction.get(0).getConfValue().equals(TaxDeclarationFunctionEnum.REBOOT.getValue()))){
|
if (taxDeclarationFunction == null || taxDeclarationFunction.size() == 0 || (taxDeclarationFunction.get(0).getConfValue().equals(TaxDeclarationFunctionEnum.REBOOT.getValue()))) {
|
||||||
// 默认开启报税功能 或者重启状态时前端展示开启
|
// 默认开启报税功能 或者重启状态时前端展示开启
|
||||||
appSettingVO.setIsOpenTaxDeclaration("1");
|
appSettingVO.setIsOpenTaxDeclaration("1");
|
||||||
}else {
|
} else {
|
||||||
appSettingVO.setIsOpenTaxDeclaration(taxDeclarationFunction.get(0).getConfValue());
|
appSettingVO.setIsOpenTaxDeclaration(taxDeclarationFunction.get(0).getConfValue());
|
||||||
}
|
}
|
||||||
//默认加密开启
|
//默认加密开启
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue