소스 검색

module模块

叶君翔 3 년 전
부모
커밋
aee7248cc2
28개의 변경된 파일336개의 추가작업 그리고 35개의 파일을 삭제
  1. 1 0
      lb-module/src/main/java/com/ydd/module/domain/Agent.java
  2. 2 0
      lb-module/src/main/java/com/ydd/module/domain/MemberConfig.java
  3. 1 1
      lb-module/src/main/java/com/ydd/module/domain/ShopWaimai.java
  4. 53 0
      lb-module/src/main/java/com/ydd/module/domain/SysUserBindAgent.java
  5. 2 0
      lb-module/src/main/java/com/ydd/module/dto/MemberConfigDto.java
  6. 33 0
      lb-module/src/main/java/com/ydd/module/dto/SysUserBindAgentDto.java
  7. 39 0
      lb-module/src/main/java/com/ydd/module/dto/WaimaiAuthListDto.java
  8. 1 0
      lb-module/src/main/java/com/ydd/module/enums/CacheKeyEnum.java
  9. 1 1
      lb-module/src/main/java/com/ydd/module/mapper/ShopDeliveryBindMapper.java
  10. 1 1
      lb-module/src/main/java/com/ydd/module/mapper/ShopDeliveryMapper.java
  11. 5 0
      lb-module/src/main/java/com/ydd/module/mapper/ShopWaimaiMapper.java
  12. 15 0
      lb-module/src/main/java/com/ydd/module/mapper/SysUserBindAgentMapper.java
  13. 1 1
      lb-module/src/main/java/com/ydd/module/service/IShopDeliveryBindService.java
  14. 7 1
      lb-module/src/main/java/com/ydd/module/service/IShopWaimaiService.java
  15. 22 0
      lb-module/src/main/java/com/ydd/module/service/ISysUserBindAgentService.java
  16. 4 5
      lb-module/src/main/java/com/ydd/module/service/impl/AgentServiceImpl.java
  17. 20 2
      lb-module/src/main/java/com/ydd/module/service/impl/OrderServiceImpl.java
  18. 3 2
      lb-module/src/main/java/com/ydd/module/service/impl/PersonnelServiceImpl.java
  19. 1 1
      lb-module/src/main/java/com/ydd/module/service/impl/ProfitsActivityServiceImpl.java
  20. 3 4
      lb-module/src/main/java/com/ydd/module/service/impl/ShopDeliveryBindServiceImpl.java
  21. 1 1
      lb-module/src/main/java/com/ydd/module/service/impl/ShopDeliveryServiceImpl.java
  22. 65 0
      lb-module/src/main/java/com/ydd/module/service/impl/SysUserBindAgentServiceImpl.java
  23. 6 0
      lb-module/src/main/resources/mapper/module/ShopDeliveryBindMapper.xml
  24. 6 0
      lb-module/src/main/resources/mapper/module/ShopDeliveryMapper.xml
  25. 11 0
      lb-module/src/main/resources/mapper/module/SysUserBindAgentMapper.xml
  26. 5 7
      lb-module/src/main/resources/mapper/module/merchantMapper.xml
  27. 5 8
      lb-module/src/main/resources/mapper/module/orderMapper.xml
  28. 22 0
      lb-module/src/main/resources/mapper/module/shopWaimaiMapper.xml

+ 1 - 0
lb-module/src/main/java/com/ydd/module/domain/Agent.java

@@ -121,6 +121,7 @@ private static final long serialVersionUID=1L;
 
     private Integer dspId;
 
+    private Integer syncWm;
     /**
      * 优惠包id
      */

+ 2 - 0
lb-module/src/main/java/com/ydd/module/domain/MemberConfig.java

@@ -138,6 +138,8 @@ private static final long serialVersionUID=1L;
     @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
     private Date createTime;
 
+    @ApiModelProperty(value = "开启wifi自动下载安装包: 1->是,0->否")
+    private Integer wifiUpgrade;
     /** 更新时间 */
     @TableField(update = "now()")
     private Date updateTime;

+ 1 - 1
lb-module/src/main/java/com/ydd/module/domain/ShopWaimai.java

@@ -38,7 +38,7 @@ private static final long serialVersionUID=1L;
     /** 商家ID */
     @Excel(name = "商家ID")
     private Long merchantId;
