kaick пре 1 година
родитељ
комит
7204aae296

+ 7 - 0
src/main/java/com/caimei365/user/controller/BaseApi.java

@@ -14,6 +14,7 @@ import com.caimei365.user.service.SysDictService;
 import com.caimei365.user.utils.RequestUtil;
 import com.caimei365.user.utils.RequestUtil;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;
 import lombok.RequiredArgsConstructor;
 import lombok.RequiredArgsConstructor;
+import org.apache.ibatis.annotations.Param;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.http.ResponseEntity;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
@@ -262,4 +263,10 @@ public class BaseApi {
         }
         }
         return ResponseJson.success(sysDictService.getSysDictList(new SysDict().setType(type)));
         return ResponseJson.success(sysDictService.getSysDictList(new SysDict().setType(type)));
     }
     }
+
+    @ApiOperation("获取userId")
+    @GetMapping("/getFindUserId")
+    public ResponseJson getFindUserId(Integer userType, Integer id) {
+        return ResponseJson.success(baseService.getByUserId(userType, id));
+    }
 }
 }

+ 2 - 2
src/main/java/com/caimei365/user/controller/SellerApi.java

@@ -202,8 +202,8 @@ public class SellerApi {
      * 机构访问列表
      * 机构访问列表
      */
      */
     @GetMapping("/getBehaviorRecordClub")
     @GetMapping("/getBehaviorRecordClub")
-    public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accessTime) {
-        return sellerService.getBehaviorRecordClub( spId, accessTime);
+    public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accDateTime) {
+        return sellerService.getBehaviorRecordClub( spId, accDateTime);
 
 
     }
     }
     /**
     /**

+ 2 - 2
src/main/java/com/caimei365/user/feign/ToolsFeign.java

@@ -37,8 +37,8 @@ public interface ToolsFeign {
     /**
     /**
      * 请求发消息
      * 请求发消息
      */
      */
-    @PostMapping("/tools//message/send")
-    String sendMessage(@RequestBody MessageModel messageModel);
+    @PostMapping("/tools/message/send")
+    ResponseJson sendCommonMessage(@RequestBody MessageModel messageModel);
 
 
 
 
 }
 }

+ 1 - 0
src/main/java/com/caimei365/user/mapper/BaseMapper.java

@@ -175,4 +175,5 @@ public interface BaseMapper {
     List<String> findLabelsByLableIds(String labelIds);
     List<String> findLabelsByLableIds(String labelIds);
 
 
     Integer findBankByUserId(Integer userId);
     Integer findBankByUserId(Integer userId);
+    Integer getByUserId(@Param("userType")Integer userType,@Param("id")Integer id);
 }
 }

+ 5 - 0
src/main/java/com/caimei365/user/mapper/LoginMapper.java

@@ -176,4 +176,9 @@ public interface LoginMapper {
      */
      */
     Integer getClubTypeById(Integer userId);
     Integer getClubTypeById(Integer userId);
 
 
+    /**
+     * 会员机构类型:1医美,2生
+     */
+    Integer getClubSpUserId(Integer clubId);
+
 }
 }

+ 4 - 0
src/main/java/com/caimei365/user/model/po/ClubPo.java

@@ -121,5 +121,9 @@ public class ClubPo implements Serializable {
      * 状态:90:已上线,91:已冻结,92:审查资料未通过,待补充资料,1:待审查资料,2:电话预约,3:已预约,20:待确认,21:待拜访,30:待员工推荐,40:已完成第一次采购
      * 状态:90:已上线,91:已冻结,92:审查资料未通过,待补充资料,1:待审查资料,2:电话预约,3:已预约,20:待确认,21:待拜访,30:待员工推荐,40:已完成第一次采购
      */
      */
     private Integer status;
     private Integer status;
+    /**
+     * 新分配机构状态 0.否,1.是
+     */
+    private Integer newDeal;
 }
 }
 
 

+ 13 - 3
src/main/java/com/caimei365/user/model/vo/MessageCenter.java

@@ -119,12 +119,22 @@ public class MessageCenter implements Serializable {
     /** 名称 */
     /** 名称 */
     private String name;
     private String name;
 
 
-    /** 用户名称 */
+    /**
+     * 用户名称
+     */
     private String userName;
     private String userName;
 
 
-    /** 前用户名称 */
+    /**
+     * 前用户名称
+     */
     private String superUserName;
     private String superUserName;
 
 
-    /** 当前id */
+    /**
+     * 当前id
+     */
     private Integer thisId;
     private Integer thisId;
+    /**
+     * 数量
+     */
+    private Integer sum;
 }
 }

