Browse Source

Merge branch 'lcy' of http://47.107.53.207:3000/traineeCoder001/Bailian-Al

# Conflicts:
#	benyun-core/src/main/java/com/benyun/core/entity/StoreWd.java
JensionDzero 1 year ago
parent
commit
e5d443195d
37 changed files with 1184 additions and 10 deletions
  1. 3 4
      benyun-core/src/main/java/com/benyun/core/controller/BrandController.java
  2. 185 0
      benyun-core/src/main/java/com/benyun/core/controller/WorkTableController.java
  3. 17 0
      benyun-core/src/main/java/com/benyun/core/dao/AttentionPoolDao.java
  4. 12 0
      benyun-core/src/main/java/com/benyun/core/dao/AttentionPoolStatisticsDao.java
  5. 16 0
      benyun-core/src/main/java/com/benyun/core/dao/BusinessOpportunitiesDao.java
  6. 16 0
      benyun-core/src/main/java/com/benyun/core/dao/FollowUpDao.java
  7. 32 0
      benyun-core/src/main/java/com/benyun/core/entity/AttentionPool.java
  8. 26 0
      benyun-core/src/main/java/com/benyun/core/entity/AttentionPoolStatistics.java
  9. 3 0
      benyun-core/src/main/java/com/benyun/core/entity/Brand.java
  10. 26 0
      benyun-core/src/main/java/com/benyun/core/entity/BusinessOpportunitiesClue.java
  11. 26 0
      benyun-core/src/main/java/com/benyun/core/entity/FollowUpRecord.java
  12. 2 1
      benyun-core/src/main/java/com/benyun/core/entity/WdInfo.java
  13. 16 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/AttentionPoolBo.java
  14. 14 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/AttentionPoolStatisticsBo.java
  15. 1 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/BrandSearch.java
  16. 15 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/BusinessOpportunitiesClueBo.java
  17. 14 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/FollowUpRecordBo.java
  18. 17 0
      benyun-core/src/main/java/com/benyun/core/entity/vo/AddFollowRecordVo.java
  19. 13 0
      benyun-core/src/main/java/com/benyun/core/entity/vo/TurnBusinessOpportunitiesVo.java
  20. 15 0
      benyun-core/src/main/java/com/benyun/core/entity/vo/WorkTableSearchVo.java
  21. 18 0
      benyun-core/src/main/java/com/benyun/core/service/AttentionPoolService.java
  22. 1 1
      benyun-core/src/main/java/com/benyun/core/service/BrandService.java
  23. 15 0
      benyun-core/src/main/java/com/benyun/core/service/BusinessOpportunitiesService.java
  24. 10 0
      benyun-core/src/main/java/com/benyun/core/service/DatabackService.java
  25. 159 0
      benyun-core/src/main/java/com/benyun/core/service/impl/AttentionPoolServiceImpl.java
  26. 24 3
      benyun-core/src/main/java/com/benyun/core/service/impl/BrandServiceImpl.java
  27. 80 0
      benyun-core/src/main/java/com/benyun/core/service/impl/BusinessOpportunitiesServiceImpl.java
  28. 56 0
      benyun-core/src/main/java/com/benyun/core/service/impl/DatabackServiceImpl.java
  29. 70 0
      benyun-core/src/main/resources/mapper/AttentionPoolMapper.xml
  30. 23 0
      benyun-core/src/main/resources/mapper/AttentionPoolStatisticsMapper.xml
  31. 2 0
      benyun-core/src/main/resources/mapper/BrandMapper.xml
  32. 53 0
      benyun-core/src/main/resources/mapper/BusinessOpportunitiesMapper.xml
  33. 62 0
      benyun-core/src/main/resources/mapper/FollowUpMapper.xml
  34. 69 0
      benyun-core/src/test/java/com/benyun/core/service/AttentionPoolServiceImplTest.java
  35. 2 1
      benyun-core/src/test/java/com/benyun/core/service/BrandServiceImplTest.java
  36. 45 0
      benyun-core/src/test/java/com/benyun/core/service/BusinessOpportunitiesServiceImplTest.java
  37. 26 0
      benyun-core/src/test/java/com/benyun/core/service/DatabackServiceImplTest.java

+ 3 - 4
benyun-core/src/main/java/com/benyun/core/controller/BrandController.java

