BatchMomentService.java
4.67 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
package cn.com.glsx.entmicro.service.wechatcloudcontrol;
import cn.com.glsx.entmicro.convert.ConvertRequest;
import cn.com.glsx.entmicro.convert.ConvertResponse;
import cn.com.glsx.entmicro.model.request.wechatcloudcontrol.batchmoment.AttachmentRpcRequest;
import cn.com.glsx.entmicro.model.request.wechatcloudcontrol.batchmoment.BatchMomentCreateRpcRequest;
import cn.com.glsx.entmicro.model.request.wechatcloudcontrol.batchmoment.BatchMomentQueryRpcRequest;
import cn.com.glsx.entmicro.model.request.wechatcloudcontrol.batchmoment.BatchMomentStaffRecordQueryRpcRequest;
import cn.com.glsx.entmicro.model.response.wechatcloudcontrol.batchmoment.BatchMomentRpcResponse;
import cn.com.glsx.entmicro.model.response.wechatcloudcontrol.batchmoment.BatchMomentStaffRecordRpcResponse;
import cn.com.glsx.entmicro.remote.BatchMomentRemote;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentCreateRopRequest;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentQueryRopRequest;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentStaffRecordQueryRopRequest;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmoment.BatchMomentRopResponse;
import cn.com.glsx.entmicro.response.wechatcloudcontrol.batchmoment.BatchMomentStaffRecordRopResponse;
import cn.com.glsx.entmicro.utils.Pagination;
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 lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* @Author yelq
* @Version 1.0
* @Description: 朋友圈群发
* @Date 2022/9/16 17:35
*/
@Service
@Slf4j
public class BatchMomentService {
@Autowired
private BatchMomentRemote batchMomentRemote;
/**
* 朋友圈群发任务创建
*
* @param ropRequest
* @return
*/
public Boolean batchMomentSave(BatchMomentCreateRopRequest ropRequest) {
BatchMomentCreateRpcRequest rpcRequest = ConvertRequest.convertRequest(ropRequest, new BatchMomentCreateRpcRequest());
if (ropRequest.getAttachmentList() != null && !ropRequest.getAttachmentList().isEmpty()) {
rpcRequest.setAttachmentList(ConvertRequest.convertListRequest(ropRequest.getAttachmentList(), AttachmentRpcRequest.class));
}
RpcResponse<Boolean> response = batchMomentRemote.batchMomentSave(rpcRequest);
if (response.isSuccess()) {
return response.getResult();
}
throw new RpcServiceException(response.getError(), response.getMessage());
}
/**
* 朋友圈群发任务多条件分页查询
*
* @param request
* @return
*/
public Pagination<BatchMomentRopResponse> batchMomentConditionPage(BatchMomentQueryRopRequest request) {
RpcPagination<BatchMomentQueryRpcRequest> pagination = ConvertRequest.convertPage(request, new BatchMomentQueryRpcRequest());
RpcResponse<RpcPagination<BatchMomentRpcResponse>> response = batchMomentRemote.batchMomentConditionPage(pagination);
if (response.isSuccess()) {
Pagination<BatchMomentRopResponse> res = ConvertResponse.convertPage(response.getResult(), BatchMomentRopResponse.class);
return res;
}
throw new RpcServiceException(response.getError(), response.getMessage());
}
/**
* 发送记录分页查询
*
* @param request
* @return
*/
public Pagination<BatchMomentStaffRecordRopResponse> batchMomentStaffRecordPage(BatchMomentStaffRecordQueryRopRequest request) {
RpcPagination<BatchMomentStaffRecordQueryRpcRequest> pagination = ConvertRequest.convertPage(request, new BatchMomentStaffRecordQueryRpcRequest());
RpcResponse<RpcPagination<BatchMomentStaffRecordRpcResponse>> response = batchMomentRemote.batchMomentStaffRecordPage(pagination);
if (response.isSuccess()) {
Pagination<BatchMomentStaffRecordRopResponse> res = ConvertResponse.convertPage(response.getResult(), BatchMomentStaffRecordRopResponse.class);
return res;
}
throw new RpcServiceException(response.getError(), response.getMessage());
}
/**
* 发送记录分页查询
*
* @param request
* @return
*/
public Boolean stopBatchMomentSend(BatchMomentStaffRecordQueryRopRequest request) {
RpcResponse<Boolean> response = batchMomentRemote.stopBatchMomentSend(request.getId());
if (response.isSuccess()) {
return response.getResult();
}
throw new RpcServiceException(response.getError(), response.getMessage());
}
}