BatchMomentController.java
2.92 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
package cn.com.glsx.entmicro.controller.wechatcloudcontrol;
import cn.com.glsx.entmicro.controller.BaseControllerTest;
import cn.com.glsx.entmicro.dto.wechatcloudcontrol.MomentAttachmentDTO;
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.remote.BatchMomentRemote;
import cn.com.glsx.entmicro.request.one.template.QyAttachmentVo;
import cn.com.glsx.entmicro.request.wechatcloudcontrol.batchmoment.BatchMomentCreateRopRequest;
import cn.com.glsx.entmicro.service.wechatcloudcontrol.BatchMomentService;
import cn.com.glsx.framework.core.beans.rpc.RpcResponse;
import com.alibaba.fastjson.JSON;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
/**
* @Author yelq
* @Version 1.0
* @Description:
* @Date 2022/9/20 15:38
*/
public class BatchMomentController extends BaseControllerTest {
@Autowired
private BatchMomentRemote batchMomentRemote;
@Resource
private BatchMomentService batchMomentService;
@Test
public void jsonTest01() throws Exception{
MomentAttachmentDTO dto = new MomentAttachmentDTO();
dto.setFileType(1);
dto.setFileSize(284766);
dto.setFileId("https://qcwx.glsx.com.cn/upload/biz/haibao002.jpg");
dto.setFileHeight(1024);
dto.setFileWidth(746);
dto.setVideoLength(48);
System.out.println(JSON.toJSONString(dto));
}
@Test
public void batchMomentSaveTest01() throws Exception{
BatchMomentCreateRpcRequest ropRequest = new BatchMomentCreateRpcRequest();
ropRequest.setSendType(1);
ropRequest.setStaffIds(Arrays.asList(277));
ropRequest.setTaskName("开发测试朋友圈群发");
ropRequest.setAttachmentList(createAttachment());
RpcResponse<Boolean> save = batchMomentRemote.batchMomentSave(ropRequest);
System.out.println(save);
}
private List<AttachmentRpcRequest> createAttachment() {
List<AttachmentRpcRequest> attachmentList = new ArrayList<>();
AttachmentRpcRequest vo1 = new AttachmentRpcRequest();
vo1.setAttContent("https://qcwx.glsx.com.cn/upload/biz/haibao002.jpg");
vo1.setAttType(1);
attachmentList.add(vo1);
AttachmentRpcRequest vo2 = new AttachmentRpcRequest();
vo2.setAttContent("{\"fileHeight\":1024,\"fileId\":\"https://qcwx.glsx.com.cn/upload/biz/haibao002.jpg\",\"fileSize\":284766,\"fileType\":1,\"fileWidth\":746,\"videoLength\":48}");
vo2.setAttType(2);
attachmentList.add(vo2);
// AttachmentRpcRequest vo3 = new AttachmentRpcRequest();
// vo3.setAttContent("hello");
// vo3.setAttType(1);
// attachmentList.add(vo3);
return attachmentList;
}
}