@@ -8,9 +8,7 @@ import com.ruoyi.common.core.domain.R;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 
@@ -32,7 +30,8 @@ public class BrandController extends BaseController {
 //    获取品牌信息列表
     @GetMapping("/list")
     public R list(BrandListQueryBody body){
-        return R.ok(brandService.searchListByMulti(body));
+        String userId = "1";
+        return R.ok(brandService.searchListByMulti(body,userId));
     }
 
 //    获取品牌详细信息

+ 185 - 0
benyun-core/src/main/java/com/benyun/core/controller/WorkTableController.java

@@ -0,0 +1,185 @@
+package com.benyun.core.controller;
+
+import com.benyun.core.entity.bo.AttentionPoolBo;
+import com.benyun.core.entity.bo.AttentionPoolStatisticsBo;
+import com.benyun.core.entity.vo.AddFollowRecordVo;
+import com.benyun.core.entity.vo.TurnBusinessOpportunitiesVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.benyun.core.service.AttentionPoolService;
+import com.benyun.core.service.BusinessOpportunitiesService;
+import com.benyun.core.service.DatabackService;
+import com.github.pagehelper.PageInfo;
+import com.ruoyi.common.core.domain.R;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.validation.annotation.Validated;
+import org.springframework.web.bind.annotation.*;
+
+import java.util.List;
+
+@Validated
+@RequiredArgsConstructor
+@RestController
+@RequestMapping("/work")
+public class WorkTableController {
+    @Autowired
+    DatabackService databackService;
+    @Autowired
+    AttentionPoolService attentionPoolService;
+    @Autowired
+    BusinessOpportunitiesService businessOpportunitiesService;
+
+//    获取数据概览
+    @GetMapping("/databack/about")
+    public R about(){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        AttentionPoolStatisticsBo bo = databackService.searchAbout(userId);
+        return R.ok(bo);
+    }
+
+//    获取客户数量变化趋势
+    @GetMapping("/databack/trend")
+    public R trend(){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        List<AttentionPoolStatisticsBo> bos = databackService.searchTrand(userId);
+        return R.ok(bos);
+    }
+
+//    分页获取潜客列表
+    @GetMapping("/pool/list")
+    public R poolList(WorkTableSearchVo workTableSearchVo){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        PageInfo<List<AttentionPoolBo>> listPageInfo = attentionPoolService.searchList(workTableSearchVo, userId);
+        return R.ok(listPageInfo);
+    }
+
+//    取消关注
+    @DeleteMapping("/pool")
+    public R cancel(String attentionId){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        if (attentionId == null || attentionId.equals(""))
+            return R.fail("attentionId不能为空");
+        int flag = attentionPoolService.cancelAttention(attentionId, userId);
+        if (flag == 1)
+            return R.ok("取消关注成功!");
+        return R.fail("取消关注失败。");
+    }
+
+//    转化商机
+    @PostMapping("/pool")
+    public R turn(TurnBusinessOpportunitiesVo turnVo){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        int flag = attentionPoolService.turnBusinessOpportunities(turnVo, userId);
+        if (flag == 1)
+            return R.ok("转化成功!");
+        return R.fail("转化失败。");
+    }
+
+//    分页获取线索列表
+    @GetMapping("/clue/list")
+    public R clueList(WorkTableSearchVo vo){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        return R.ok(businessOpportunitiesService.searchList(vo,userId));
+    }
+
+//    分页获取跟进记录
+    @GetMapping("/follow/list")
+    public R followList(WorkTableSearchVo vo){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        return R.ok(businessOpportunitiesService.searchFollowList(vo,userId));
+    }
+
+//    添加跟进记录
+    @PostMapping("/follow")
+    public R followAdd(AddFollowRecordVo addVo){
+        // 获取用户id
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        int flag = businessOpportunitiesService.addFollow(addVo, userId);
+        if (flag == 1)
+            return R.ok("添加成功!");
+        return R.fail("添加失败");
+    }
+
+    //    品牌关注
+    @PostMapping("/brand")
+    public R brandAttention(String brandId){
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        int flag = attentionPoolService.attentionBrand(brandId, userId);
+        if (flag == 1){
+            return R.ok("关注成功!");
+        }else if (flag == 2){
+            return R.fail("重复关注。");
+        }else if (flag == 3){
+            return R.fail("未知品牌");
+        }
+        return R.fail("关注失败。");
+    }
+
+    //    品牌取消关注
+    @DeleteMapping("/brand")
+    public R brandCancel(String brandId){
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        int flag = attentionPoolService.cancelBrand(brandId, userId);
+        if (flag == 1){
+            return R.ok("取消关注成功!");
+        }
+        return R.fail("取消关注失败。");
+    }
+
+//    网点关注
+    @PostMapping("/wdInfo")
+    public R wdInfoAttention(String wdId){
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        int flag = attentionPoolService.attentionWdInfo(wdId,userId);
+        if (flag == 1){
+            return R.ok("关注成功!");
+        }else if (flag == 2){
+            return R.fail("重复关注。");
+        }else if (flag == 3){
+            return R.fail("未知网点");
+        }
+        return R.fail("关注失败。");
+    }
+
+//    网点取消关注
+    @DeleteMapping("/wdInfo")
+    public R wdInfoCancel(String wdId){
+        String userId = "1";
+        if (userId == null || userId.equals(""))
+            return R.fail("请登录");
+        int flag = attentionPoolService.cancelWdInfo(wdId, userId);
+        if (flag == 1){
+            return R.ok("取消关注成功!");
+        }
+        return R.fail("取消关注失败。");
+    }
+}

+ 17 - 0
benyun-core/src/main/java/com/benyun/core/dao/AttentionPoolDao.java

@@ -0,0 +1,17 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.AttentionPool;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface AttentionPoolDao extends BaseMapper<AttentionPool> {
+    int searchCountByUserId(String userId);
+    List<AttentionPool> searchByMulti(@Param("text") String text, @Param("userId") String userId);
+    int deleteByAttentionIdAndUserId(@Param("attentionId") String attentionId, @Param("userId") String userId);
+    AttentionPool searchByBrandIdOrWdIdAndUserId(@Param("brandId") String brandId, @Param("wdId") String wdId, @Param("userId") String userId);
+    int deleteByBrandIdOrWdIdAndUserId(@Param("brandId") String brandId, @Param("wdId") String wdId, @Param("userId") String userId);
+}

+ 12 - 0
benyun-core/src/main/java/com/benyun/core/dao/AttentionPoolStatisticsDao.java

@@ -0,0 +1,12 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.AttentionPoolStatistics;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface AttentionPoolStatisticsDao extends BaseMapper<AttentionPoolStatistics> {
+    List<AttentionPoolStatistics> searchAllByUserId(String userId);
+}

+ 16 - 0
benyun-core/src/main/java/com/benyun/core/dao/BusinessOpportunitiesDao.java

@@ -0,0 +1,16 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.BusinessOpportunitiesClue;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface BusinessOpportunitiesDao extends BaseMapper<BusinessOpportunitiesClue> {
+    int searchCountByUserId(@Param("userId") String userId);
+    BusinessOpportunitiesClue searchByAttentionIdAndUserId(@Param("attentionId") String attentionId, @Param("userId") String userId);
+    int deleteByAttentionIdAndUserId(@Param("attentionId")String attentionId, @Param("userId") String userId);
+    List<BusinessOpportunitiesClue> searchAllByMulti(@Param("text") String text, @Param("userId") String userId);
+}

+ 16 - 0
benyun-core/src/main/java/com/benyun/core/dao/FollowUpDao.java

@@ -0,0 +1,16 @@
+package com.benyun.core.dao;
+
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+import com.benyun.core.entity.FollowUpRecord;
+import org.apache.ibatis.annotations.Mapper;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.List;
+
+@Mapper
+public interface FollowUpDao extends BaseMapper<FollowUpRecord> {
+    int searchCountByUserIdAndWay(@Param("userId") String userId, @Param("way") String way);
+    List<FollowUpRecord> searchAllByClueIdAndUserId(@Param("clueId") String clueId, @Param("userId") String userId);
+    int deleteByClueIdAndUserId(@Param("clueId") String clueId, @Param("userId") String userId);
+    List<FollowUpRecord> searchAllByMulti(@Param("clueId") String clueId,@Param("text") String text, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("userId") String userId);
+}

+ 32 - 0
benyun-core/src/main/java/com/benyun/core/entity/AttentionPool.java

@@ -0,0 +1,32 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("bl_attention_pool")
+public class AttentionPool {
+    @TableField("attention_id")
+    private String attentionId;
+    @TableField("contact")
+    private String contact;
+    @TableField("telephone")
+    private String telephone;
+    @TableField("wd_id")
+    private String wdId;
+    @TableField("wd_name")
+    private String wdName;
+    @TableField("wd_addr_info")
+    private String wdAddrInfo;
+    @TableField("brand_id")
+    private String brandId;
+    @TableField("brand_name")
+    private String brandName;
+    @TableField("user_id")
+    private String userId;
+    @TableField("attention_time")
+    private Date attentionTime;
+}

+ 26 - 0
benyun-core/src/main/java/com/benyun/core/entity/AttentionPoolStatistics.java

@@ -0,0 +1,26 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("bl_attention_pool_statistics")
+public class AttentionPoolStatistics {
+    @TableField("stat_id")
+    private String statId;
+    @TableField("attention_count")
+    private Integer attentionCount;
+    @TableField("clue_count")
+    private Integer clueCount;
+    @TableField("online_count")
+    private Integer onlineCount;
+    @TableField("offline_count")
+    private Integer offlineCount;
+    @TableField("user_id")
+    private String userId;
+    @TableField("stat_time")
+    private Date statTime;
+}

+ 3 - 0
benyun-core/src/main/java/com/benyun/core/entity/Brand.java

@@ -54,6 +54,9 @@ public class Brand extends BaseEntity {
      *
      */
     private Float indexScore;
+
+    private String contact;
+    private String telephone;
     /**
      *
      */

+ 26 - 0
benyun-core/src/main/java/com/benyun/core/entity/BusinessOpportunitiesClue.java

@@ -0,0 +1,26 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("bl_business_opportunities_clue")
+public class BusinessOpportunitiesClue {
+    @TableField("clue_id")
+    private String clueId;
+    @TableField("attention_id")
+    private String attentionId;
+    @TableField("contact")
+    private String contact;
+    @TableField("telephone")
+    private String telephone;
+    @TableField("follow_up_count")
+    private Integer followUpCount;
+    @TableField("user_id")
+    private String userId;
+    @TableField("create_time")
+    private Date createTime;
+}

+ 26 - 0
benyun-core/src/main/java/com/benyun/core/entity/FollowUpRecord.java

@@ -0,0 +1,26 @@
+package com.benyun.core.entity;
+
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableName;
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+@TableName("bl_follow_up_record")
+public class FollowUpRecord {
+    @TableField("record_id")
+    private String recordId;
+    @TableField("clue_id")
+    private String clueId;
+    @TableField("follow_way")
+    private String followWay;
+    @TableField("follow_content")
+    private String followContent;
+    @TableField("follow_person")
+    private String followPerson;
+    @TableField("user_id")
+    private String userId;
+    @TableField("follow_time")
+    private Date followTime;
+}

+ 2 - 1
benyun-core/src/main/java/com/benyun/core/entity/WdInfo.java

@@ -1,6 +1,7 @@
 package com.benyun.core.entity;
 
 import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.TableName;
 import com.fasterxml.jackson.annotation.JsonFormat;
 import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
@@ -18,7 +19,7 @@ import java.time.LocalDateTime;
 @Data
 @TableName("ddt_wd_info")
 public class WdInfo {
-    @TableField("wd_id")
+    @TableId("wd_id")
     private String wdId;
     @TableField("wd_img")
     private String wdImg;

+ 16 - 0
benyun-core/src/main/java/com/benyun/core/entity/bo/AttentionPoolBo.java

@@ -0,0 +1,16 @@
+package com.benyun.core.entity.bo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class AttentionPoolBo {
+    private String attentionId;
+    private String contact;
+    private String telephone;
+    private String wdName;
+    private String wdAddrInfo;
+    private String brandName;
+    private Date attentionTime;
+}

+ 14 - 0
benyun-core/src/main/java/com/benyun/core/entity/bo/AttentionPoolStatisticsBo.java

@@ -0,0 +1,14 @@
+package com.benyun.core.entity.bo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class AttentionPoolStatisticsBo {
+    private Integer attentionCount;
+    private Integer clueCount;
+    private Integer onlineCount;
+    private Integer offlineCount;
+    private Date time;
+}

+ 1 - 0
benyun-core/src/main/java/com/benyun/core/entity/bo/BrandSearch.java

@@ -13,5 +13,6 @@ public class BrandSearch {
     private String enterpriseName;
     private Integer coverCityCount;
     private Integer total;
+    private String attention;
     private Date updateTime;
 }

+ 15 - 0
benyun-core/src/main/java/com/benyun/core/entity/bo/BusinessOpportunitiesClueBo.java

@@ -0,0 +1,15 @@
+package com.benyun.core.entity.bo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class BusinessOpportunitiesClueBo {
+    private String clueId;
+    private String attentionId;
+    private String contact;
+    private String telephone;
+    private Integer followUpCount;
+    private Date createTime;
+}

+ 14 - 0
benyun-core/src/main/java/com/benyun/core/entity/bo/FollowUpRecordBo.java

@@ -0,0 +1,14 @@
+package com.benyun.core.entity.bo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class FollowUpRecordBo {
+    private String recordId;
+    private String way;
+    private String content;
+    private String person;
+    private Date followTime;
+}

+ 17 - 0
benyun-core/src/main/java/com/benyun/core/entity/vo/AddFollowRecordVo.java

@@ -0,0 +1,17 @@
+package com.benyun.core.entity.vo;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+
+@Data
+public class AddFollowRecordVo {
+    @NotEmpty(message = "clueId不能为空")
+    String clueId;
+    @NotEmpty(message = "way不能为空")
+    String way;
+    @NotEmpty(message = "content不能为空")
+    String content;
+    @NotEmpty(message = "person不能为空")
+    String person;
+}

+ 13 - 0
benyun-core/src/main/java/com/benyun/core/entity/vo/TurnBusinessOpportunitiesVo.java

@@ -0,0 +1,13 @@
+package com.benyun.core.entity.vo;
+
+import lombok.Data;
+
+import javax.validation.constraints.NotEmpty;
+
+@Data
+public class TurnBusinessOpportunitiesVo {
+    @NotEmpty(message = "attentionId不能为空")
+    String attentionId;
+    String contact;
+    String telephone;
+}

+ 15 - 0
benyun-core/src/main/java/com/benyun/core/entity/vo/WorkTableSearchVo.java

@@ -0,0 +1,15 @@
+package com.benyun.core.entity.vo;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class WorkTableSearchVo {
+    int pageSize = 10;
+    int pageNum = 1;
+    String text; //搜索关键字
+    String clueId;
+    String startTime;
+    String endTime;
+}

+ 18 - 0
benyun-core/src/main/java/com/benyun/core/service/AttentionPoolService.java

@@ -0,0 +1,18 @@
+package com.benyun.core.service;
+
+import com.benyun.core.entity.bo.AttentionPoolBo;
+import com.benyun.core.entity.vo.TurnBusinessOpportunitiesVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+
+public interface AttentionPoolService {
+    PageInfo<List<AttentionPoolBo>> searchList(WorkTableSearchVo workVo, String userId);
+    int cancelAttention(String attentionId, String userId);
+    int turnBusinessOpportunities(TurnBusinessOpportunitiesVo turnVo, String userId);
+    int attentionBrand(String brandId, String userId);
+    int cancelBrand(String brnadId, String userId);
+    int attentionWdInfo(String wdId, String userId);
+    int cancelWdInfo(String wdId, String userId);
+}

+ 1 - 1
benyun-core/src/main/java/com/benyun/core/service/BrandService.java

@@ -15,7 +15,7 @@ public interface BrandService {
     BrandDistribution searchDistributionByBrandId(String brandId);
     List<BrandProvinceBo> searchProvinceByBrandId(String brandId);
     BrandDisCloud searchDisCloudByBrandId(String brandId);
-    PageInfo<List<BrandSearch>> searchListByMulti(BrandListQueryBody body);
+    PageInfo<List<BrandSearch>> searchListByMulti(BrandListQueryBody body,String userId);
     List<BrandTotal> searchTotal();
     BStoreData searchAvgScoreByBrandId(String brandId);
     List<BrandAddrDistribution> searchAddrDistribution(List<String> addrCodes);

+ 15 - 0
benyun-core/src/main/java/com/benyun/core/service/BusinessOpportunitiesService.java

@@ -0,0 +1,15 @@
+package com.benyun.core.service;
+
+import com.benyun.core.entity.bo.BusinessOpportunitiesClueBo;
+import com.benyun.core.entity.bo.FollowUpRecordBo;
+import com.benyun.core.entity.vo.AddFollowRecordVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.github.pagehelper.PageInfo;
+
+import java.util.List;
+
+public interface BusinessOpportunitiesService {
+    PageInfo<List<BusinessOpportunitiesClueBo>> searchList(WorkTableSearchVo workVo, String userId);
+    PageInfo<List<FollowUpRecordBo>> searchFollowList(WorkTableSearchVo workVo, String userId);
+    int addFollow(AddFollowRecordVo addVo, String userId);
+}

+ 10 - 0
benyun-core/src/main/java/com/benyun/core/service/DatabackService.java

@@ -0,0 +1,10 @@
+package com.benyun.core.service;
+
+import com.benyun.core.entity.bo.AttentionPoolStatisticsBo;
+
+import java.util.List;
+
+public interface DatabackService {
+    AttentionPoolStatisticsBo searchAbout(String userId);
+    List<AttentionPoolStatisticsBo> searchTrand(String userId);
+}

+ 159 - 0
benyun-core/src/main/java/com/benyun/core/service/impl/AttentionPoolServiceImpl.java

@@ -0,0 +1,159 @@
+package com.benyun.core.service.impl;
+
+import com.benyun.core.dao.*;
+import com.benyun.core.entity.*;
+import com.benyun.core.entity.bo.AttentionPoolBo;
+import com.benyun.core.entity.vo.TurnBusinessOpportunitiesVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.benyun.core.service.AttentionPoolService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+@Service
+public class AttentionPoolServiceImpl implements AttentionPoolService {
+    @Autowired
+    AttentionPoolDao attentionPoolDao;
+    @Autowired
+    BusinessOpportunitiesDao businessOpportunitiesDao;
+    @Autowired
+    FollowUpDao followUpDao;
+    @Autowired
+    BrandMapper brandMapper;
+    @Autowired
+    WdInfoDao wdInfoDao;
+    @Autowired
+    StoreWdDao storeWdDao;
+
+    @Override
+    public PageInfo<List<AttentionPoolBo>> searchList(WorkTableSearchVo workVo, String userId) {
+        PageHelper.startPage(workVo.getPageNum(),workVo.getPageSize(),true);
+        List<AttentionPool> pools = attentionPoolDao.searchByMulti(workVo.getText(), userId);
+        List<AttentionPoolBo> bos = new ArrayList<>();
+        for (AttentionPool pool : pools){
+            AttentionPoolBo bo = new AttentionPoolBo();
+            bo.setAttentionId(pool.getAttentionId());
+            bo.setContact(pool.getContact());
+            bo.setTelephone(pool.getTelephone());
+            bo.setBrandName(pool.getBrandName());
+            bo.setWdName(pool.getWdName());
+            bo.setWdAddrInfo(pool.getWdAddrInfo());
+            bo.setAttentionTime(pool.getAttentionTime());
+            bos.add(bo);
+        }
+        return new PageInfo(bos);
+    }
+
+    @Override
+    public int cancelAttention(String attentionId, String userId) {
+        BusinessOpportunitiesClue clue = businessOpportunitiesDao.searchByAttentionIdAndUserId(attentionId, userId);
+        if (clue != null){
+            List<FollowUpRecord> followUpRecords = followUpDao.searchAllByClueIdAndUserId(clue.getClueId(), userId);
+            if (!followUpRecords.isEmpty())
+                followUpDao.deleteByClueIdAndUserId(clue.getClueId(), userId);
+            businessOpportunitiesDao.deleteByAttentionIdAndUserId(attentionId, userId);
+        }
+        int deleteAttention = attentionPoolDao.deleteByAttentionIdAndUserId(attentionId, userId);
+        return deleteAttention;
+    }
+
+    @Override
+    public int turnBusinessOpportunities(TurnBusinessOpportunitiesVo turnVo, String userId) {
+        BusinessOpportunitiesClue clue1 = businessOpportunitiesDao.searchByAttentionIdAndUserId(turnVo.getAttentionId(), userId);
+        if (clue1 == null)
+            return 0;
+        BusinessOpportunitiesClue clue = new BusinessOpportunitiesClue();
+        clue.setClueId(UUID.randomUUID().toString().replace("-",""));
+        clue.setAttentionId(turnVo.getAttentionId());
+        clue.setContact(turnVo.getContact());
+        clue.setTelephone(turnVo.getTelephone());
+        clue.setFollowUpCount(0);
+        clue.setUserId(userId);
+        clue.setCreateTime(new Date());
+        return businessOpportunitiesDao.insert(clue);
+    }
+
+    @Override
+    public int attentionBrand(String brandId, String userId) {
+        AttentionPool attentionPool = attentionPoolDao.searchByBrandIdOrWdIdAndUserId(brandId,null, userId);
+        if (attentionPool != null) // 判断是否已经关注
+            return 2;
+        Brand brand = brandMapper.searchById(brandId);
+        if (brand == null) // 判断是否有该品牌
+            return 3;
+        AttentionPool pool = new AttentionPool();
+        pool.setAttentionId(UUID.randomUUID().toString().replace("-",""));
+        pool.setContact(brand.getContact());
+        if (brand.getContact() == null)
+            pool.setContact("");
+        pool.setTelephone(brand.getTelephone());
+        if (brand.getTelephone() == null)
+            pool.setTelephone("");
+        pool.setBrandId(brand.getBrandId());
+        pool.setBrandName(brand.getBrandName());
+        pool.setWdId("");
+        pool.setWdName("");
+        pool.setWdAddrInfo("");
+        pool.setUserId(userId);
+        pool.setAttentionTime(new Date());
+        return attentionPoolDao.insert(pool);
+    }
+
+    @Override
+    public int cancelBrand(String brnadId, String userId) {
+        return attentionPoolDao.deleteByBrandIdOrWdIdAndUserId(brnadId,null,userId);
+    }
+
+    @Override
+    public int attentionWdInfo(String wdId, String userId) {
+        AttentionPool attentionPool = attentionPoolDao.searchByBrandIdOrWdIdAndUserId(null, wdId, userId);
+        if (attentionPool != null) // 判断是否已经关注
+            return 2;
+        WdInfo wdInfo = wdInfoDao.selectById(wdId);
+        if (wdInfo == null) // 判断是否有该网点
+            return 3;
+        AttentionPool pool = new AttentionPool();
+        pool.setAttentionId(UUID.randomUUID().toString().replace("-",""));
+        pool.setWdId(wdInfo.getWdId());
+        pool.setWdName(wdInfo.getWdName());
+        pool.setWdAddrInfo(wdInfo.getAddrInfo());
+        StoreWd storeWd = storeWdDao.selectById(wdId);
+        if (storeWd != null){
+            pool.setContact(storeWd.getContact());
+            if (storeWd.getContact() == null)
+                pool.setContact("");
+            pool.setTelephone(storeWd.getTelephone());
+            if (storeWd.getTelephone() == null)
+                pool.setTelephone("");
+            if (storeWd.getBrandId() != null || !storeWd.getBrandId().equals("")){
+                Brand brand = brandMapper.searchById(storeWd.getBrandId());
+                if (brand != null){
+                    pool.setBrandId(brand.getBrandId());
+                    pool.setBrandName(brand.getBrandName());
+                }else {
+                    pool.setBrandId("");
+                    pool.setBrandName("");
+                }
+            }
+        }else {
+            pool.setContact("");
+            pool.setTelephone("");
+            pool.setBrandId("");
+            pool.setBrandName("");
+        }
+        pool.setUserId(userId);
+        pool.setAttentionTime(new Date());
+        return attentionPoolDao.insert(pool);
+    }
+
+    @Override
+    public int cancelWdInfo(String wdId, String userId) {
+        return attentionPoolDao.deleteByBrandIdOrWdIdAndUserId(null,wdId,userId);
+    }
+}

+ 24 - 3
benyun-core/src/main/java/com/benyun/core/service/impl/BrandServiceImpl.java

@@ -11,7 +11,9 @@ import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
 import java.util.ArrayList;
+import java.util.HashMap;
 import java.util.List;
+import java.util.Map;
 
 @Service
 public class BrandServiceImpl implements BrandService {
@@ -27,6 +29,8 @@ public class BrandServiceImpl implements BrandService {
     BrandZoneMapper brandZoneMapper;
     @Autowired
     EnterpriseMapper enterpriseMapper;
+    @Autowired
+    AttentionPoolDao attentionPoolDao;
 
     @Override
     public List<BrandSearch> searchByLikeName(String text) {
@@ -227,7 +231,7 @@ public class BrandServiceImpl implements BrandService {
     }
 
     @Override
-    public PageInfo<List<BrandSearch>> searchListByMulti(BrandListQueryBody body) {
+    public PageInfo<List<BrandSearch>> searchListByMulti(BrandListQueryBody body,String userId) {
         PageHelper.startPage(body.getPageNum(),body.getPageSize(),true);
         String text = body.getText();
         List<String> industryCode = body.getIndustryCode();
@@ -242,8 +246,25 @@ public class BrandServiceImpl implements BrandService {
             coverUp = Integer.parseInt(body.getCoverCityCount().get(1));
         }catch (Exception e){}
         List<BrandSearch> brandSearches = brandMapper.searchSearchByMulti(text, industryCode, countUp, countDown, coverUp, coverDown);
-        PageInfo info = new PageInfo(brandSearches);
-        return info;
+        if (userId == null || userId.equals("")){
+            for (BrandSearch search : brandSearches){
+                search.setAttention("0");
+            }
+        }else {
+            List<AttentionPool> pools = attentionPoolDao.searchByMulti(null, userId);
+            Map<String ,String> map = new HashMap<>();
+            for (AttentionPool pool : pools){
+                map.put(pool.getBrandId(),"1");
+            }
+            for (BrandSearch search : brandSearches){
+                if (map.get(search.getBrandId()) == null){
+                    search.setAttention("0");
+                }else {
+                    search.setAttention("1");
+                }
+            }
+        }
+        return new PageInfo(brandSearches);
     }
 
     @Override

+ 80 - 0
benyun-core/src/main/java/com/benyun/core/service/impl/BusinessOpportunitiesServiceImpl.java

@@ -0,0 +1,80 @@
+package com.benyun.core.service.impl;
+
+import com.benyun.core.dao.BusinessOpportunitiesDao;
+import com.benyun.core.dao.FollowUpDao;
+import com.benyun.core.entity.BusinessOpportunitiesClue;
+import com.benyun.core.entity.FollowUpRecord;
+import com.benyun.core.entity.bo.BusinessOpportunitiesClueBo;
+import com.benyun.core.entity.bo.FollowUpRecordBo;
+import com.benyun.core.entity.vo.AddFollowRecordVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.benyun.core.service.BusinessOpportunitiesService;
+import com.github.pagehelper.PageHelper;
+import com.github.pagehelper.PageInfo;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.UUID;
+
+@Service
+public class BusinessOpportunitiesServiceImpl implements BusinessOpportunitiesService {
+    @Autowired
+    BusinessOpportunitiesDao businessOpportunitiesDao;
+    @Autowired
+    FollowUpDao followUpDao;
+
+    @Override
+    public PageInfo<List<BusinessOpportunitiesClueBo>> searchList(WorkTableSearchVo workVo, String userId) {
+        PageHelper.startPage(workVo.getPageNum(),workVo.getPageSize(),true);
+        List<BusinessOpportunitiesClue> clues = businessOpportunitiesDao.searchAllByMulti(workVo.getText(), userId);
+        List<BusinessOpportunitiesClueBo> clueBos = new ArrayList<>();
+        for (BusinessOpportunitiesClue clue : clues){
+            BusinessOpportunitiesClueBo clueBo = new BusinessOpportunitiesClueBo();
+            clueBo.setClueId(clue.getClueId());
+            clueBo.setAttentionId(clue.getAttentionId());
+            clueBo.setContact(clue.getContact());
+            clueBo.setTelephone(clue.getTelephone());
+            clueBo.setFollowUpCount(clue.getFollowUpCount());
+            clueBo.setCreateTime(clue.getCreateTime());
+            clueBos.add(clueBo);
+        }
+        return new PageInfo(clueBos);
+    }
+
+    @Override
+    public PageInfo<List<FollowUpRecordBo>> searchFollowList(WorkTableSearchVo workVo, String userId) {
+        PageHelper.startPage(workVo.getPageNum(),workVo.getPageSize(),true);
+        if (workVo.getStartTime().equals(""))
+            workVo.setStartTime(null);
+        if (workVo.getEndTime().equals(""))
+            workVo.setEndTime(null);
+        List<FollowUpRecord> records = followUpDao.searchAllByMulti(workVo.getClueId(), workVo.getText(), workVo.getStartTime(), workVo.getEndTime(), userId);
+        List<FollowUpRecordBo> recordBos = new ArrayList<>();
+        for (FollowUpRecord record : records){
+            FollowUpRecordBo recordBo = new FollowUpRecordBo();
+            recordBo.setRecordId(record.getRecordId());
+            recordBo.setContent(record.getFollowContent());
+            recordBo.setPerson(record.getFollowPerson());
+            recordBo.setWay(record.getFollowWay());
+            recordBo.setFollowTime(record.getFollowTime());
+            recordBos.add(recordBo);
+        }
+        return new PageInfo(recordBos);
+    }
+
+    @Override
+    public int addFollow(AddFollowRecordVo addVo, String userId) {
+        FollowUpRecord record = new FollowUpRecord();
+        record.setRecordId(UUID.randomUUID().toString().replace("-",""));
+        record.setClueId(addVo.getClueId());
+        record.setFollowContent(addVo.getContent());
+        record.setFollowPerson(addVo.getPerson());
+        record.setFollowWay(addVo.getWay());
+        record.setUserId(userId);
+        record.setFollowTime(new Date());
+        return followUpDao.insert(record);
+    }
+}

+ 56 - 0
benyun-core/src/main/java/com/benyun/core/service/impl/DatabackServiceImpl.java

@@ -0,0 +1,56 @@
+package com.benyun.core.service.impl;
+
+import com.benyun.core.dao.AttentionPoolDao;
+import com.benyun.core.dao.AttentionPoolStatisticsDao;
+import com.benyun.core.dao.BusinessOpportunitiesDao;
+import com.benyun.core.dao.FollowUpDao;
+import com.benyun.core.entity.AttentionPoolStatistics;
+import com.benyun.core.entity.bo.AttentionPoolStatisticsBo;
+import com.benyun.core.service.DatabackService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.ArrayList;
+import java.util.List;
+
+@Service
+public class DatabackServiceImpl implements DatabackService {
+    @Autowired
+    AttentionPoolStatisticsDao attentionPoolStatisticsDao;
+    @Autowired
+    AttentionPoolDao attentionPoolDao;
+    @Autowired
+    BusinessOpportunitiesDao businessOpportunitiesDao;
+    @Autowired
+    FollowUpDao followUpDao;
+
+    @Override
+    public AttentionPoolStatisticsBo searchAbout(String userId) {
+        int attentionCount = attentionPoolDao.searchCountByUserId(userId);
+        int clueCount = businessOpportunitiesDao.searchCountByUserId(userId);
+        int onlineCount = followUpDao.searchCountByUserIdAndWay(userId, "线上电话");
+        int offlineCount = followUpDao.searchCountByUserIdAndWay(userId, "线下实地");
+        AttentionPoolStatisticsBo bo = new AttentionPoolStatisticsBo();
+        bo.setAttentionCount(attentionCount);
+        bo.setClueCount(clueCount);
+        bo.setOnlineCount(onlineCount);
+        bo.setOfflineCount(offlineCount);
+        return bo;
+    }
+
+    @Override
+    public List<AttentionPoolStatisticsBo> searchTrand(String userId) {
+        List<AttentionPoolStatistics> list = attentionPoolStatisticsDao.searchAllByUserId(userId);
+        List<AttentionPoolStatisticsBo> boList = new ArrayList<>();
+        for (AttentionPoolStatistics aps : list){
+            AttentionPoolStatisticsBo apsb = new AttentionPoolStatisticsBo();
+            apsb.setAttentionCount(aps.getAttentionCount());
+            apsb.setClueCount(aps.getClueCount());
+            apsb.setOnlineCount(aps.getOnlineCount());
+            apsb.setOfflineCount(aps.getOfflineCount());
+            apsb.setTime(aps.getStatTime());
+            boList.add(apsb);
+        }
+        return boList;
+    }
+}

+ 70 - 0
benyun-core/src/main/resources/mapper/AttentionPoolMapper.xml

@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.benyun.core.dao.AttentionPoolDao">
+    <resultMap type="com.benyun.core.entity.AttentionPool" id="AttentionPoolResult">
+        <result property="attentionId" column="attention_id"/>
+        <result property="contact" column="contact"/>
+        <result property="telephone" column="telephone"/>
+        <result property="brandId" column="brand_id"/>
+        <result property="brandName" column="brand_name"/>
+        <result property="wdId" column="wd_id"/>
+        <result property="wdName" column="wd_name"/>
+        <result property="wdAddrInfo" column="wd_addr_info"/>
+        <result property="userId" column="user_id"/>
+        <result property="attentionTime" column="attention_time"/>
+    </resultMap>
+    <delete id="deleteByAttentionIdAndUserId">
+        delete from `bl_attention_pool`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and attention_id = #{attentionId}
+        </trim>
+    </delete>
+    <delete id="deleteByBrandIdOrWdIdAndUserId">
+        delete from `bl_attention_pool` where user_id = #{userId}
+        <if test="brandId != null">
+            and brand_id = #{brandId} and wd_id = ''
+        </if>
+        <if test="wdId != null">
+            and wd_id = #{wdId}
+        </if>
+    </delete>
+    <select id="searchByMulti" resultMap="AttentionPoolResult">
+        select * from `bl_attention_pool`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            <if test="text != null">
+                and (
+                contact like concat('%',#{text},'%')
+                or telephone like concat('%',#{text},'%')
+                or wd_name like concat('%',#{text},'%')
+                or wd_addr_info like concat('%',#{text},'%')
+                or brand_name like concat('%',#{text},'%')
+                )
+            </if>
+        </trim>
+    </select>
+    <select id="searchCountByUserId" resultType="java.lang.Integer">
+        select count(*) from `bl_attention_pool`
+        <where>
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+        </where>
+    </select>
+    <select id="searchByBrandIdOrWdIdAndUserId" resultMap="AttentionPoolResult">
+        select * from `bl_attention_pool` where user_id = #{userId}
+        <if test="brandId != null">
+            and brand_id = #{brandId} and wd_id = ''
+        </if>
+        <if test="wdId != null">
+            and wd_id = #{wdId}
+        </if>
+    </select>
+</mapper>

+ 23 - 0
benyun-core/src/main/resources/mapper/AttentionPoolStatisticsMapper.xml

@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.benyun.core.dao.AttentionPoolStatisticsDao">
+    <resultMap type="com.benyun.core.entity.AttentionPoolStatistics" id="StatisticsResult">
+        <result property="statId" column="stat_id"/>
+        <result property="attentionCount" column="attention_count"/>
+        <result property="clueCount" column="clue_count"/>
+        <result property="onlineCount" column="online_count"/>
+        <result property="offlineCount" column="offline_count"/>
+        <result property="userId" column="user_id"/>
+        <result property="statTime" column="stat_time"/>
+    </resultMap>
+    <select id="searchAllByUserId" resultMap="StatisticsResult">
+        select * from `bl_attention_pool_statistics`
+        <where>
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+        </where>
+    </select>
+</mapper>

+ 2 - 0
benyun-core/src/main/resources/mapper/BrandMapper.xml

@@ -14,6 +14,8 @@
         <result property="score" column="score"/>
         <result property="menuInfo" column="menu_info"/>
         <result property="indexScore" column="index_score"/>
+        <result property="contact" column="contact"/>
+        <result property="telephone" column="telephone"/>
         <result property="createDate" column="create_date"/>
         <result property="audit" column="audit"/>
         <result property="collectPerson" column="collect_person"/>

+ 53 - 0
benyun-core/src/main/resources/mapper/BusinessOpportunitiesMapper.xml

@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.benyun.core.dao.BusinessOpportunitiesDao">
+    <resultMap type="com.benyun.core.entity.BusinessOpportunitiesClue" id="ClueResult">
+        <result property="clueId" column="clue_id"/>
+        <result property="attentionId" column="attention_id"/>
+        <result property="contact" column="contact"/>
+        <result property="telephone" column="telephone"/>
+        <result property="followUpCount" column="follow_up_count"/>
+        <result property="userId" column="user_id"/>
+        <result property="createTime" column="create_time"/>
+    </resultMap>
+    <delete id="deleteByAttentionIdAndUserId">
+        delete from `bl_business_opportunities_clue`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and attention_id = #{attentionId}
+        </trim>
+    </delete>
+    <select id="searchCountByUserId" resultType="java.lang.Integer">
+        select count(*) from `bl_business_opportunities_clue`
+        <where>
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+        </where>
+    </select>
+    <select id="searchByAttentionIdAndUserId" resultMap="ClueResult">
+        select * from `bl_business_opportunities_clue`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and attention_id = #{attentionId}
+        </trim>
+    </select>
+    <select id="searchAllByMulti" resultMap="ClueResult">
+        select * from `bl_business_opportunities_clue`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            <if test="text != null">
+                and (contact like concat('%',#{text},'%')
+                or telephone like concat('%',#{text},'%'))
+            </if>
+        </trim>
+    </select>
+</mapper>

+ 62 - 0
benyun-core/src/main/resources/mapper/FollowUpMapper.xml

@@ -0,0 +1,62 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper
+    PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+    "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.benyun.core.dao.FollowUpDao">
+    <resultMap type="com.benyun.core.entity.FollowUpRecord" id="RecoredResult">
+        <result property="recordId" column="record_id"/>
+        <result property="clueId" column="clue_id"/>
+        <result property="followWay" column="follow_way"/>
+        <result property="followContent" column="follow_content"/>
+        <result property="followPerson" column="follow_person"/>
+        <result property="userId" column="user_id"/>
+        <result property="followTime" column="follow_time"/>
+    </resultMap>
+    <delete id="deleteByClueIdAndUserId">
+        delete from `bl_follow_up_record`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and clue_id = #{clueId}
+        </trim>
+    </delete>
+    <select id="searchCountByUserIdAndWay" resultType="java.lang.Integer">
+        select count(*) from `bl_follow_up_record`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and follow_way = #{way}
+        </trim>
+    </select>
+    <select id="searchAllByClueIdAndUserId" resultMap="RecoredResult">
+        select * from `bl_follow_up_record`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and clue_id = #{clueId}
+        </trim>
+    </select>
+    <select id="searchAllByMulti" resultMap="RecoredResult">
+        select * from `bl_follow_up_record`
+        <trim prefix="where" prefixOverrides="and">
+            <if test="userId != null">
+                user_id = #{userId}
+            </if>
+            and clue_id = #{clueId}
+            <if test="text != null">
+                and (record_id like concat('%',#{text},'%')
+                or follow_content like concat('%',#{text},'%')
+                or follow_person like concat('%',#{text},'%'))
+            </if>
+            <if test="startTime != null">
+                and #{startTime} <![CDATA[<=]]> follow_time
+            </if>
+            <if test="endTime != null">
+                and follow_time <![CDATA[<=]]> #{endTime}
+            </if>
+        </trim>
+    </select>
+</mapper>

+ 69 - 0
benyun-core/src/test/java/com/benyun/core/service/AttentionPoolServiceImplTest.java

@@ -0,0 +1,69 @@
+package com.benyun.core.service;
+
+import com.benyun.core.entity.bo.AttentionPoolBo;
+import com.benyun.core.entity.vo.TurnBusinessOpportunitiesVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.github.pagehelper.PageInfo;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class AttentionPoolServiceImplTest {
+    @Autowired
+    AttentionPoolService attentionPoolService;
+
+    @Test
+    public void searchListTest(){
+        WorkTableSearchVo vo = new WorkTableSearchVo();
+        vo.setText("1");
+        PageInfo<List<AttentionPoolBo>> info = attentionPoolService.searchList(vo, "1");
+        System.out.println(info);
+    }
+
+    @Test
+    public void turnBusinessOpportunitiesTest(){
+        TurnBusinessOpportunitiesVo vo = new TurnBusinessOpportunitiesVo();
+        vo.setAttentionId("2");
+        vo.setContact("xxx");
+        vo.setTelephone("130xxx");
+        System.out.println(attentionPoolService.turnBusinessOpportunities(vo,"1"));
+    }
+
+    @Test
+    public void cancelAttentionTest(){
+        System.out.println(attentionPoolService.cancelAttention("3000","2"));
+    }
+
+    @Test
+    public void attentionBrandTest(){
+        String userId = "1";
+//        String brandId = "5eb6d4ccee1d498997c26a140a4bef08";
+        String brandId = "fhlksjdflkjsldkjf";
+        System.out.println(attentionPoolService.attentionBrand(brandId, userId));
+    }
+
+    @Test
+    public void cancelBrandTest(){
+        String userId = "1";
+        String brandId = "5eb6d4ccee1d498997c26a140a4bef08";
+        System.out.println(attentionPoolService.cancelBrand(brandId,userId));
+    }
+
+    @Test
+    public void attentionWdInfoTest(){
+        String userId = "1";
+//        String wdId = "0001ec104d7049eab1f992732e089518";
+        String wdId = "fjklsdjflksjdfkljsdf";
+        System.out.println(attentionPoolService.attentionWdInfo(wdId,userId));
+    }
+
+    @Test
+    public void cancelWdInfo(){
+        String userId = "1";
+        String wdId = "0001ec104d7049eab1f992732e089518";
+        System.out.println(attentionPoolService.cancelWdInfo(wdId,userId));
+    }
+}

+ 2 - 1
benyun-core/src/test/java/com/benyun/core/service/BrandServiceImplTest.java

@@ -70,6 +70,7 @@ public class BrandServiceImplTest {
 
     @Test
     public void searchListByMultiTest(){
+        String userId = "1";
         BrandListQueryBody body = new BrandListQueryBody();
         body.setText("益禾堂");
         List<String> industryCode = new ArrayList<>();
@@ -90,7 +91,7 @@ public class BrandServiceImplTest {
         body.setOrderBy("check_first_time");
         body.setPageNum(1);
         body.setPageSize(10);
-        PageInfo<List<BrandSearch>> list = brandService.searchListByMulti(body);
+        PageInfo<List<BrandSearch>> list = brandService.searchListByMulti(body,userId);
         System.out.println(list);
     }
 

+ 45 - 0
benyun-core/src/test/java/com/benyun/core/service/BusinessOpportunitiesServiceImplTest.java

@@ -0,0 +1,45 @@
+package com.benyun.core.service;
+
+import com.benyun.core.entity.bo.BusinessOpportunitiesClueBo;
+import com.benyun.core.entity.bo.FollowUpRecordBo;
+import com.benyun.core.entity.vo.AddFollowRecordVo;
+import com.benyun.core.entity.vo.WorkTableSearchVo;
+import com.github.pagehelper.PageInfo;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class BusinessOpportunitiesServiceImplTest {
+    @Autowired
+    BusinessOpportunitiesService businessOpportunitiesService;
+
+    @Test
+    public void searchListTest(){
+        WorkTableSearchVo vo = new WorkTableSearchVo();
+        vo.setText("1");
+        PageInfo<List<BusinessOpportunitiesClueBo>> info = businessOpportunitiesService.searchList(vo, null);
+        System.out.println(info);
+    }
+
+    @Test
+    public void searchFollowListTest(){
+        WorkTableSearchVo vo = new WorkTableSearchVo();
+        vo.setText("1");
+        vo.setClueId("2");
+        PageInfo<List<FollowUpRecordBo>> info = businessOpportunitiesService.searchFollowList(vo, null);
+        System.out.println(info);
+    }
+
+    @Test
+    public void addFollowTest(){
+        AddFollowRecordVo vo = new AddFollowRecordVo();
+        vo.setClueId("2");
+        vo.setContent("xxx");
+        vo.setPerson("李");
+        vo.setWay("线上电话");
+        System.out.println(businessOpportunitiesService.addFollow(vo, null));
+    }
+}

+ 26 - 0
benyun-core/src/test/java/com/benyun/core/service/DatabackServiceImplTest.java

@@ -0,0 +1,26 @@
+package com.benyun.core.service;
+
+import com.benyun.core.entity.bo.AttentionPoolStatisticsBo;
+import org.junit.jupiter.api.Test;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.test.context.SpringBootTest;
+
+import java.util.List;
+
+@SpringBootTest
+public class DatabackServiceImplTest {
+    @Autowired
+    DatabackService databackService;
+
+    @Test
+    public void searchAboutTest(){
+        AttentionPoolStatisticsBo bo = databackService.searchAbout(null);
+        System.out.println(bo);
+    }
+
+    @Test
+    public void searchTrandTest(){
+        List<AttentionPoolStatisticsBo> bos = databackService.searchTrand(null);
+        System.out.println(bos);
+    }
+}