+ 3 - 0
src/main/java/com/caimei365/user/model/vo/UserLoginVo.java

@@ -19,6 +19,9 @@ public class UserLoginVo implements Serializable {
      */
      */
     @ApiModelProperty("用户Id")
     @ApiModelProperty("用户Id")
     private Integer userId;
     private Integer userId;
+
+    @ApiModelProperty("协销用户Id")
+    private Integer spUserId;
     /**
     /**
      * 组织Id
      * 组织Id
      */
      */

+ 4 - 0
src/main/java/com/caimei365/user/service/BaseService.java

@@ -4,6 +4,7 @@ import com.aliyuncs.exceptions.ClientException;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.ResponseJson;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.MobileDto;
 import com.caimei365.user.model.dto.PasswordDto;
 import com.caimei365.user.model.dto.PasswordDto;
+import org.apache.ibatis.annotations.Param;
 
 
 import java.util.HashMap;
 import java.util.HashMap;
 import java.util.Map;
 import java.util.Map;
@@ -130,4 +131,7 @@ public interface BaseService {
     ResponseJson findPackage();
     ResponseJson findPackage();
 
 
     ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException;
     ResponseJson<HashMap<String, String>> ossTokenGet() throws ClientException;
+
+    ResponseJson<Integer>  getByUserId(Integer userType, Integer userId);
+
 }
 }

+ 5 - 0
src/main/java/com/caimei365/user/service/impl/BaseServiceImpl.java

@@ -800,4 +800,9 @@ public class BaseServiceImpl implements BaseService {
         }
         }
         return superVipDto;
         return superVipDto;
     }
     }
+
+    @Override
+    public ResponseJson<Integer> getByUserId(Integer userType, Integer id) {
+        return ResponseJson.success(baseMapper.getByUserId(userType, id));
+    }
 }
 }

+ 3 - 0
src/main/java/com/caimei365/user/service/impl/LoginServiceImpl.java

