Răsfoiți Sursa

更新商户的添加,和添加商户上架员

Yangzw 2 luni în urmă
părinte
comite
13f4c97f5b

+ 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 = "更新商户申请")

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

@@ -19,8 +19,11 @@ import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantRespVO;
 import cn.newfeifan.mall.sale.controller.admin.merchant.vo.MerchantSaveReqVO;
 import cn.newfeifan.mall.sale.controller.admin.shop.vo.ShopRespVO;
 import cn.newfeifan.mall.sale.dal.dataobject.merchant.MerchantDO;
+import cn.newfeifan.mall.sale.dal.dataobject.merchantapply.MerchantApplyDO;
 import cn.newfeifan.mall.sale.dal.mysql.merchant.MerchantMapper;
+import cn.newfeifan.mall.sale.dal.mysql.merchantapply.MerchantApplyMapper;
 import cn.newfeifan.mall.sale.dal.redis.ShopMessage;
+import cn.newfeifan.mall.sale.service.merchantapply.MerchantApplyService;
 import cn.newfeifan.mall.sale.service.shop.ShopService;
 import org.springframework.data.redis.core.StringRedisTemplate;
 import org.springframework.stereotype.Service;
@@ -65,6 +68,8 @@ public class MerchantServiceImpl implements MerchantService {
     private SpuApplyService spuApplyService;
     @Resource
     private StringRedisTemplate stringRedisTemplate;
+    @Resource
+    private MerchantApplyMapper merchantApplyMapper;
 
     @Override
     @Transactional(rollbackFor = Exception.class)
@@ -107,6 +112,10 @@ public class MerchantServiceImpl implements MerchantService {
         // 更新
         MerchantDO updateObj = BeanUtils.toBean(updateReqVO, MerchantDO.class);
         merchantMapper.updateById(updateObj);
+
+        MerchantApplyDO bean = BeanUtils.toBean(updateReqVO, MerchantApplyDO.class);
+        bean.setId(updateObj.getMerchantApplyId());
+        merchantApplyMapper.updateById(bean);
     }
 
     @Override

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

@@ -82,7 +82,15 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
     public Long createMerchantApply(MerchantApplySaveReqVO createReqVO) {
         // 插入
         MerchantApplyDO merchantApply = BeanUtils.toBean(createReqVO, MerchantApplyDO.class);
+        merchantApply.setCheckStatus(MerchantApplyCheckStatusEnum.AUDIT_PASS.getType());
+        merchantApply.setCheckPersonStatus(MerchantApplyCheckPersonStatusEnum.ZERO.getStatus());
+        merchantApply.setApplyMemberUserId(getLoginUserId());
         merchantApplyMapper.insert(merchantApply);
+
+        MerchantSaveReqVO bean = BeanUtils.toBean(createReqVO, MerchantSaveReqVO.class);
+
+        bean.setMerchantApplyId(merchantApply.getId());
+        merchantService.createMerchant(bean, null);
         // 返回
         return merchantApply.getId();
     }
@@ -124,27 +132,28 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
         } else {
             // 审核通过
             // 一级审核人
-            if (MerchantApplyCheckPersonStatusEnum.getCheckPersonStatus(loginUserId).equals(MerchantApplyCheckPersonStatusEnum.ONE.getStatus())) {
-                // 修改为向二级审核人审核,状态不变
-                updateDO.setCheckPersonStatus(MerchantApplyCheckPersonStatusEnum.TWO.getStatus());
-                updateDO.setCheckStatus(MerchantApplyCheckStatusEnum.WAIT_AUDIT.getType());
-                merchantApplyMapper.updateById(updateDO);
-
-                MerchantApplyLogSaveReqVO build = MerchantApplyLogSaveReqVO.builder()
-                        .status(MerchantApplyCheckStatusEnum.AUDIT_PASS.getType())
-                        .merchantApplyId(updateDO.getId())
-                        .checkComment(updateDO.getCheckComment())
-                        .checkSystemUserId(loginUserId)
-                        .build();
-                merchantApplyLogService.createMerchantApplyLog(build);
-
-                // todo 商户审核通过向上级发送微信信息
-                sentWxChantMessageToThSystemUser(updateDO,MerchantApplyCheckPersonStatusEnum.TWO.getUserid());
-
-                // 发送极光推送
-                jPushToThSystemUser(updateDO, MerchantApplyCheckPersonStatusEnum.TWO.getUserid());
-                return;
-            } else if (MerchantApplyCheckPersonStatusEnum.getCheckPersonStatus(loginUserId).equals(MerchantApplyCheckPersonStatusEnum.TWO.getStatus())) {
+//            if (MerchantApplyCheckPersonStatusEnum.getCheckPersonStatus(loginUserId).equals(MerchantApplyCheckPersonStatusEnum.ONE.getStatus())) {
+//                // 修改为向二级审核人审核,状态不变
+//                updateDO.setCheckPersonStatus(MerchantApplyCheckPersonStatusEnum.TWO.getStatus());
+//                updateDO.setCheckStatus(MerchantApplyCheckStatusEnum.WAIT_AUDIT.getType());
+//                merchantApplyMapper.updateById(updateDO);
+//
+//                MerchantApplyLogSaveReqVO build = MerchantApplyLogSaveReqVO.builder()
+//                        .status(MerchantApplyCheckStatusEnum.AUDIT_PASS.getType())
+//                        .merchantApplyId(updateDO.getId())
+//                        .checkComment(updateDO.getCheckComment())
+//                        .checkSystemUserId(loginUserId)
+//                        .build();
+//                merchantApplyLogService.createMerchantApplyLog(build);
+//
+//                // todo 商户审核通过向上级发送微信信息
+//                sentWxChantMessageToThSystemUser(updateDO,MerchantApplyCheckPersonStatusEnum.TWO.getUserid());
+//
+//                // 发送极光推送
+//                jPushToThSystemUser(updateDO, MerchantApplyCheckPersonStatusEnum.TWO.getUserid());
+//                return;
+//            } else
+                if (MerchantApplyCheckPersonStatusEnum.getCheckPersonStatus(loginUserId).equals(MerchantApplyCheckPersonStatusEnum.TWO.getStatus())) {
                 // 修改为向三级审核人审核,状态不变
                 updateDO.setCheckPersonStatus(MerchantApplyCheckPersonStatusEnum.THREE.getStatus());
                 updateDO.setCheckStatus(MerchantApplyCheckStatusEnum.WAIT_AUDIT.getType());
@@ -357,7 +366,7 @@ public class MerchantApplyServiceImpl implements MerchantApplyService {
 
         Long loginUserId = getLoginUserId();
 
-        if (loginUserId != null && loginUserId != 1L) {
+        if (loginUserId != null && loginUserId != 1L && MerchantApplyCheckPersonStatusEnum.getCheckPersonStatus(loginUserId) != -1) {
             pageReqVO.setCheckPersonStatus(MerchantApplyCheckPersonStatusEnum.getCheckPersonStatus(loginUserId));
         }