Althars123 3 năm trước cách đây
mục cha
commit
7cd101d81c

+ 22 - 21
twzd-admin/src/main/resources/application-dev.yml

@@ -58,27 +58,28 @@ spring:
                         multi-statement-allow: true
     cache:
         type: redis
-    # redis 配置
-    redis:
-        database: 2
-        # 地址
-        host: 1.15.26.233
-        # 端口,默认为6379
-        port: 6379
-        # 密码
-        password:
-        # 连接超时时间
-        timeout: 10s
-        lettuce:
-            pool:
-                # 连接池中的最小空闲连接
-                min-idle: 0
-                # 连接池中的最大空闲连接
-                max-idle: 8
-                # 连接池的最大数据库连接数
-                max-active: 8
-                # #连接池最大阻塞等待时间(使用负值表示没有限制)
-                max-wait: -1ms
+        # redis 配置
+        redis:
+            # 地址
+            host: 1.15.29.64
+            # 端口,默认为6379
+            port: 6379
+            # 密码
+            password: miaxis110
+            # 连接超时时间
+            timeout: 10000
+            lettuce:
+                pool:
+                    # 连接池中的最小空闲连接
+                    min-idle: 0
+                    # 连接池中的最大空闲连接
+                    max-idle: 8
+                    # 连接池的最大数据库连接数
+                    max-active: 8
+                    # #连接池最大阻塞等待时间(使用负值表示没有限制)
+                    max-wait: -1ms
+            # 指定库
+            database: 14
 
 
 

+ 20 - 42
twzd-service/src/main/java/com/miaxis/extension/service/impl/WxExtensionIncomeServiceImpl.java

@@ -3,6 +3,7 @@ package com.miaxis.extension.service.impl;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.miaxis.common.core.domain.entity.SysDictData;
+import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.extension.domain.WxExtensionIncome;
 import com.miaxis.extension.mapper.WxExtensionIncomeMapper;
 import com.miaxis.extension.service.IWxExtensionIncomeService;
@@ -12,6 +13,7 @@ import com.miaxis.spread.domain.WxSpreadRelation;
 import com.miaxis.spread.service.IWxSpreadRelationService;
 import com.miaxis.system.service.ISysDictDataService;
 import com.miaxis.system.service.ISysDictTypeService;
+import com.miaxis.user.service.IUserInfoService;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
 import org.springframework.stereotype.Service;
@@ -39,6 +41,8 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
 
     private final ISysDictDataService dictDataService;
 
