Browse Source

数据看板
潜客池
商机线索

云殇忆 1 year ago
parent
commit
07c2c074c9
31 changed files with 958 additions and 0 deletions
  1. 126 0
      benyun-core/src/main/java/com/benyun/core/controller/WorkTableController.java
  2. 15 0
      benyun-core/src/main/java/com/benyun/core/dao/AttentionPoolDao.java
  3. 12 0
      benyun-core/src/main/java/com/benyun/core/dao/AttentionPoolStatisticsDao.java
  4. 16 0
      benyun-core/src/main/java/com/benyun/core/dao/BusinessOpportunitiesDao.java
  5. 16 0
      benyun-core/src/main/java/com/benyun/core/dao/FollowUpDao.java
  6. 32 0
      benyun-core/src/main/java/com/benyun/core/entity/AttentionPool.java
  7. 26 0
      benyun-core/src/main/java/com/benyun/core/entity/AttentionPoolStatistics.java
  8. 3 0
      benyun-core/src/main/java/com/benyun/core/entity/Brand.java
  9. 26 0
      benyun-core/src/main/java/com/benyun/core/entity/BusinessOpportunitiesClue.java
  10. 26 0
      benyun-core/src/main/java/com/benyun/core/entity/FollowUpRecord.java
  11. 16 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/AttentionPoolBo.java
  12. 14 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/AttentionPoolStatisticsBo.java
  13. 15 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/BusinessOpportunitiesClueBo.java
  14. 14 0
      benyun-core/src/main/java/com/benyun/core/entity/bo/FollowUpRecordBo.java
  15. 17 0
      benyun-core/src/main/java/com/benyun/core/entity/vo/AddFollowRecordVo.java
  16. 13 0
      benyun-core/src/main/java/com/benyun/core/entity/vo/TurnBusinessOpportunitiesVo.java
  17. 15 0
      benyun-core/src/main/java/com/benyun/core/entity/vo/WorkTableSearchVo.java
  18. 14 0
      benyun-core/src/main/java/com/benyun/core/service/AttentionPoolService.java
  19. 15 0
      benyun-core/src/main/java/com/benyun/core/service/BusinessOpportunitiesService.java
  20. 10 0
      benyun-core/src/main/java/com/benyun/core/service/DatabackService.java
  21. 79 0
      benyun-core/src/main/java/com/benyun/core/service/impl/AttentionPoolServiceImpl.java
  22. 80 0
      benyun-core/src/main/java/com/benyun/core/service/impl/BusinessOpportunitiesServiceImpl.java
  23. 56 0
      benyun-core/src/main/java/com/benyun/core/service/impl/DatabackServiceImpl.java
  24. 52 0
      benyun-core/src/main/resources/mapper/AttentionPoolMapper.xml
  25. 23 0
      benyun-core/src/main/resources/mapper/AttentionPoolStatisticsMapper.xml
  26. 2 0
      benyun-core/src/main/resources/mapper/BrandMapper.xml
  27. 53 0
      benyun-core/src/main/resources/mapper/BusinessOpportunitiesMapper.xml
  28. 62 0
      benyun-core/src/main/resources/mapper/FollowUpMapper.xml
  29. 39 0
      benyun-core/src/test/java/com/benyun/core/service/AttentionPoolServiceImplTest.java
  30. 45 0
      benyun-core/src/test/java/com/benyun/core/service/BusinessOpportunitiesServiceImplTest.java
  31. 26 0
      benyun-core/src/test/java/com/benyun/core/service/DatabackServiceImplTest.java

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

@@ -0,0 +1,126 @@
+package com.benyun.core.controller;
+
+import com.benyun.core.entity.bo.AttentionPoolBo;
+import com.benyun.core.entity.bo.AttentionPoolStatisticsBo;
+import com.benyun.core.entity.bo.FollowUpRecordBo;
+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 = null;
+//        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 = null;
+//        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 = null;
+//        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 = null;
+//        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 = null;
+//        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 = null;
+//        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 = null;
+//        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 = null;
+//        if (userId == null || userId.equals(""))
+//            return R.fail("请登录");
+        int flag = businessOpportunitiesService.addFollow(addVo, userId);
+        if (flag == 1)
+            return R.ok("添加成功!");
+        return R.fail("添加失败");
+    }
+}

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

@@ -0,0 +1,15 @@
+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);
+}

+ 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_poll")
+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;
+}

+ 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;
+}

+ 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;
+}

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

@@ -0,0 +1,14 @@
+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);
+}

+ 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);
+}

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

@@ -0,0 +1,79 @@
+package com.benyun.core.service.impl;
+
+import com.benyun.core.dao.AttentionPoolDao;
+import com.benyun.core.dao.BusinessOpportunitiesDao;
+import com.benyun.core.dao.FollowUpDao;
+import com.benyun.core.entity.AttentionPool;
+import com.benyun.core.entity.BusinessOpportunitiesClue;
+import com.benyun.core.entity.FollowUpRecord;
+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;
+
+    @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);
+    }
+}

+ 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;
+    }
+}

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

@@ -0,0 +1,52 @@
+<?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>
+    <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>
+</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>

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

@@ -0,0 +1,39 @@
+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"));
+    }
+}

+ 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);
+    }
+}