|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+package api.controller.system;
|
|
|
2
|
+
|
|
|
3
|
+import api.controller.BaseController;
|
|
|
4
|
+import api.entity.database.system.User;
|
|
|
5
|
+import api.entity.input.system.CustomerInput;
|
|
|
6
|
+import api.entity.input.system.OrderInput;
|
|
|
7
|
+import api.model.AjaxResult;
|
|
|
8
|
+import api.service.system.IUserService;
|
|
|
9
|
+import api.util.annotation.Anonymous;
|
|
|
10
|
+import api.util.annotation.Log;
|
|
|
11
|
+import api.util.enums.BusinessType;
|
|
|
12
|
+import api.util.helper.HttpHelper;
|
|
|
13
|
+import api.util.helper.SecretHelper;
|
|
|
14
|
+import api.util.helper.SpringHelper;
|
|
|
15
|
+import api.util.helper.StringHelper;
|
|
|
16
|
+import com.alibaba.fastjson2.JSON;
|
|
|
17
|
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
18
|
+import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
19
|
+import io.swagger.annotations.Api;
|
|
|
20
|
+import io.swagger.annotations.ApiOperation;
|
|
|
21
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
22
|
+import org.springframework.web.bind.annotation.*;
|
|
|
23
|
+
|
|
|
24
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
25
|
+import java.util.*;
|
|
|
26
|
+
|
|
|
27
|
+@Api(value = "微信和工单相关的", tags = "微信和工单相关的")
|
|
|
28
|
+@RestController
|
|
|
29
|
+@RequestMapping("/system/wxrelated")
|
|
|
30
|
+public class WxRelatedController extends BaseController {
|
|
|
31
|
+ @Autowired
|
|
|
32
|
+ private IUserService userService;
|
|
|
33
|
+ @ApiOperation("外部新增用户")
|
|
|
34
|
+ @Log(title = "外部新增用户", businessType = BusinessType.INSERT)
|
|
|
35
|
+ @PostMapping("/externaladd")
|
|
|
36
|
+ @Anonymous
|
|
|
37
|
+ public AjaxResult externaladd(@RequestBody User user,HttpServletRequest request) {
|
|
|
38
|
+
|
|
|
39
|
+
|
|
|
40
|
+ String uuid= request.getHeader("uuid");
|
|
|
41
|
+ String pass= request.getHeader("pass");
|
|
|
42
|
+
|
|
|
43
|
+ String md5str= SecretHelper.MD5("huawuxitong%@"+uuid);
|
|
|
44
|
+ if(!md5str.equals(pass)){
|
|
|
45
|
+ return Error("验证失败");
|
|
|
46
|
+ }
|
|
|
47
|
+
|
|
|
48
|
+ if (!userService.checkUserNameUnique(user)) {
|
|
|
49
|
+ return Error("新增用户'" + user.getUserName() + "'失败,登录账号已存在");
|
|
|
50
|
+ }
|
|
|
51
|
+ if (StringHelper.isEmpty(user.getPassword()))
|
|
|
52
|
+ return Error("请输入密码");
|
|
|
53
|
+ if (StringHelper.isEmpty(user.getUserName()))
|
|
|
54
|
+ return Error("请输入姓名");
|
|
|
55
|
+ if (StringHelper.isEmpty(user.getNickName()))
|
|
|
56
|
+ return Error("请输入工号");
|
|
|
57
|
+ user.setStatus("0");
|
|
|
58
|
+ user.setDelFlag("0");
|
|
|
59
|
+ user.setPassword(user.getPassword());
|
|
|
60
|
+ user.setCreateBy(user.getCreateBy());
|
|
|
61
|
+ user.setCreateTime(new Date());
|
|
|
62
|
+
|
|
|
63
|
+ boolean result = userService.insert(user);
|
|
|
64
|
+ if (result) {
|
|
|
65
|
+ return Success("新增成功");
|
|
|
66
|
+ } else {
|
|
|
67
|
+ return Error("新增失败");
|
|
|
68
|
+ }
|
|
|
69
|
+ }
|
|
|
70
|
+ @ApiOperation("外部新增用户list")
|
|
|
71
|
+ @Log(title = "外部新增用户list", businessType = BusinessType.INSERT)
|
|
|
72
|
+ @PostMapping("/externaladduserlist")
|
|
|
73
|
+ @Anonymous
|
|
|
74
|
+ public AjaxResult externaladduserlist(@RequestBody List<User> userlist,HttpServletRequest request) {
|
|
|
75
|
+
|
|
|
76
|
+
|
|
|
77
|
+ String uuid= request.getHeader("uuid");
|
|
|
78
|
+ String pass= request.getHeader("pass");
|
|
|
79
|
+
|
|
|
80
|
+ String md5str= SecretHelper.MD5("huawuxitong%@"+uuid);
|
|
|
81
|
+ if(!md5str.equals(pass)){
|
|
|
82
|
+ return Error("验证失败");
|
|
|
83
|
+ }
|
|
|
84
|
+
|
|
|
85
|
+ Integer res=0;
|
|
|
86
|
+ for (User user : userlist){
|
|
|
87
|
+ if (!userService.checkUserNameExternalUnique(user)) {
|
|
|
88
|
+ continue;
|
|
|
89
|
+ }
|
|
|
90
|
+ if (StringHelper.isEmpty(user.getPassword()))
|
|
|
91
|
+ continue;
|
|
|
92
|
+ if (StringHelper.isEmpty(user.getUserName()))
|
|
|
93
|
+ continue;
|
|
|
94
|
+ if (StringHelper.isEmpty(user.getNickName()))
|
|
|
95
|
+ continue;
|
|
|
96
|
+ user.setStatus("0");
|
|
|
97
|
+ user.setDelFlag("0");
|
|
|
98
|
+ user.setPassword(user.getPassword());
|
|
|
99
|
+ user.setCreateBy(user.getCreateBy());
|
|
|
100
|
+ user.setCreateTime(new Date());
|
|
|
101
|
+
|
|
|
102
|
+ boolean result = userService.insert(user);
|
|
|
103
|
+ if(result){
|
|
|
104
|
+ res=res+1;
|
|
|
105
|
+ }
|
|
|
106
|
+
|
|
|
107
|
+
|
|
|
108
|
+ }
|
|
|
109
|
+ return Success("同步成功");
|
|
|
110
|
+
|
|
|
111
|
+
|
|
|
112
|
+ }
|
|
|
113
|
+
|
|
|
114
|
+ @ApiOperation("外部删除用户")
|
|
|
115
|
+ @Log(title = "外部删除用户", businessType = BusinessType.INSERT)
|
|
|
116
|
+ @PostMapping("/externaldelete")
|
|
|
117
|
+ @Anonymous
|
|
|
118
|
+ public AjaxResult externaldelete(@RequestBody User user,HttpServletRequest request) {
|
|
|
119
|
+
|
|
|
120
|
+
|
|
|
121
|
+ String uuid= request.getHeader("uuid");
|
|
|
122
|
+ String pass= request.getHeader("pass");
|
|
|
123
|
+
|
|
|
124
|
+ String md5str= SecretHelper.MD5("huawuxitong%@"+uuid);
|
|
|
125
|
+ if(!md5str.equals(pass)){
|
|
|
126
|
+ return Error("验证失败");
|
|
|
127
|
+ }
|
|
|
128
|
+ LambdaUpdateWrapper<User> uw = new LambdaUpdateWrapper<>();
|
|
|
129
|
+ uw.set(User::getDelFlag, "2").eq(User::getExternalId, user.getExternalId());
|
|
|
130
|
+ boolean result = userService.updateBatch(uw);
|
|
|
131
|
+ if (result) {
|
|
|
132
|
+ return Success("删除成功");
|
|
|
133
|
+ } else {
|
|
|
134
|
+ return Error("删除失败");
|
|
|
135
|
+ }
|
|
|
136
|
+ }
|
|
|
137
|
+
|
|
|
138
|
+
|
|
|
139
|
+ @ApiOperation("外部接口修改系统用户user")
|
|
|
140
|
+ @Log(title = "外部接口修改系统用户user", businessType = BusinessType.UPDATE)
|
|
|
141
|
+ @PostMapping("/externaledit")
|
|
|
142
|
+ @Anonymous
|
|
|
143
|
+ public AjaxResult externaledit(@RequestBody User user,HttpServletRequest request) {
|
|
|
144
|
+ String uuid= request.getHeader("uuid");
|
|
|
145
|
+ String pass= request.getHeader("pass");
|
|
|
146
|
+
|
|
|
147
|
+ String md5str= SecretHelper.MD5("huawuxitong%@"+uuid);
|
|
|
148
|
+ if(!md5str.equals(pass)){
|
|
|
149
|
+ return Error("验证失败");
|
|
|
150
|
+ }
|
|
|
151
|
+
|
|
|
152
|
+
|
|
|
153
|
+
|
|
|
154
|
+
|
|
|
155
|
+
|
|
|
156
|
+ LambdaUpdateWrapper<User> usermodel=new LambdaUpdateWrapper<>();
|
|
|
157
|
+ usermodel.eq(User::getExternalId,user.getExternalId());
|
|
|
158
|
+
|
|
|
159
|
+ if(! userService.exists(usermodel))
|
|
|
160
|
+ {
|
|
|
161
|
+ //不存在这个就去添加
|
|
|
162
|
+
|
|
|
163
|
+
|
|
|
164
|
+ user.setStatus("0");
|
|
|
165
|
+ user.setDelFlag("0");
|
|
|
166
|
+ user.setPassword(user.getPassword());
|
|
|
167
|
+ user.setCreateBy(user.getCreateBy());
|
|
|
168
|
+ user.setCreateTime(new Date());
|
|
|
169
|
+ userService.insert(user);
|
|
|
170
|
+ return Success("添加成功");
|
|
|
171
|
+ }
|
|
|
172
|
+
|
|
|
173
|
+
|
|
|
174
|
+
|
|
|
175
|
+
|
|
|
176
|
+ if(!StringHelper.isEmpty(user.getPassword())){
|
|
|
177
|
+ usermodel.set(User::getPassword,user.getPassword());
|
|
|
178
|
+ }
|
|
|
179
|
+ if(!StringHelper.isEmpty(user.getUserName())) {
|
|
|
180
|
+
|
|
|
181
|
+ LambdaQueryWrapper<User> qw=new LambdaQueryWrapper<>();
|
|
|
182
|
+ qw.eq(User::getUserName, user.getUserName());
|
|
|
183
|
+ qw.ne(User::getExternalId,user.getExternalId());
|
|
|
184
|
+
|
|
|
185
|
+ if(! userService.exists(qw)){
|
|
|
186
|
+ usermodel.set(User::getUserName, user.getUserName());
|
|
|
187
|
+ }
|
|
|
188
|
+ }
|
|
|
189
|
+ boolean result = userService.updateBatch(usermodel);
|
|
|
190
|
+ if (result) {
|
|
|
191
|
+ return Success("修改成功");
|
|
|
192
|
+ } else {
|
|
|
193
|
+ return Error("修改失败");
|
|
|
194
|
+ }
|
|
|
195
|
+ }
|
|
|
196
|
+
|
|
|
197
|
+//以下是调用vs的
|
|
|
198
|
+
|
|
|
199
|
+
|
|
|
200
|
+ @ApiOperation("调用外部接口获取市民信息通过微信id")
|
|
|
201
|
+ @Log(title = "调用外部接口获取市民信息通过微信id", businessType = BusinessType.UPDATE)
|
|
|
202
|
+ @GetMapping("/getcusdata")
|
|
|
203
|
+ @Anonymous
|
|
|
204
|
+ public AjaxResult getcusdata(String wxid) {
|
|
|
205
|
+
|
|
|
206
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
207
|
+ String param="wxid="+wxid;
|
|
|
208
|
+ String datares= HttpHelper.sendGet(huawuURL+"Customer/GetCusDatabyWx",param);
|
|
|
209
|
+ return Success("外部接口获取市民信息通过微信id成功",datares);
|
|
|
210
|
+
|
|
|
211
|
+ }
|
|
|
212
|
+
|
|
|
213
|
+ @ApiOperation("调用外部接口编辑话务系统的市民信息")
|
|
|
214
|
+ @Log(title = "调用外部接口编辑话务系统的市民信息", businessType = BusinessType.UPDATE)
|
|
|
215
|
+ @GetMapping("/editcus")
|
|
|
216
|
+ @Anonymous
|
|
|
217
|
+ public AjaxResult editcus(CustomerInput input) {
|
|
|
218
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
219
|
+
|
|
|
220
|
+// String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
221
|
+// String param="F_CustomerId=132668&F_CustomerEName=wxnamenew&F_CustomerName=瑟吉欧";
|
|
|
222
|
+// String datares= HttpHelper.sendPost(huawuURL+"Customer/AddOrEditCusDataByWx",param);
|
|
|
223
|
+
|
|
|
224
|
+// input.setF_CustomerId(13266L);
|
|
|
225
|
+// input.setF_CustomerEName("wxnamenew");
|
|
|
226
|
+// input.setF_CustomerName("瑟吉欧");
|
|
|
227
|
+ String datares= HttpHelper.sendJson(huawuURL+"Customer/AddOrEditCusDataByWx", JSON.toJSONString(input));
|
|
|
228
|
+
|
|
|
229
|
+ return Success("外部接口编辑市民信息成功",datares);
|
|
|
230
|
+
|
|
|
231
|
+ }
|
|
|
232
|
+ @ApiOperation("调用外部接口通过wxid获取市民的历史工单信息")
|
|
|
233
|
+ @Log(title = "调用外部接口通过wxid获取市民的历史工单信息", businessType = BusinessType.UPDATE)
|
|
|
234
|
+ @GetMapping("/gethistoryorders")
|
|
|
235
|
+ @Anonymous
|
|
|
236
|
+ public AjaxResult gethistoryorders(String wxid) {
|
|
|
237
|
+
|
|
|
238
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
239
|
+ String param="wxid="+wxid;
|
|
|
240
|
+ String datares= HttpHelper.sendGet(huawuURL+"Order/getOrderDataByWx",param);
|
|
|
241
|
+ return Success("外部接口获取市民信息通过微信id成功",datares);
|
|
|
242
|
+
|
|
|
243
|
+ }
|
|
|
244
|
+
|
|
|
245
|
+
|
|
|
246
|
+ @ApiOperation("调用外部接口添加工单")
|
|
|
247
|
+ @Log(title = "调用外部接口通过wxid获取市民的历史工单信息", businessType = BusinessType.UPDATE)
|
|
|
248
|
+ @PostMapping("/addorder")
|
|
|
249
|
+ @Anonymous
|
|
|
250
|
+ public AjaxResult addorder(@RequestBody Map<String,Object> map) {
|
|
|
251
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
252
|
+ String datares= HttpHelper.sendJson(huawuURL+"WXInterFace/workOrderAddData",JSON.toJSONString(map));//
|
|
|
253
|
+ if(Objects.equals(datares, "True")){
|
|
|
254
|
+ return Success("添加工单成功",datares);
|
|
|
255
|
+ }
|
|
|
256
|
+ else {
|
|
|
257
|
+ return Error("添加失败");
|
|
|
258
|
+ }
|
|
|
259
|
+
|
|
|
260
|
+ }
|
|
|
261
|
+
|
|
|
262
|
+
|
|
|
263
|
+ @ApiOperation("调用外部接口添加工单")
|
|
|
264
|
+ @Log(title = "调用外部接口通过wxid获取市民的历史工单信息", businessType = BusinessType.UPDATE)
|
|
|
265
|
+ @GetMapping("/addcuss")
|
|
|
266
|
+ @Anonymous
|
|
|
267
|
+ public AjaxResult addcuss() {
|
|
|
268
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
269
|
+ CustomerInput in=new CustomerInput();
|
|
|
270
|
+ in.setF_CustomerId(0L);
|
|
|
271
|
+ in.setF_CustomerEName("534354354dsjkdljsklfd");
|
|
|
272
|
+
|
|
|
273
|
+ String param="wxid="+in.getF_CustomerEName();
|
|
|
274
|
+ String datares= HttpHelper.sendGet(huawuURL+"Customer/AddCusDataByWx",param);
|
|
|
275
|
+ return Success(datares);
|
|
|
276
|
+ }
|
|
|
277
|
+
|
|
|
278
|
+ @ApiOperation("调用外部接口获取字典下拉框,nld,clfs")
|
|
|
279
|
+ @Log(title = "调用外部接口获取字典下拉框", businessType = BusinessType.UPDATE)
|
|
|
280
|
+ @GetMapping("/getnld")
|
|
|
281
|
+ @Anonymous
|
|
|
282
|
+ public AjaxResult getnld(String diccodetype) {
|
|
|
283
|
+
|
|
|
284
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
285
|
+ String param="dicCodeType="+diccodetype;
|
|
|
286
|
+ String datares= HttpHelper.sendGet(huawuURL+"WXInterFace/GetDicList",param);
|
|
|
287
|
+ return Success("获取字段成功",datares);
|
|
|
288
|
+
|
|
|
289
|
+ }
|
|
|
290
|
+
|
|
|
291
|
+ @ApiOperation("获取机许线的车站")
|
|
|
292
|
+ @Log(title = "获取机许线的车站", businessType = BusinessType.UPDATE)
|
|
|
293
|
+ @GetMapping("/getstation")
|
|
|
294
|
+ @Anonymous
|
|
|
295
|
+ public AjaxResult getstation() {
|
|
|
296
|
+
|
|
|
297
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
298
|
+
|
|
|
299
|
+ String datares= HttpHelper.sendGet(huawuURL+"WXInterFace/GetDicSelectStation");
|
|
|
300
|
+ return Success("获取机许线的车站",datares);
|
|
|
301
|
+
|
|
|
302
|
+ }
|
|
|
303
|
+ @ApiOperation("获取业务类型")
|
|
|
304
|
+ @Log(title = "获取业务类型", businessType = BusinessType.UPDATE)
|
|
|
305
|
+ @GetMapping("/gettypelist")
|
|
|
306
|
+ @Anonymous
|
|
|
307
|
+ public AjaxResult gettypelist() {
|
|
|
308
|
+
|
|
|
309
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
310
|
+
|
|
|
311
|
+ String datares= HttpHelper.sendGet(huawuURL+"WXInterFace/GetWorkOrderTypeModelList");
|
|
|
312
|
+ return Success("获取业务类型",datares);
|
|
|
313
|
+
|
|
|
314
|
+ }
|
|
|
315
|
+ @ApiOperation("获取转单部门")
|
|
|
316
|
+ @Log(title = "获取转单部门", businessType = BusinessType.UPDATE)
|
|
|
317
|
+ @GetMapping("/getdeptuserlist")
|
|
|
318
|
+ @Anonymous
|
|
|
319
|
+ public AjaxResult getdeptuserlist() {
|
|
|
320
|
+
|
|
|
321
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
322
|
+ String datares= HttpHelper.sendGet(huawuURL+"WXInterFace/GetDepartmentAndUserJsonModelTrun");
|
|
|
323
|
+ return Success("获取转单部门",datares);
|
|
|
324
|
+ }
|
|
|
325
|
+ @ApiOperation("获取标签")
|
|
|
326
|
+ @Log(title = "获取标签", businessType = BusinessType.UPDATE)
|
|
|
327
|
+ @GetMapping("/gettaglist")
|
|
|
328
|
+ @Anonymous
|
|
|
329
|
+ public AjaxResult gettaglist() {
|
|
|
330
|
+
|
|
|
331
|
+ String huawuURL= SpringHelper.getRequiredProperty("huawuURL");
|
|
|
332
|
+ String datares= HttpHelper.sendGet(huawuURL+"WXInterFace/GetTagList");
|
|
|
333
|
+ return Success("获取标签",datares);
|
|
|
334
|
+ }
|
|
|
335
|
+
|
|
|
336
|
+
|
|
|
337
|
+}
|