大大的豆芽 3 months ago
parent
commit
fc6fed79e7

+ 11 - 0
yiqi-admin/src/main/java/com/yiqi/admin/controller/app/AppDeliveryManController.java

@@ -10,6 +10,7 @@ import com.yiqi.common.core.domain.R;
 import com.yiqi.common.core.page.TableDataInfo;
 import com.yiqi.order.domain.vo.OrderClothRecordVO;
 import com.yiqi.order.service.IOrderClothService;
+import com.yiqi.system.domain.SysStore;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import org.springframework.security.access.prepost.PreAuthorize;
@@ -133,4 +134,14 @@ public class AppDeliveryManController extends BaseController {
     public R<List<AppDeliveryManListVO>> getDeliveryManListByOrg() {
         return R.ok(appDeliveryManService.getDeliveryManListByOrg());
     }
+
+
+    /**
+     * 查看配送员列表
+     */
+    @GetMapping("/store/list")
+    @ApiOperation(value = "查询配送员绑定的门店列表")
+    public R<List<SysStore>> getStoreList(Long deliveryId) {
+        return R.ok(appDeliveryManService.getStoreList(deliveryId));
+    }
 }

+ 7 - 0
yiqi-common/src/main/java/com/yiqi/app/service/IAppDeliveryManService.java

@@ -6,6 +6,7 @@ import com.yiqi.app.domain.AppDeliveryMan;
 import com.yiqi.app.domain.dto.AppDeliveryManDTO;
 import com.yiqi.app.domain.dto.AppDeliveryManListQueryDTO;
 import com.yiqi.app.domain.vo.AppDeliveryManListVO;
+import com.yiqi.system.domain.SysStore;
 
 /**
  * 配送员Service接口
@@ -73,4 +74,10 @@ public interface IAppDeliveryManService extends IService<AppDeliveryMan> {
 
     public List<AppDeliveryManListVO>  getDeliveryManListByOrg();
 
+    /**
+     * * 查询配送员绑定的门店列表
+     * @param deliveryId
+     * @return
+     */
+    List<SysStore> getStoreList(Long deliveryId);
 }

+ 17 - 2
yiqi-core/src/main/java/com/yiqi/app/service/impl/AppDeliveryManServiceImpl.java

@@ -2,6 +2,7 @@ package com.yiqi.app.service.impl;
 
 import java.util.ArrayList;
 import java.util.List;
+import java.util.stream.Collectors;
 
 import cn.hutool.core.collection.CollUtil;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -16,6 +17,8 @@ import com.yiqi.common.exception.GlobalException;
 import com.yiqi.common.utils.DateUtils;
 import com.yiqi.common.utils.SecurityUtils;
 import com.yiqi.common.utils.bean.BeanUtils;
+import com.yiqi.system.domain.SysStore;
+import com.yiqi.system.service.ISysStoreService;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import com.yiqi.app.mapper.AppDeliveryManMapper;
@@ -33,7 +36,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 public class AppDeliveryManServiceImpl extends ServiceImpl<AppDeliveryManMapper, AppDeliveryMan> implements IAppDeliveryManService {
     @Autowired
     private IAppDeliveryRelationService appDeliveryRelationService;
-
+    @Autowired
+    private ISysStoreService sysStoreService;
     /**
      * 查询配送员
      *
@@ -173,5 +177,16 @@ public class AppDeliveryManServiceImpl extends ServiceImpl<AppDeliveryManMapper,
         return baseMapper.getDeliveryManListByOrg(SecurityUtils.getLoginUser().getOrgId(), SecurityUtils.getLoginUser().getSourceType());
     }
 
-
+    @Override
+    public List<SysStore> getStoreList(Long deliveryId) {
+        //查询配送员绑定的门店列表
+        List<AppDeliveryRelation> list = appDeliveryRelationService.list(new QueryWrapper<AppDeliveryRelation>().lambda()
+                .eq(AppDeliveryRelation::getAppUserId, deliveryId));
+        if (CollUtil.isNotEmpty(list)) {
+            List<Long> storeIds = list.stream().map(AppDeliveryRelation::getOrgId).collect(Collectors.toList());
+            return sysStoreService.list(new QueryWrapper<SysStore>().lambda()
+                    .in(SysStore::getId, storeIds));
+        }
+        return new ArrayList<>();
+    }
 }

+ 2 - 3
yiqi-core/src/main/resources/mapper/app/AppUserMapper.xml

@@ -51,19 +51,18 @@
         select a.id as appUserId, a.wx_open_id as wxOpenId, a.phone_number as phoneNumber, a.nick_name as nickName, a.real_name as realName,
                a.level as level, a.birthday as birthday, a.sex as sex, a.avatar_url as avatarUrl,
                b.province , b.city, b.area, b.address, b.address_detail as addressDetail, b.contact_name as contactName, b.contact_phone as contactPhone
-        from app_user a left join  app_user_address b on a.id = b.app_user_id
+        from app_user a left join  app_user_address b on a.id = b.app_user_id  and b.is_default = 'Y'
         where a.id = #{appUserId}
     </select>
     <select id="getAppUserInfoByIds" resultType="com.yiqi.app.domain.vo.AppUserInfoVO">
         select a.id as appUserId, a.wx_open_id as wxOpenId, a.phone_number as phoneNumber, a.nick_name as nickName, a.real_name as realName,
                 a.level as level, a.birthday as birthday, a.sex as sex, a.avatar_url as avatarUrl,
                b.province , b.city, b.area, b.address, b.address_detail as addressDetail, b.contact_name as contactName, b.contact_phone as contactPhone
-        from app_user a left join  app_user_address b on a.id = b.app_user_id
+        from app_user a left join  app_user_address b on a.id = b.app_user_id and b.is_default = 'Y'
         where a.id IN
               <foreach collection="appUserIds" item="id" open="(" separator="," close=")">
                   #{id}
               </foreach>
-
     </select>
 
     <insert id="insertAppUser" parameterType="AppUser" useGeneratedKeys="true"