Pārlūkot izejas kodu

服务商任务

zhijiezhao 2 mēneši atpakaļ
vecāks
revīzija
abbb733970

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

@@ -15,6 +15,7 @@ import lombok.RequiredArgsConstructor;
 import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang.StringUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.bind.annotation.*;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -42,7 +43,6 @@ public class SellerApi {
             @ApiImplicitParam(name = "pageNum", required = true, value = "第几页"),
             @ApiImplicitParam(name = "pageNum", required = true, value = "第几页"),
             @ApiImplicitParam(name = "pageSize", required = true, value = "一页多少条")
             @ApiImplicitParam(name = "pageSize", required = true, value = "一页多少条")
     })
     })
-
     @GetMapping("/temporary/club")
     @GetMapping("/temporary/club")
     public ResponseJson<PageInfo<ClubTemporaryVo>> temporaryClub(Integer userId, String searchName,
     public ResponseJson<PageInfo<ClubTemporaryVo>> temporaryClub(Integer userId, String searchName,
                                                                  @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
                                                                  @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
@@ -114,7 +114,7 @@ public class SellerApi {
     @ApiOperation("机构看板")
     @ApiOperation("机构看板")
     @GetMapping("/club/livelyClub")
     @GetMapping("/club/livelyClub")
     public ResponseJson<Map<String, Object>> getLivelyClub(Integer spId) {
     public ResponseJson<Map<String, Object>> getLivelyClub(Integer spId) {
-        if (null == spId ) {
+        if (null == spId) {
             return ResponseJson.error("spId  参数不全!", null);
             return ResponseJson.error("spId  参数不全!", null);
         }
         }
         return sellerService.getLivelyClub(spId);
         return sellerService.getLivelyClub(spId);
@@ -124,33 +124,33 @@ public class SellerApi {
      * 机构活跃分析
      * 机构活跃分析
      * 原spi的 /seller/club/list
      * 原spi的 /seller/club/list
      *
      *
-     * @param spId           协销Id
-     * @param status         机构状态
-     * @param type           1.我的机构2.组员机构3.待分配机构 4 活跃机构 5 不活跃机构
-     * @param name           机构名字关键字(搜索用)
+     * @param spId   协销Id
+     * @param status 机构状态
+     * @param type   1.我的机构2.组员机构3.待分配机构 4 活跃机构 5 不活跃机构
+     * @param name   机构名字关键字(搜索用)
      */
      */
     @ApiOperation("机构活跃分析列表")
     @ApiOperation("机构活跃分析列表")
     @GetMapping("/club/livelyClubList")
     @GetMapping("/club/livelyClubList")
     public ResponseJson<PaginationVo<ClubVo>> getLivelyClubList(Integer spId,
     public ResponseJson<PaginationVo<ClubVo>> getLivelyClubList(Integer spId,
-                                                                         Integer status,
-                                                                         Integer type,
-                                                                         String name,
-                                                                         Integer userIdentity,
-                                                                         @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                                         @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+                                                                Integer status,
+                                                                Integer type,
+                                                                String name,
+                                                                Integer userIdentity,
+                                                                @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
         if (null == spId || null == type) {
         if (null == spId || null == type) {
             return ResponseJson.error("spId 或 type 参数不全!", null);
             return ResponseJson.error("spId 或 type 参数不全!", null);
         }
         }
-        if (4 != type && 5 != type ) {
+        if (4 != type && 5 != type) {
             return ResponseJson.error("type 参数错误!", null);
             return ResponseJson.error("type 参数错误!", null);
         }
         }
-
         return sellerService.getLivelyClubList(spId, status, type, name, userIdentity, pageNum, pageSize);
         return sellerService.getLivelyClubList(spId, status, type, name, userIdentity, pageNum, pageSize);
     }
     }
 
 
 
 
     /**
     /**
      * 获取相关咨询记录机构信息
      * 获取相关咨询记录机构信息
+     *
      * @param spId
      * @param spId
      * @param type
      * @param type
      * @param pageNum
      * @param pageNum
@@ -172,6 +172,7 @@ public class SellerApi {
 
 
     /**
     /**
      * 机构所有咨询记录
      * 机构所有咨询记录
+     *
      * @param clubId
      * @param clubId
      * @param pageNum
      * @param pageNum
      * @param pageSize
      * @param pageSize
@@ -257,6 +258,7 @@ public class SellerApi {
 
 
     /**
     /**
      * 机构重点访问页面
      * 机构重点访问页面
+     *
      * @param clubId
      * @param clubId
      * @return
      * @return
      */
      */
@@ -264,8 +266,8 @@ public class SellerApi {
     @ApiImplicitParam(required = true, name = "clubId", value = "机构Id")
     @ApiImplicitParam(required = true, name = "clubId", value = "机构Id")
     @GetMapping("/getClubKeynoteRecord")
     @GetMapping("/getClubKeynoteRecord")
     public ResponseJson<PageInfo<RetuenDataVo>> getClubKeynoteRecord(Integer clubId,
     public ResponseJson<PageInfo<RetuenDataVo>> getClubKeynoteRecord(Integer clubId,
-                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
-                                                              @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+                                                                     @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                                     @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
 
 
         if (null == clubId) {
         if (null == clubId) {
             return ResponseJson.error(-1, "机构id不能为空", null);
             return ResponseJson.error(-1, "机构id不能为空", null);
@@ -275,6 +277,7 @@ public class SellerApi {
 
 
     /**
     /**
      * 协销不活跃机构
      * 协销不活跃机构
+     *
      * @param serviceProviderId
      * @param serviceProviderId
      * @param pageNum
      * @param pageNum
      * @param pageSize
      * @param pageSize
@@ -292,4 +295,44 @@ public class SellerApi {
         return sellerService.getUnActiveClubList(serviceProviderId, pageNum, pageSize);
         return sellerService.getUnActiveClubList(serviceProviderId, pageNum, pageSize);
     }
     }
 
 
+
+    @ApiOperation("服务商任务列表")
+    @ApiImplicitParam(required = true, name = "serviceProviderId", value = "协销Id")
+    @GetMapping("/taskList")
+    public ResponseJson<PageInfo<ProviderTaskVo>> getTaskList(Integer serviceProviderId,
+                                                              @RequestParam(value = "pageNum", defaultValue = "1") int pageNum,
+                                                              @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) {
+
+        if (null == serviceProviderId) {
+            return ResponseJson.error(-1, "协销Id不能为空", null);
+        }
+        return sellerService.getTaskList(serviceProviderId, pageNum, pageSize);
+    }
+
+    @ApiOperation("服务商任务详情")
+    @ApiImplicitParams({
+            @ApiImplicitParam(name = "userId", required = false, value = "userId"),
+            @ApiImplicitParam(name = "serviceProviderId", required = true, value = "分享协销Id"),
+            @ApiImplicitParam(name = "taskId", required = true, value = "任务Id")
+    })
+    @GetMapping("/taskDetail")
+    public ResponseJson<ProviderTaskVo> getTaskDetail(HttpServletRequest request, Integer taskId, Integer serviceProviderId, Integer userId) {
+        if (null == taskId) {
+            return ResponseJson.error(-1, "Id不能为空", null);
+        }
+        return sellerService.getTaskDetail(request,taskId, serviceProviderId, userId);
+    }
+
+    @ApiOperation("领取任务")
+    @ApiImplicitParams({
+            @ApiImplicitParam(required = true, name = "serviceProviderId", value = "协销Id"),
+            @ApiImplicitParam(required = true, name = "taskId", value = "任务Id")
+    })
+    @GetMapping("/receiveTask")
+    public ResponseJson receiveTask(Integer serviceProviderId, Integer taskId) {
+        if (null == serviceProviderId || null == taskId) {
+            return ResponseJson.error(-1, "参数有误", null);
+        }
+        return sellerService.receiveTask(serviceProviderId, taskId);
+    }
 }
 }

+ 7 - 0
src/main/java/com/caimei365/user/mapper/SellerMapper.java

@@ -177,4 +177,11 @@ public interface SellerMapper {
      */
      */
     List<ClubVo> getUnActiveClub(@Param("serviceProviderId") Integer serviceProviderId);
     List<ClubVo> getUnActiveClub(@Param("serviceProviderId") Integer serviceProviderId);
 
 
+    List<ProviderTaskVo> getTaskList(Integer serviceProviderId);
+
+    void receiveTask(@Param("serviceProviderId") Integer serviceProviderId, @Param("taskId") Integer taskId);
+
+    ProviderTaskVo getTaskDetail(Integer taskId);
+
+    void insertClick(@Param("serviceProviderId") Integer serviceProviderId, @Param("userId") Integer userId, @Param("taskId") Integer taskId, @Param("ip") String ip);
 }
 }

+ 67 - 0
src/main/java/com/caimei365/user/model/vo/ProviderTaskVo.java

@@ -0,0 +1,67 @@
+package com.caimei365.user.model.vo;
+
+import com.fasterxml.jackson.annotation.JsonFormat;
+import lombok.Data;
+import lombok.experimental.Accessors;
+
+import java.util.Date;
+
+@Accessors(chain = true)
+@Data
+public class ProviderTaskVo {
+
+    private Integer taskId;
+    /**
+     * 任务领取标记 0未领取 1已领取
+     */
+    private Integer receiveFlag;
+    /**
+     * 任务提交审核状态 0未审核 1审核通过 2审核不通过
+     */
+    private Integer auditStatus;
+    /**
+     * 任务商品Id
+     */
+    private Integer productId;
+    /**
+     * 赏金
+     */
+    private String reward;
+    /**
+     * 富文本内容
+     */
+    private String content;
+    /**
+     * 供应商Id
+     */
+    private Integer shopId;
+    /**
+     * 标题
+     */
+    private String title;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date addTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date startTime;
+
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date endTime;
+
+    /**
+     * 领取时间
+     */
+    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
+    private Date receiveTime;
+
+    private String shopName;
+    /**
+     * 转发封面
+     */
+    private String topPic;
+    /**
+     * 任务状态 1未开始 2任务中 3任务过期
+     */
+    private Integer status;
+}

+ 29 - 10
src/main/java/com/caimei365/user/service/SellerService.java

@@ -7,6 +7,7 @@ import com.caimei365.user.model.po.ServiceProviderPo;
 import com.caimei365.user.model.vo.*;
 import com.caimei365.user.model.vo.*;
 import com.github.pagehelper.PageInfo;
 import com.github.pagehelper.PageInfo;
 
 
+import javax.servlet.http.HttpServletRequest;
 import java.util.List;
 import java.util.List;
 import java.util.Map;
 import java.util.Map;
 
 
@@ -30,8 +31,7 @@ public interface SellerService {
 
 
     /**
     /**
      * 功能描述: 机构活跃分析
      * 功能描述: 机构活跃分析
-     * @auther: Kaick
-     * @date: 2023/8/30 16:54
+     *
      * @param serviceProviderId
      * @param serviceProviderId
      * @param status
      * @param status
      * @param type
      * @param type
@@ -40,11 +40,14 @@ public interface SellerService {
      * @param pageNum
      * @param pageNum
      * @param pageSize
      * @param pageSize
      * @return [serviceProviderId, status, type, name, userIdentity, pageNum, pageSize]
      * @return [serviceProviderId, status, type, name, userIdentity, pageNum, pageSize]
+     * @auther: Kaick
+     * @date: 2023/8/30 16:54
      */
      */
     ResponseJson<PaginationVo<ClubVo>> getLivelyClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer pageNum, Integer pageSize);
     ResponseJson<PaginationVo<ClubVo>> getLivelyClubList(Integer serviceProviderId, Integer status, Integer type, String name, Integer userIdentity, Integer pageNum, Integer pageSize);
 
 
     /**
     /**
      * 获取相关咨询记录机构信息
      * 获取相关咨询记录机构信息
+     *
      * @param spId
      * @param spId
      * @param type
      * @param type
      * @param pageNum
      * @param pageNum
@@ -55,19 +58,23 @@ public interface SellerService {
 
 
     /**
     /**
      * 机构所有的咨询记录
      * 机构所有的咨询记录
+     *
      * @param clubId
      * @param clubId
      * @return
      * @return
      */
      */
     ResponseJson<PaginationVo<RemarksVo>> getClubAllRemark(Integer clubId, String search, Integer pageNum, Integer pageSize);
     ResponseJson<PaginationVo<RemarksVo>> getClubAllRemark(Integer clubId, String search, Integer pageNum, Integer pageSize);
+
     /**
     /**
      * 功能描述: 机构活跃分析比例
      * 功能描述: 机构活跃分析比例
-     * @auther: Kaick
-     * @date: 2023/9/4 9:48
+     *
      * @param
      * @param
      * @return []
      * @return []
+     * @auther: Kaick
+     * @date: 2023/9/4 9:48
      */
      */
 
 
     ResponseJson<Map<String, Object>> getLivelyClub(Integer serviceProviderId);
     ResponseJson<Map<String, Object>> getLivelyClub(Integer serviceProviderId);
+
     /**
     /**
      * 协销登录(手机号,密码)
      * 协销登录(手机号,密码)
      *
      *
@@ -76,14 +83,16 @@ public interface SellerService {
      * @param unionId  微信unionId
      * @param unionId  微信unionId
      * @return UserLoginVo
      * @return UserLoginVo
      */
      */
-    ResponseJson<UserLoginVo> passwordLogin(String mobile, String password, String unionId,Integer isUnion);
+    ResponseJson<UserLoginVo> passwordLogin(String mobile, String password, String unionId, Integer isUnion);
 
 
     /**
     /**
      * 采购员验证码登录 --组织
      * 采购员验证码登录 --组织
+     *
      * @param loginCodeDto
      * @param loginCodeDto
      * @return
      * @return
      */
      */
     ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto);
     ResponseJson<UserLoginVo> organizeCodeLogin(LoginCodeDto loginCodeDto);
+
     /**
     /**
      * 待注册机构列表
      * 待注册机构列表
      *
      *
@@ -124,23 +133,27 @@ public interface SellerService {
      * @param userId 协销用户id
      * @param userId 协销用户id
      */
      */
     ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
     ResponseJson<ServiceProviderPo> getSellerHome(Integer userId);
+
     /**
     /**
      * 功能描述: 更新协销信息
      * 功能描述: 更新协销信息
-     * @auther: Kaick
-     * @date: 2023/9/4 10:02
+     *
      * @param serviceProviderPo
      * @param serviceProviderPo
      * @return [serviceProviderPo]
      * @return [serviceProviderPo]
+     * @auther: Kaick
+     * @date: 2023/9/4 10:02
      */
      */
 
 
     ResponseJson setSellerHome(ServiceProviderPo serviceProviderPo);
     ResponseJson setSellerHome(ServiceProviderPo serviceProviderPo);
 
 
-    ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer type,Integer spId,String accessTime);
-    ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer type,Integer spId, Integer clubId, String accessTime);
+    ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClub(Integer type, Integer spId, String accessTime);
+
+    ResponseJson<List<CmBehaviorRecordVo>> getBehaviorRecordClubFrom(Integer type, Integer spId, Integer clubId, String accessTime);
 
 
-    ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId,Integer status);
+    ResponseJson<List<ServiceProviderVo>> getServiceTeam(Integer spId, Integer status);
 
 
     /**
     /**
      * 机构重点访问页面
      * 机构重点访问页面
+     *
      * @param clubId
      * @param clubId
      * @return
      * @return
      */
      */
@@ -148,6 +161,7 @@ public interface SellerService {
 
 
     /**
     /**
      * 协销不活跃机构列表
      * 协销不活跃机构列表
+     *
      * @param serviceProviderId
      * @param serviceProviderId
      * @param pageNum
      * @param pageNum
      * @param pageSize
      * @param pageSize
@@ -155,4 +169,9 @@ public interface SellerService {
      */
      */
     ResponseJson<PageInfo<ClubVo>> getUnActiveClubList(Integer serviceProviderId, int pageNum, int pageSize);
     ResponseJson<PageInfo<ClubVo>> getUnActiveClubList(Integer serviceProviderId, int pageNum, int pageSize);
 
 
+    ResponseJson<PageInfo<ProviderTaskVo>> getTaskList(Integer serviceProviderId, int pageNum, int pageSize);
+
+    ResponseJson receiveTask(Integer serviceProviderId, Integer taskId);
+
+    ResponseJson<ProviderTaskVo> getTaskDetail(HttpServletRequest request, Integer taskId, Integer serviceProviderId, Integer userId);
 }
 }

+ 27 - 0
src/main/java/com/caimei365/user/service/impl/AsyncService.java

@@ -6,10 +6,12 @@ import com.caimei365.user.model.po.UserBeansHistoryPo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.ClubVo;
 import com.caimei365.user.model.vo.UserVo;
 import com.caimei365.user.model.vo.UserVo;
 import lombok.extern.slf4j.Slf4j;
 import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringUtils;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.scheduling.annotation.Async;
 import org.springframework.stereotype.Component;
 import org.springframework.stereotype.Component;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.Date;
 
 
@@ -37,6 +39,30 @@ public class AsyncService {
     private BaseMapper baseMapper;
     private BaseMapper baseMapper;
     @Resource
     @Resource
     private WeChatService weChatService;
     private WeChatService weChatService;
+    @Resource
+    private SellerMapper sellerMapper;
+
+    @Async("taskExecutor")
+    public void serviceTask(HttpServletRequest request, Integer serviceProviderId, Integer userId, Integer taskId) {
+        String ip = "";
+        String unknown = "unknown";
+        ip = request.getHeader("x-forwarded-for");
+        if (StringUtils.isBlank(ip)) {
+            ip = request.getHeader("X-Real-IP");
+        }
+        if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("Proxy-Client-IP");
+        }
+
+        if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
+            ip = request.getHeader("WL-Proxy-Client-IP");
+        }
+
+        if (ip == null || ip.length() == 0 || unknown.equalsIgnoreCase(ip)) {
+            ip = request.getRemoteAddr();
+        }
+        sellerMapper.insertClick(serviceProviderId, userId, taskId, ip);
+    }
 
 
     @Async("taskExecutor")
     @Async("taskExecutor")
     public void loginUpdateBeans(Integer userId, Integer identity) {
     public void loginUpdateBeans(Integer userId, Integer identity) {
@@ -111,6 +137,7 @@ public class AsyncService {
             weChatService.sendChoseServiceMessage(title, keyWord1, keyWord2, keyWord3, keyWord4, remark, path, openId, templateId);
             weChatService.sendChoseServiceMessage(title, keyWord1, keyWord2, keyWord3, keyWord4, remark, path, openId, templateId);
         }
         }
     }
     }
+
     @Async("taskExecutor")
     @Async("taskExecutor")
     public void updateTourist(Integer userId, String touristId) {
     public void updateTourist(Integer userId, String touristId) {
         loginMapper.updateTourist(userId, touristId);
         loginMapper.updateTourist(userId, touristId);

+ 25 - 0
src/main/java/com/caimei365/user/service/impl/SellerServiceImpl.java

@@ -21,8 +21,10 @@ import org.apache.commons.lang.StringUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.apache.commons.lang3.ObjectUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import javax.servlet.http.HttpServletRequest;
 import java.text.ParseException;
 import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.text.SimpleDateFormat;
 import java.util.*;
 import java.util.*;
@@ -57,6 +59,8 @@ public class SellerServiceImpl implements SellerService {
     private LoginMapper loginMapper;
     private LoginMapper loginMapper;
     @Resource
     @Resource
     private ClubMapper clubMapper;
     private ClubMapper clubMapper;
+    @Resource
+    private AsyncService asyncService;
 
 
     /**
     /**
      * 协销机构列表
      * 协销机构列表
@@ -676,6 +680,27 @@ public class SellerServiceImpl implements SellerService {
         return ResponseJson.success(page);
         return ResponseJson.success(page);
     }
     }
 
 
+    @Override
+    public ResponseJson<PageInfo<ProviderTaskVo>> getTaskList(Integer serviceProviderId, int pageNum, int pageSize) {
+        PageHelper.startPage(pageNum, pageSize);
+        List<ProviderTaskVo> tasks = sellerMapper.getTaskList(serviceProviderId);
+        PageInfo<ProviderTaskVo> page = new PageInfo<>(tasks);
+        return ResponseJson.success(page);
+    }
+
+    @Transactional(rollbackFor = Exception.class)
+    @Override
+    public ResponseJson receiveTask(Integer serviceProviderId, Integer taskId) {
+        sellerMapper.receiveTask(serviceProviderId, taskId);
+        return ResponseJson.success();
+    }
+
+    @Override
+    public ResponseJson<ProviderTaskVo> getTaskDetail(HttpServletRequest request, Integer taskId, Integer serviceProviderId, Integer userId) {
+        asyncService.serviceTask(request, serviceProviderId, taskId, userId);
+        return ResponseJson.success(sellerMapper.getTaskDetail(taskId));
+    }
+
     /**
     /**
      * 机构编号
      * 机构编号
      *
      *

+ 1 - 1
src/main/resources/mapper/LoginMapper.xml

@@ -184,7 +184,7 @@
                  left join user u on s.userID = u.userID
                  left join user u on s.userID = u.userID
         where s.openid = #{openId}
         where s.openid = #{openId}
           and s.organizeId = #{organizeId}
           and s.organizeId = #{organizeId}
-          and u.validFlag = 1
+          and s.status = 90
         limit 1
         limit 1
     </select>
     </select>
     <update id="updateUserInfo">
     <update id="updateUserInfo">

+ 303 - 227
src/main/resources/mapper/SellerMapper.xml

@@ -1,20 +1,25 @@
 <?xml version="1.0" encoding="UTF-8" ?>
 <?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">
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
 <mapper namespace="com.caimei365.user.mapper.SellerMapper">
 <mapper namespace="com.caimei365.user.mapper.SellerMapper">
+    <insert id="insertClick">
+        insert into provider_task_click(serviceProviderId, taskId, clickTime, userId, ip)
+            value (#{serviceProviderId}, #{taskId}, now(), #{userId}, #{ip})
+    </insert>
+
     <select id="getLoginSellerByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
     <select id="getLoginSellerByMobile" resultType="com.caimei365.user.model.vo.UserLoginVo">
-        select u.userID         as userId,
-               u.clubID         as clubId,
-               u.shopID         as shopId,
-               u.userName       as userName,
-               u.name           as name,
-               u.mobile         as mobile,
-               u.bindMobile     as bindMobile,
-               u.email          as email,
-               u.guideFlag      as guideFlag,
-               u.userIdentity   as userIdentity,
-               u.serviceProviderID as serviceProviderId,
+        select u.userID                as userId,
+               u.clubID                as clubId,
+               u.shopID                as shopId,
+               u.userName              as userName,
+               u.name                  as name,
+               u.mobile                as mobile,
+               u.bindMobile            as bindMobile,
+               u.email                 as email,
+               u.guideFlag             as guideFlag,
+               u.userIdentity          as userIdentity,
+               u.serviceProviderID     as serviceProviderId,
                u.serviceProviderStatus as serviceStatus,
                u.serviceProviderStatus as serviceStatus,
-               u.password       as password
+               u.password              as password
         from user u
         from user u
         where u.mobile = #{mobile}
         where u.mobile = #{mobile}
           and u.userIdentity = 1
           and u.userIdentity = 1
@@ -32,7 +37,7 @@
         </trim>
         </trim>
         where userID = #{userId}
         where userID = #{userId}
     </update>
     </update>
-    <update id="setSellerUserHome" >
+    <update id="setSellerUserHome">
         update user
         update user
         <trim prefix="SET" suffixOverrides=",">
         <trim prefix="SET" suffixOverrides=",">
             <if test="image != null and image != ''">image = #{image},</if>
             <if test="image != null and image != ''">image = #{image},</if>
@@ -97,6 +102,14 @@
         WHERE `id` = #{id}
         WHERE `id` = #{id}
     </update>
     </update>
 
 
+    <update id="receiveTask">
+        update provider_task_role
+        set receiveFlag = 1,
+            receiveTime = now()
+        where serviceProviderId = #{serviceProviderId}
+          and taskId = #{taskId}
+    </update>
+
     <delete id="deleteTemporaryClub">
     <delete id="deleteTemporaryClub">
         DELETE
         DELETE
         FROM `club_temporary`
         FROM `club_temporary`
@@ -117,7 +130,7 @@
     </select>
     </select>
 
 
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
     <select id="findClubs" resultType="com.caimei365.user.model.vo.ClubVo">
-        select  c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
+        select c.clubID as clubId, c.userID as userId, c.name, c.sname as shortName, c.contractMobile,
         c.contractEmail as contractEmail,
         c.contractEmail as contractEmail,
         c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
         c.contractPhone, c.linkMan, c.provinceID as proviceId, c.cityID as cityId, c.townID as townId,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
         c.address, c.headpic as shopPhoto, c.businessLicenseImage as businessLicense, c.socialCreditCode,
@@ -132,11 +145,14 @@
         from club c
         from club c
         left join user u on c.userID = u.userID
         left join user u on c.userID = u.userID
         LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
         LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
-        LEFT JOIN (SELECT userId, activeStatus, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON coas.userId = c.userId
-        LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON covs.userID = c.userID
+        LEFT JOIN (SELECT userId, activeStatus, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1)
+        coas ON coas.userId = c.userId
+        LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON
+        covs.userID = c.userID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         LEFT JOIN cm_provider_record cpr ON cpr.spID = sp.serviceProviderID and cpr.clubId = c.clubId
         LEFT JOIN cm_provider_record cpr ON cpr.spID = sp.serviceProviderID and cpr.clubId = c.clubId
-        LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = c.clubId
+        LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER
+        BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = c.clubId
         where
         where
         <if test="1 == type">
         <if test="1 == type">
             c.spID = #{serviceProviderId}
             c.spID = #{serviceProviderId}
@@ -164,18 +180,19 @@
             AND c.newDeal =1
             AND c.newDeal =1
         </if>
         </if>
         <if test="name != null and name != ''">
         <if test="name != null and name != ''">
-            AND (c.name LIKE CONCAT('%',#{name},'%') OR c.linkMan LIKE CONCAT('%',#{name},'%') OR c.contractMobile LIKE CONCAT('%',#{name},'%'))
+            AND (c.name LIKE CONCAT('%',#{name},'%') OR c.linkMan LIKE CONCAT('%',#{name},'%') OR c.contractMobile LIKE
+            CONCAT('%',#{name},'%'))
         </if>
         </if>
         <if test="userIdentity != null">
         <if test="userIdentity != null">
             AND u.userIdentity = #{userIdentity}
             AND u.userIdentity = #{userIdentity}
         </if>
         </if>
         <if test="startTime != null and startTime != ''">
         <if test="startTime != null and startTime != ''">
             AND (ccs.checkTime <![CDATA[ >= ]]> #{startTime}
             AND (ccs.checkTime <![CDATA[ >= ]]> #{startTime}
-                OR cpr.createTime <![CDATA[ >= ]]> #{startTime})
+            OR cpr.createTime <![CDATA[ >= ]]> #{startTime})
         </if>
         </if>
         <if test="endTime != null and endTime != ''">
         <if test="endTime != null and endTime != ''">
             AND (ccs.checkTime <![CDATA[ <= ]]> #{endTime}
             AND (ccs.checkTime <![CDATA[ <= ]]> #{endTime}
-                OR cpr.createTime <![CDATA[ <= ]]> #{endTime})
+            OR cpr.createTime <![CDATA[ <= ]]> #{endTime})
         </if>
         </if>
         <if test="activeState != null and activeState != ''">
         <if test="activeState != null and activeState != ''">
             AND coas.activeState like concat('%', #{userIdentity}, '%')
             AND coas.activeState like concat('%', #{userIdentity}, '%')
@@ -217,29 +234,32 @@
         covs.customerValue AS customerValue,
         covs.customerValue AS customerValue,
         b.num,
         b.num,
         (
         (
-            SELECT ADDTIME FROM
-            (
-                SELECT
-                ADDTIME
-                FROM cm_club_remarks
-                WHERE  clubId = c.clubId
-                UNION
-                SELECT
-                ADDTIME
-                FROM cm_visitor_remarks
-                WHERE
-                clubId IS NOT NULL AND clubId != ''
-                AND clubId = c.clubId
-            ) b ORDER BY ADDTIME DESC LIMIT 1
+        SELECT ADDTIME FROM
+        (
+        SELECT
+        ADDTIME
+        FROM cm_club_remarks
+        WHERE clubId = c.clubId
+        UNION
+        SELECT
+        ADDTIME
+        FROM cm_visitor_remarks
+        WHERE
+        clubId IS NOT NULL AND clubId != ''
+        AND clubId = c.clubId
+        ) b ORDER BY ADDTIME DESC LIMIT 1
         ) AS ADDTIME
         ) AS ADDTIME
         FROM club c
         FROM club c
         LEFT JOIN USER u ON c.userID = u.userID
         LEFT JOIN USER u ON c.userID = u.userID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
-        LEFT JOIN (SELECT userId, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON coas.userId = c.userId
-        LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON covs.userID = c.userID
-        LEFT JOIN (SELECT clubId, COUNT(id) AS num  FROM cm_club_remarks GROUP BY clubId
-                UNION
-                SELECT clubId, COUNT(id) AS num FROM cm_visitor_remarks WHERE clubId IS NOT NULL AND clubId != '' GROUP BY clubId ) AS b  ON c.clubId = b.clubId
+        LEFT JOIN (SELECT userId, activeState FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) coas ON
+        coas.userId = c.userId
+        LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON
+        covs.userID = c.userID
+        LEFT JOIN (SELECT clubId, COUNT(id) AS num FROM cm_club_remarks GROUP BY clubId
+        UNION
+        SELECT clubId, COUNT(id) AS num FROM cm_visitor_remarks WHERE clubId IS NOT NULL AND clubId != '' GROUP BY
+        clubId ) AS b ON c.clubId = b.clubId
         where c.spId = #{spId}
         where c.spId = #{spId}
         <if test="type != null">
         <if test="type != null">
             <if test="type == 1">
             <if test="type == 1">
@@ -255,130 +275,128 @@
         select * from
         select * from
         (
         (
         SELECT DISTINCT ccr.id AS remarksId,
         SELECT DISTINCT ccr.id AS remarksId,
-                ccr.remarks,
-                ccr.addTime,
-                ccr.questionMan,
-                ccr.serviceProviderId AS serviceProviderId,
-                ccr.createServiceProviderId AS createServiceProviderId,
-                csr.leaderId AS leaderId,
-                IFNULL(ccr.consultType,'') AS consult,
-                c.Name AS clubName,
-                ccr.clubType AS clubType,
-                ccr.pinceSensitve AS pinceSensitve,
-                ccr.satisfied AS satisfied,
-                ccr.followup AS followup,
-                ccr.extra AS extra,
-                ccr.communicationSituation,
-                ccr.communicationMethods,
-                ccr.customerSource,
-                ccr.customerGender,
-                ccr.groupAddition,
-                ccr.customerAge,
-                ifnull(ccr.trendsKeyword, "") as trendsKeyword,
-                ifnull(ccr.stateKeyword, "") as stateKeyword,
-                (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
-                (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) AS recordName,
-                cmc.status AS STATUS
+        ccr.remarks,
+        ccr.addTime,
+        ccr.questionMan,
+        ccr.serviceProviderId AS serviceProviderId,
+        ccr.createServiceProviderId AS createServiceProviderId,
+        csr.leaderId AS leaderId,
+        IFNULL(ccr.consultType,'') AS consult,
+        c.Name AS clubName,
+        ccr.clubType AS clubType,
+        ccr.pinceSensitve AS pinceSensitve,
+        ccr.satisfied AS satisfied,
+        ccr.followup AS followup,
+        ccr.extra AS extra,
+        ccr.communicationSituation,
+        ccr.communicationMethods,
+        ccr.customerSource,
+        ccr.customerGender,
+        ccr.groupAddition,
+        ccr.customerAge,
+        ifnull(ccr.trendsKeyword, "") as trendsKeyword,
+        ifnull(ccr.stateKeyword, "") as stateKeyword,
+        (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID= csr.leaderId) AS leaderName,
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.createServiceProviderId) AS recordName,
+        cmc.status AS STATUS
         FROM cm_club_remarks ccr
         FROM cm_club_remarks ccr
-                 LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
-                 LEFT JOIN club c ON c.clubId=ccr.clubId
-                 LEFT JOIN cm_serviceTeam_group csg ON ccr.createServiceProviderId = csg.serviceId
-                 LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
-                 LEFT JOIN cm_club_report cmc ON cmc.clubId = ccr.clubId
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN club c ON c.clubId=ccr.clubId
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.createServiceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.clubId = ccr.clubId
         <where>
         <where>
             ccr.clubId = #{clubId}
             ccr.clubId = #{clubId}
             <if test="search != null and search != ''">
             <if test="search != null and search != ''">
                 and (
                 and (
-                    ccr.remarks like concat('%',#{search},'%')
-                     or ccr.questionMan like concat('%',#{search},'%')
-                     or c.name like concat('%',#{search},'%')
-                     or c.contractMobile like concat('%',#{search},'%')
+                ccr.remarks like concat('%',#{search},'%')
+                or ccr.questionMan like concat('%',#{search},'%')
+                or c.name like concat('%',#{search},'%')
+                or c.contractMobile like concat('%',#{search},'%')
                 )
                 )
             </if>
             </if>
         </where>
         </where>
         UNION
         UNION
         SELECT DISTINCT ccr.id AS remarksId,
         SELECT DISTINCT ccr.id AS remarksId,
-                ccr.remarks,
-                ccr.addTime AS ADDDATE,
-                ccr.questionMan,
-                ccr.serviceProviderId,
-                ccr.createServiceProviderId AS createServiceProviderId,
-                csr.leaderId AS leaderId,
-                IFNULL(ccr.consultType,'') AS consult,
-                c.Name AS clubName,
-                ccr.clubType AS clubType,
-                ccr.pinceSensitve AS pinceSensitve,
-                ccr.satisfied AS satisfied,
-                ccr.followup AS followup,
-                ccr.extra AS extra,
-                ccr.communicationSituation,
-                ccr.communicationMethods,
-                ccr.customerSource,
-                ccr.customerGender,
-                ccr.groupAddition,
-                ccr.customerAge,
-                ifnull(ccr.trendsKeyword, "") as trendsKeyword,
-                ifnull(ccr.stateKeyword, "") as stateKeyword,
-                (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
-                (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
-                cmc.status AS STATUS
+        ccr.remarks,
+        ccr.addTime AS ADDDATE,
+        ccr.questionMan,
+        ccr.serviceProviderId,
+        ccr.createServiceProviderId AS createServiceProviderId,
+        csr.leaderId AS leaderId,
+        IFNULL(ccr.consultType,'') AS consult,
+        c.Name AS clubName,
+        ccr.clubType AS clubType,
+        ccr.pinceSensitve AS pinceSensitve,
+        ccr.satisfied AS satisfied,
+        ccr.followup AS followup,
+        ccr.extra AS extra,
+        ccr.communicationSituation,
+        ccr.communicationMethods,
+        ccr.customerSource,
+        ccr.customerGender,
+        ccr.groupAddition,
+        ccr.customerAge,
+        ifnull(ccr.trendsKeyword, "") as trendsKeyword,
+        ifnull(ccr.stateKeyword, "") as stateKeyword,
+        (SELECT NAME FROM serviceprovider s WHERE s.serviceProviderID = csr.leaderId) AS leaderName,
+        (SELECT linkMan FROM serviceprovider s WHERE s.serviceProviderID = ccr.serviceProviderId) AS recordName,
+        cmc.status AS STATUS
         FROM cm_visitor_remarks ccr
         FROM cm_visitor_remarks ccr
-                 LEFT JOIN club c ON c.clubId=ccr.clubId
-                 LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
-                 LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
-                 LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
-                 LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
+        LEFT JOIN club c ON c.clubId=ccr.clubId
+        LEFT JOIN serviceprovider s ON ccr.serviceProviderId = s.serviceProviderID
+        LEFT JOIN cm_serviceTeam_group csg ON ccr.serviceProviderId = csg.serviceId
+        LEFT JOIN cm_serviceTeam_role csr ON csr.id = csg.teamId
+        LEFT JOIN cm_club_report cmc ON cmc.Id = ccr.reportID
         <where>
         <where>
             ccr.remarks IS NOT NULL
             ccr.remarks IS NOT NULL
             AND ccr.clubId is NOT null AND ccr.clubId != '' AND ccr.clubId = #{clubId}
             AND ccr.clubId is NOT null AND ccr.clubId != '' AND ccr.clubId = #{clubId}
             <if test="search != null and search != ''">
             <if test="search != null and search != ''">
                 and (
                 and (
-                    ccr.remarks like concat('%',#{search},'%')
-                    or ccr.questionMan like concat('%',#{search},'%')
-                    or c.name like concat('%',#{search},'%')
-                    or c.contractMobile like concat('%',#{search},'%')
+                ccr.remarks like concat('%',#{search},'%')
+                or ccr.questionMan like concat('%',#{search},'%')
+                or c.name like concat('%',#{search},'%')
+                or c.contractMobile like concat('%',#{search},'%')
                 )
                 )
             </if>
             </if>
         </where>
         </where>
-            ) b
+        ) b
         ORDER BY b.addTime DESC
         ORDER BY b.addTime DESC
     </select>
     </select>
 
 
 
 
     <select id="findSpUserLoginSum" resultType="java.util.HashMap">
     <select id="findSpUserLoginSum" resultType="java.util.HashMap">
-        SELECT
-            (CASE coas.activeStatus
-                 WHEN 0 THEN 'active'
-                 WHEN 1 THEN 'unActive'
-                END) AS activeStatus,
-            COUNT(coas.activeStatus) AS number
+        SELECT (CASE coas.activeStatus
+                    WHEN 0 THEN 'active'
+                    WHEN 1 THEN 'unActive'
+            END)                        AS activeStatus,
+               COUNT(coas.activeStatus) AS number
         FROM cm_organ_active_system coas
         FROM cm_organ_active_system coas
                  LEFT JOIN club c ON coas.userId = c.userId
                  LEFT JOIN club c ON coas.userId = c.userId
                  LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId
                  LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId
-        WHERE  s.serviceProviderId = #{spId} AND coas.stage = 0 AND delType = 1
+        WHERE s.serviceProviderId = #{spId}
+          AND coas.stage = 0
+          AND delType = 1
         GROUP BY coas.activeStatus
         GROUP BY coas.activeStatus
     </select>
     </select>
 
 
     <select id="getRemarkClub" resultType="java.util.Map">
     <select id="getRemarkClub" resultType="java.util.Map">
-        SELECT
-            COUNT(clubId) AS isHaveClub,
-            (SELECT COUNT(clubId) FROM club c LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId WHERE s.serviceProviderId = #{spId})AS allclub
-        FROM
-            (
-                SELECT
-                    clubid AS clubID
-                FROM cm_club_remarks
-                WHERE  createServiceProviderId = #{spId}
-                GROUP BY clubId
-                UNION
-                SELECT
-                    clubId AS clubID
-                FROM cm_visitor_remarks
-                WHERE
-                    clubId IS NOT NULL AND clubId != ''
-                  AND createServiceProviderId = #{spId}
-                GROUP BY clubId
-            ) b
+        SELECT COUNT(clubId)                         AS isHaveClub,
+               (SELECT COUNT(clubId)
+                FROM club c
+                         LEFT JOIN serviceprovider s ON s.serviceProviderId = c.spId
+                WHERE s.serviceProviderId = #{spId}) AS allclub
+        FROM (SELECT clubid AS clubID
+              FROM cm_club_remarks
+              WHERE createServiceProviderId = #{spId}
+              GROUP BY clubId
+              UNION
+              SELECT clubId AS clubID
+              FROM cm_visitor_remarks
+              WHERE clubId IS NOT NULL
+                AND clubId != ''
+                AND createServiceProviderId = #{spId}
+              GROUP BY clubId) b
     </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,
@@ -401,9 +419,9 @@
         </if>
         </if>
     </select>
     </select>
     <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
     <select id="getSellerByUserId" resultType="com.caimei365.user.model.po.ServiceProviderPo">
-        select s.serviceProviderID     AS serviceProviderId,
+        select s.serviceProviderID AS serviceProviderId,
                s.status,
                s.status,
-               s.userID                AS userId,
+               s.userID            AS userId,
                s.openid,
                s.openid,
                s.unionId,
                s.unionId,
                s.name,
                s.name,
@@ -415,7 +433,7 @@
                s.qrCode,
                s.qrCode,
                u.image
                u.image
         from serviceprovider s
         from serviceprovider s
-        LEFT JOIN USER u ON s.userId = u.userId
+                 LEFT JOIN USER u ON s.userId = u.userId
         where s.userID = #{userId}
         where s.userID = #{userId}
     </select>
     </select>
     <select id="findManager" resultType="java.lang.Integer">
     <select id="findManager" resultType="java.lang.Integer">
@@ -435,7 +453,7 @@
     <select id="findLeaderId" resultType="java.lang.Integer">
     <select id="findLeaderId" resultType="java.lang.Integer">
         SELECT csr.leaderId
         SELECT csr.leaderId
         FROM cm_serviceteam_role csr
         FROM cm_serviceteam_role csr
-        LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
+                 LEFT JOIN serviceprovider s ON s.serviceProviderId = csr.leaderId
         WHERE s.userId = #{userId}
         WHERE s.userId = #{userId}
     </select>
     </select>
     <select id="findLeaderIdByServiceId" resultType="java.lang.Integer">
     <select id="findLeaderIdByServiceId" resultType="java.lang.Integer">
@@ -461,7 +479,7 @@
         WHERE csg.serviceId != #{serviceProviderId}
         WHERE csg.serviceId != #{serviceProviderId}
     </select>
     </select>
     <select id="findServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
     <select id="findServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
-        SELECT csg.serviceId as serviceProviderId,s.linkMan as name
+        SELECT csg.serviceId as serviceProviderId,s.name as name
         FROM cm_serviceteam_group csg
         FROM cm_serviceteam_group csg
         LEFT JOIN cm_serviceteam_role csr ON csr.id=csg.teamId
         LEFT JOIN cm_serviceteam_role csr ON csr.id=csg.teamId
         left join serviceprovider s on csg.serviceId=s.serviceProviderID
         left join serviceprovider s on csg.serviceId=s.serviceProviderID
@@ -471,7 +489,7 @@
         </if>
         </if>
     </select>
     </select>
     <select id="findAllServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
     <select id="findAllServices" resultType="com.caimei365.user.model.vo.ServiceProviderVo">
-        SELECT csg.serviceId AS serviceProviderId,s.linkMan AS NAME
+        SELECT csg.serviceId AS serviceProviderId,s.name AS NAME
         FROM cm_serviceteam_group csg
         FROM cm_serviceteam_group csg
         LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
         LEFT JOIN serviceprovider s ON csg.serviceId=s.serviceProviderID
         <where>
         <where>
@@ -492,7 +510,7 @@
             AND c.clubId =#{clubId}
             AND c.clubId =#{clubId}
         </if>
         </if>
         and b.pageType in(6,8,11)
         and b.pageType in(6,8,11)
-        and  DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
+        and DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
         GROUP BY b.pageLabel LIMIT 10) as a
         GROUP BY b.pageLabel LIMIT 10) as a
     </select>
     </select>
     <select id="getBehaviorRecordMinutePageLabel" resultType="string">
     <select id="getBehaviorRecordMinutePageLabel" resultType="string">
@@ -501,66 +519,69 @@
         FROM cm_behavior_record b
         FROM cm_behavior_record b
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
         LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
-        WHERE  sp.status=90 and sp.serviceProviderID=#{spId}
+        WHERE sp.status=90 and sp.serviceProviderID=#{spId}
         and b.pageType in (69,70,71)
         and b.pageType in (69,70,71)
-        and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and  #{accessTime}
+        and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
         <if test="clubId != null">
         <if test="clubId != null">
             AND c.clubId =#{clubId}
             AND c.clubId =#{clubId}
         </if>
         </if>
         GROUP BY b.pageLabel LIMIT 10) as a
         GROUP BY b.pageLabel LIMIT 10) as a
     </select>
     </select>
     <select id="getBehaviorRecordYesterdayClubFrom" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
     <select id="getBehaviorRecordYesterdayClubFrom" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
-        SELECT
-            b.recordID,
-            b.userID,
-            b.pagePath,
-            b.pageType,
-            b.pageLabel,
-            b.productID,
-            b.accessTime,
-            b.accessDuration,
-            b.accessDate,
-            b.referer,
-            b.accessClient,
-            b.isReckon,
-            b.region,
-            c.name,c.linkMan,c.contractMobile,c.clubId,u.image
+        SELECT b.recordID,
+               b.userID,
+               b.pagePath,
+               b.pageType,
+               b.pageLabel,
+               b.productID,
+               b.accessTime,
+               b.accessDuration,
+               b.accessDate,
+               b.referer,
+               b.accessClient,
+               b.isReckon,
+               b.region,
+               c.name,
+               c.linkMan,
+               c.contractMobile,
+               c.clubId,
+               u.image
         FROM cm_behavior_record b
         FROM cm_behavior_record b
-        LEFT JOIN club c ON b.userID = c.userID
-        LEFT JOIN user u ON u.userID = c.userID
-        WHERE b.userId !=0
-        and c.spId=#{spId}
-        and c.clubId=#{clubId}
-        and b.pageType in(6,11)
-        and  DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
+                 LEFT JOIN club c ON b.userID = c.userID
+                 LEFT JOIN user u ON u.userID = c.userID
+        WHERE b.userId != 0
+          and c.spId = #{spId}
+          and c.clubId = #{clubId}
+          and b.pageType in (6, 11)
+          and DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
     </select>
     </select>
     <select id="getBehaviorRecordMinuteClubFrom" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
     <select id="getBehaviorRecordMinuteClubFrom" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
         SELECT
         SELECT
-            b.recordID,
-            b.userID,
-            b.pagePath,
-            b.pageType,
-            b.pageLabel,
-            b.productID,
-            b.accessTime,
-            b.accessDuration,
-            b.accessDate,
-            b.referer,
-            b.accessClient,
-            b.isReckon,
-            b.region,
-            (select cpaf.fileName from cm_product_archive_content cpac
-            left join cm_product_archive_file cpaf on cpaf.archiveContentId=cpac.id
-            where cpac.id=b.productArchiveId limit 1)as title,
-            ifnull(c.name,b.IP),
-            c.linkMan,c.contractMobile,c.clubId,u.image
+        b.recordID,
+        b.userID,
+        b.pagePath,
+        b.pageType,
+        b.pageLabel,
+        b.productID,
+        b.accessTime,
+        b.accessDuration,
+        b.accessDate,
+        b.referer,
+        b.accessClient,
+        b.isReckon,
+        b.region,
+        (select cpaf.fileName from cm_product_archive_content cpac
+        left join cm_product_archive_file cpaf on cpaf.archiveContentId=cpac.id
+        where cpac.id=b.productArchiveId limit 1)as title,
+        ifnull(c.name,b.IP),
+        c.linkMan,c.contractMobile,c.clubId,u.image
         FROM cm_behavior_record b
         FROM cm_behavior_record b
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN user u ON u.userID = c.userID
         LEFT JOIN user u ON u.userID = c.userID
         LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
         LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
-        WHERE  sp.status=90 and sp.serviceProviderID=#{spId}
-          and b.pageType in (69,70,71)
-          and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and  #{accessTime}
+        WHERE sp.status=90 and sp.serviceProviderID=#{spId}
+        and b.pageType in (69,70,71)
+        and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
         <if test="clubId != null">
         <if test="clubId != null">
             AND c.clubId =#{clubId}
             AND c.clubId =#{clubId}
         </if>
         </if>
@@ -579,14 +600,18 @@
                b.accessClient,
                b.accessClient,
                b.isReckon,
                b.isReckon,
                b.region,
                b.region,
-               c.name,c.linkMan,c.contractMobile,c.clubId,u.image
+               c.name,
+               c.linkMan,
+               c.contractMobile,
+               c.clubId,
+               u.image
         FROM cm_behavior_record b
         FROM cm_behavior_record b
                  LEFT JOIN club c ON b.userID = c.userID
                  LEFT JOIN club c ON b.userID = c.userID
                  LEFT JOIN user u ON u.userID = c.userID
                  LEFT JOIN user u ON u.userID = c.userID
-        WHERE b.userId !=0
-        and c.spId=#{spId}
-          and b.pageType in(6,8,11)
-          and  DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
+        WHERE b.userId != 0
+          and c.spId = #{spId}
+          and b.pageType in (6, 8, 11)
+          and DATE(b.accessTime) = DATE(DATE_SUB(#{accessTime}, INTERVAL 1 day))
         GROUP BY c.clubId
         GROUP BY c.clubId
     </select>
     </select>
     <select id="getBehaviorRecordMinuteClub" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
     <select id="getBehaviorRecordMinuteClub" resultType="com.caimei365.user.model.vo.CmBehaviorRecordVo">
@@ -603,23 +628,30 @@
                b.accessClient,
                b.accessClient,
                b.isReckon,
                b.isReckon,
                b.region,
                b.region,
-               ifnull(c.name,b.region)
-               ,c.linkMan,c.contractMobile,c.clubId,u.image
+               ifnull(c.name, b.region)
+                ,
+               c.linkMan,
+               c.contractMobile,
+               c.clubId,
+               u.image
         FROM cm_behavior_record b
         FROM cm_behavior_record b
                  LEFT JOIN club c ON b.userID = c.userID
                  LEFT JOIN club c ON b.userID = c.userID
                  LEFT JOIN user u ON u.userID = c.userID
                  LEFT JOIN user u ON u.userID = c.userID
                  LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
                  LEFT JOIN serviceprovider sp ON b.headUserId = sp.userID
-        WHERE  sp.status=90 and sp.serviceProviderID=#{spId}
-          and b.pageType in (69,70,71)
-          and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and  #{accessTime}
+        WHERE sp.status = 90
+          and sp.serviceProviderID = #{spId}
+          and b.pageType in (69, 70, 71)
+          and b.accessTime between DATE_SUB(#{accessTime}, INTERVAL 5 Minute) and #{accessTime}
         GROUP BY b.region
         GROUP BY b.region
     </select>
     </select>
 
 
     <select id="getClubAccessDate" resultType="com.caimei365.user.model.vo.RetuenDataVo">
     <select id="getClubAccessDate" resultType="com.caimei365.user.model.vo.RetuenDataVo">
         select cbr.accessDate
         select cbr.accessDate
         from cm_behavior_record cbr
         from cm_behavior_record cbr
-        LEFT JOIN club c ON cbr.userID = c.userID
-        where c.clubID = #{clubId} group by cbr.accessDate order by cbr.accessDate desc
+                 LEFT JOIN club c ON cbr.userID = c.userID
+        where c.clubID = #{clubId}
+        group by cbr.accessDate
+        order by cbr.accessDate desc
     </select>
     </select>
     <select id="getClubKeynoteRecord" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
     <select id="getClubKeynoteRecord" resultType="com.caimei365.user.model.vo.BehaviorRecodeVo">
         SELECT
         SELECT
@@ -636,63 +668,107 @@
         b.accessClient,
         b.accessClient,
         b.isReckon,
         b.isReckon,
         b.region,
         b.region,
-        p.name      AS productName,
+        p.name AS productName,
         p.mainImage AS productImage
         p.mainImage AS productImage
         FROM cm_behavior_record b
         FROM cm_behavior_record b
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN club c ON b.userID = c.userID
         LEFT JOIN product p ON b.productID = p.productID
         LEFT JOIN product p ON b.productID = p.productID
         LEFT JOIN cm_page_type pt ON b.pageType = pt.id
         LEFT JOIN cm_page_type pt ON b.pageType = pt.id
         WHERE c.clubID = #{clubId}
         WHERE c.clubID = #{clubId}
-            and b.pageType IN (6,11)
-            <if test="accessDateList.size()>0">
-                and
-                <foreach collection="accessDateList" item="accessDate" open="(" separator="or" close=")">
-                    b.accessTime like concat('%', #{accessDate}, '%')
-                </foreach>
-            </if>
+        and b.pageType IN (6,11)
+        <if test="accessDateList.size()>0">
+            and
+            <foreach collection="accessDateList" item="accessDate" open="(" separator="or" close=")">
+                b.accessTime like concat('%', #{accessDate}, '%')
+            </foreach>
+        </if>
         order by b.accessTime desc
         order by b.accessTime desc
     </select>
     </select>
 
 
     <select id="getUnActiveClub" resultType="com.caimei365.user.model.vo.ClubVo">
     <select id="getUnActiveClub" resultType="com.caimei365.user.model.vo.ClubVo">
-        SELECT c.clubID as clubId,
-               c.userID as userId,
+        SELECT c.clubID                    as clubId,
+               c.userID                    as userId,
                c.name,
                c.name,
-               c.sname as shortName,
+               c.sname                     as shortName,
                c.contractMobile,
                c.contractMobile,
-               c.contractEmail as contractEmail,
+               c.contractEmail             as contractEmail,
                c.contractPhone,
                c.contractPhone,
                c.linkMan,
                c.linkMan,
-               c.provinceID as proviceId,
-               c.cityID as cityId,
-               c.townID as townId,
+               c.provinceID                as proviceId,
+               c.cityID                    as cityId,
+               c.townID                    as townId,
                c.address,
                c.address,
-               c.headpic as shopPhoto,
-               c.businessLicenseImage as businessLicense,
+               c.headpic                   as shopPhoto,
+               c.businessLicenseImage      as businessLicense,
                c.socialCreditCode,
                c.socialCreditCode,
                c.firstClubType,
                c.firstClubType,
                c.secondClubType,
                c.secondClubType,
                c.department,
                c.department,
                c.medicalPracticeLicenseImg as medicalPracticeLicense,
                c.medicalPracticeLicenseImg as medicalPracticeLicense,
-               c.mainpro as mainProduct,
+               c.mainpro                   as mainProduct,
                c.fax,
                c.fax,
-               c.info as profile,
-               c.spID as serviceProviderId,
-               c.addTime, c.status,
+               c.info                      as profile,
+               c.spID                      as serviceProviderId,
+               c.addTime,
+               c.status,
                c.lastCheckOrderDate,
                c.lastCheckOrderDate,
                u.userIdentity,
                u.userIdentity,
-               c.newDeal as newDeal,IF(r.id IS NOT NULL,1,0) AS recordCount,
-               sp.name AS serviceName,
-               coas.activeState AS activeState,
-               covs.customerValue AS customerValue
-            from club c
-            left join user u on c.userID = u.userID
-            LEFT JOIN record_link r ON r.`clubId`=c.`clubID`
-            LEFT JOIN (SELECT userId, activeState, activeStatus FROM cm_organ_active_system WHERE stage = 0 AND delType = 1) AS coas ON coas.userId = c.userId
-            LEFT JOIN (SELECT userId, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) AS covs ON covs.userId = c.userId
-            LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
+               c.newDeal                   as newDeal,
+               IF(r.id IS NOT NULL, 1, 0)  AS recordCount,
+               sp.name                     AS serviceName,
+               coas.activeState            AS activeState,
+               covs.customerValue          AS customerValue
+        from club c
+                 left join user u on c.userID = u.userID
+                 LEFT JOIN record_link r ON r.`clubId` = c.`clubID`
+                 LEFT JOIN (SELECT userId, activeState, activeStatus
+                            FROM cm_organ_active_system
+                            WHERE stage = 0
+                              AND delType = 1) AS coas ON coas.userId = c.userId
+                 LEFT JOIN (SELECT userId, customerValue
+                            FROM cm_organ_value_system
+                            WHERE stage = 0
+                              AND delType = 1) AS covs ON covs.userId = c.userId
+                 LEFT JOIN serviceprovider sp ON c.spID = sp.serviceProviderID
         WHERE coas.activeStatus = 1
         WHERE coas.activeStatus = 1
           AND sp.serviceProviderID = #{serviceProviderId}
           AND sp.serviceProviderID = #{serviceProviderId}
         GROUP BY covs.userID
         GROUP BY covs.userID
     </select>
     </select>
 
 
+    <select id="getTaskList" resultType="com.caimei365.user.model.vo.ProviderTaskVo">
+        SELECT ptr.taskId,
+               ptr.receiveFlag,
+               ptr.auditStatus,
+               ptr.receiveTime,
+               cpt.shopId,
+               cpt.title,
+               cpt.content,
+               cpt.reward,
+               cpt.productId,
+               cpt.addTime,
+               cpt.startTime,
+               cpt.endTime,
+               cpt.topPic
+        FROM provider_task_role ptr
+                 LEFT JOIN cm_provider_task cpt ON ptr.taskId = cpt.id
+        WHERE cpt.delflag = 0
+          AND ptr.serviceProviderId = #{serviceProviderId}
+        order by cpt.addTime desc
+    </select>
+
+    <select id="getTaskDetail" resultType="com.caimei365.user.model.vo.ProviderTaskVo">
+        select id as taskId,
+               shopId,
+               productId,
+               title,
+               topPic,
+               content,
+               reward,
+               addTime,
+               startTime,
+               endTime
+        from cm_provider_task
+        where id = #{taskId}
+    </select>
+
 </mapper>
 </mapper>