StrategyInfoController.java
16.5 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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
package cn.com.glsx.dj.strategy.controller;
import cn.com.glsx.dj.mindworkplate.dto.ConversationBatchDTO;
import cn.com.glsx.dj.mindworkplate.model.warning.LearningEffectAnalysisDTO;
import cn.com.glsx.dj.mindworkplate.model.warning.LearningEffectAnalysisRequest;
import cn.com.glsx.dj.mindworkplate.remote.MonitoringRemote;
import cn.com.glsx.dj.smartcarlife.dto.LoginUserDTO;
import cn.com.glsx.dj.smartcarlife.dto.StaffInfoDTO;
import cn.com.glsx.dj.smartcarlife.remote.StaffInfoRemote;
import cn.com.glsx.dj.strategy.dto.BatchInsertStrategyInfo;
import cn.com.glsx.dj.strategy.dto.MerchantBusinessInfo;
import cn.com.glsx.dj.strategy.dto.MerchantBusinessOverview;
import cn.com.glsx.dj.strategy.dto.ShopMerchantOperatorReqDTO;
import cn.com.glsx.dj.strategy.dto.ShopMerchantOperatorRespDTO;
import cn.com.glsx.dj.strategy.enums.StrategyDataSourceEnum;
import cn.com.glsx.dj.strategy.model.StrategyInfo;
import cn.com.glsx.dj.strategy.remote.StrategyInfoRemote;
import cn.com.glsx.dj.strategy.request.*;
import cn.com.glsx.dj.strategy.uitl.CommonUtil;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import cn.com.glsx.framework.core.exception.RpcServiceException;
import cn.com.glsx.framework.rop.response.RopResponse;
import com.rop.annotation.IgnoreSignType;
import com.rop.annotation.NeedInSessionType;
import com.rop.annotation.ServiceMethod;
import com.rop.annotation.ServiceMethodBean;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import java.util.List;
@Slf4j
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
@Api("策略中心-策略信息")
public class StrategyInfoController {
@Autowired
private StrategyInfoRemote strategyInfoRemote;
@Autowired
private StaffInfoRemote staffInfoRemote;
@Autowired
private MonitoringRemote monitoringRemote;
@ApiOperation("策略分页列表")
@ServiceMethod(method = "dj.api.strategy.info.page", needInSession = NeedInSessionType.NO, ignoreSign = IgnoreSignType.YES)
public RopResponse<RpcPagination<StrategyInfo>> strategyInfoPage(StaffInfoPageRequest request) {
try {
RpcPagination<StrategyInfo> pagination = CommonUtil.getRpcPagination(StrategyInfo.class);
RpcResponse<RpcPagination<StrategyInfo>> response = strategyInfoRemote.selectStrategyInfoPage(pagination);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (Exception e) {
log.error("=====dj.api.strategy.info.page exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("创建策略")
@ServiceMethod(method = "dj.api.strategy.info.batch.create")
public RopResponse<Boolean> batchCreate(BatchInsertStrategyInfoRequest request) {
try {
BatchInsertStrategyInfo batchInsertStrategyInfo = CommonUtil.convertRequest(BatchInsertStrategyInfo.class);
LoginUserDTO loginUser = CommonUtil.getLoginUser();
//String accountName = loginUser.getLoginAccout();
batchInsertStrategyInfo.setCreatedBy(loginUser.getUserName());
batchInsertStrategyInfo.setCreatedUUid(loginUser.getUuid());
batchInsertStrategyInfo.getStrategyInfo().setDataSource(StrategyDataSourceEnum.STRATEGY_CENTER.getValue());
RpcResponse<Boolean> response = strategyInfoRemote.batchCreate(batchInsertStrategyInfo);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.info.batch.create rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.info.batch.create exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("删除策略")
@ServiceMethod(method = "dj.api.strategy.info.delete")
public RopResponse<Boolean> delete(DeleteStrategyRequest request) {
try {
String accountName = CommonUtil.getAccountName();
StrategyInfo strategyInfo = CommonUtil.convertRequest(StrategyInfo.class);
strategyInfo.setUpdatedBy(accountName);
RpcResponse<Boolean> response = strategyInfoRemote.delete(strategyInfo);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.info.delete rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.info.delete exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("查询驻店员工/区域运营/飞行督导列表")
@ServiceMethod(method = "dj.api.strategy.staff.page")
public RopResponse<RpcPagination<StaffInfoDTO>> listStaffWithPage(StaffInfoSearchRequest request) {
try {
RpcPagination<StaffInfoDTO> pagination = CommonUtil.getRpcPagination(StaffInfoDTO.class);
RpcResponse<RpcPagination<StaffInfoDTO>> response = staffInfoRemote.listMultipleRolesStaffWithPage(pagination);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.staff.page rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.staff.page exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("查询驻店员工(已按手机号去重)")
@ServiceMethod(method = "dj.api.strategy.staff.page.distinct.phone")
public RopResponse<RpcPagination<StaffInfoDTO>> listStaffWithPageDistinctPhone(StaffInfoSearchRequest request) {
try {
RpcPagination<StaffInfoDTO> pagination = CommonUtil.getRpcPagination(StaffInfoDTO.class);
RpcResponse<RpcPagination<StaffInfoDTO>> response = staffInfoRemote.listStaffWithPageDistinctPhone(pagination);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.staff.page.distinct.phone rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.staff.page.distinct.phone exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("查询门店展业时间线")
@ServiceMethod(method = "dj.api.strategy.merchant.timeline")
public RopResponse<MerchantBusinessOverview> listStrategyMerchantTimeline(MerchantBusinessRequest request) {
try {
MerchantBusinessInfo merchantBusinessInfo = CommonUtil.convertRequest(MerchantBusinessInfo.class);
RpcResponse<MerchantBusinessOverview> response = strategyInfoRemote.listStrategyMerchantTimeline(merchantBusinessInfo);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
/*MerchantBusinessOverview result = response.getResult();
List<StrategyMerchantTimelineTest> collect = result.getTimelineList().stream().map(el -> {
StrategyMerchantTimelineTest strategyMerchantTimelineTest = BeanUtil.copyProperties(el, StrategyMerchantTimelineTest.class);
strategyMerchantTimelineTest.setNodeDateStr(DateUtil.format(strategyMerchantTimelineTest.getNodeDate(), DatePattern.NORM_DATE_PATTERN));
strategyMerchantTimelineTest.setNoteTypeStr(MerchantNodeTypeEnum.getDisplayName(el.getNodeType()));
return strategyMerchantTimelineTest;
}).collect(Collectors.toList());
log.info("时间线{}", JSONUtil.toJsonStr(collect));*/
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.merchant.timeline rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.merchant.timeline exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("停止门店展业")
@ServiceMethod(method = "dj.api.strategy.merchant.stop.business")
public RopResponse<Boolean> stopMerchantBusiness(MerchantBusinessRequest request) {
try {
MerchantBusinessInfo merchantBusinessInfo = CommonUtil.convertRequest(MerchantBusinessInfo.class);
String accountName = CommonUtil.getAccountName();
merchantBusinessInfo.setUpdatedBy(accountName);
RpcResponse<Boolean> response = strategyInfoRemote.stopMerchantBusiness(merchantBusinessInfo);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.merchant.stop.business rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.merchant.stop.business exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("查询策略详情(学习、课程、带教申请、协同类策略:人员更换评估/商务政策更新评估/多品类拓张/流量问题改善)")
@ServiceMethod(method = "dj.api.strategy.info.queryStrategyInfoById",needInSession = NeedInSessionType.YES)
public RopResponse<StrategyInfo> queryStrategyInfoById(StrategyInfoQueryRequest request) {
try {
RpcResponse<StrategyInfo> response = strategyInfoRemote.queryStrategyInfoById(request.getId());
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.info.queryStrategyInfoById rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.info.queryStrategyInfoById exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("策略中心-策略详细-查询录音记录概览(学习前后传状态)")
@ServiceMethod(method = "dj.api.strategy.monitor.findRecordStaticByCondition", needInSession = NeedInSessionType.YES)
public RopResponse<ConversationBatchDTO> findRecordStaticByCondition(
LearningEffectAnalysisRecordRopRequest req) {
try {
LearningEffectAnalysisRequest request = CommonUtil.convertRequest(LearningEffectAnalysisRequest.class);
RpcResponse<ConversationBatchDTO> response = monitoringRemote.findRecordStaticByCondition(request);
if (response.isSuccess()) {
return RopResponse.success(response.getResult());
}
return RopResponse.error(response.getMessage());
} catch (Exception e) {
log.error("接口异常", e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("策略中心-策略详细-查询录音记录")
@ServiceMethod(method = "dj.api.strategy.monitor.getRecordPageListByCondition", needInSession = NeedInSessionType.YES)
public RopResponse<RpcPagination<ConversationBatchDTO>> getRecordPageListByCondition(
LearningEffectAnalysisRecordPageRopRequest request) {
try {
RpcPagination<LearningEffectAnalysisRequest> pagination = CommonUtil.getRpcPagination(LearningEffectAnalysisRequest.class);
RpcResponse<RpcPagination<ConversationBatchDTO>> response = monitoringRemote.getRecordPageListByCondition(pagination);
if (response.isSuccess()) {
return RopResponse.success(response.getResult());
}
return RopResponse.error(response.getMessage());
} catch (Exception e) {
log.error("接口异常", e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("策略中心-选择策略录音记录")
@ServiceMethod(method = "dj.api.strategy.monitor.getRecordAllPageListByCondition", needInSession = NeedInSessionType.YES)
public RopResponse<RpcPagination<ConversationBatchDTO>> getRecordAllPageListByCondition(LearningRecordRopRequest req) {
try {
RpcPagination<LearningEffectAnalysisRequest> pagination = CommonUtil.getRpcPagination(LearningEffectAnalysisRequest.class);
RpcResponse<RpcPagination<ConversationBatchDTO>> response = monitoringRemote.getRecordPageListByCondition(pagination);
if (response.isSuccess()) {
return RopResponse.success(response.getResult());
}
return RopResponse.error(response.getMessage());
} catch (Exception e) {
log.error("接口异常", e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("策略中心-策略详细查询学习前后的指标")
@ServiceMethod(method = "dj.api.strategy.monitor.findLearningEffectAnalysis", needInSession = NeedInSessionType.YES)
public RopResponse<LearningEffectAnalysisDTO> findLearningEffectAnalysis(LearningEffectAnalysisZbRopRequest req) {
try {
LearningEffectAnalysisRequest request = CommonUtil.convertRequest(LearningEffectAnalysisRequest.class);
RpcResponse<LearningEffectAnalysisDTO> response = monitoringRemote.findLearningEffectAnalysis(request);
if (response.isSuccess()) {
return RopResponse.success(response.getResult());
}
return RopResponse.error(response.getMessage());
} catch (Exception e) {
log.error("接口异常", e);
return RopResponse.error(e.getMessage());
}
}
@ApiOperation("查询当前门店+业务下的全部区域运营")
@ServiceMethod(method = "dj.api.strategy.shop.merchant.operators", needInSession = NeedInSessionType.NO, ignoreSign = IgnoreSignType.YES)
public RopResponse<List<ShopMerchantOperatorRespDTO>> listShopMerchantOperators(ShopMerchantOperatorRequest request) {
try {
ShopMerchantOperatorReqDTO reqDTO = CommonUtil.convertRequest(ShopMerchantOperatorReqDTO.class);
RpcResponse<List<ShopMerchantOperatorRespDTO>> response = strategyInfoRemote.listShopMerchantOperators(reqDTO);
if (response.hasError()) {
log.error(response.getMessage());
return RopResponse.error(response.getError(), response.getMessage());
}
return RopResponse.success(response.getResult());
} catch (RpcServiceException e) {
log.error("=====dj.api.strategy.shop.merchant.operators rpcServiceException:{}", e.getMessage());
return RopResponse.error(e);
} catch (Exception e) {
log.error("=====dj.api.strategy.shop.merchant.operators exception:{}", e.getMessage(), e);
return RopResponse.error(e.getMessage());
}
}
}