EntmicroStaffServiceTest.java
11.1 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
package cn.com.glsx.entmicro.service;
import cn.com.glsx.entmicro.Main;
import cn.com.glsx.entmicro.entity.EntmicroStaff;
import cn.com.glsx.entmicro.entity.EntmicroStaffDepartRelation;
import cn.com.glsx.entmicro.model.request.*;
import cn.com.glsx.entmicro.model.request.wechatcloudcontrol.login.WechatDepositRequest;
import cn.com.glsx.entmicro.model.response.DictDataResponse;
import cn.com.glsx.entmicro.model.response.EntmicroStaffResponse;
import cn.com.glsx.framework.core.beans.rpc.RpcPagination;
import com.alibaba.fastjson.JSONObject;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.util.CollectionUtils;
import java.util.*;
import java.util.stream.Collectors;
/**
* @author Lichongyuan
* @Description:
* @date 2021/9/18 14:54
*/
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = Main.class)
public class EntmicroStaffServiceTest {
@Autowired
private EntmicroStaffService entmicroStaffService;
@Autowired
private MerchantService merchantService;
@Test
public void findStaffDetailListTest(){
ArrayList<StaffRequestDTO> list = new ArrayList<>();
StaffRequestDTO requestDTO = new StaffRequestDTO();
requestDTO.setStaffPhone("13825207633");
requestDTO.setMerchantId(44210895);
list.add(requestDTO);
StaffRequestDTO requestDTO1 = new StaffRequestDTO();
requestDTO1.setStaffPhone("18269441763");
requestDTO1.setMerchantId(44210895);
list.add(requestDTO1);
System.out.println(entmicroStaffService.findStaffDetailList(list));
}
@Test
public void saveEntmicroStaff() {
EntmicroStaff entmicroStaff = new EntmicroStaff();
entmicroStaff.setStaffName("马邦德");
entmicroStaff.setDepartmentId("14");
entmicroStaff.setEntmicroName("马邦德企微");
entmicroStaff.setIsAddOutsider((byte) 1);
entmicroStaff.setMerchantid(10087);
entmicroStaff.setOpenUserid("AiJiuZaiYiQi");
entmicroStaff.setStaffTitle("县长");
entmicroStaff.setStaffEmail("qq@didihu.com");
entmicroStaff.setStaffPhone("6666666666");
entmicroStaff.setUserId("AiJiuZaiYiQi");
entmicroStaffService.saveEntmicroStaff(entmicroStaff, true);
}
@Test
public void updateEntmicroStaff() {
EntmicroStaff entmicroStaff = new EntmicroStaff();
entmicroStaff.setStaffName("ZhuanChiHouMianBaoShuDeMianYang");
entmicroStaff.setUserId("ZhuanChiHouMianBaoShuDeMianYang");
entmicroStaff.setMerchantid(44211000);
entmicroStaff.setStaffPhone("15099944620");
entmicroStaff.setDelFlag((byte) 0);
EntmicroStaffDepartRelation entmicroStaffDepartRelation = new EntmicroStaffDepartRelation();
entmicroStaffDepartRelation.setDepartmentId(5487);
entmicroStaffDepartRelation.setRelevanceMerchant(44211000);
entmicroStaffDepartRelation.setStaffPhone("15099944620");
entmicroStaff.setEntmicroStaffDepartRelationList(Arrays.asList(entmicroStaffDepartRelation));
entmicroStaffService.updateEntmicroStaff(entmicroStaff, true);
}
@Test
public void deleteEntmicroStaff() {
EntmicroStaff entmicroStaff = new EntmicroStaff();
entmicroStaff.setId(1);
entmicroStaffService.deleteEntmicroStaff(entmicroStaff);
}
@Test
public void syncEntmicroStaff() {
entmicroStaffService.syncEntmicroStaff(44209636, true, null, true);
}
@Test
public void findAllByDictType() {
Map<Integer, String> homeownerTypeMap = new HashMap<>();
List<DictDataResponse> businessTypeList = merchantService.findAllByDictType("homeowner_type");
if (!CollectionUtils.isEmpty(businessTypeList)) {
homeownerTypeMap = businessTypeList.stream().collect(Collectors.toMap(DictDataResponse::getDictValue, DictDataResponse::getDictLabel));
}
System.out.println("homeowner_type============" + homeownerTypeMap);
}
@Test
public void syncIsAddOutSiderStaffList() {
entmicroStaffService.syncIsAddOutSiderStaffList(10001001);
}
@Test
public void listIsAddOutsiderStaff() {
EntmicroStaffRequest entmicroStaffRequest = new EntmicroStaffRequest();
entmicroStaffRequest.setMerchantId(10001001);
System.out.println(entmicroStaffService.listIsAddOutsiderStaff(entmicroStaffRequest));
}
@Test
public void findFollowStaff() {
StaffRequestDTO entmicroStaffRequest = new StaffRequestDTO();
entmicroStaffRequest.setMerchantId(44210685);
System.out.println(entmicroStaffService.findFollowStaff(entmicroStaffRequest));
}
@Test
public void findStaffDetail() {
StaffRequestDTO entmicroStaffRequest = new StaffRequestDTO();
entmicroStaffRequest.setUserUuid("e795f0f1bf6d4e0c80cc28b11441732c");
System.out.println(entmicroStaffService.findStaffDetail(entmicroStaffRequest));
}
@Test
public void findStaffDetailById() {
System.out.println(entmicroStaffService.findStaffDetailById(221));
}
@Test
public void findlistEntmicroStaff() {
EntmicroStaffRequest entmicroStaffRequest = new EntmicroStaffRequest();
// entmicroStaffRequest.setMerchantId(44209572);
entmicroStaffRequest.setMerchantId(10001001);
System.out.println(entmicroStaffService.findlistEntmicroStaff(entmicroStaffRequest));
}
@Test
public void getByUserId() {
List<String> strings = new ArrayList<>();
strings.add("wo219ICgAA647DIvukNDtse-KkLDbaxw");
strings.add("wo219ICgAARmf0Sn3PrwLJWnE3tQpAbQ");
strings.add("Mao1");
strings.add("wo219ICgAAhaMGjPKv60wMpHxU88WdJg");
strings.add("linlong");
strings.add("WangXinWei");
entmicroStaffService.getIdsByUserIds(strings, 10001001);
}
@Test
public void getStaffListByIds() {
List<Integer> ids = new ArrayList<>();
ids.add(221);
ids.add(223);
List<EntmicroStaffResponse> staffList = entmicroStaffService.findStaffByStaffId(ids);
System.out.println("===" + JSONObject.toJSONString(staffList));
}
@Test
public void findLordGroup() {
LordCustomerGroupRequest lordCustomerGroupRequest = new LordCustomerGroupRequest();
lordCustomerGroupRequest.setMerchantId(44210688);
lordCustomerGroupRequest.setLordName("羊羊");
List<EntmicroStaffResponse> staffList = entmicroStaffService.findLordGroup(lordCustomerGroupRequest);
System.out.println("===" + JSONObject.toJSONString(staffList));
}
@Test
public void findStaffByMerchantId() {
EntmicroStaffRequest entmicroStaffRequest = new EntmicroStaffRequest();
entmicroStaffRequest.setMerchantId(44209846);
// entmicroStaffRequest.setStaffPhone("13476670746");
System.out.println(entmicroStaffService.findStaffByMerchantId(entmicroStaffRequest));
}
@Test
public void findStaffDetailByUserIds() {
EntmicroStaffRequest entmicroStaffRequest = new EntmicroStaffRequest();
entmicroStaffRequest.setMerchantId(44209846);
System.out.println(entmicroStaffService.findStaffDetailByUserIds(Arrays.asList("YuanLaiShiNi"), 44209846));
}
@Test
public void findStaffDetailByIds() {
System.out.println(entmicroStaffService.findStaffDetailByIds(null, "杨北旺"));
}
@Test
public void findHavingCustomer() {
System.out.println(entmicroStaffService.findHavingCustomer(44209846, true));
}
@Test
public void getEntmicroByBusinessType() {
List<EntmicroStaffResponse> entmicroByBusinessType = entmicroStaffService.getEntmicroByBusinessType("1,2,3", 44209846);
System.out.println(entmicroByBusinessType);
}
@Test
public void updateStaffSensitiveInfo() {
UpdateStaffSensitiveInfoRequest updateStaffSensitiveInfoRequest = new UpdateStaffSensitiveInfoRequest();
updateStaffSensitiveInfoRequest.setUserid("stupidz.");
updateStaffSensitiveInfoRequest.setMobile("17750020170");
updateStaffSensitiveInfoRequest.setEmail("1140616420@qq.com");
updateStaffSensitiveInfoRequest.setMerchantId(44209846);
entmicroStaffService.updateStaffSensitiveInfo(updateStaffSensitiveInfoRequest);
}
@Test
public void findMerchantStartStaff() {
MerchantStartStaffRequest updateStaffSensitiveInfoRequest = new MerchantStartStaffRequest();
updateStaffSensitiveInfoRequest.setMerchantId(44209846);
// updateStaffSensitiveInfoRequest.setOpenJoinFlag(true);
List<EntmicroStaffResponse> merchantStartStaff = entmicroStaffService.findMerchantStartStaff(updateStaffSensitiveInfoRequest);
System.out.println(merchantStartStaff);
}
@Test
public void wechatDepositList() {
RpcPagination<WechatDepositRequest> wechatDepositRequestRpcPagination=new RpcPagination<WechatDepositRequest>();
wechatDepositRequestRpcPagination.setPageNum(1);
wechatDepositRequestRpcPagination.setPageSize(10);
WechatDepositRequest wechatDepositRequest=new WechatDepositRequest();
wechatDepositRequest.setEntmicroName("");
wechatDepositRequest.setLoginStatus(null);
wechatDepositRequest.setStaffPhone("");
wechatDepositRequestRpcPagination.setCondition(wechatDepositRequest);
RpcPagination<EntmicroStaffResponse> entmicroStaffResponseRpcPagination = entmicroStaffService.wechatDepositList(wechatDepositRequestRpcPagination);
System.out.println(entmicroStaffResponseRpcPagination.getList());
}
@Test
public void wechatDepositNotAccessList() {
RpcPagination<WechatDepositRequest> wechatDepositRequestRpcPagination=new RpcPagination<WechatDepositRequest>();
wechatDepositRequestRpcPagination.setPageNum(1);
wechatDepositRequestRpcPagination.setPageSize(10);
WechatDepositRequest wechatDepositRequest=new WechatDepositRequest();
wechatDepositRequest.setEntmicroName("");
wechatDepositRequest.setLoginStatus(null);
wechatDepositRequest.setStaffPhone("");
wechatDepositRequestRpcPagination.setCondition(wechatDepositRequest);
RpcPagination<EntmicroStaffResponse> entmicroStaffResponseRpcPagination = entmicroStaffService.wechatDepositNotAccessList(wechatDepositRequestRpcPagination);
System.out.println(entmicroStaffResponseRpcPagination.getList());
}
@Test
public void findResidentEntmicroStaff() {
List<EntmicroStaffResponse> entmicroStaffResponseRpcPagination = entmicroStaffService.findResidentEntmicroStaff(44210895,44211025);
System.out.println(entmicroStaffResponseRpcPagination);
}
@Test
public void findStaffListByTopMerchantIdTest(){
EntmicroStaffRequest request = new EntmicroStaffRequest();
request.setMerchantId(44209565);
List<EntmicroStaffResponse> listByTopMerchantId = entmicroStaffService.findStaffListByTopMerchantId(request);
System.out.println(listByTopMerchantId);
System.out.println(listByTopMerchantId.get(0).getMerchantId());
}
}