浏览代码

密码加密

liu_lake 6 月之前
父节点
当前提交
213111326f

+ 1 - 1
web/admin-api/src/main/java/pay/platform/api/system/controller/PayAgentController.java

@@ -37,7 +37,7 @@ public class PayAgentController {
     @Operation(summary = "添加代理")
 
     public boolean save(@RequestBody PayAgent PayAgent) {
-        return payAgentService.save(PayAgent);
+        return payAgentService.saveAgent(PayAgent);
     }
 
 

+ 1 - 0
web/admin-api/src/main/java/pay/platform/api/system/servcie/PayAgentService.java

@@ -12,4 +12,5 @@ import pay.platform.domain.PayAgent;
  */
 public interface PayAgentService extends IService<PayAgent> {
 
+    boolean saveAgent(PayAgent payAgent);
 }

+ 6 - 0
web/admin-api/src/main/java/pay/platform/api/system/servcie/impl/PayAgentServiceImpl.java

@@ -4,6 +4,7 @@ package pay.platform.api.system.servcie.impl;
 import org.springframework.stereotype.Service;
 import pay.platform.api.system.servcie.PayAgentService;
 import pay.platform.core.common.domain.BaseService;
+import pay.platform.core.util.PasswordUtil;
 import pay.platform.domain.PayAgent;
 import pay.platform.mapper.PayAgentMapper;
 
@@ -16,4 +17,9 @@ import pay.platform.mapper.PayAgentMapper;
 @Service
 public class PayAgentServiceImpl extends BaseService<PayAgentMapper, PayAgent> implements PayAgentService {
 
+    @Override
+    public boolean saveAgent(PayAgent payAgent) {
+        payAgent.setPassword(PasswordUtil.encoder(payAgent.getPassword()));
+        return save(payAgent);
+    }
 }

+ 2 - 0
web/admin-api/src/main/java/pay/platform/api/system/servcie/impl/PayMerchantServiceImpl.java

@@ -9,6 +9,7 @@ import pay.platform.api.system.servcie.PayMerchantAppKeyService;
 import pay.platform.api.system.servcie.PayMerchantService;
 import pay.platform.api.system.servcie.PayMerchantStoreService;
 import pay.platform.core.common.domain.BaseService;
+import pay.platform.core.util.PasswordUtil;
 import pay.platform.domain.PayMerchant;
 import pay.platform.domain.PayMerchantAppKey;
 import pay.platform.domain.PayMerchantStore;
@@ -33,6 +34,7 @@ public class PayMerchantServiceImpl extends BaseService<PayMerchantMapper, PayMe
     @Override
     @Transactional
     public boolean saveMerchant(PayMerchant payMerchant) {
+        payMerchant.setPassword(PasswordUtil.encoder(payMerchant.getPassword()));
         save(payMerchant);
         List<PayMerchantStore> storeList = new ArrayList<>();
         for (int i = 0; i < 7; i++) {

+ 2 - 0
web/agent-api/src/main/java/pay/platform/api/system/servcie/impl/PayMerchantServiceImpl.java

@@ -10,6 +10,7 @@ import pay.platform.api.system.servcie.PayMerchantService;
 import pay.platform.api.system.servcie.PayMerchantStoreService;
 import pay.platform.core.common.domain.BaseService;
 import pay.platform.core.security.util.SecurityUtil;
+import pay.platform.core.util.PasswordUtil;
 import pay.platform.domain.PayMerchant;
 import pay.platform.domain.PayMerchantAppKey;
 import pay.platform.domain.PayMerchantStore;
@@ -34,6 +35,7 @@ public class PayMerchantServiceImpl extends BaseService<PayMerchantMapper, PayMe
     @Override
     @Transactional
     public boolean saveMerchant(PayMerchant payMerchant) {
+        payMerchant.setPassword(PasswordUtil.encoder(payMerchant.getPassword()));
         payMerchant.setAgentId(SecurityUtil.getCurrentUser().getUserid());
         save(payMerchant);
         List<PayMerchantStore> storeList = new ArrayList<>();