FollowPoolController.java
5.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
package cn.fw.valhalla.controller.app;
import cn.fw.common.page.AppPage;
import cn.fw.common.web.auth.LoginAuthBean;
import cn.fw.common.web.auth.annotation.CurrentUser;
import cn.fw.data.base.domain.common.Message;
import cn.fw.security.auth.client.annotation.Authorization;
import cn.fw.security.auth.client.annotation.IgnoreAuth;
import cn.fw.security.auth.client.enums.AuthType;
import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
import cn.fw.valhalla.domain.vo.customer.PublicPoolVO;
import cn.fw.valhalla.domain.vo.follow.FollowDetailVO;
import cn.fw.valhalla.domain.vo.follow.FollowPoolListVO;
import cn.fw.valhalla.service.bus.follow.FollowBizService;
import cn.fw.valhalla.service.bus.follow.FollowPoolBizService;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import lombok.extern.slf4j.Slf4j;
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 javax.validation.constraints.NotNull;
import static cn.fw.common.web.util.ExceptionHandler.handleException;
import static cn.fw.common.web.util.ResultBuilder.failureWithMessage;
import static cn.fw.common.web.util.ResultBuilder.success;
import static cn.fw.valhalla.common.constant.MessageStr.QUERY_FAILURE;
/**
* @author : kurisu
* @className : FollowPoolController
* @description : 跟进池控制器
* @date: 2020-09-23 14:24
*/
@Slf4j
@RestController
@Authorization(AuthType.APP)
@IgnoreAuth
@Validated
@RequestMapping("/app/pool")
public class FollowPoolController {
private final FollowPoolBizService followPoolBizService;
private final FollowBizService followBizService;
@Autowired
public FollowPoolController(final FollowPoolBizService followPoolBizService,
final FollowBizService followBizService) {
this.followPoolBizService = followPoolBizService;
this.followBizService = followBizService;
}
@GetMapping("/follow/own/list")
public Message<AppPage<FollowPoolListVO>> ownFollowList(@CurrentUser LoginAuthBean currentUser, final FollowPoolQueryVO queryVO) {
final String msg = "查询自己的跟进池列表[pool/own/follow/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
AppPage<FollowPoolListVO> page = followPoolBizService.followList(currentUser, queryVO);
return success(page, data -> log.info("dataSize: {}", CollectionUtils.isEmpty(data.getData()) ? 0 : data.getData().size()));
} catch (Exception ex) {
handleException(ex, e -> log.error("{}失败:param[{}]", msg, queryVO.getType(), e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/follow/list")
@IgnoreAuth
public Message<AppPage<FollowPoolListVO>> followList(@CurrentUser LoginAuthBean currentUser, final FollowPoolQueryVO queryVO) {
final String msg = "查询跟进池列表[pool/follow/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
queryVO.setGroupId(currentUser.getGroupId());
AppPage<FollowPoolListVO> page = followPoolBizService.followList(null, queryVO);
return success(page, data -> log.info("dataSize: {}", CollectionUtils.isEmpty(data.getData()) ? 0 : data.getData().size()));
} catch (Exception ex) {
handleException(ex, e -> log.error("{}失败:param[{}]", msg, queryVO.getType(), e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/public/list")
@IgnoreAuth
public Message<AppPage<PublicPoolVO>> publicList(@CurrentUser LoginAuthBean currentUser, final FollowPoolQueryVO queryVO) {
final String msg = "查询公共池列表[pool/public/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
queryVO.setGroupId(currentUser.getGroupId());
AppPage<PublicPoolVO> page = followPoolBizService.publicList(queryVO);
return success(page, data -> log.info("dataSize: {}", CollectionUtils.isEmpty(data.getData()) ? 0 : data.getData().size()));
} catch (Exception ex) {
handleException(ex, e -> log.error("{}失败:param[{}]", msg, queryVO.getType(), e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/follow/detail")
@IgnoreAuth
public Message<FollowDetailVO> detail(@NotNull(message = "跟进池id不能为空") final Long taskId) {
final String msg = "查询跟进池详情[pool/follow/detail]";
try {
log.info("{}: param[{}]", msg, taskId);
FollowDetailVO detailVO = followBizService.followPoolDetail(taskId);
return success(detailVO, data -> log.info("{}", data));
} catch (Exception ex) {
handleException(ex, e -> log.error("{}失败:param[{}]", msg, taskId, e));
return failureWithMessage(QUERY_FAILURE);
}
}
}