| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263 |
- package com.crm.settlement.service.impl;
- import com.alibaba.fastjson2.JSON;
- import com.crm.rely.backend.core.constant.Constants;
- import com.crm.rely.backend.core.exception.ServiceException;
- import com.crm.rely.backend.model.pojo.table.SysSettlementConfigTable;
- import com.crm.rely.backend.service.RedisService;
- import com.crm.rely.backend.util.AESUtil;
- import com.crm.settlement.dao.repository.SysSettlementConfigRepository;
- import com.crm.settlement.service.SysConfigService;
- import com.crm.settlement.service.SysSettlementConfigService;
- import org.apache.commons.lang3.StringUtils;
- import org.springframework.beans.factory.annotation.Autowired;
- import org.springframework.stereotype.Service;
- @Service
- public class SysSettlementConfigServiceImpl implements SysSettlementConfigService {
- @Autowired
- private SysSettlementConfigRepository sysSettlementConfigRepository;
- @Autowired
- private RedisService redisService;
- @Autowired
- private SysConfigService sysConfigService;
- @Override
- public SysSettlementConfigTable getByCode(String code){
- SysSettlementConfigTable cacheEntity = redisService.getEntity(code, SysSettlementConfigTable.class);
- SysSettlementConfigTable configTable;
- if (cacheEntity == null || StringUtils.isEmpty(cacheEntity.getValue())) {
- configTable = sysSettlementConfigRepository.getByCode(code);
- if (configTable == null) {
- throw ServiceException.exception(Constants.INFO_NOT_FOUND);
- } else {
- redisService.save(code, configTable, 24 * 60 * 60 * 1000);
- }
- } else {
- configTable = cacheEntity;
- }
- SysSettlementConfigTable resultTable = JSON.parseObject(JSON.toJSONString(configTable), SysSettlementConfigTable.class);
- String aesKey = sysConfigService.getPropertyKey();
- String property = AESUtil.decrypt(configTable.getValue(), aesKey);
- resultTable.setValue(property);
- return resultTable;
- }
- public static void main(String[] args) {
- String s = "xt4mA5tZi/4TcVck+5OPVL5to4cYAuqFtTJoyCVKl5elPCKNPYu+dGSNJOwAAqhc2SKBM0k9oxrGZJUxiNwnthSFoFAFQFP0bnWNR4E9oFZJv3xKhC8YlRWx3zd3Eed0L/Sxjm5u2vxgSLALJFxkHAxBc0GWjzcqtEIF1NRTMzMin9cV701GK6K6H9I/QbhMhQUIVh8ygcrR+wsxS2nYt6VF9GCviq4hSIXhmaSlAwrIVtvGjHST9VWdy5HsNFZHCfuSideRej3m9KE3Mz3Got7sig/dbhJ0Oj8Snl7MSLzo0Hz32+pS2vi11Uhbp9B36n1IayH9SH6BRqevJtqPvzJnDwsJN2dg8/VQulqbeFJ5bXpjFR+g808cFJzB8snVN8+LRE95PxrfPKUyzWOETgmCvGUAsKb0ixG6JFDzLa7jibXAehbVHD/tISZH6vLI71HxoSHlSE94IiAEuM9gLBCNPJVR1NaO34aKw+Yb93655YQe3A6Z5GhEiqwDMwhjzqAJaZ2qGp2OcAOJfwepb8KtiMVTKj+CBF1HXdTaI2wUgKwLYtQvWw9nYl+3RFHVTtgdD5QcHYBBeaSyuSb4D2s5nCuVmge8xH9Iz0FIWY7AI6RY7QlOGsRyuFFPI+89uZkLHcIJi3Q9itpkKfXXW4KO5YJl9mptWVhXC331KtO5lkhLSKS9jGcY3XnWjZ5Xra9z04q/MNVMRElHkSFWdwFoWkYQQYngih14Ody8IdhwMUdi81wT8c11Bq649xWqKetY7N6J4ndcNuQ8bHdNEz0kmMAGVd9NLHWpI/8lL+AAYyVDcFJaPOuBOQJZ9iHB/W7pjacAi/95lDrZWyD0tjPgReXp31efgfCnA8gR/Us=";
- System.out.println(AESUtil.decrypt(s, "bfa5559109f94c78af615bcf00d52060"));
- String ss = "{\n" +
- " \"privateKey\": \"MIIBVgIBADANBgkqhkiG9w0BAQEFAASCAUAwggE8AgEAAkEAprqtYRwj0Aw5WPEVF8xUov5/dFb48OnNRuVfBBA+itIwEOsnNsA5cUo+uMC03/WJfuFjMDiYMQ9dgfExrtSYmwIDAQABAkA2RViPXh4IKBp4qYzAoNnB7o5lO7QvkyMnGx1pELKS896CztGxeJ6oLtdIs2KE26mzxsAroFFCICna7rGtBWydAiEAzutOVTbjjSyYYlQRsqu1607ySnn/v/c5kcBRlHqj3QUCIQDORu2MJbIbEKYVNYH8eJCja5CbAJtq+W331TnFUymRHwIhALJj0UvMH5AVk2aqXfuw6AzvKholZeVlSd+rc2nT9bPVAiEAkOkTCFmS/aB8jHnCj3LDaYqvU7Theg0wS+LnatA5a1ECIQCEKe4vVViJqs4nXFvNM1I6zqw7KJUawtnjO3OGcL4NuQ==\",\n" +
- " \"merchantPublicKey\": \"MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBAKntL8BowACv+Yhe4PCCG61GR+bVxZuNhVYQs6M+gIYe0orac+7abhTy88NA7DOsQpodEwgEOHlGOGyfoV4uXDECAwEAAQ==\"\n" +
- "}";
- System.out.println(AESUtil.encrypt(ss, "bfa5559109f94c78af615bcf00d52060"));
- }
- }
|