PoolController.java
8.73 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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
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.CustomerCluePoolQueryVO;
import cn.fw.valhalla.domain.query.FollowPoolQueryVO;
import cn.fw.valhalla.domain.query.SecretReportHistoryQuery;
import cn.fw.valhalla.domain.query.StammkundePoolQueryVO;
import cn.fw.valhalla.domain.vo.SecretReportHistoryVO;
import cn.fw.valhalla.domain.vo.follow.FollowDetailVO;
import cn.fw.valhalla.domain.vo.pool.*;
import cn.fw.valhalla.service.bus.follow.FollowBizService;
import cn.fw.valhalla.service.bus.follow.PoolBizService;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
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 : StammkundePoolController
* @description : 保有客池
* @date: 2020-11-11 17:26
*/
@Slf4j
@RestController
@Authorization(AuthType.APP)
@RequiredArgsConstructor
@Validated
@RequestMapping("/app/pool")
public class PoolController {
private final PoolBizService poolBizService;
private final 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 = poolBizService.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 = poolBizService.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("/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);
}
}
@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 = poolBizService.publicList(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, e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/stammkunde/own/list")
public Message<AppPage<StammkundePoolVO>> ownStammkundeList(@CurrentUser LoginAuthBean currentUser, final StammkundePoolQueryVO queryVO) {
final String msg = "查询自己的保有客池列表[pool/stammkunde/own/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
AppPage<StammkundePoolVO> page = poolBizService.stammkundeList(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, e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/stammkunde/list")
@IgnoreAuth
public Message<AppPage<StammkundePoolVO>> stammkundeList(@CurrentUser LoginAuthBean currentUser, final StammkundePoolQueryVO queryVO) {
final String msg = "查询保有客池列表[pool/stammkunde/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
queryVO.setGroupId(currentUser.getGroupId());
AppPage<StammkundePoolVO> page = poolBizService.stammkundeList(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, e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/clue/list")
@IgnoreAuth
public Message<AppPage<CustomerCluePoolVO>> clueList(@CurrentUser LoginAuthBean currentUser, final CustomerCluePoolQueryVO queryVO) {
final String msg = "查询客户线索池列表[pool/clue/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
queryVO.setGroupId(currentUser.getGroupId());
AppPage<CustomerCluePoolVO> page = poolBizService.clueList(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("/clue/summary")
@IgnoreAuth
public Message<CustomerClueSummaryVO> clueSummary(@CurrentUser LoginAuthBean currentUser, final CustomerCluePoolQueryVO queryVO) {
final String msg = "查询客户线索池概况[pool/clue/summary]";
try {
log.info("{}: param[{}]", msg, queryVO);
queryVO.setGroupId(currentUser.getGroupId());
return success(poolBizService.summary(queryVO), data -> log.info("summary: {}", JSONObject.toJSONString(data)));
} catch (Exception ex) {
handleException(ex, e -> log.error("{}失败:param[{}]", msg, queryVO.getType(), e));
return failureWithMessage(QUERY_FAILURE);
}
}
@GetMapping("/secret/report/list")
@IgnoreAuth
public Message<AppPage<SecretReportHistoryVO>> reportList(@CurrentUser LoginAuthBean currentUser, final SecretReportHistoryQuery queryVO) {
final String msg = "查询智能通话记录池列表[pool/clue/list]";
try {
log.info("{}: param[{}]", msg, queryVO);
queryVO.setGroupId(currentUser.getGroupId());
AppPage<SecretReportHistoryVO> page = poolBizService.secretReportList(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.getTaskType(), e));
return failureWithMessage(QUERY_FAILURE);
}
}
}