+    private final IUserInfoService userInfoService;
+
     /**
      * 查询分成收益列表
      *
@@ -67,62 +71,36 @@ public class WxExtensionIncomeServiceImpl extends ServiceImpl<WxExtensionIncomeM
         WxSpreadRelation oneRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", openid));
         if (oneRelation == null){
             log.info(openid+": 此用户不存在绑定关系");
+            return;
         }
 
-        WxSpreadRelation twoRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", oneRelation.getParentOpenid()));
+        //WxSpreadRelation twoRelation = wxSpreadRelationService.getOne(new QueryWrapper<WxSpreadRelation>().eq("openid", oneRelation.getParentOpenid()));
 
         //根据字典获取分成百分比
         List<SysDictData> dictDatas = dictTypeService.selectDictDataByType("sys_divide_percent");
 
-        List<WxExtensionIncome> extensionIncomes = new ArrayList<>();
+        List<UserInfo> userInfos = new ArrayList<>();
         dictDatas.forEach(d -> {
             if ("一级".equals(d.getDictLabel())){
-                WxExtensionIncome income = new WxExtensionIncome();
-                income.setOutTradeNo(outTradeNo);
-                income.setBeneficiaryOpenid(oneRelation.getParentOpenid());
-                income.setSourceOpenid(openid);
-                income.setHierarchy("1");
-                income.setPercentage(Integer.parseInt(d.getDictValue()));
-                income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
-                extensionIncomes.add(income);
-            }
-            if ("二级".equals(d.getDictLabel())){
-                if (twoRelation != null){
-                    WxExtensionIncome income = new WxExtensionIncome();
-                    income.setOutTradeNo(outTradeNo);
-                    income.setBeneficiaryOpenid(twoRelation.getParentOpenid());
-                    income.setSourceOpenid(openid);
-                    income.setHierarchy("2");
-                    income.setPercentage(Integer.parseInt(d.getDictValue()));
-                    income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
-                    extensionIncomes.add(income);
-                }
+                //给上级分发佣金和业绩
+                UserInfo userInfo =  userInfoService.getOne(new QueryWrapper<UserInfo>().eq("openid",oneRelation.getParentOpenid()));
+                userInfo.setProfitPrice(userInfo.getProfitPrice()+(total*Integer.parseInt(d.getDictValue()))/100);
+                userInfo.setAchievement(userInfo.getAchievement()+total);
+                userInfos.add(userInfo);
             }
 
-            if ("销售".equals(d.getDictLabel())){
-                if (twoRelation != null){
-                    //销售提成
-                    List<WxSpreadRelation> wxSpreadRelationList = wxSpreadRelationService.getWxSpreadRelationList(twoRelation.getParentOpenid());
-                    if (!wxSpreadRelationList.isEmpty()){
-                        wxSpreadRelationList.stream().forEach(o->{
-                            if (o.getSaleType()!=null && o.getSaleType() > 0){
-                                WxExtensionIncome income = new WxExtensionIncome();
-                                income.setOutTradeNo(outTradeNo);
-                                income.setBeneficiaryOpenid(o.getParentOpenid());
-                                income.setSourceOpenid(openid);
-                                income.setHierarchy("3");
-                                income.setPercentage(Integer.parseInt(d.getDictValue()));
-                                income.setProfitPrice((total*Integer.parseInt(d.getDictValue()))/100);
-                                extensionIncomes.add(income);
-                            }
-                        });
-                    }
-                }
+            List<UserInfo> upUserInfos = wxSpreadRelationService.getWxSpreadRelationList(oneRelation.getParentOpenid());
+            if (!upUserInfos.isEmpty()) {
+                upUserInfos.stream().forEach(userInfo -> {
+                    userInfo.setAchievement(userInfo.getAchievement() + total);
+                    userInfos.add(userInfo);
+                });
+
             }
         });
 
         //保存分成收益信息
-        this.saveBatch(extensionIncomes);
+        userInfoService.updateBatchById(userInfos);
     }
 
 

+ 2 - 1
twzd-service/src/main/java/com/miaxis/spread/mapper/WxSpreadRelationMapper.java

@@ -1,6 +1,7 @@
 package com.miaxis.spread.mapper;
 
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.spread.domain.WxSpreadRelation;
 
 import java.util.List;
@@ -12,5 +13,5 @@ import java.util.List;
  * @date 2021/10/29 9:41
  */
 public interface WxSpreadRelationMapper extends BaseMapper<WxSpreadRelation> {
-    List<WxSpreadRelation> getWxSpreadRelationList(String openid);
+    List<UserInfo> getWxSpreadRelationList(String openid);
 }

+ 2 - 1
twzd-service/src/main/java/com/miaxis/spread/service/IWxSpreadRelationService.java

@@ -1,6 +1,7 @@
 package com.miaxis.spread.service;
 
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.miaxis.common.core.domain.entity.UserInfo;
 import com.miaxis.spread.domain.WxSpreadRelation;
 import com.miaxis.spread.vo.WxSpreadRelationVo;
 
@@ -22,5 +23,5 @@ public interface IWxSpreadRelationService extends IService<WxSpreadRelation> {
      */
     ArrayList<WxSpreadRelationVo> spreadRelationList(String openid);
 
-    List<WxSpreadRelation> getWxSpreadRelationList(String openid);
+    List<UserInfo> getWxSpreadRelationList(String openid);
 }