-    
+
     private String epoid;
 
     /** 门店ID */

+ 53 - 0
lb-module/src/main/java/com/ydd/module/domain/SysUserBindAgent.java

@@ -0,0 +1,53 @@
+package com.ydd.module.domain;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import com.baomidou.mybatisplus.annotation.TableLogic;
+import com.baomidou.mybatisplus.annotation.TableName;
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 员工绑定代理商
+ * @author 叶君翔
+ * @date 2022/03/10 18:21
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+@TableName("lb_sys_user_bind_agent")
+public class SysUserBindAgent implements Serializable {
+
+    private static final long serialVersionUID = 4005781304660074199L;
+
+    @TableId(value = "id")
+    private Long id;
+
+    /**
+     * 用户id(sys_user表主键)
+     */
+    private Long userId;
+
+    /**
+     * 管理代理商id(多个用英文逗号隔开)
+     */
+    private String agentId;
+
+    /** 创建时间 */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
+    private Date createTime;
+
+    /** 更新时间 */
+    @TableField(update = "now()")
+    private Date updateTime;
+
+    /** 删除标识位: 0正常 1删除 */
+    @TableLogic
+    private Integer deleted;
+
+}

+ 2 - 0
lb-module/src/main/java/com/ydd/module/dto/MemberConfigDto.java

@@ -69,4 +69,6 @@ public class MemberConfigDto implements Serializable {
     /** 预约单自动下单时长: 单位秒 */
     private Integer bookingAutodeliveryOrderTime;
 
+    private Integer wifiUpgrade;
+    private Integer uForce;
 }

+ 33 - 0
lb-module/src/main/java/com/ydd/module/dto/SysUserBindAgentDto.java

@@ -0,0 +1,33 @@
+package com.ydd.module.dto;
+
+import lombok.Data;
+
+import java.io.Serializable;
+import java.util.List;
+
+/**
+ * @author 叶君翔
+ * @date 2022/03/14 10:47
+ */
+@Data
+public class SysUserBindAgentDto implements Serializable {
+
+    private static final long serialVersionUID = -3324317530507793043L;
+
+    private Long userId;
+
+    private String userName;
+
+    private String nickName;
+
+    private String email;
+
+    private String phonenumber;
+
+    private String agentName;
+
+    private String roleName;
+
+    private List<Long> agentIdList;
+
+}

+ 39 - 0
lb-module/src/main/java/com/ydd/module/dto/WaimaiAuthListDto.java

@@ -0,0 +1,39 @@
+package com.ydd.module.dto;
+
+import io.swagger.annotations.ApiModelProperty;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+import lombok.experimental.Accessors;
+
+import java.io.Serializable;
+
+/**
+ * Project:lb-server
+ * Class:DeliveryDto
+ * Description:TODO
+ * Time:2021/3/1 18:07
+ *
+ * @author zoe
+ */
+@Data
+@NoArgsConstructor
+@Accessors(chain = true)
+public class WaimaiAuthListDto implements Serializable {
+
+
+    /** 外卖平台门店ID */
+    @ApiModelProperty(value = "外卖平台门店ID")
+    private String thirdShopId;
+
+    /** 外卖平台门店名称 */
+    @ApiModelProperty(value = "外卖平台门店名称")
+    private String thirdShopName;
+
+
+    private  Integer  businessId;
+    private  String  authToken;
+    private String epoid;
+    private String developerId;
+    private String signKey;
+
+}

+ 1 - 0
lb-module/src/main/java/com/ydd/module/enums/CacheKeyEnum.java

