Yangzw 7 місяців тому
батько
коміт
a0bc1c2039
28 змінених файлів з 895 додано та 31 видалено
  1. 1 1
      feifan-module-sale/feifan-module-sale-api/src/main/java/cn/newfeifan/mall/module/enums/ErrorCodeConstants.java
  2. 22 0
      feifan-module-sale/feifan-module-sale-api/src/main/java/cn/newfeifan/mall/module/enums/MerchantApplyCheckStatusEnum.java
  3. 26 4
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/MerchantController.java
  4. 21 1
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/vo/MerchantPageReqVO.java
  5. 28 2
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/vo/MerchantRespVO.java
  6. 26 3
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/vo/MerchantSaveReqVO.java
  7. 6 6
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/MerchantApplyController.java
  8. 28 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/vo/MerchantApplyPageReqVO.java
  9. 38 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/vo/MerchantApplyRespVO.java
  10. 28 2
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/vo/MerchantApplySaveReqVO.java
  11. 96 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/MerchantApplyLogController.java
  12. 36 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/vo/MerchantApplyLogPageReqVO.java
  13. 37 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/vo/MerchantApplyLogRespVO.java
  14. 28 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/vo/MerchantApplyLogSaveReqVO.java
  15. 31 6
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/dataobject/merchant/MerchantDO.java
  16. 38 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/dataobject/merchantapply/MerchantApplyDO.java
  17. 44 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/dataobject/merchantapplylog/MerchantApplyLogDO.java
  18. 28 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/mysql/merchantapplylog/MerchantApplyLogMapper.java
  19. 14 1
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantService.java
  20. 22 2
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantServiceImpl.java
  21. 80 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchantapply/MerchantApplyServiceImpl.java
  22. 54 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchantapplylog/MerchantApplyLogService.java
  23. 97 0
      feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchantapplylog/MerchantApplyLogServiceImpl.java
  24. 12 0
      feifan-module-sale/feifan-module-sale-biz/src/main/resources/mapper/merchantapplylog/MerchantApplyLogMapper.xml
  25. 4 0
      feifan-module-system/feifan-module-system-api/src/main/java/cn/newfeifan/mall/module/system/enums/DictTypeConstants.java
  26. 2 1
      feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserService.java
  27. 11 2
      feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserServiceImpl.java
  28. 37 0
      sql/mysql/建空库SQL/19_20240801.sql

+ 1 - 1
feifan-module-sale/feifan-module-sale-api/src/main/java/cn/newfeifan/mall/module/enums/ErrorCodeConstants.java

