|
@@ -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("添加失败");
|
|
|
|
+ }
|
|
|
|
+}
|