@@ -20,6 +20,7 @@ public enum CacheKeyEnum {
      */
     SMS_FORGOT_PASSWORD_CAPTCHA("app:forgot:captcha", "短信验证码缓存key", 5),
 
+    SMS_VERIFY_CAPTCHA("app:verify:captcha", "身份验证key", 5),
     ;
     /**
      * key

+ 1 - 1
lb-module/src/main/java/com/ydd/module/mapper/ShopDeliveryBindMapper.java

@@ -32,7 +32,7 @@ public interface ShopDeliveryBindMapper extends BaseMapper<ShopDeliveryBind> {
      * @param merchant
      * @return
      */
-    List<ShopDeliveryDto> getShopDeliveryList(@Param("page") Page page, @Param("params") Merchant merchant);
+    List<ShopDeliveryDto> getShopDeliveryList(@Param("page") Page page, @Param("params") Merchant merchant, @Param("agentIds") List<Long> agentIds);
 
     void editShopNo(@Param("params") ShopDeliveryDto shopDelivery);
 

+ 1 - 1
lb-module/src/main/java/com/ydd/module/mapper/ShopDeliveryMapper.java

@@ -39,7 +39,7 @@ public interface ShopDeliveryMapper extends BaseMapper<ShopDelivery> {
 
     List<ShopDeliveryDto> selectAll(@Param("page")Page page,@Param("params")Merchant merchant);
 
-    List<ShopDeliveryDto> verify(@Param("page")Page page,@Param("params")Merchant merchant,@Param("merchantIdList")List<Integer> merchantIdList);
+    List<ShopDeliveryDto> verify(@Param("page")Page page,@Param("params")Merchant merchant,@Param("merchantIdList")List<Integer> merchantIdList, @Param("agentIds") List<Long> agentIds);
 
     List<ShopWaimaiDto> waimaiVerify(@Param("page")Page page, @Param("params")Merchant merchant, @Param("merchantIdList")List<Integer> merchantIdList);
 

+ 5 - 0
lb-module/src/main/java/com/ydd/module/mapper/ShopWaimaiMapper.java

@@ -3,6 +3,7 @@ package com.ydd.module.mapper;
 import com.ydd.module.domain.Shop;
 import com.ydd.module.domain.ShopWaimai;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydd.module.dto.WaimaiAuthListDto;
 import com.ydd.module.dto.WaimaiDto;
 import com.ydd.module.dto.WaimaiListDto;
 import org.apache.ibatis.annotations.Param;
@@ -28,4 +29,8 @@ public interface ShopWaimaiMapper extends BaseMapper<ShopWaimai> {
     List<ShopWaimai> selectEleRetailShop();
     List<WaimaiListDto> findWaimaiList(@Param("waimaiId") Long waimaiId, @Param("merchantId") Long merchantId,@Param("shopId")Long shopId);
     List<WaimaiListDto> findWMiList(@Param("shopId")Long shopId);
+    List<WaimaiAuthListDto> findWMListByMobile(@Param("mobile")String mobile,@Param("waimaiId") String waimaiId);
+
+    Integer findSyncMt(String epoid);
+    Integer findSyncEle(String thirdShopId);
 }

+ 15 - 0
lb-module/src/main/java/com/ydd/module/mapper/SysUserBindAgentMapper.java

@@ -0,0 +1,15 @@
+package com.ydd.module.mapper;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.ydd.module.domain.SysUserBindAgent;
+import org.apache.ibatis.annotations.Param;
+
+/**
+ * @author 叶君翔
+ * @date 2022/03/14 10:15
+ */
+public interface SysUserBindAgentMapper extends BaseMapper<SysUserBindAgent> {
+
+    String getAgentIdStrByUserId(@Param("userId") Long userId);
+
+}

+ 1 - 1
lb-module/src/main/java/com/ydd/module/service/IShopDeliveryBindService.java

@@ -81,7 +81,7 @@ public interface IShopDeliveryBindService extends IService<ShopDeliveryBind> {
      * @param merchant
      * @return
      */
-    PageResult getShopDeliveryList(Page page, Merchant merchant);
+    PageResult getShopDeliveryList(Page page, Merchant merchant, List<Long> agentIds);
 
     void editShopNo(ShopDeliveryDto shopDeliveryDto);
 

+ 7 - 1
lb-module/src/main/java/com/ydd/module/service/IShopWaimaiService.java

@@ -3,6 +3,7 @@ package com.ydd.module.service;
 import com.ydd.module.domain.Shop;
 import com.ydd.module.domain.ShopWaimai;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydd.module.dto.WaimaiAuthListDto;
 import com.ydd.module.dto.WaimaiDto;
 import com.ydd.module.dto.WaimaiListDto;
 import org.apache.ibatis.annotations.Param;
@@ -62,5 +63,10 @@ public interface IShopWaimaiService extends IService<ShopWaimai> {
 
 
     List<WaimaiListDto> findWMList(  Long shopId);
- //   void refreshSgToken();
+//    void refreshSgToken();
+
+    List<WaimaiAuthListDto> findWMListByMobile(String mobile, String waimaiId);
+
+    Integer findSyncMt(String epoid);
+    Integer findSyncEle(String thirdShopId);
 }

+ 22 - 0
lb-module/src/main/java/com/ydd/module/service/ISysUserBindAgentService.java

@@ -0,0 +1,22 @@
+package com.ydd.module.service;
+
+import com.baomidou.mybatisplus.extension.service.IService;
+import com.ydd.module.domain.SysUserBindAgent;
+import com.ydd.module.dto.SysUserBindAgentDto;
+
+/**
+ * 用户关联代理商
+ * @author 叶君翔
+ * @date 2022/03/14 10:12
+ */
+public interface ISysUserBindAgentService extends IService<SysUserBindAgent> {
+
+    void setAgentInfo(SysUserBindAgentDto bindAgentDto, Long userId);
+
+    /**
+     * 关联代理商
+     * @param bindAgentDto 请求参数
+     */
+    void bindAgent(SysUserBindAgentDto bindAgentDto);
+
+}

+ 4 - 5
lb-module/src/main/java/com/ydd/module/service/impl/AgentServiceImpl.java

@@ -1,12 +1,11 @@
 package com.ydd.module.service.impl;
 
-import com.aliyun.oss.OSSClient;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import com.google.zxing.common.BitMatrix;
 import com.ydd.common.constant.UserConstants;
 import com.ydd.common.core.domain.entity.SysUser;
 import com.ydd.common.enums.UserTypeEnums;
@@ -15,7 +14,6 @@ import com.ydd.common.exception.CustomException;
 import com.ydd.common.oss.cloud.CloudStorageConfig;
 import com.ydd.common.oss.cloud.OSSFactory;
 import com.ydd.common.utils.SecurityUtils;
-import com.ydd.ecloud.core.utils.OSSHelper;
 import com.ydd.module.domain.*;
 import com.ydd.module.dto.BaseConfgMinDto;
 import com.ydd.module.enums.PackageCityConfigPackageTypeEnum;
@@ -25,7 +23,6 @@ import com.ydd.module.mapper.AgentMapper;
 import com.ydd.module.request.AgentBindRulePackageRequest;
 import com.ydd.module.service.*;
 import com.ydd.module.utils.BarCodeUtils;
-import com.ydd.module.utils.QRCodeUtil;
 import com.ydd.system.service.ISysUserService;
 import lombok.RequiredArgsConstructor;
 import org.apache.commons.compress.utils.Lists;
@@ -39,7 +36,6 @@ import java.awt.image.BufferedImage;
 import java.io.InputStream;
 import java.math.BigDecimal;
 import java.util.ArrayList;
-import java.util.Date;
 import java.util.List;
 import java.util.Objects;
 
@@ -170,6 +166,9 @@ public class AgentServiceImpl extends ServiceImpl<AgentMapper, Agent> implements
         if (agent.getEndTime() != null) {
           lqw.le(Agent::getCreateTime, agent.getEndTime());
         }
+        if (CollectionUtils.isNotEmpty(user.getAgentIds())) {
+            lqw.in(Agent::getId, user.getAgentIds());
+        }
         lqw.orderByDesc(Agent::getCreateTime);
         List<Agent> list = this.list(lqw);
         List<AgentLevel> agentLevelList = iAgentLevelService.queryList(new AgentLevel(), user);

+ 20 - 2
lb-module/src/main/java/com/ydd/module/service/impl/OrderServiceImpl.java

@@ -315,6 +315,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
                 result = false;
             }
         }
+        if (CollectionUtils.isNotEmpty(user.getAgentIds())) {
+            if (CollectionUtils.isEmpty(order.getAgentIds())) {
+                order.setAgentIds(user.getAgentIds());
+            } else {
+                order.getAgentIds().retainAll(user.getAgentIds());
+            }
+            if (CollectionUtils.isEmpty(order.getAgentIds())) {
+                result = false;
+            }
+        }
         if (StringUtils.isNotEmpty(order.getMemberMobile())) {
 //            List<Long> memberIds = iMemberService.list(new QueryWrapper<Member>()
 //                    .like("mobile", order.getMemberMobile())
@@ -384,7 +394,16 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
             agentIds = iAgentService.listAgent(user.getAgentId().longValue());
         }
 
-        if (order.getAId() != null) {
+        // 取交集
+        if (CollectionUtils.isNotEmpty(user.getAgentIds())) {
+            if (CollectionUtils.isNotEmpty(agentIds)) {
+                agentIds.retainAll(user.getAgentIds());
+            } else {
+                agentIds.addAll(user.getAgentIds());
+            }
+        }
+
+        if(order.getAId() != null) {
             aIds = iAgentService.listAgent(order.getAId());
         }
 
@@ -624,7 +643,6 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
 
     /**
      * 查询所有配送完成订单
-     *
      * @return
      */
     @Override

+ 3 - 2
lb-module/src/main/java/com/ydd/module/service/impl/PersonnelServiceImpl.java

@@ -1,6 +1,7 @@
 package com.ydd.module.service.impl;
 
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.ydd.common.constant.UserConstants;
@@ -9,6 +10,7 @@ import com.ydd.common.enums.UserTypeEnums;
 import com.ydd.common.exception.CustomException;
 import com.ydd.common.oss.cloud.CloudStorageConfig;
 import com.ydd.common.oss.cloud.OSSFactory;
+import com.ydd.ecloud.core.validator.group.AddGroup;
 import com.ydd.module.domain.Agent;
 import com.ydd.module.domain.Personnel;
 import com.ydd.module.dto.SystemOrderDto;
@@ -49,8 +51,7 @@ public class PersonnelServiceImpl extends ServiceImpl<PersonnelMapper, Personnel
     public List<Personnel> queryList(Personnel personnel, SysUser user, List<Long> agents) {
         LambdaQueryWrapper<Personnel> lqw = Wrappers.lambdaQuery();
 
-
-        if (personnel.getAgentId() != null){
+        if (CollectionUtils.isNotEmpty(agents)){
             lqw.in(Personnel::getAgentId , agents);
         }
 

+ 1 - 1
lb-module/src/main/java/com/ydd/module/service/impl/ProfitsActivityServiceImpl.java

@@ -14,8 +14,8 @@ import com.ydd.module.mapper.ProfitsActivityMapper;
 import com.ydd.module.service.IAgentService;
 import com.ydd.module.service.IMerchantService;
 import com.ydd.module.service.IProfitsActivityService;
-import com.ydd.module.service.IShopService;
 import com.ydd.module.utils.CommonUtils;
+import com.ydd.module.service.IShopService;
 import lombok.SneakyThrows;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.compress.utils.Lists;

+ 3 - 4
lb-module/src/main/java/com/ydd/module/service/impl/ShopDeliveryBindServiceImpl.java

@@ -19,7 +19,6 @@ import com.ydd.module.service.IDspDeliveryService;
 import com.ydd.module.service.IMemberService;
 import com.ydd.module.service.IShopDeliveryBindService;
 import com.ydd.module.service.IShopService;
-
 import com.ydd.third.common.vo.ResObject;
 import com.ydd.third.common.vo.shop.AmountResultVo;
 import com.ydd.third.common.vo.shop.QueryAmount;
@@ -150,8 +149,8 @@ public class ShopDeliveryBindServiceImpl extends ServiceImpl<ShopDeliveryBindMap
     }
 
     @Override
-    public PageResult getShopDeliveryList(Page page, Merchant merchant) {
-        List<ShopDeliveryDto> dtos = baseMapper.getShopDeliveryList(page,merchant);
+    public PageResult getShopDeliveryList(Page page, Merchant merchant, List<Long> agentIds) {
+        List<ShopDeliveryDto> dtos = baseMapper.getShopDeliveryList(page,merchant,agentIds);
         for (ShopDeliveryDto d :dtos){
             DspDelivery dspDelivery = iDspDeliveryService.getById(d.getDeliveryId());
             d.setType(dspDelivery.getType());
@@ -242,7 +241,7 @@ public class ShopDeliveryBindServiceImpl extends ServiceImpl<ShopDeliveryBindMap
         }
         // 查询余额
         queryAmount.setMerchantId(shopDeliveryBind.getThirdShopId());
-        ResObject<AmountResultVo> res = dadaClient.queryAmount(queryAmount);
+        ResObject<AmountResultVo> res = client.queryAmount(queryAmount);
         if(res.getCode() == 0) {
             BigDecimal balanceAmount = res.getData().getBalanceAmount();
             // 变更余额

+ 1 - 1
lb-module/src/main/java/com/ydd/module/service/impl/ShopDeliveryServiceImpl.java

@@ -168,7 +168,7 @@ public class ShopDeliveryServiceImpl extends ServiceImpl<ShopDeliveryMapper, Sho
             }
         }
 
-        List<ShopDeliveryDto> dtos = baseMapper.verify(page,merchant,merchantIdList);
+        List<ShopDeliveryDto> dtos = baseMapper.verify(page,merchant,merchantIdList, user.getAgentIds());
         for (ShopDeliveryDto d :dtos){
             DspDelivery dspDelivery = iDspDeliveryService.getById(d.getDeliveryId());
             d.setType(dspDelivery.getType());

+ 65 - 0
lb-module/src/main/java/com/ydd/module/service/impl/SysUserBindAgentServiceImpl.java

@@ -0,0 +1,65 @@
+package com.ydd.module.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ydd.module.domain.Agent;
+import com.ydd.module.domain.SysUserBindAgent;
+import com.ydd.module.dto.SysUserBindAgentDto;
+import com.ydd.module.mapper.SysUserBindAgentMapper;
+import com.ydd.module.service.IAgentService;
+import com.ydd.module.service.ISysUserBindAgentService;
+import org.apache.commons.collections4.CollectionUtils;
+import org.apache.commons.compress.utils.Lists;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.stereotype.Service;
+
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+/**
+ * @author 叶君翔
+ * @date 2022/03/14 10:13
+ */
+@Service
+public class SysUserBindAgentServiceImpl extends ServiceImpl<SysUserBindAgentMapper, SysUserBindAgent> implements ISysUserBindAgentService {
+
+    @Resource
+    private IAgentService agentService;
+
+    @Override
+    public void setAgentInfo(SysUserBindAgentDto bindAgentDto, Long userId) {
+        String agentIdStr = baseMapper.getAgentIdStrByUserId(userId);
+        if (StringUtils.isBlank(agentIdStr)) {
+            return;
+        }
+        String agentName = "";
+        List<String> agentIds = Arrays.asList(agentIdStr.split(","));
+        List<Long> agentIdList = Lists.newArrayList();
+        if (CollectionUtils.isNotEmpty(agentIds)) {
+            List<Agent> agents = agentService.list(new QueryWrapper<Agent>().in("id", agentIds));
+            if (CollectionUtils.isNotEmpty(agents)) {
+                agentName = agents.stream().map(Agent::getName).collect(Collectors.joining(","));
+                agentIdList = agents.stream().map(Agent::getId).collect(Collectors.toList());
+            }
+        }
+        bindAgentDto.setAgentName(agentName);
+        bindAgentDto.setAgentIdList(agentIdList);
+    }
+
+    @Override
+    public void bindAgent(SysUserBindAgentDto bindAgentDto) {
+        SysUserBindAgent userBindAgent = baseMapper.selectOne(new QueryWrapper<SysUserBindAgent>().eq("user_id", bindAgentDto.getUserId()));
+        if (userBindAgent == null) {
+            userBindAgent = new SysUserBindAgent();
+        }
+        if (CollectionUtils.isNotEmpty(bindAgentDto.getAgentIdList())) {
+            String agentIdStr = bindAgentDto.getAgentIdList().stream().map(String :: valueOf).collect(Collectors.joining(","));
+            userBindAgent.setAgentId(agentIdStr);
+            userBindAgent.setUserId(bindAgentDto.getUserId());
+            this.saveOrUpdate(userBindAgent);
+        }
+    }
+
+}

+ 6 - 0
lb-module/src/main/resources/mapper/module/ShopDeliveryBindMapper.xml

@@ -154,6 +154,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
                 select id from lb_shop where deleted = 0 and `name` like concat('%', #{params.shopName}, '%')
             )
         </if>
+        <if test="agentIds != null and agentIds.size > 0">
+            and m.agent_id in
+            <foreach collection="agentIds" index="index" item="agentId" open="(" separator="," close=")">
+                #{agentId}
+            </foreach>
+        </if>
         ORDER BY d.id desc
     </select>
 

+ 6 - 0
lb-module/src/main/resources/mapper/module/ShopDeliveryMapper.xml

@@ -279,6 +279,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="params.endTime != null">
             AND to_days(#{params.endTime}) >= to_days(d.create_time)
         </if>
+        <if test="agentIds != null and agentIds.size > 0">
+            and m.agent_id in
+            <foreach collection="agentIds" index="index" item="agentId" open="(" separator="," close=")">
+                #{agentId}
+            </foreach>
+        </if>
         ORDER BY d.id desc
     </select>
 

+ 11 - 0
lb-module/src/main/resources/mapper/module/SysUserBindAgentMapper.xml

@@ -0,0 +1,11 @@
+<?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="com.ydd.module.mapper.SysUserBindAgentMapper">
+
+    <select id="getAgentIdStrByUserId" resultType="java.lang.String">
+        select agent_id from lb_sys_user_bind_agent where user_id = #{userId} and deleted = 0
+    </select>
+
+</mapper>

+ 5 - 7
lb-module/src/main/resources/mapper/module/merchantMapper.xml

@@ -107,13 +107,11 @@
         left join lb_member mb on mc.id = mb.merchant_id
         left join lb_personnel p on mc.personnel_id = p.id
         where mc.deleted = 0 and mb.member_type = 2
-        <if test="params.agentId != null">
+        <if test="agentIds != null and agentIds.size > 0">
             and mc.agent_id in
-            <if test="agentIds.size > 0 and agentIds != null">
-                <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
+            <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="params.personnelId != null">
             and mc.personnel_id = #{params.personnelId}
@@ -163,7 +161,7 @@
         <if test="params.merchantName != null and params.merchantName != ''">
             and mc.merchant_name like concat('%', #{params.merchantName}, '%')
         </if>
-        <if test="params.agentId != null or params.aId != null">
+        <if test="agentIds != null and agentIds.size > 0">
             and mc.agent_id in
             <foreach collection="agentIds" index="index" item="agentId" open="(" separator="," close=")">
                 #{agentId}

+ 5 - 8
lb-module/src/main/resources/mapper/module/orderMapper.xml

@@ -1149,14 +1149,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         <if test="params.deliveryStatus != null and params.deliveryStatus == 100">
             AND (wo.status = 4 and o.delivery_status != 4)
         </if>
-        <if test="params.agentId != null">
-            AND
-            o.agent_Id in
-            <if test="agentIds.size > 0 and agentIds != null">
-                <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
-                    #{item}
-                </foreach>
-            </if>
+        <if test="agentIds != null and agentIds.size > 0">
+            AND o.agent_Id in
+            <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
+                #{item}
+            </foreach>
         </if>
         <if test="params.aId != null">
             AND

+ 22 - 0
lb-module/src/main/resources/mapper/module/shopWaimaiMapper.xml

@@ -89,4 +89,26 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         on dw.id = w.waimai_id
         where w.shop_id = #{shopId} and w.deleted = 0 and w.bind_status=1
     </select>
+
+    <select id="findWMListByMobile" resultType="com.ydd.module.dto.WaimaiAuthListDto">
+        select
+        w.third_shop_id as thirdShopId,
+        w.third_shop_name as thirdShopName,
+        IFNULL(w.business_id,2) as businessId,
+        w.auth_token as authToken,
+        w.epoid
+        from lb_shop_waimai as w
+        join lb_member as dw
+        on dw.shop_id = w.shop_id
+        where dw.mobile=#{mobile} and w.waimai_id= #{waimaiId} and w.deleted = 0 and w.bind_status=1
+    </select>
+
+    <select id="findSyncMt" resultType="java.lang.Integer">
+        select count(1) from lb_shop_waimai w ,lb_merchant m,lb_agent a where w.merchant_id = m.id and m.agent_id = a.id
+        and a.sync_wm=1 and w.bind_status=1 and w.deleted=0 and w.epoid=#{epoid}
+    </select>
+    <select id="findSyncEle" resultType="java.lang.Integer">
+        select count(1) from lb_shop_waimai w ,lb_merchant m,lb_agent a where w.merchant_id = m.id and m.agent_id = a.id
+        and a.sync_wm=1 and w.bind_status=1 and w.deleted=0 and w.third_shop_id=#{thirdShopId}
+    </select>
 </mapper>