From b938c9c1824cc57d9b487ed607bbf65bf63f4a81 Mon Sep 17 00:00:00 2001
From: 彭雪彬 <1724387007@qq.com>
Date: Wed, 16 Jul 2025 16:49:54 +0800
Subject: [PATCH] 骑手完成订单接口修改

---
 oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java |   26 ++++++++++++++++++++------
 1 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
index abf98cf..5e17186 100644
--- a/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
+++ b/oying-system/src/main/java/com/oying/modules/system/service/impl/MerchantServiceImpl.java
@@ -1,8 +1,12 @@
 package com.oying.modules.system.service.impl;
 
+import cn.hutool.core.util.IdUtil;
 import com.oying.modules.system.domain.Merchant;
+import com.oying.modules.system.domain.UserMerchant;
 import com.oying.modules.system.mapper.MerchantMapper;
+import com.oying.modules.system.service.UserMerchantService;
 import com.oying.utils.FileUtil;
+import com.oying.utils.enums.MerchantRole;
 import lombok.RequiredArgsConstructor;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
@@ -11,39 +15,48 @@
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 import com.oying.utils.PageUtil;
+
 import java.util.List;
 import java.util.Map;
 import java.io.IOException;
 import javax.servlet.http.HttpServletResponse;
 import java.util.ArrayList;
 import java.util.LinkedHashMap;
+
 import com.oying.utils.PageResult;
 
 /**
-* @description 服务实现
-* @author lixin
-* @date 2025-05-29
-**/
+ * @author lixin
+ * @description 服务实现
+ * @date 2025-05-29
+ **/
 @Service
 @RequiredArgsConstructor
 public class MerchantServiceImpl extends ServiceImpl<MerchantMapper, Merchant> implements MerchantService {
 
     private final MerchantMapper merchantMapper;
+    private final UserMerchantService userMerchantService;
 
     @Override
-    public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page){
+    public PageResult<Merchant> queryAll(MerchantsQueryCriteria criteria, Page<Object> page) {
         return PageUtil.toPage(merchantMapper.findAll(criteria, page));
     }
 
     @Override
-    public List<Merchant> queryAll(MerchantsQueryCriteria criteria){
+    public List<Merchant> queryAll(MerchantsQueryCriteria criteria) {
         return merchantMapper.findAll(criteria);
     }
 
     @Override
     @Transactional(rollbackFor = Exception.class)
     public void create(Merchant resources) {
+        resources.setMerchantCode(IdUtil.getSnowflakeNextIdStr());
         merchantMapper.insert(resources);
+        UserMerchant userMerchant = new UserMerchant();
+        userMerchant.setMerchantId(resources.getMerchantId());
+        userMerchant.setUserId(resources.getUserId());
+        userMerchant.setRoleType(MerchantRole.OWNER.getRole());
+        userMerchantService.create(userMerchant);
     }
 
     @Override
@@ -65,6 +78,7 @@
         List<Map<String, Object>> list = new ArrayList<>();
         for (Merchant merchant : all) {
             Map<String, Object> map = new LinkedHashMap<>();
+            map.put("商户类型", merchant.getMerchantType());
             map.put("名称", merchant.getMerchantName());
             map.put("商户编码", merchant.getMerchantCode());
             map.put("营业执照号", merchant.getBusinessLicense());

--
Gitblit v1.9.3