@@ -883,6 +883,9 @@ public class LoginServiceImpl implements LoginService {
 //        }
 //        }
 
 
         if (loginUser.getUserId() != null) {
         if (loginUser.getUserId() != null) {
+            if(loginUser.getClubId() != null&&loginUser.getClubId()!=1342){
+                loginUser.setSpUserId(loginMapper.getClubSpUserId(loginUser.getClubId()));
+            }
             Integer shopID = messageCenterMapper.shopID(loginUser.getUserId());
             Integer shopID = messageCenterMapper.shopID(loginUser.getUserId());
             Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
             Integer newReceiptType = messageCenterMapper.newReceiptType(shopID);
             Integer listingFeeCount= messageCenterMapper.listingFee(shopID);
             Integer listingFeeCount= messageCenterMapper.listingFee(shopID);

+ 5 - 2
src/main/java/com/caimei365/user/service/impl/RegisterServiceImpl.java

@@ -283,11 +283,13 @@ public class RegisterServiceImpl implements RegisterService {
         if (StringUtils.isNotBlank(club.getLinkMan())) {
         if (StringUtils.isNotBlank(club.getLinkMan())) {
             clubMapper.inProvider(spId, club.getClubId(), spId!=1342?"系统自动分配":club.getLinkMan(), 0);
             clubMapper.inProvider(spId, club.getClubId(), spId!=1342?"系统自动分配":club.getLinkMan(), 0);
             if(spId!=1342) {
             if(spId!=1342) {
+                log.info("注册普通机构,开始站内信推送");
                 String selSpName = clubMapper.selSpName(spId);
                 String selSpName = clubMapper.selSpName(spId);
                 String spMessage = "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + user.getUserName() + "】,联系人【" + user.getUserName() + "】,手机号【" + user.getBindMobile() + "】。";
                 String spMessage = "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + user.getUserName() + "】,联系人【" + user.getUserName() + "】,手机号【" + user.getBindMobile() + "】。";
                 String mobile = vipMapper.findMobile(clubMapper.getSpUserId(spId));
                 String mobile = vipMapper.findMobile(clubMapper.getSpUserId(spId));
                 String clubMessage = "【采美365】采美平台已为您提供专属客户经理,为您提供专业服务。客户经理【" + selSpName + "】,手机号【" + mobile + "】。";
                 String clubMessage = "【采美365】采美平台已为您提供专属客户经理,为您提供专业服务。客户经理【" + selSpName + "】,手机号【" + mobile + "】。";
                 if (mobile != null && mobile != "") {
                 if (mobile != null && mobile != "") {
+                    log.info("注册普通机构,发送站内信推送");
                     //站内信
                     //站内信
                     MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
                     MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
                     insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
                     insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
@@ -302,7 +304,7 @@ public class RegisterServiceImpl implements RegisterService {
                                     .thisId(spId)
                                     .thisId(spId)
                                     .clubId(club.getClubId())
                                     .clubId(club.getClubId())
                             );
                             );
-                    smsFeign.sendMessage(insideMessageMessageModel);
+                    smsFeign.sendCommonMessage(insideMessageMessageModel);
 
 
                     insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
                     insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
                             .info(new InsideMessage()
                             .info(new InsideMessage()
@@ -313,7 +315,7 @@ public class RegisterServiceImpl implements RegisterService {
                                     .mobile(mobile)
                                     .mobile(mobile)
                                     .clubId(club.getClubId())
                                     .clubId(club.getClubId())
                             );
                             );
-                    smsFeign.sendMessage(insideMessageMessageModel);
+                    smsFeign.sendCommonMessage(insideMessageMessageModel);
                     //短信
                     //短信
                     remoteCallService.remoteSendSms(25, 1, mobile, spMessage);
                     remoteCallService.remoteSendSms(25, 1, mobile, spMessage);
                     remoteCallService.remoteSendSms(25, 1, user.getBindMobile(), clubMessage);
                     remoteCallService.remoteSendSms(25, 1, user.getBindMobile(), clubMessage);
@@ -957,6 +959,7 @@ public class RegisterServiceImpl implements RegisterService {
         club.setServiceProviderId(serviceProvider.getServiceProviderId());
         club.setServiceProviderId(serviceProvider.getServiceProviderId());
         // 待扫描
         // 待扫描
         club.setScanFlag(0);
         club.setScanFlag(0);
+
         // 注册时间
         // 注册时间
         club.setAddTime(current);
         club.setAddTime(current);
         // 会员机构,填写升级资料
         // 会员机构,填写升级资料

+ 18 - 1
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -24,6 +24,9 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.math.BigDecimal;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
 import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
+import java.time.LocalDate;
+import java.time.format.DateTimeFormatter;
 import java.util.*;
 import java.util.*;
 import java.util.regex.Matcher;
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.regex.Pattern;
@@ -155,7 +158,7 @@ public class SellerServiceImpl implements SellerService {
         Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
         Integer loginSum = Integer.valueOf(spUserLoginSum.get("loginSum").toString());
         Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
         Integer not_loginSum = Integer.valueOf(spUserLoginSum.get("not_loginSum").toString());
 //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
 //        机构活跃与不活跃占比计算方法,例如:机构活跃数/机构活跃数+机构不活跃数(60/(60+30)=0.666...),保留小数点后2位,四舍五入,0.67;
-        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ? loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
+        BigDecimal livelyClubProportion = new BigDecimal((loginSum + not_loginSum) != 0 ?(double) loginSum / (loginSum + not_loginSum) * 100 : 0).setScale(2, RoundingMode.UP);
         map.put("livelyClub", loginSum);
         map.put("livelyClub", loginSum);
         map.put("noLivelyClub", not_loginSum);
         map.put("noLivelyClub", not_loginSum);
         map.put("livelyClubProportion", livelyClubProportion);
         map.put("livelyClubProportion", livelyClubProportion);
@@ -355,6 +358,13 @@ public class SellerServiceImpl implements SellerService {
 
 
     @Override
     @Override
     public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accessTime) {
     public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer spId, String accessTime) {
+       // 设置日期格式
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate date = LocalDate.parse(accessTime, formatter);
+        // 获取前一天的日期
+        LocalDate dayBeforeYesterday = date.minusDays(1);
+        // 格式化日期
+        accessTime= dayBeforeYesterday.format(formatter);
         List<CmBehaviorRecordVo> behaviorRecordYesterdayClub = sellerMapper.getBehaviorRecordYesterdayClub(spId, accessTime);
         List<CmBehaviorRecordVo> behaviorRecordYesterdayClub = sellerMapper.getBehaviorRecordYesterdayClub(spId, accessTime);
         for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClub) {
         for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClub) {
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
@@ -365,6 +375,13 @@ public class SellerServiceImpl implements SellerService {
 
 
     @Override
     @Override
     public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer spId, Integer clubId, String accessTime) {
     public ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer spId, Integer clubId, String accessTime) {
+        // 设置日期格式
+        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
+        LocalDate date = LocalDate.parse(accessTime, formatter);
+        // 获取前一天的日期
+        LocalDate dayBeforeYesterday = date.minusDays(1);
+        // 格式化日期
+        accessTime= dayBeforeYesterday.format(formatter);
         List<CmBehaviorRecordVo> behaviorRecordYesterdayClubFrom = sellerMapper.getBehaviorRecordYesterdayClubFrom(spId, clubId, accessTime);
         List<CmBehaviorRecordVo> behaviorRecordYesterdayClubFrom = sellerMapper.getBehaviorRecordYesterdayClubFrom(spId, clubId, accessTime);
         for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClubFrom) {
         for (CmBehaviorRecordVo cmBehaviorRecordVo : behaviorRecordYesterdayClubFrom) {
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);
             String pageLabel = sellerMapper.getBehaviorRecordYesterdayPageLabel(spId, cmBehaviorRecordVo.getClubId(), accessTime);

+ 13 - 0
src/main/resources/mapper/BaseMapper.xml

@@ -203,4 +203,17 @@
         WHERE userId = #{userId}
         WHERE userId = #{userId}
           and delflag = 0
           and delflag = 0
     </select>
     </select>
+    <select id="getByUserId" resultType="java.lang.Integer">
+        <if test="userType != null">
+            <if test="userType == 1">
+            SELECT userID from  club   WHERE  clubId = #{id}
+            </if>
+            <if test="userType == 2">
+            SELECT userID from  shop   WHERE  shopId = #{id}
+            </if>
+            <if test="userType == 3">
+            SELECT userID from  serviceprovider  WHERE  serviceProviderID = #{id}
+            </if>
+        </if>
+    </select>
 </mapper>
 </mapper>

+ 6 - 0
src/main/resources/mapper/LoginMapper.xml

@@ -473,4 +473,10 @@
         WHERE userID = #{userId}
         WHERE userID = #{userId}
         limit 1
         limit 1
     </select>
     </select>
+    <select id="getClubSpUserId" resultType="java.lang.Integer">
+        SELECT s.userID from  serviceprovider s
+        left join club c on c.spId=s.serviceProviderID
+        WHERE  c.clubId = #{clubId}
+        limit 1
+    </select>
 </mapper>
 </mapper>

+ 4 - 4
src/main/resources/mapper/RegisterMapper.xml

@@ -14,12 +14,12 @@
             values(#{userID},"新增用户","一般挽留客户",0,1)
             values(#{userID},"新增用户","一般挽留客户",0,1)
     </insert>
     </insert>
     <insert id="insertClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
     <insert id="insertClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
-        insert into club(`name`, `sname`, `contractMobile`, `linkMan`, `userID`, `addTime`, `status`, `spID`, `scanFlag`, provinceID, cityID, townID, address, headpic, businessLicenseImage, medicalPracticeLicenseImg, socialCreditCode)
-                  values(#{name},#{shortName},#{contractMobile},#{linkMan},#{userId},#{addTime},#{status}, #{serviceProviderId}, #{scanFlag}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{shopPhoto}, #{businessLicense},#{medicalPracticeLicense}, #{socialCreditCode})
+        insert into club(`name`, `sname`, `contractMobile`, `linkMan`, `userID`, `addTime`, `status`, `spID`, `scanFlag`, provinceID, cityID, townID, address, headpic, businessLicenseImage, medicalPracticeLicenseImg, socialCreditCode,newDeal)
+                  values(#{name},#{shortName},#{contractMobile},#{linkMan},#{userId},#{addTime},#{status}, #{serviceProviderId}, #{scanFlag}, #{provinceId}, #{cityId}, #{townId}, #{address}, #{shopPhoto}, #{businessLicense},#{medicalPracticeLicense}, #{socialCreditCode},1)
     </insert>
     </insert>
     <insert id="insertUpgradeClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
     <insert id="insertUpgradeClub" parameterType="com.caimei365.user.model.po.ClubPo" keyProperty="clubId" useGeneratedKeys="true">
-        insert into club(`name`, `sname`,     `contractMobile`, `userID`, `addTime`, `status`, `spID`,              `scanFlag`,`contractEmail`,`linkMan`, `provinceID`, `cityID`,`townID`, `address`, `headpic`, `businessLicenseImage`,`socialCreditCode`,`firstClubType`,`secondClubType`,`department`,`medicalPracticeLicenseImg`,`mainpro`)
-                  values(#{name},#{shortName},#{contractMobile},#{userId},#{addTime},#{status},#{serviceProviderId},#{scanFlag},#{contractEmail},#{linkMan},#{provinceId},#{cityId},#{townId},#{address},#{shopPhoto},#{businessLicense},#{socialCreditCode},#{firstClubType},#{secondClubType},#{department},#{medicalPracticeLicense},#{mainProduct})
+        insert into club(`name`, `sname`,     `contractMobile`, `userID`, `addTime`, `status`, `spID`,              `scanFlag`,`contractEmail`,`linkMan`, `provinceID`, `cityID`,`townID`, `address`, `headpic`, `businessLicenseImage`,`socialCreditCode`,`firstClubType`,`secondClubType`,`department`,`medicalPracticeLicenseImg`,`mainpro`,newDeal)
+                  values(#{name},#{shortName},#{contractMobile},#{userId},#{addTime},#{status},#{serviceProviderId},#{scanFlag},#{contractEmail},#{linkMan},#{provinceId},#{cityId},#{townId},#{address},#{shopPhoto},#{businessLicense},#{socialCreditCode},#{firstClubType},#{secondClubType},#{department},#{medicalPracticeLicense},#{mainProduct},1)
     </insert>
     </insert>
     <insert id="insertOperation" parameterType="com.caimei365.user.model.po.OperationPo" keyProperty="id" useGeneratedKeys="true">
     <insert id="insertOperation" parameterType="com.caimei365.user.model.po.OperationPo" keyProperty="id" useGeneratedKeys="true">
         insert into cm_mall_operation_user(`userID`, `clubID`, `shopID`, `userOrganizeID`,`linkName`,`nickName`,`headimgurl`,`userType`,`mobile`,`status`, `unionId`, `openid`,`pcOpenid`, `addTime`, `updateTime`, `bindTime`, `delFlag`)
         insert into cm_mall_operation_user(`userID`, `clubID`, `shopID`, `userOrganizeID`,`linkName`,`nickName`,`headimgurl`,`userType`,`mobile`,`status`, `unionId`, `openid`,`pcOpenid`, `addTime`, `updateTime`, `bindTime`, `delFlag`)

+ 66 - 8
src/main/resources/mapper/SellerMapper.xml

@@ -154,13 +154,47 @@
         </if>
         </if>
         <if test="4 == type">
         <if test="4 == type">
             c.spID = #{serviceProviderId}
             c.spID = #{serviceProviderId}
-            AND sp.status = 90
-                AND u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            AND sp.status = 90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+            AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR c.clubId= (select aa.clubId
+            FROM ((select
+            c.clubId
+            FROM club c
+            LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            )UNION(
+            select c.clubId
+            FROM club c
+            LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            )) aa
+            where aa.clubId=c.clubId
+            GROUP BY aa.clubId LIMIT 0,1))
         </if>
         </if>
         <if test="5 == type">
         <if test="5 == type">
             c.spID = #{serviceProviderId}
             c.spID = #{serviceProviderId}
-            AND sp.status = 90
-                AND u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            AND sp.status = 90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+            AND (u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR c.clubId!= (select aa.clubId
+            FROM ((select
+            c.clubId
+            FROM club c
+            LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            )UNION(
+            select c.clubId
+            FROM club c
+            LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+            LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+            where c.status=90 and sp.status=90
+            and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+            )) aa
+            where aa.clubId=c.clubId
+            GROUP BY aa.clubId LIMIT 0,1))
         </if>
         </if>
         <if test="6 == type">
         <if test="6 == type">
             c.spID = #{serviceProviderId}
             c.spID = #{serviceProviderId}
@@ -185,15 +219,39 @@
 
 
     <select id="findSpUserLoginSum" resultType="java.util.HashMap" parameterType="string">
     <select id="findSpUserLoginSum" resultType="java.util.HashMap" parameterType="string">
         select
         select
-        ifnull(COUNT(CASE WHEN u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) THEN 1 END),0) AS loginSum,
-        ifnull(COUNT(CASE WHEN u.loginTime <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) THEN 1 END),0) AS not_loginSum
+        ifnull(COUNT(   CASE WHEN a.time >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) THEN 1 END),0) AS loginSum,
+        ifnull(COUNT(  CASE WHEN a.time <![CDATA[ < ]]> DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) THEN 1 END),0) AS not_loginSum
+        FROM (select a.*
+        FROM (
+        (select
+        c.clubId,u.loginTime AS time,c.spID
         FROM club c
         FROM club c
         LEFT JOIN user u ON u.userID = c.userID
         LEFT JOIN user u ON u.userID = c.userID
         LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
         LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
-        where sp.status=90
+        where c.status=90 and  sp.status=90  and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+        )UNION(
+        select
+        c.clubId,ccr.addTime AS time,c.spID
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        LEFT JOIN cm_club_remarks ccr ON ccr.clubId = c.clubId
+        LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+        where c.status=90 and sp.status=90  and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+        and  ccr.addTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+        )UNION(
+        select c.clubId,cr.orderTime AS time,c.spID
+        FROM club c
+        LEFT JOIN user u ON u.userID = c.userID
+        LEFT JOIN cm_order cr ON cr.clubId = c.clubId
+        LEFT JOIN serviceprovider sp ON sp.serviceProviderID = c.spID
+        where c.status=90 and sp.status=90 and (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4
+        and  cr.orderTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH)
+        )
+        ) a where a.time is not null
         <if test="spID != null">
         <if test="spID != null">
-            and  c.spID=#{spID}
+            and  a.spID=#{spID}
         </if>
         </if>
+        GROUP BY a.clubId ) a
     </select>
     </select>
     <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
     <select id="getAllClubList" resultType="com.caimei365.user.model.vo.ClubVo">
         SELECT DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
         SELECT DISTINCT c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,

+ 23 - 0
src/test/java/com/caimei365/user/UserApplicationTests.java

@@ -8,6 +8,10 @@ import com.caimei365.user.service.LoginService;
 import com.caimei365.user.utils.AliyunSmsUtil;
 import com.caimei365.user.utils.AliyunSmsUtil;
 import com.caimei365.user.utils.CodeUtil;
 import com.caimei365.user.utils.CodeUtil;
 import com.caimei365.user.utils.ValidateUtil;
 import com.caimei365.user.utils.ValidateUtil;
+import com.caimei365.user.utils.message.InsideMessage;
+import com.caimei365.user.utils.message.MessageModel;
+import com.caimei365.user.utils.message.MessageType;
+import com.caimei365.user.utils.message.MqInfo;
 import org.junit.jupiter.api.Test;
 import org.junit.jupiter.api.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest;
@@ -15,16 +19,35 @@ import org.springframework.boot.test.context.SpringBootTest;
 import javax.annotation.Resource;
 import javax.annotation.Resource;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.Date;
 import java.util.List;
 import java.util.List;
 
 
 @SpringBootTest
 @SpringBootTest
 class UserApplicationTests {
 class UserApplicationTests {
+    @Resource
+    private ToolsFeign smsFeign;
     @Resource
     @Resource
     LoginService loginService;
     LoginService loginService;
     @Test
     @Test
     void contextLoads() {
     void contextLoads() {
+
+//        //站内信
+//        MessageModel<InsideMessage> insideMessageMessageModel = new MessageModel<>();
+//        insideMessageMessageModel.code(MessageType.WEB_INSIDE_MESSAGE)
+//                .mqInfo(new MqInfo().topic("MessageLine").delay(1).async(0))
+//                .info(new InsideMessage()
+//                        .userType(3)
+//                        .messageType(3)
+//                        .shopTieredType(4)
+//                        .name("user.getUserName()")
+//                        .userName("user.getUserName()")
+//                        .mobile("164848989")
+//                        .thisId(4648)
+//                        .clubId(448)
+//                );
+//        smsFeign.sendCommonMessage(insideMessageMessageModel);
         /*List<Integer> listShopId = loginService.getMessageCenterListDay(1);
         /*List<Integer> listShopId = loginService.getMessageCenterListDay(1);
         System.out.println("-------->listShopId == "+listShopId.toString()+" <--------------");*/
         System.out.println("-------->listShopId == "+listShopId.toString()+" <--------------");*/
 //        boolean b = ValidateUtil.validateEmail("182126@qq.com");
 //        boolean b = ValidateUtil.validateEmail("182126@qq.com");