@@ -4,7 +4,6 @@ import cn.newfeifan.mall.framework.common.exception.ErrorCode;
 
 /**
  * System 错误码枚举类
- *
  * system 系统,使用 1-002-000-000 段
  */
 public interface ErrorCodeConstants {
@@ -14,5 +13,6 @@ public interface ErrorCodeConstants {
     ErrorCode SHOP_NOT_EXISTS = new ErrorCode(1_002_029_002, "店铺不存在不存在");
     ErrorCode NO_BANDING = new ErrorCode(1_002_029_002, "未绑定");
     ErrorCode MERCHANT_APPLY_NOT_EXISTS = new ErrorCode(1_002_029_003, "商户申请不存在");
+    ErrorCode MERCHANT_APPLY_LOG_NOT_EXISTS = new ErrorCode(1_002_029_004, "商户申请记录不存在");
 
 }

+ 22 - 0
feifan-module-sale/feifan-module-sale-api/src/main/java/cn/newfeifan/mall/module/enums/MerchantApplyCheckStatusEnum.java

@@ -0,0 +1,22 @@
+package cn.newfeifan.mall.module.enums;
+
+import lombok.Getter;
+import lombok.RequiredArgsConstructor;
+
+/**
+ * 商户申请状态枚举类
+ */
+
+@RequiredArgsConstructor
+@Getter
+public enum MerchantApplyCheckStatusEnum {
+
+    WAIT_AUDIT(0, "审核中"),
+    AUDIT_PASS(1, "审核通过"),
+    AUDIT_FAIL(2, "审核不通过"),
+    ;
+
+    private final Integer type;
+
+    private final String name;
+}

+ 26 - 4
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/MerchantController.java

@@ -4,7 +4,6 @@ import cn.newfeifan.mall.module.system.service.user.AdminUserService;
 import cn.newfeifan.mall.module.trade.service.order.TradeOrderQueryService;
 import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantPageReqVO;
 import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantRespVO;
-import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqByMobileVO;
 import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqVO;
 import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
 import cn.newfeifan.mall.sale.service.merchant.MerchantService;
@@ -29,7 +28,6 @@ import cn.newfeifan.mall.framework.common.pojo.PageResult;
 import cn.newfeifan.mall.framework.common.pojo.CommonResult;
 import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 
-import static cn.newfeifan.mall.framework.common.pojo.CommonResult.error;
 import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
 
 import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
@@ -58,7 +56,7 @@ public class MerchantController {
     @Operation(summary = "创建商户")
     @PreAuthorize("@ss.hasPermission('sale:merchant:create')")
     public CommonResult<HashMap<String, Long>> createMerchant(@Valid @RequestBody MerchantSaveReqVO createReqVO) {
-        return success(merchantService.createMerchant(createReqVO));
+        return success(merchantService.createMerchant(createReqVO, null));
     }
 
     /*@PostMapping("/createByMobile")
@@ -101,7 +99,31 @@ public class MerchantController {
     @PreAuthorize("@ss.hasPermission('sale:merchant:query')")
     public CommonResult<MerchantRespVO> getMerchant(@RequestParam("id") Long id) {
         MerchantDO merchant = merchantService.getMerchant(id);
-        return success(BeanUtils.toBean(merchant, MerchantRespVO.class));
+        MerchantRespVO bean = BeanUtils.toBean(merchant, MerchantRespVO.class);
+        if(merchant != null && merchant.getOtherCertificate() != null){
+            // Step 1: 去除字符串中的方括号和空格
+            String input = merchant.getOtherCertificate().replaceAll("[\\[\\]\\s]", "");
+
+            // Step 2: 按逗号分割字符串
+            String[] parts = input.split(",");
+
+            List<String> fileList = new ArrayList<>();
+
+            // Step 3: 去除每个部分可能的空格并添加到列表中
+            for (String part : parts) {
+                fileList.add(part.trim());
+            }
+
+            bean.setOtherCertificate(fileList);
+        }
+        return success(bean);
+    }
+
+    @GetMapping("/getMerchantCount")
+    @Operation(summary = "获得商户数量")
+    @PreAuthorize("@ss.hasPermission('sale:merchant:query')")
+    public CommonResult<Integer> getMerchantCount(@Valid MerchantPageReqVO pageReqVO) {
+        return success(merchantService.getMerchantPage(pageReqVO).getList().size());
     }
 
 

+ 21 - 1
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/vo/MerchantPageReqVO.java

@@ -1,6 +1,5 @@
 package cn.newfeifan.mall.sale.controller.admin.merchant.vo;
 
-import com.alibaba.excel.annotation.ExcelProperty;
 import lombok.*;
 import java.util.*;
 import io.swagger.v3.oas.annotations.media.Schema;
@@ -77,4 +76,25 @@ public class MerchantPageReqVO extends PageParam {
 
     @Schema(description = "区域id,对应文件系统 src/main/resources/area.csv 中的id一列", example = "22725")
     private Long areaId;
+
+    @Schema(description = "商户申请id", example = "25541")
+    private Long merchantApplyId;
+
+    @Schema(description = "品牌授权书")
+    private String brandLicensing;
+
+    @Schema(description = "其他证书")
+    private List<String> otherCertificate;
+
+    @Schema(description = "法人")
+    private String legalPerson;
+
+    @Schema(description = "法人电话")
+    private String legalPersonNumber;
+
+    @Schema(description = "身份证正面")
+    private String identityCardFront;
+
+    @Schema(description = "身份证反面")
+    private String identityCardReverseSide;
 }

+ 28 - 2
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/vo/MerchantRespVO.java

@@ -3,8 +3,6 @@ package cn.newfeifan.mall.sale.controller.admin.merchant.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import java.util.*;
-import java.util.*;
-import org.springframework.format.annotation.DateTimeFormat;
 import java.time.LocalDateTime;
 import com.alibaba.excel.annotation.*;
 
@@ -106,4 +104,32 @@ public class MerchantRespVO {
     @ExcelProperty("商品总数")
     private Integer skuCount;
 
+    @Schema(description = "商户申请id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25541")
+    @ExcelProperty("商户申请id")
+    private Long merchantApplyId;
+
+    @Schema(description = "品牌授权书", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("品牌授权书")
+    private String brandLicensing;
+
+    @Schema(description = "其他证书")
+    @ExcelProperty("其他证书")
+    private List<String> otherCertificate;
+
+    @Schema(description = "法人", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("法人")
+    private String legalPerson;
+
+    @Schema(description = "法人电话", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("法人电话")
+    private String legalPersonNumber;
+
+    @Schema(description = "身份证正面", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("身份证正面")
+    private String identityCardFront;
+
+    @Schema(description = "身份证反面", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("身份证反面")
+    private String identityCardReverseSide;
+
 }

+ 26 - 3
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchant/vo/MerchantSaveReqVO.java

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import javax.validation.constraints.*;
 import java.time.LocalDateTime;
+import java.util.List;
 
 @Schema(description = "管理后台 - 商户新增/修改 Request VO")
 @Data
@@ -73,16 +74,38 @@ public class MerchantSaveReqVO {
 
 
     @Schema(description = "账户名称", example = "非繁人")
-    @NotEmpty(message = "账户名称不能为空")
     private String accountName;
 
     @Schema(description = "账户号码")
-    @NotEmpty(message = "账户号码不能为空")
     private String accountNumber;
 
     @Schema(description = "开户银行", example = "李四")
-    @NotEmpty(message = "开户银行不能为空")
     private String bankName;
 
+    @Schema(description = "商户申请id", requiredMode = Schema.RequiredMode.REQUIRED, example = "25541")
+    private Long merchantApplyId;
+
+    @Schema(description = "品牌授权书", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String brandLicensing;
+
+    @Schema(description = "其他证书")
+    private List<String> otherCertificate;
+
+    @Schema(description = "法人", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "法人不能为空")
+    private String legalPerson;
+
+    @Schema(description = "法人电话", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "法人电话不能为空")
+    private String legalPersonNumber;
+
+    @Schema(description = "身份证正面", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "身份证正面不能为空")
+    private String identityCardFront;
+
+    @Schema(description = "身份证反面", requiredMode = Schema.RequiredMode.REQUIRED)
+    @NotEmpty(message = "身份证反面不能为空")
+    private String identityCardReverseSide;
+
 
 }

+ 6 - 6
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/MerchantApplyController.java

@@ -39,12 +39,12 @@ public class MerchantApplyController {
     @Resource
     private MerchantApplyService merchantApplyService;
 
-    @PostMapping("/create")
-    @Operation(summary = "创建商户申请")
-    @PreAuthorize("@ss.hasPermission('sale:merchant-apply:create')")
-    public CommonResult<Long> createMerchantApply(@Valid @RequestBody MerchantApplySaveReqVO createReqVO) {
-        return success(merchantApplyService.createMerchantApply(createReqVO));
-    }
+//    @PostMapping("/create")
+//    @Operation(summary = "创建商户申请")
+//    @PreAuthorize("@ss.hasPermission('sale:merchant-apply:create')")
+//    public CommonResult<Long> createMerchantApply(@Valid @RequestBody MerchantApplySaveReqVO createReqVO) {
+//        return success(merchantApplyService.createMerchantApply(createReqVO));
+//    }
 
     @PutMapping("/update")
     @Operation(summary = "更新商户申请")

+ 28 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/vo/MerchantApplyPageReqVO.java

@@ -5,6 +5,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import cn.newfeifan.mall.framework.common.pojo.PageParam;
 import org.springframework.format.annotation.DateTimeFormat;
 import java.time.LocalDateTime;
+import java.util.List;
 
 import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
 
@@ -89,4 +90,31 @@ public class MerchantApplyPageReqVO extends PageParam {
     @Schema(description = "审核状态:默认0表示未审核,1审核通过,2审核不通过", example = "1")
     private Integer checkStatus;
 
+    @Schema(description = "账户名称", example = "赵六")
+    private String accountName;
+
+    @Schema(description = "账户号码")
+    private String accountNumber;
+
+    @Schema(description = "开户银行", example = "非繁人")
+    private String bankName;
+
+    @Schema(description = "品牌授权书")
+    private String brandLicensing;
+
+    @Schema(description = "其他证书")
+    private List<String> otherCertificate;
+
+    @Schema(description = "法人")
+    private String legalPerson;
+
+    @Schema(description = "法人电话")
+    private String legalPersonNumber;
+
+    @Schema(description = "身份证正面")
+    private String identityCardFront;
+
+    @Schema(description = "身份证反面")
+    private String identityCardReverseSide;
+
 }

+ 38 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/vo/MerchantApplyRespVO.java

@@ -3,6 +3,8 @@ package cn.newfeifan.mall.sale.controller.admin.merchantapply.vo;
 import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import java.time.LocalDateTime;
+import java.util.List;
+
 import com.alibaba.excel.annotation.*;
 
 @Schema(description = "管理后台 - 商户申请 Response VO")
@@ -110,4 +112,40 @@ public class MerchantApplyRespVO {
     @ExcelProperty("审核状态:默认0表示未审核,1审核通过,2审核不通过")
     private Integer checkStatus;
 
+    @Schema(description = "账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    @ExcelProperty("账户名称")
+    private String accountName;
+
+    @Schema(description = "账户号码", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("账户号码")
+    private String accountNumber;
+
+    @Schema(description = "开户银行", requiredMode = Schema.RequiredMode.REQUIRED, example = "非繁人")
+    @ExcelProperty("开户银行")
+    private String bankName;
+
+    @Schema(description = "品牌授权书", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("品牌授权书")
+    private String brandLicensing;
+
+    @Schema(description = "其他证书", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("其他证书")
+    private List<String> otherCertificate;
+
+    @Schema(description = "法人", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("法人")
+    private String legalPerson;
+
+    @Schema(description = "法人电话", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("法人电话")
+    private String legalPersonNumber;
+
+    @Schema(description = "身份证正面", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("身份证正面")
+    private String identityCardFront;
+
+    @Schema(description = "身份证反面", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("身份证反面")
+    private String identityCardReverseSide;
+
 }

+ 28 - 2
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapply/vo/MerchantApplySaveReqVO.java

@@ -4,6 +4,7 @@ import io.swagger.v3.oas.annotations.media.Schema;
 import lombok.*;
 import javax.validation.constraints.*;
 import java.time.LocalDateTime;
+import java.util.List;
 
 @Schema(description = "管理后台 - 商户申请新增/修改 Request VO")
 @Data
@@ -20,7 +21,6 @@ public class MerchantApplySaveReqVO {
     private String name;
 
     @Schema(description = "商户状态,关联商户状态表", requiredMode = Schema.RequiredMode.REQUIRED, example = "1")
-    @NotNull(message = "商户状态,关联商户状态表不能为空")
     private Integer status;
 
     @Schema(description = "简介", example = "随便")
@@ -48,6 +48,7 @@ public class MerchantApplySaveReqVO {
     private String customerServiceHotline;
 
     @Schema(description = "邮箱")
+    @Email(message = "邮箱格式不正确")
     private String email;
 
     @Schema(description = "营业执照图片路径")
@@ -66,7 +67,6 @@ public class MerchantApplySaveReqVO {
     private Long areaId;
 
     @Schema(description = "申请用户id", requiredMode = Schema.RequiredMode.REQUIRED, example = "7189")
-    @NotNull(message = "申请用户id不能为空")
     private Long applyMemberUserId;
 
     @Schema(description = "审核系统用户id", example = "29612")
@@ -84,4 +84,30 @@ public class MerchantApplySaveReqVO {
     @Schema(description = "审核状态:默认0表示未审核,1审核通过,2审核不通过", example = "1")
     private Integer checkStatus;
 
+    @Schema(description = "账户名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
+    private String accountName;
+
+    @Schema(description = "账户号码", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String accountNumber;
+
+    @Schema(description = "开户银行", requiredMode = Schema.RequiredMode.REQUIRED, example = "非繁人")
+    private String bankName;
+
+    @Schema(description = "品牌授权书", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String brandLicensing;
+
+    @Schema(description = "其他证书", requiredMode = Schema.RequiredMode.REQUIRED)
+    private List<String> otherCertificate;
+
+    @Schema(description = "法人", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String legalPerson;
+
+    @Schema(description = "法人电话", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String legalPersonNumber;
+
+    @Schema(description = "身份证正面", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String identityCardFront;
+
+    @Schema(description = "身份证反面", requiredMode = Schema.RequiredMode.REQUIRED)
+    private String identityCardReverseSide;
 }

+ 96 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/MerchantApplyLogController.java

@@ -0,0 +1,96 @@
+package cn.newfeifan.mall.sale.controller.admin.merchantapplylog;
+
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogPageReqVO;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogRespVO;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogSaveReqVO;
+import cn.newfeifan.mall.sale.service.merchantapplylog.MerchantApplyLogService;
+import org.springframework.web.bind.annotation.*;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.security.access.prepost.PreAuthorize;
+import io.swagger.v3.oas.annotations.tags.Tag;
+import io.swagger.v3.oas.annotations.Parameter;
+import io.swagger.v3.oas.annotations.Operation;
+
+import javax.validation.*;
+import javax.servlet.http.*;
+import java.util.*;
+import java.io.IOException;
+
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.pojo.CommonResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+import static cn.newfeifan.mall.framework.common.pojo.CommonResult.success;
+
+import cn.newfeifan.mall.framework.excel.core.util.ExcelUtils;
+
+import cn.newfeifan.mall.framework.operatelog.core.annotations.OperateLog;
+import static cn.newfeifan.mall.framework.operatelog.core.enums.OperateTypeEnum.*;
+
+import cn.newfeifan.mall.sale.dal.dataobject.merchantapplylog.MerchantApplyLogDO;
+
+@Tag(name = "管理后台 - 商户审核记录")
+@RestController
+@RequestMapping("/sale/merchant-apply-log")
+@Validated
+public class MerchantApplyLogController {
+
+    @Resource
+    private MerchantApplyLogService merchantApplyLogService;
+
+    @PostMapping("/create")
+    @Operation(summary = "创建商户审核记录")
+    @PreAuthorize("@ss.hasPermission('sale:merchant-apply-log:create')")
+    public CommonResult<Long> createMerchantApplyLog(@Valid @RequestBody MerchantApplyLogSaveReqVO createReqVO) {
+        return success(merchantApplyLogService.createMerchantApplyLog(createReqVO));
+    }
+
+    @PutMapping("/update")
+    @Operation(summary = "更新商户审核记录")
+    @PreAuthorize("@ss.hasPermission('sale:merchant-apply-log:update')")
+    public CommonResult<Boolean> updateMerchantApplyLog(@Valid @RequestBody MerchantApplyLogSaveReqVO updateReqVO) {
+        merchantApplyLogService.updateMerchantApplyLog(updateReqVO);
+        return success(true);
+    }
+
+    @DeleteMapping("/delete")
+    @Operation(summary = "删除商户审核记录")
+    @Parameter(name = "id", description = "编号", required = true)
+    @PreAuthorize("@ss.hasPermission('sale:merchant-apply-log:delete')")
+    public CommonResult<Boolean> deleteMerchantApplyLog(@RequestParam("id") Long id) {
+        merchantApplyLogService.deleteMerchantApplyLog(id);
+        return success(true);
+    }
+
+    @GetMapping("/get")
+    @Operation(summary = "获得商户审核记录")
+    @Parameter(name = "id", description = "编号", required = true, example = "1024")
+    @PreAuthorize("@ss.hasPermission('sale:merchant-apply-log:query')")
+    public CommonResult<MerchantApplyLogRespVO> getMerchantApplyLog(@RequestParam("id") Long id) {
+        MerchantApplyLogDO merchantApplyLog = merchantApplyLogService.getMerchantApplyLog(id);
+        return success(BeanUtils.toBean(merchantApplyLog, MerchantApplyLogRespVO.class));
+    }
+
+    @GetMapping("/page")
+    @Operation(summary = "获得商户审核记录分页")
+    @PreAuthorize("@ss.hasPermission('sale:merchant-apply-log:query')")
+    public CommonResult<PageResult<MerchantApplyLogRespVO>> getMerchantApplyLogPage(@Valid MerchantApplyLogPageReqVO pageReqVO) {
+        PageResult<MerchantApplyLogDO> pageResult = merchantApplyLogService.getMerchantApplyLogPage(pageReqVO);
+        return success(BeanUtils.toBean(pageResult, MerchantApplyLogRespVO.class));
+    }
+
+    @GetMapping("/export-excel")
+    @Operation(summary = "导出商户审核记录 Excel")
+    @PreAuthorize("@ss.hasPermission('sale:merchant-apply-log:export')")
+    @OperateLog(type = EXPORT)
+    public void exportMerchantApplyLogExcel(@Valid MerchantApplyLogPageReqVO pageReqVO,
+              HttpServletResponse response) throws IOException {
+        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
+        List<MerchantApplyLogDO> list = merchantApplyLogService.getMerchantApplyLogPage(pageReqVO).getList();
+        // 导出 Excel
+        ExcelUtils.write(response, "商户审核记录.xls", "数据", MerchantApplyLogRespVO.class,
+                        BeanUtils.toBean(list, MerchantApplyLogRespVO.class));
+    }
+
+}

+ 36 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/vo/MerchantApplyLogPageReqVO.java

@@ -0,0 +1,36 @@
+package cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo;
+
+import lombok.*;
+import io.swagger.v3.oas.annotations.media.Schema;
+import cn.newfeifan.mall.framework.common.pojo.PageParam;
+import org.springframework.format.annotation.DateTimeFormat;
+import java.time.LocalDateTime;
+
+import static cn.newfeifan.mall.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
+
+@Schema(description = "管理后台 - 商户审核记录分页 Request VO")
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+public class MerchantApplyLogPageReqVO extends PageParam {
+
+    @Schema(description = "申请状态  0:申请中 1:通过 2:未通过", example = "2")
+    private Integer status;
+
+    @Schema(description = "商户申请id", example = "16850")
+    private Long merchantApplyId;
+
+    @Schema(description = "审核系统用户id", example = "16237")
+    private Long checkSystemUserId;
+
+    @Schema(description = "审核意见")
+    private String checkComment;
+
+    @Schema(description = "创建时间")
+    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
+    private LocalDateTime[] createTime;
+
+    @Schema(description = "商户id")
+    private Long merchantId;
+
+}

+ 37 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/vo/MerchantApplyLogRespVO.java

@@ -0,0 +1,37 @@
+package cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import java.time.LocalDateTime;
+import com.alibaba.excel.annotation.*;
+
+@Schema(description = "管理后台 - 商户审核记录 Response VO")
+@Data
+@ExcelIgnoreUnannotated
+public class MerchantApplyLogRespVO {
+
+    @Schema(description = "审核记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9887")
+    @ExcelProperty("审核记录id")
+    private Long id;
+
+    @Schema(description = "申请状态  0:申请中 1:通过 2:未通过", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @ExcelProperty("申请状态  0:申请中 1:通过 2:未通过")
+    private Integer status;
+
+    @Schema(description = "商户申请id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16850")
+    @ExcelProperty("商户申请id")
+    private Long merchantApplyId;
+
+    @Schema(description = "审核系统用户id", example = "16237")
+    @ExcelProperty("审核系统用户id")
+    private Long checkSystemUserId;
+
+    @Schema(description = "审核意见")
+    @ExcelProperty("审核意见")
+    private String checkComment;
+
+    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
+    @ExcelProperty("创建时间")
+    private LocalDateTime createTime;
+
+}

+ 28 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/controller/admin/merchantapplylog/vo/MerchantApplyLogSaveReqVO.java

@@ -0,0 +1,28 @@
+package cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo;
+
+import io.swagger.v3.oas.annotations.media.Schema;
+import lombok.*;
+import javax.validation.constraints.*;
+
+@Schema(description = "管理后台 - 商户审核记录新增/修改 Request VO")
+@Data
+@Builder
+public class MerchantApplyLogSaveReqVO {
+
+    @Schema(description = "审核记录id", requiredMode = Schema.RequiredMode.REQUIRED, example = "9887")
+    private Long id;
+
+    @Schema(description = "申请状态  0:申请中 1:通过 2:未通过", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
+    @NotNull(message = "申请状态  0:申请中 1:通过 2:未通过不能为空")
+    private Integer status;
+
+    @Schema(description = "商户申请id", requiredMode = Schema.RequiredMode.REQUIRED, example = "16850")
+    private Long merchantApplyId;
+
+    @Schema(description = "审核系统用户id", example = "16237")
+    private Long checkSystemUserId;
+
+    @Schema(description = "审核意见")
+    private String checkComment;
+
+}

+ 31 - 6
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/dataobject/merchant/MerchantDO.java

@@ -1,13 +1,11 @@
 package cn.newfeifan.mall.sale.dal.dataobject.merchant;
 
 import lombok.*;
-import java.util.*;
-import java.time.LocalDateTime;
-import java.time.LocalDateTime;
 import java.time.LocalDateTime;
 import com.baomidou.mybatisplus.annotation.*;
 import cn.newfeifan.mall.framework.mybatis.core.dataobject.BaseDO;
 
+
 /**
  * 商户 DO
  *
@@ -41,7 +39,7 @@ public class MerchantDO extends BaseDO {
      */
     private String description;
     /**
-     * 负责
+     * 联络
      */
     private String contact;
     /**
@@ -49,7 +47,7 @@ public class MerchantDO extends BaseDO {
      */
     private String address;
     /**
-     * 负责人电话
+     * 联络人电话
      */
     private String contactNumber;
     /**
@@ -94,5 +92,32 @@ public class MerchantDO extends BaseDO {
      */
     private Long areaId;
 
-
+    /**
+     * 商户申请id
+     */
+    private Long merchantApplyId;
+    /**
+     * 品牌授权书
+     */
+    private String brandLicensing;
+    /**
+     * 其他证书
+     */
+    private String otherCertificate;
+    /**
+     * 法人
+     */
+    private String legalPerson;
+    /**
+     * 法人电话
+     */
+    private String legalPersonNumber;
+    /**
+     * 身份证正面
+     */
+    private String identityCardFront;
+    /**
+     * 身份证反面
+     */
+    private String identityCardReverseSide;
 }

+ 38 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/dataobject/merchantapply/MerchantApplyDO.java

@@ -118,4 +118,42 @@ public class MerchantApplyDO extends BaseDO {
      */
     private Integer checkStatus;
 
+    /**
+     * 账户名称
+     */
+    private String accountName;
+    /**
+     * 账户号码
+     */
+    private String accountNumber;
+    /**
+     * 开户银行
+     */
+    private String bankName;
+    /**
+     * 品牌授权书
+     */
+    private String brandLicensing;
+    /**
+     * 其他证书
+     */
+    private String otherCertificate;
+
+    /**
+     * 法人
+     */
+    private String legalPerson;
+    /**
+     * 法人电话
+     */
+    private String legalPersonNumber;
+    /**
+     * 身份证正面
+     */
+    private String identityCardFront;
+    /**
+     * 身份证反面
+     */
+    private String identityCardReverseSide;
+
 }

+ 44 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/dataobject/merchantapplylog/MerchantApplyLogDO.java

@@ -0,0 +1,44 @@
+package cn.newfeifan.mall.sale.dal.dataobject.merchantapplylog;
+
+import lombok.*;
+import com.baomidou.mybatisplus.annotation.*;
+import cn.newfeifan.mall.framework.mybatis.core.dataobject.BaseDO;
+
+/**
+ * 商户审核记录 DO
+ *
+ * @author 非繁人
+ */
+@TableName("sale_merchant_apply_log")
+@KeySequence("sale_merchant_apply_log_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
+@Data
+@EqualsAndHashCode(callSuper = true)
+@ToString(callSuper = true)
+@Builder
+@NoArgsConstructor
+@AllArgsConstructor
+public class MerchantApplyLogDO extends BaseDO {
+
+    /**
+     * 审核记录id
+     */
+    @TableId
+    private Long id;
+    /**
+     * 申请状态  0:申请中 1:通过 2:未通过
+     */
+    private Integer status;
+    /**
+     * 商户申请id
+     */
+    private Long merchantApplyId;
+    /**
+     * 审核系统用户id
+     */
+    private Long checkSystemUserId;
+    /**
+     * 审核意见
+     */
+    private String checkComment;
+
+}

+ 28 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/dal/mysql/merchantapplylog/MerchantApplyLogMapper.java

@@ -0,0 +1,28 @@
+package cn.newfeifan.mall.sale.dal.mysql.merchantapplylog;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.mybatis.core.query.LambdaQueryWrapperX;
+import cn.newfeifan.mall.framework.mybatis.core.mapper.BaseMapperX;
+import cn.newfeifan.mall.sale.dal.dataobject.merchantapplylog.MerchantApplyLogDO;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogPageReqVO;
+import org.apache.ibatis.annotations.Mapper;
+
+/**
+ * 商户审核记录 Mapper
+ *
+ * @author 非繁人
+ */
+@Mapper
+public interface MerchantApplyLogMapper extends BaseMapperX<MerchantApplyLogDO> {
+
+    default PageResult<MerchantApplyLogDO> selectPage(MerchantApplyLogPageReqVO reqVO) {
+        return selectPage(reqVO, new LambdaQueryWrapperX<MerchantApplyLogDO>()
+                .eqIfPresent(MerchantApplyLogDO::getStatus, reqVO.getStatus())
+                .eqIfPresent(MerchantApplyLogDO::getMerchantApplyId, reqVO.getMerchantApplyId())
+                .eqIfPresent(MerchantApplyLogDO::getCheckSystemUserId, reqVO.getCheckSystemUserId())
+                .eqIfPresent(MerchantApplyLogDO::getCheckComment, reqVO.getCheckComment())
+                .betweenIfPresent(MerchantApplyLogDO::getCreateTime, reqVO.getCreateTime())
+                .orderByDesc(MerchantApplyLogDO::getId));
+    }
+
+}

+ 14 - 1
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantService.java

@@ -25,7 +25,7 @@ public interface MerchantService {
      * @param createReqVO 创建信息
      * @return 编号
      */
-    HashMap<String, Long> createMerchant(@Valid MerchantSaveReqVO createReqVO);
+    HashMap<String, Long> createMerchant(@Valid MerchantSaveReqVO createReqVO, String mobile);
 
     /**
      * 更新商户
@@ -59,4 +59,17 @@ public interface MerchantService {
 
     List<MerchantRespVO> salesVolume(Map<Long, MerchantRespVO> map);
     void doSendMail(LoginSendMessage message);
+
+    /**
+     * 根据商户申请id查询商户
+     * @param id 商户申请id
+     * @return 商户
+     */
+    MerchantDO selectByApplyId(Long id);
+
+    /**
+     * 更新商户
+     * @param merchantDO 商户
+     */
+    void updateMerchant(MerchantDO merchantDO);
 }

+ 22 - 2
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchant/MerchantServiceImpl.java

@@ -62,7 +62,7 @@ public class MerchantServiceImpl implements MerchantService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public HashMap<String, Long> createMerchant(MerchantSaveReqVO createReqVO) {
+    public HashMap<String, Long> createMerchant(MerchantSaveReqVO createReqVO, String mobile) {
         // 插入
         MerchantDO merchant = BeanUtils.toBean(createReqVO, MerchantDO.class);
         merchantMapper.insert(merchant);
@@ -75,7 +75,16 @@ public class MerchantServiceImpl implements MerchantService {
         if (adminUserDO != null) {
             throw exception(USER_MOBILE_EXISTS);
         }
-        adminUserService.createUserByMobile(merchant.getId(), shopId, merchant.getContactNumber(), merchant.getContact());
+        adminUserService.createUserByMobile(merchant.getId(), shopId, merchant.getContactNumber(), merchant.getContact(), true);
+
+        // 不同的手机号, 创建不同的账号
+        if (mobile != null) {
+            AdminUserDO userDO = userMapper.selectByMobile(merchant.getContactNumber());
+            if (userDO != null) {
+                throw exception(USER_MOBILE_EXISTS);
+            }
+            adminUserService.createUserByMobile(merchant.getId(), shopId, mobile, merchant.getContact(),false);
+        }
         // todo 设置直推人关联关系
         HashMap<String, Long> stringLongHashMap = new HashMap<>();
         stringLongHashMap.put("shopId", shopId);
@@ -136,6 +145,7 @@ public class MerchantServiceImpl implements MerchantService {
         }
         return new ArrayList<>(map.values());
     }
+
     @Override
     public void doSendMail(LoginSendMessage message) {
 
@@ -166,4 +176,14 @@ public class MerchantServiceImpl implements MerchantService {
             }
         }
     }
+
+    @Override
+    public MerchantDO selectByApplyId(Long id) {
+        return merchantMapper.selectOne(MerchantDO::getMerchantApplyId, id);
+    }
+
+    @Override
+    public void updateMerchant(MerchantDO merchantDO) {
+        merchantMapper.updateById(merchantDO);
+    }
 }

+ 80 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchantapply/MerchantApplyServiceImpl.java

@@ -1,9 +1,25 @@
 package cn.newfeifan.mall.sale.service.merchantapply;
 
+import cn.newfeifan.mall.module.enums.MerchantApplyCheckStatusEnum;
+import cn.newfeifan.mall.module.enums.MerchantStatusEnum;
+import cn.newfeifan.mall.module.member.dal.dataobject.user.MemberUserDO;
+import cn.newfeifan.mall.module.member.service.user.MemberUserService;
+import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqVO;
 import cn.newfeifan.mall.sale.controller.admin.merchantapply.vo.MerchantApplyPageReqVO;
 import cn.newfeifan.mall.sale.controller.admin.merchantapply.vo.MerchantApplySaveReqVO;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogSaveReqVO;
+import cn.newfeifan.mall.sale.controller.admin.shop.vo.ShopRespVO;
+import cn.newfeifan.mall.sale.controller.admin.shop.vo.ShopSaveReqVO;
+import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
+import cn.newfeifan.mall.sale.service.merchant.MerchantService;
+import cn.newfeifan.mall.sale.service.merchantapplylog.MerchantApplyLogService;
+import cn.newfeifan.mall.sale.service.shop.ShopService;
+import org.springframework.context.annotation.Lazy;
 import org.springframework.stereotype.Service;
+
 import javax.annotation.Resource;
+
+import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import cn.newfeifan.mall.sale.dal.dataobject.merchantapply.MerchantApplyDO;
@@ -12,7 +28,12 @@ import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
 
 import cn.newfeifan.mall.sale.dal.mysql.merchantapply.MerchantApplyMapper;
 
+import java.time.LocalDateTime;
+import java.util.List;
+import java.util.Objects;
+
 import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
 import static cn.newfeifan.mall.module.enums.ErrorCodeConstants.MERCHANT_APPLY_NOT_EXISTS;
 
 /**
@@ -27,6 +48,19 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
     @Resource
     private MerchantApplyMapper merchantApplyMapper;
 
+    @Resource
+    @Lazy
+    private MerchantApplyLogService merchantApplyLogService;
+
+    @Resource
+    private MerchantService merchantService;
+
+    @Resource
+    private ShopService shopService;
+
+    @Resource
+    private MemberUserService memberUserService;
+
     @Override
     public Long createMerchantApply(MerchantApplySaveReqVO createReqVO) {
         // 插入
@@ -37,12 +71,58 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public void updateMerchantApply(MerchantApplySaveReqVO updateReqVO) {
         // 校验存在
         validateMerchantApplyExists(updateReqVO.getId());
         // 更新
         MerchantApplyDO updateObj = BeanUtils.toBean(updateReqVO, MerchantApplyDO.class);
+        updateObj.setCheckTime(LocalDateTime.now());
+        updateObj.setCheckSystemUserId(getLoginUserId());
         merchantApplyMapper.updateById(updateObj);
+
+        MerchantApplyLogSaveReqVO build = MerchantApplyLogSaveReqVO.builder()
+                .status(updateObj.getCheckStatus())
+                .merchantApplyId(updateObj.getId())
+                .checkComment(updateObj.getCheckComment())
+                .build();
+        merchantApplyLogService.createMerchantApplyLog(build);
+
+        MerchantSaveReqVO bean = BeanUtils.toBean(updateReqVO, MerchantSaveReqVO.class);
+        MerchantDO merchantDO = merchantService.selectByApplyId(updateObj.getId());
+        // 如果审核通过
+        if (Objects.equals(updateObj.getCheckStatus(), MerchantApplyCheckStatusEnum.AUDIT_PASS.getType())) {
+            bean.setStatus(MerchantStatusEnum.USING.getType());
+
+            // 创建
+            if (merchantDO == null) {
+
+                MemberUserDO user = memberUserService.getUser(updateReqVO.getApplyMemberUserId());
+
+                bean.setId(null);
+                bean.setMerchantApplyId(updateObj.getId());
+                bean.setContactNumber(user.getMobile());
+                merchantService.createMerchant(bean, !user.getMobile().equals(updateReqVO.getContactNumber()) ? updateReqVO.getContactNumber() : null);
+            } else {
+                // 修改
+                bean.setId(merchantDO.getId());
+                merchantService.updateMerchant(bean);
+
+                // 修改商户下的店铺
+                List<ShopRespVO> merchantAllShop = shopService.getMerchantAllShop(merchantDO.getId());
+                for (ShopRespVO shopRespVO : merchantAllShop) {
+                    shopRespVO.setAccountName(updateReqVO.getAccountName());
+                    shopRespVO.setAccountNumber(updateReqVO.getAccountNumber());
+                    shopRespVO.setBankName(updateReqVO.getBankName());
+                    shopService.updateShop(BeanUtils.toBean(shopRespVO, ShopSaveReqVO.class));
+                }
+            }
+        } else if (Objects.equals(updateObj.getCheckStatus(), MerchantApplyCheckStatusEnum.AUDIT_FAIL.getType())) {
+            if(merchantDO != null){
+                merchantDO.setStatus(MerchantStatusEnum.STOP.getType());
+                merchantService.updateMerchant(merchantDO);
+            }
+        }
     }
 
     @Override

+ 54 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchantapplylog/MerchantApplyLogService.java

@@ -0,0 +1,54 @@
+package cn.newfeifan.mall.sale.service.merchantapplylog;
+
+import javax.validation.*;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogPageReqVO;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogSaveReqVO;
+import cn.newfeifan.mall.sale.dal.dataobject.merchantapplylog.MerchantApplyLogDO;
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+
+/**
+ * 商户审核记录 Service 接口
+ *
+ * @author 非繁人
+ */
+public interface MerchantApplyLogService {
+
+    /**
+     * 创建商户审核记录
+     *
+     * @param createReqVO 创建信息
+     * @return 编号
+     */
+    Long createMerchantApplyLog(@Valid MerchantApplyLogSaveReqVO createReqVO);
+
+    /**
+     * 更新商户审核记录
+     *
+     * @param updateReqVO 更新信息
+     */
+    void updateMerchantApplyLog(@Valid MerchantApplyLogSaveReqVO updateReqVO);
+
+    /**
+     * 删除商户审核记录
+     *
+     * @param id 编号
+     */
+    void deleteMerchantApplyLog(Long id);
+
+    /**
+     * 获得商户审核记录
+     *
+     * @param id 编号
+     * @return 商户审核记录
+     */
+    MerchantApplyLogDO getMerchantApplyLog(Long id);
+
+    /**
+     * 获得商户审核记录分页
+     *
+     * @param pageReqVO 分页查询
+     * @return 商户审核记录分页
+     */
+    PageResult<MerchantApplyLogDO> getMerchantApplyLogPage(MerchantApplyLogPageReqVO pageReqVO);
+
+}

+ 97 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/java/cn/newfeifan/mall/sale/service/merchantapplylog/MerchantApplyLogServiceImpl.java

@@ -0,0 +1,97 @@
+package cn.newfeifan.mall.sale.service.merchantapplylog;
+
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogPageReqVO;
+import cn.newfeifan.mall.sale.controller.admin.merchantapplylog.vo.MerchantApplyLogSaveReqVO;
+import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
+import cn.newfeifan.mall.sale.dal.dataobject.merchantapply.MerchantApplyDO;
+import cn.newfeifan.mall.sale.dal.dataobject.merchantapplylog.MerchantApplyLogDO;
+import cn.newfeifan.mall.sale.dal.mysql.merchantapplylog.MerchantApplyLogMapper;
+import cn.newfeifan.mall.sale.service.merchant.MerchantService;
+import cn.newfeifan.mall.sale.service.merchantapply.MerchantApplyService;
+import org.springframework.stereotype.Service;
+import javax.annotation.Resource;
+import org.springframework.validation.annotation.Validated;
+
+import cn.newfeifan.mall.framework.common.pojo.PageResult;
+import cn.newfeifan.mall.framework.common.util.object.BeanUtils;
+
+import static cn.newfeifan.mall.framework.common.exception.util.ServiceExceptionUtil.exception;
+import static cn.newfeifan.mall.framework.security.core.util.SecurityFrameworkUtils.getLoginUserId;
+import static cn.newfeifan.mall.module.enums.ErrorCodeConstants.MERCHANT_APPLY_LOG_NOT_EXISTS;
+
+/**
+ * 商户审核记录 Service 实现类
+ *
+ * @author 非繁人
+ */
+@Service
+@Validated
+public class MerchantApplyLogServiceImpl implements MerchantApplyLogService {
+
+    @Resource
+    private MerchantApplyLogMapper merchantApplyLogMapper;
+
+    @Resource
+    private MerchantService merchantService;
+
+    @Resource
+    private MerchantApplyService merchantApplyService;
+
+    @Override
+    public Long createMerchantApplyLog(MerchantApplyLogSaveReqVO createReqVO) {
+        // 插入
+        MerchantApplyLogDO merchantApplyLog = BeanUtils.toBean(createReqVO, MerchantApplyLogDO.class);
+
+        // 设置审核人
+        merchantApplyLog.setCheckSystemUserId(getLoginUserId());
+
+        merchantApplyLogMapper.insert(merchantApplyLog);
+        // 返回
+        return merchantApplyLog.getId();
+    }
+
+    @Override
+    public void updateMerchantApplyLog(MerchantApplyLogSaveReqVO updateReqVO) {
+        // 校验存在
+        validateMerchantApplyLogExists(updateReqVO.getId());
+        // 更新
+        MerchantApplyLogDO updateObj = BeanUtils.toBean(updateReqVO, MerchantApplyLogDO.class);
+        merchantApplyLogMapper.updateById(updateObj);
+    }
+
+    @Override
+    public void deleteMerchantApplyLog(Long id) {
+        // 校验存在
+        validateMerchantApplyLogExists(id);
+        // 删除
+        merchantApplyLogMapper.deleteById(id);
+    }
+
+    private void validateMerchantApplyLogExists(Long id) {
+        if (merchantApplyLogMapper.selectById(id) == null) {
+            throw exception(MERCHANT_APPLY_LOG_NOT_EXISTS);
+        }
+    }
+
+    @Override
+    public MerchantApplyLogDO getMerchantApplyLog(Long id) {
+        return merchantApplyLogMapper.selectById(id);
+    }
+
+    @Override
+    public PageResult<MerchantApplyLogDO> getMerchantApplyLogPage(MerchantApplyLogPageReqVO pageReqVO) {
+
+        MerchantDO merchant = merchantService.getMerchant(pageReqVO.getMerchantId());
+
+        MerchantApplyDO merchantApply = merchantApplyService.getMerchantApply(merchant.getMerchantApplyId());
+
+        if (merchantApply == null) {
+            return PageResult.empty();
+        }
+
+        pageReqVO.setMerchantApplyId(merchantApply.getId());
+
+        return merchantApplyLogMapper.selectPage(pageReqVO);
+    }
+
+}

+ 12 - 0
feifan-module-sale/feifan-module-sale-biz/src/main/resources/mapper/merchantapplylog/MerchantApplyLogMapper.xml

@@ -0,0 +1,12 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="cn.newfeifan.mall.sale.dal.mysql.merchantapplylog.MerchantApplyLogMapper">
+
+    <!--
+        一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
+        无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
+        代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
+        文档可见:https://www.zhongxing.cn/MyBatis/x-plugins/
+     -->
+
+</mapper>

+ 4 - 0
feifan-module-system/feifan-module-system-api/src/main/java/cn/newfeifan/mall/module/system/enums/DictTypeConstants.java

@@ -26,4 +26,8 @@ public interface DictTypeConstants {
     String SMS_SEND_STATUS = "system_sms_send_status"; // 短信发送状态
     String SMS_RECEIVE_STATUS = "system_sms_receive_status"; // 短信接收状态
 
+    //默认头像
+    String DEFAULT_AVATAR = "https://pt.letcgo.com/admin-api/infra/file/23/get/f9deb6a0e38c17d3d416da8b5285412dee1360e53e5b094f9397094be4252e66.png";
+
+
 }

+ 2 - 1
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserService.java

@@ -213,8 +213,9 @@ public interface AdminUserService {
      * @param shopId 店铺ID
      * @param contactMobile 用户手机号码
      * @param contactName 用户名称
+     * @param isApply 是否申请人
      */
-    void createUserByMobile(Long merId, Long shopId, String contactMobile, String contactName);
+    void createUserByMobile(Long merId, Long shopId, String contactMobile, String contactName, Boolean isApply);
 
 
     /**

+ 11 - 2
feifan-module-system/feifan-module-system-biz/src/main/java/cn/newfeifan/mall/module/system/service/user/AdminUserServiceImpl.java

@@ -27,6 +27,7 @@ import cn.newfeifan.mall.module.system.dal.mysql.dept.UserPostMapper;
 import cn.newfeifan.mall.module.system.dal.mysql.permission.RoleMapper;
 import cn.newfeifan.mall.module.system.dal.mysql.permission.UserRoleMapper;
 import cn.newfeifan.mall.module.system.dal.mysql.user.AdminUserMapper;
+import cn.newfeifan.mall.module.system.enums.DictTypeConstants;
 import cn.newfeifan.mall.module.system.service.dept.DeptService;
 import cn.newfeifan.mall.module.system.service.dept.PostService;
 import cn.newfeifan.mall.module.system.service.permission.PermissionService;
@@ -488,7 +489,7 @@ public class AdminUserServiceImpl implements AdminUserService {
 
     @Override
     @Transactional(rollbackFor = Exception.class)
-    public void createUserByMobile(Long merId, Long shopId, String contactMobile, String contactName) {
+    public void createUserByMobile(Long merId, Long shopId, String contactMobile, String contactName, Boolean isApply) {
         Set<Long> roleIds = new HashSet<>();
 
         // 查询商户管理员的ID
@@ -497,6 +498,13 @@ public class AdminUserServiceImpl implements AdminUserService {
         if (shanghuAdmin != null) {
             roleIds.add(shanghuAdmin.getId());
         }
+
+        // 是否申请人
+        if (isApply) {
+            RoleDO shenQingRen = roleMapper.selectOne(new LambdaQueryWrapper<RoleDO>().eq(RoleDO::getCode, "shenqingren"));
+            roleIds.add(shenQingRen.getId());
+        }
+
         UserSaveReqVO build = UserSaveReqVO
                 .builder()
                 .mobile(contactMobile)
@@ -507,13 +515,14 @@ public class AdminUserServiceImpl implements AdminUserService {
                 .roleIds(roleIds)
                 .shopId(shopId)
                 .merchantId(merId)
+                .avatar(DictTypeConstants.DEFAULT_AVATAR)
                 .build();
         createUser(build);
     }
 
     @Override
     public List<Long> getUserIdsByShop(Long shopId) {
-        if(shopId != null){
+        if (shopId != null) {
             List<AdminUserDO> adminUserDOS = userMapper.selectList(new LambdaQueryWrapper<AdminUserDO>()
                     .eq(AdminUserDO::getShopId, shopId)
             );

+ 37 - 0
sql/mysql/建空库SQL/19_20240801.sql

@@ -0,0 +1,37 @@
+ALTER TABLE sale_merchant_apply
+    ADD COLUMN `account_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账户名称',
+		ADD COLUMN `account_number` varchar(30) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '账户号码',
+		ADD COLUMN `bank_name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '开户银行',
+		ADD COLUMN `brand_licensing` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '品牌授权书',
+		ADD COLUMN `other_certificate` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '其他证书';
+
+CREATE TABLE `sale_merchant_apply_log`(
+                                          `id` bigint unsigned NOT NULL AUTO_INCREMENT COMMENT '审核记录id',
+                                          `status` tinyint NOT NULL DEFAULT '0' COMMENT '申请状态  0:申请中 1:通过 2:未通过',
+                                          `merchant_apply_id` bigint NOT NULL COMMENT '商户申请id',
+                                          `check_system_user_id` bigint DEFAULT NULL COMMENT '审核系统用户id',
+                                          `check_comment` text CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci COMMENT '审核意见',
+                                          `creator` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '创建者',
+                                          `create_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
+                                          `updater` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT '' COMMENT '更新者',
+                                          `update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
+                                          `deleted` bit(1) NOT NULL DEFAULT b'0' COMMENT '是否删除',
+                                          PRIMARY KEY (`id`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci ROW_FORMAT=DYNAMIC COMMENT='商户审核记录';
+
+ALTER TABLE sale_merchant_apply
+    MODIFY   `check_status` tinyint DEFAULT '0' COMMENT '审核状态:默认0表示未审核,1审核通过,2审核不通过';
+
+ALTER TABLE sale_merchant_apply
+    ADD COLUMN `legal_person` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '法人',
+		ADD COLUMN `legal_person_number` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '法人电话',
+		ADD COLUMN `identity_card_front` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '身份证正面',
+		ADD COLUMN `identity_card_reverse_side` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '身份证反面';
+
+ALTER TABLE sale_merchant
+    ADD COLUMN `legal_person` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '法人',
+		ADD COLUMN `legal_person_number` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '法人电话',
+		ADD COLUMN `identity_card_front` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '身份证正面',
+		ADD COLUMN `identity_card_reverse_side` varchar(1024) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '身份证反面';
+
+