BatchMessagingController.java
9.19 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
package cn.com.glsx.entmicro.controller.wechatcloudcontrol;
import cn.com.glsx.entmicro.dto.activityreport.ScrmActivityReportLogDTO;
import cn.com.glsx.entmicro.model.response.wechatcloudcontrol.batchmessaging.BatchMessagingGroupResponse;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.ActivityReportLog.ActivityReportLogSearchRopRequest;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmessaging.*;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmessaging.BatchMessagingMerchantVO;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmessaging.BatchMessagingRecordVO;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmessaging.BatchMessagingRecordOfSendVO;
import cn.com.glsx.entmicro.service.wechatcloudcontrol.BatchMessagingService;
import cn.com.glsx.entmicro.utils.Pagination;
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 cn.com.glsx.worktool.model.response.ScrmWorktoolGroupResponse;
import cn.com.glsx.worktool.remote.GroupRemote;
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.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.env.Environment;
import javax.annotation.Resource;
import java.util.List;
/**
* @author chizw
* @version ver.1.0.0
* @Description
* @create 2022/9/19 15:06
*/
@Slf4j
@Api("企微接入 - 企微群发")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
public class BatchMessagingController {
@Resource
private BatchMessagingService batchMessagingService;
@Autowired
private GroupRemote groupRemote;
@Autowired
private Environment env;
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.nosession.batchmessaging.create", needInSession = NeedInSessionType.NO)
@ApiOperation("企微高级群发任务创建")
public RopResponse<Boolean> createBatchMessagingNoSessionTask(BatchMessagingCreateRopRequest request) {
try {
return RopResponse.success(batchMessagingService.createBatchMessagingTask(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_createBatchMessagingTask_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.create")
@ApiOperation("企微高级群发任务创建")
public RopResponse<Boolean> createBatchMessagingTask(BatchMessagingCreateRopRequest request) {
try {
return RopResponse.success(batchMessagingService.createBatchMessagingTask(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_createBatchMessagingTask_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.customercount")
@ApiOperation("企微高级群发查看预计群发人数")
public RopResponse<Integer> estimateCustomerCount(BatchMessagingCreateRopRequest request) {
try {
return RopResponse.success(batchMessagingService.getEstimateCustomerCount(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_estimateCustomerCount_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.create.merchant")
@ApiOperation("企微高级群发创建门店列表")
public RopResponse<List<BatchMessagingMerchantVO>> queryBatchMessagingCreateMerchant(BatchMessagingMerchantRopRequest request) {
try {
return RopResponse.success(batchMessagingService.findBatchMessagingMerchantList(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_queryBatchMessagingCreateMerchant_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.record")
@ApiOperation("企微高级群发记录")
public RopResponse<Pagination<BatchMessagingRecordVO>> queryBatchMessagingRecord(BatchMessagingRecordRopRequest request) {
try {
return RopResponse.success(batchMessagingService.queryBatchMessaging(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_queryBatchMessagingRecord_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.record.send")
@ApiOperation("企微高级群发发送记录")
public RopResponse<Pagination<BatchMessagingRecordOfSendVO>> queryBatchMessagingRecordOfSend(BatchMessagingRecordOfSendRopRequest request) {
try {
return RopResponse.success(batchMessagingService.queryBatchMessagingOfSend(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_queryBatchMessagingRecordOfSend_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.group.list")
@ApiOperation("企微高级群聊列表")
public RopResponse<List<BatchMessagingGroupResponse>> getBatchMessagingGroupList(BatchMessagingUserRopRequest request) {
try {
return RopResponse.success(batchMessagingService.getBatchMessagingGroupList(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_getBatchMessagingGroupList_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.group.list.nosession", needInSession = NeedInSessionType.NO)
@ApiOperation("企微高级群聊列表")
public RopResponse<List<BatchMessagingGroupResponse>> getBatchMessagingGroupListNoSeesion(BatchMessagingUserRopRequest request) {
try {
return RopResponse.success(batchMessagingService.getBatchMessagingGroupList(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_getBatchMessagingGroupList_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.batchmessaging.send.stop")
@ApiOperation("群发记录停止发送")
public RopResponse<Boolean> stopBatchMessagingSend(BatchMessagingRecordOfSendRopRequest request) {
try {
return RopResponse.success(batchMessagingService.stopBatchMessagingSend(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_stopBatchMessagingSend_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.activityreport.log.page")
@ApiOperation("查询喜报战报推送日志分页列表")
public RopResponse<Pagination<ScrmActivityReportLogDTO>> getActivityReportLogPage(ActivityReportLogSearchRopRequest request) {
try {
return RopResponse.success(batchMessagingService.getActivityReportLogPage(request));
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_getActivityReportLogPage_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
@ServiceMethod(method = "entmicro.api.wechatcloudcontrol.activityreport.worktool.grouplist")
@ApiOperation("查询worktool群列表")
public RopResponse<RpcResponse<List<ScrmWorktoolGroupResponse>>> worktoolGroupList(WorkToolGroupListRopRequest workToolGroupListRopRequest) {
try {
RpcResponse<List<ScrmWorktoolGroupResponse>> groupResponse;
// 查询新版本喜报配置是否开启
String switchOpen = env.getProperty("dj.new.report.group.push.switch");
if (StringUtils.isNotEmpty(switchOpen) && "1".equals(switchOpen)){
groupResponse = batchMessagingService.getNewReportGroupList();
}else {
groupResponse = groupRemote.groupList(workToolGroupListRopRequest.getCloudId());
}
return RopResponse.success(groupResponse);
} catch (RpcServiceException e) {
log.info("=======BatchMessagingController_getActivityReportLogPage_invoke__exception:{}", e.getMessage());
return RopResponse.error(e.getErrId(), e.getMessage());
}
}
}