igl hace 3 meses
padre
commit
5013dea292

+ 14 - 4
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/MerchantAuthServiceImpl.java

@@ -1,5 +1,6 @@
 package com.chelvc.cloud.vehicle.server.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -14,14 +15,13 @@ import com.chelvc.cloud.vehicle.client.param.MerchantAuthPagingParam;
 import com.chelvc.cloud.vehicle.client.param.MerchantModifyParam;
 import com.chelvc.cloud.vehicle.server.copier.MerchantAuthCopier;
 import com.chelvc.cloud.vehicle.server.dao.MerchantAuthMapper;
-import com.chelvc.cloud.vehicle.server.entity.Merchant;
 import com.chelvc.cloud.vehicle.server.entity.MerchantAuth;
-import com.chelvc.cloud.vehicle.server.entity.UserAuth;
 import com.chelvc.cloud.vehicle.server.service.CategoryService;
 import com.chelvc.cloud.vehicle.server.service.MerchantAuthService;
 import com.chelvc.cloud.vehicle.server.service.MerchantRelationService;
 import com.chelvc.cloud.vehicle.server.service.MerchantService;
 import com.chelvc.framework.base.context.SessionContextHolder;
+import com.chelvc.framework.common.exception.ResourceUnavailableException;
 import com.chelvc.framework.common.function.Executor;
 import com.chelvc.framework.common.model.Pagination;
 import com.chelvc.framework.common.util.AssertUtils;
@@ -58,6 +58,11 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
     @Override
     public Long addMerchantAuth(@NonNull MerchantAuthModifyParam param) {
         Long userId = SessionContextHolder.getId();
+        LambdaQueryWrapper<MerchantAuth> wrapper = Wrappers.lambdaQuery();
+        wrapper.eq(MerchantAuth::getApplicant, userId);
+        if(baseMapper.selectCount(wrapper) > 0){
+            throw new ResourceUnavailableException("审核认证已申请");
+        }
         if (StringUtils.isEmpty(param.getStoreAddress())){
             param.setStoreAddress(param.getStoreAddress());
         }
@@ -96,7 +101,7 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
         }else{
             this.merchantService.updateMerchant(merchant.getId(),param1);
         }
-        //首信易个人子商户认证
+        //首信易商户子商户认证
         merchantRelationService.registerMerchantId(merchantAuth);
         return merchantAuth.getId();
     }
@@ -107,6 +112,10 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
             param.setStoreAddress(param.getStoreAddress());
         }
         MerchantAuth merchantAuth = AssertUtils.nonnull(this.getById(id), "商家认证不存在");
+        String reviewStatus = merchantAuth.getReviewStatus();
+        if("2".equals(reviewStatus)){
+            throw new ResourceUnavailableException("已认证成功,不可重复认证");
+        }
         MerchantAuthCopier.INSTANCE.copying(param, merchantAuth);
         merchantAuth.setReviewStatus("1");
         merchantAuth.setId(id);
@@ -136,7 +145,8 @@ public class MerchantAuthServiceImpl extends ServiceImpl<MerchantAuthMapper, Mer
         }else{
             this.merchantService.updateMerchant(merchantIds.get(0),param1);
         }
-
+        //首信易商户子商户认证
+        merchantRelationService.registerMerchantId(merchantAuth);
     }
 
     @Override

+ 1 - 1
vehicle-server/src/main/java/com/chelvc/cloud/vehicle/server/service/impl/MerchantRelationServiceImpl.java

@@ -55,7 +55,7 @@ public class MerchantRelationServiceImpl extends ServiceImpl<MerchantRelationMap
         //商户基本信息
         JSONObject baseInfo = new JSONObject();
         baseInfo.put("signedType", "BY_SPLIT_BILL");
-        baseInfo.put("signedName", merchantAuth.getAccountName());
+        baseInfo.put("signedName", merchantAuth.getBusinessName());
         baseInfo.put("registerRole", "INDIVIDUAL_BUSINESS"); //个体工商户
         baseInfo.put("cerType", "INDIVIDUAL_BUSINESS_LICENCE"); //个体工商户营业执照
         baseInfo.put("signedShorthand", merchantAuth.getStoreName());