+ 1 - 1
twzd-service/src/main/java/com/miaxis/spread/service/impl/WxSpreadRelationServiceImpl.java

@@ -57,7 +57,7 @@ public class WxSpreadRelationServiceImpl extends ServiceImpl<WxSpreadRelationMap
     }
 
     @Override
-    public List<WxSpreadRelation> getWxSpreadRelationList(String openid) {
+    public List<UserInfo> getWxSpreadRelationList(String openid) {
         return wxSpreadRelationMapper.getWxSpreadRelationList(openid);
     }
 

+ 125 - 67
twzd-service/src/main/java/com/miaxis/wx/service/impl/WxGzhServiceImpl.java

@@ -26,6 +26,7 @@ import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 
 import javax.servlet.http.HttpServletRequest;
+import java.util.List;
 import java.util.concurrent.TimeUnit;
 
 /**
@@ -124,6 +125,11 @@ public class WxGzhServiceImpl implements IWxGzhService {
             if (MessageUtil.MESSAGE_TEXT.equals(msgType)) { // 文本消息
                 log.info("2.1...");
                 String content = jsonObjectData.getStr("Content");
+                String bizmsgmenuid = jsonObjectData.getStr("bizmsgmenuid");
+                //如果是选择驾校事件
+                if (bizmsgmenuid != null){
+                    return dealSchoolMsg(bizmsgmenuid,content,fromUserName,toUserName);
+                }
                 WxForeverCode wxForeverCode = wxForeverCodeService.getOne(new QueryWrapper<WxForeverCode>().eq("code", content).isNull("openid"));
                 //若该口令为未使用的口令
                 if (wxForeverCode != null){
@@ -148,30 +154,39 @@ public class WxGzhServiceImpl implements IWxGzhService {
                 return MessageUtil.initText(fromUserName, toUserName, "抱歉,暂时无法识别图片信息!");
             }else if (MessageUtil.MESSAGE_EVENT.equals(msgType)) { // 事件消息
                 log.info("3....");
+                String result = null ;
                 // 区分事件推送
                 String event = jsonObjectData.getStr("Event");
                 if (MessageUtil.MESSAGE_SUBSCRIBE.equals(event)) { // 关注事件 或 扫描二维码关注事件
                     log.info("3.1...");
                     UserInfo user = userService.getStudentByOpenId(fromUserName);
                     UserInfo userInfo = new UserInfo();
-                    if (user == null){
-                        //保存用户信息
-//                        userInfo.setHeadImage(jsonObj.getString("headimgurl"));
-//                        userInfo.setNickName(jsonObj.getString("nickname"));
-                        userInfo.setOpenid(fromUserName);
-                        userService.saveUserInfo(userInfo);
-                    }
+                    userInfo.setOpenid(fromUserName);
 
                     //存在Ticket为扫码关注
                     if (org.apache.commons.lang3.StringUtils.isNotEmpty(jsonObjectData.getStr("Ticket"))){
                         log.info("3.1.2..");
+                        //根据父级销售类型更新当前用户类型
+                        UserInfo parentUserInfo = userService.getStudentByOpenId(fromUserName);
+                        if (parentUserInfo != null && (parentUserInfo.getSaleType() ==1 || parentUserInfo.getSaleType() ==3 )){
+                            userInfo.setSaleType(1);
+                        }
                         //根据Ticket  绑定信息到上级用户
                         String subscribeEvent = wxMessageEvenService.scanSubscribeEvent(fromUserName, jsonObjectData.getStr("EventKey"),this.getGzhToken(),userInfo.getNickName());
-                        return MessageUtil.initText(fromUserName,toUserName,subscribeEvent);
+                        result =  MessageUtil.initText(fromUserName,toUserName,subscribeEvent);
 
                     }else {
-                        return MessageUtil.initText(fromUserName, toUserName, "欢迎关注金牌车教,您的学车好伙伴!");
+                        result =  MessageUtil.initText(fromUserName, toUserName, "欢迎关注金牌车教,您的学车好伙伴!");
+                    }
+
+                    if (user == null){
+                        //保存用户信息
+                       userInfoService.save(userInfo);
+
                     }
+                    return result;
+
+
 
                 }  else if (MessageUtil.MESSAGE_UNSUBSCRIBE.equals(event)) { // 取消订阅事件
                     // todo 处理取消订阅事件
@@ -200,9 +215,9 @@ public class WxGzhServiceImpl implements IWxGzhService {
                         //查询该用户的上级
                         UserInfo upUserInfo = userInfoService.getUpUserInfo(fromUserName);
                         //当用户销售类型为 普通用户(含驾校分成) 并且他的父级不是代理商(含驾校分成)时,则需要填写驾校信息,且未填写驾校信息时
-//                        if (userInfo.getSaleType() ==1 && upUserInfo.getSaleType()!=3 && upUserInfo.getSchoolName() == null ){
-//                            return choseSchoolName(userInfo,null,fromUserName,toUserName);
-//                        }
+                       if (userInfo.getSaleType() ==1 && upUserInfo.getSaleType()!=3 && upUserInfo.getSchoolName() == null ){
+                           return choseSchoolName(userInfo,fromUserName,toUserName);
+                       }
                         String mediaId = wxMessageEvenService.gainTicketEvent(fromUserName, this.getGzhToken(), false, wxForeverCode);
                         return MessageUtil.initImage(fromUserName,toUserName,mediaId);
                     }
@@ -217,66 +232,109 @@ public class WxGzhServiceImpl implements IWxGzhService {
         return null;
     }
 
-//    private String choseSchoolName(UserInfo userInfo,String text,String fromUserName,String toUserName) throws Exception {
-//        int index =0;
-//        if (userInfo.getCityName() ==null){
-//            if ()
-//            QueryParams queryParams = new QueryParams();
-//            queryParams.setChoseColumName("city_name");
-//            List<String> cities = schoolInfoMapper.queryNames(queryParams);
-//            String content = "请选择驾校所在省份: \\n";
-//            for (String city: cities){
-//                content+="  "+"<a href=\"weixin://bizmsgmenu?msgmenuid="+index+"&msgmenucontent="+city+"\">"+city+"</a>\\n";
-//                index++;
-//            }
-//            return MessageUtil.initText(fromUserName, toUserName, content);
-//        }
-//
-//        //如果输入值是市名称,则查出改市所有区名称
-//        if (cities.contains(text)){
-//            QueryParams queryParamsArea = new QueryParams();
-//            queryParams.setChoseColumName("area_name");
-//            queryParams.setConditionColumName("city_name");
-//            queryParams.setValue(text);
-//            List<String> areas = schoolInfoMapper.queryNames(queryParamsArea);
-//            String content = "请选择驾校所在区: \\n";
-//            for (String area: areas){
-//                content+="  "+"<a href=\"weixin://bizmsgmenu?msgmenuid="+index+"&msgmenucontent="+area+"\">"+area+"</a>\\n";
-//                index++;
-//            }
-//            return MessageUtil.initText(fromUserName, toUserName, content);
-//        }
-//
-//        QueryParams queryParamsArea = new QueryParams();
-//        queryParams.setChoseColumName("area_name");
-//        queryParams.setConditionColumName("city_name");
-//        queryParams.setValue(text);
-//        List<String> areas = schoolInfoMapper.queryNames(queryParamsArea);
-//        //如果输入值是区名称,则选出所有区驾校名称
-//        if (areas.contains(text)){
-//            QueryParams queryParamsSchool = new QueryParams();
-//            queryParams.setChoseColumName("area_name");
-//            queryParams.setConditionColumName("city_name");
-//            queryParams.setValue(text);
-//            List<String> areas = schoolInfoMapper.queryNames(queryParamsArea);
-//            String content = "请选择驾校所在区: \\n";
-//            for (String area: areas){
-//                content+="  "+"<a href=\"weixin://bizmsgmenu?msgmenuid="+index+"&msgmenucontent="+area+"\">"+area+"</a>\\n";
-//                index++;
-//            }
-//            return MessageUtil.initText(fromUserName, toUserName, content);
-//        }
-
-
-//        return null;
-//    }
+    private String dealSchoolMsg(String bizmsgmenuid, String content, String fromUserName, String toUserName) throws Exception {
+        UserInfo userInfo = userInfoService.getOne(new QueryWrapper<UserInfo>().eq("openid", fromUserName));
+        // 1选择城市 2选择区 3选择学校
+        if ("1".equals(bizmsgmenuid)){
+            userInfo.setCityName(content);
+            userInfoService.updateById(userInfo);
+            QueryParams queryParamsArea = new QueryParams();
+            queryParamsArea.setChoseColumName("area_name");
+            queryParamsArea.setConditionColumName1("city_name");
+            queryParamsArea.setValue1(content);
+            List<String> areas = schoolInfoMapper.queryNames(queryParamsArea);
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("请选择驾校所在区:").append("\n\n");
+            for (String area: areas){
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+area+"\">"+area+"</a>").append("\n");
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+area+"\">"+area+"</a>").append("\n\n");
+                return MessageUtil.initText(fromUserName, toUserName, buffer.toString());
+            }
+        }else if ("2".equals(bizmsgmenuid)){
+            userInfo.setAreaName(content);
+            userInfoService.updateById(userInfo);
+            QueryParams queryParamsArea = new QueryParams();
+            queryParamsArea.setChoseColumName("school_name");
+            queryParamsArea.setConditionColumName1("city_name");
+            queryParamsArea.setValue1(userInfo.getCityName());
+            queryParamsArea.setConditionColumName2("area_name");
+            queryParamsArea.setValue2(userInfo.getAreaName());
+            List<String> schools = schoolInfoMapper.queryNames(queryParamsArea);
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("请选择驾校:").append("\n\n");
+            for (String school: schools){
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+school+"\">"+school+"</a>").append("\n");
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+school+"\">"+school+"</a>").append("\n\n");
+                return MessageUtil.initText(fromUserName, toUserName, buffer.toString());
+            }
+        }
+        //如果输出的是驾校,则返回二维码
+        else if ("3".equals(bizmsgmenuid)){
+            userInfo.setSchoolName(content);
+            userInfoService.updateById(userInfo);
+            String mediaId = wxMessageEvenService.gainTicketEvent(fromUserName, this.getGzhToken(), false, null);
+            return MessageUtil.initImage(fromUserName,toUserName,mediaId);
+        }
+        return null;
+    }
+
+    private String choseSchoolName(UserInfo userInfo,String fromUserName,String toUserName) throws Exception {
+        //城市未填写
+        if (userInfo.getCityName() == null){
+            QueryParams queryParams = new QueryParams();
+            queryParams.setChoseColumName("city_name");
+            List<String> cities = schoolInfoMapper.queryNames(queryParams);
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("请选择驾校所在城市:").append("\n\n");
+            for (String city: cities){
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+city+"\">"+city+"</a>").append("\n");
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+city+"\">"+city+"</a>").append("\n\n");
+                return MessageUtil.initText(fromUserName, toUserName, buffer.toString());
+            }
+            return MessageUtil.initText(fromUserName, toUserName, buffer.toString());
+        }else if (userInfo.getAreaName() == null) {
+            QueryParams queryParamsArea = new QueryParams();
+            queryParamsArea.setChoseColumName("area_name");
+            queryParamsArea.setConditionColumName1("city_name");
+            queryParamsArea.setValue1(userInfo.getCityName());
+            List<String> areas = schoolInfoMapper.queryNames(queryParamsArea);
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("请选择驾校所在区:").append("\n\n");
+            for (String area: areas){
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+area+"\">"+area+"</a>").append("\n");
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+area+"\">"+area+"</a>").append("\n\n");
+                return MessageUtil.initText(fromUserName, toUserName, buffer.toString());
+            }
+        }
+
+        else if (userInfo.getSchoolName() == null) {
+            QueryParams queryParamsArea = new QueryParams();
+            queryParamsArea.setChoseColumName("school_name");
+            queryParamsArea.setConditionColumName1("city_name");
+            queryParamsArea.setValue1(userInfo.getCityName());
+            queryParamsArea.setConditionColumName2("area_name");
+            queryParamsArea.setValue2(userInfo.getAreaName());
+            List<String> schools = schoolInfoMapper.queryNames(queryParamsArea);
+            StringBuffer buffer = new StringBuffer();
+            buffer.append("请选择驾校:").append("\n\n");
+            for (String school: schools){
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+school+"\">"+school+"</a>").append("\n");
+                buffer.append("<a href=\"weixin://bizmsgmenu?msgmenuid=1&msgmenucontent="+school+"\">"+school+"</a>").append("\n\n");
+                return MessageUtil.initText(fromUserName, toUserName, buffer.toString());
+            }
+        }
+
+        return null;
+    }
 
 
     @Data
     public class QueryParams {
         String choseColumName;
-        String conditionColumName;
-        String value;
+        String conditionColumName1;
+        String value1;
+        String conditionColumName2;
+        String value2;
     }
 
 

+ 5 - 0
twzd-service/src/main/java/com/miaxis/wx/service/impl/WxMessageEvenServiceImpl.java

@@ -54,6 +54,7 @@ public class WxMessageEvenServiceImpl implements IWxMessageEvenService {
 
     private final IWxForeverCodeService wxForeverCodeService;
 
+
     @Value("${file.ticketPath}")
     private String ticketPath;
 
@@ -93,9 +94,13 @@ public class WxMessageEvenServiceImpl implements IWxMessageEvenService {
             wxSpreadRelation.setParentOpenid(openid);
             wxSpreadRelationService.save(wxSpreadRelation);
 
+
+
             //推送绑定模板信息到上级
             messageTemplateSend(openid,token,userName);
 
+
+
             message = "已成功绑定推广关系!";
         }else if (!spreads.isEmpty()){
             message = "已存在下级绑定关系!";

+ 6 - 3
twzd-service/src/main/resources/mapper/school/SchoolInfoMapper.xml

@@ -35,9 +35,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     </select>
 
     <select id="queryNames" resultType="string">
-        select distinct(${columName}) from school_info
-        <if test="conditionColumName != null  and conditionColumName != ''">
-        where ${conditionColumName} = #{value}
+        select distinct(${columName}) from school_info where 1=1
+        <if test="conditionColumName1 != null  and conditionColumName1 != ''">
+        and ${conditionColumName1} = #{value1}
+      </if>
+        <if test="conditionColumName2 != null  and conditionColumName2 != ''">
+            and ${conditionColumName2} = #{value2}
         </if>
 
     </select>

+ 4 - 3
twzd-service/src/main/resources/mapper/spread/WxSpreadRelationMapper.xml

@@ -3,10 +3,11 @@
         PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.miaxis.spread.mapper.WxSpreadRelationMapper">
-<select id="getWxSpreadRelationList" resultType="com.miaxis.spread.domain.WxSpreadRelation">
-select t1.*,t2.sale_type
+<select id="getWxSpreadRelationList" resultType="com.miaxis.common.core.domain.entity.UserInfo">
+select * from user_info where openid in (
+select t1.parent_openid
  FROM wx_spread_relation  t1 left join user_info  t2 on (t1.parent_openid = t2.openid) where
-FIND_IN_SET(t1.openid,getParents(#{openid}))
+FIND_IN_SET(t1.openid,getParents(#{openid})))
 </select>