薪资档案加密设置更新

This commit is contained in:
李栋 2022-10-11 17:41:00 +08:00
parent dc541e8e00
commit 9f651b173e
1 changed files with 5 additions and 4 deletions

View File

@ -4,6 +4,7 @@ import com.engine.salary.sys.constant.SalarySysConstant;
import com.engine.salary.sys.entity.po.SalarySysConfPO;
import com.engine.salary.sys.enums.OpenEnum;
import com.engine.salary.sys.service.impl.SalarySysConfServiceImpl;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import weaver.general.AES;
import weaver.general.BaseBean;
@ -28,7 +29,7 @@ public class AESEncryptUtil {
public static String encrypt(String source) {
String isEncrypt = getSalarySysConfigValue();
//防止初始化老数据时二次加密
if (StringUtils.isNotBlank(source) && OpenEnum.OPEN.getValue().equals(isEncrypt) && !source.startsWith(SalarySysConstant.PRE_SIGN_ENCRYPT)&& source.length() != 32) {
if (StringUtils.isNotBlank(source) && OpenEnum.OPEN.getValue().equals(isEncrypt) && !source.startsWith(SalarySysConstant.PRE_SIGN_ENCRYPT) && source.length() != 32) {
return SalarySysConstant.PRE_SIGN_ENCRYPT + AES.encrypt(source, aesEncryptScrect);
}
return source;
@ -40,11 +41,11 @@ public class AESEncryptUtil {
* @return
*/
private static String getSalarySysConfigValue() {
String confValue = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT).getConfValue();
if (StringUtils.isEmpty(confValue)) {
SalarySysConfPO sysConfPO = salarySysConfService.getOneByCode(SalarySysConstant.OPEN_APPLICATION_ENCRYPT);
if (ObjectUtils.isEmpty(sysConfPO)) {
return "1";
}
return confValue;
return sysConfPO.getConfValue();
}
/**