LiveCodeController.java
3.51 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
package cn.com.glsx.stoassistant.controller;
import cn.com.glsx.framework.rop.response.RopResponse;
import cn.com.glsx.stoassistant.request.GroupAllocRequest;
import cn.com.glsx.stoassistant.request.LiveCodeRequest;
import cn.com.glsx.stoassistant.response.GroupAllocResponse;
import cn.com.glsx.stoassistant.response.LiveCodeResponse;
import cn.com.glsx.stoassistant.service.LiveCodeService;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 活码管理
*/
@Slf4j
@Api("活码管理")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
//@RestController
public class LiveCodeController {
@Autowired
private LiveCodeService liveCodeService;
/**
* 获取群活码(车主扫码分配真实企微群)
*/
@ServiceMethod(method = "scrm.api.stoassistant.livecode.get", needInSession = NeedInSessionType.YES)
@ApiOperation("获取群活码")
// @PostMapping("/scrm.api.stoassistant.livecode.get/1.0.0")
public RopResponse<LiveCodeResponse> getLiveCode(LiveCodeRequest request) {
try {
if (request == null || request.getReportUuidId() == null || request.getReportUuidId().trim().isEmpty()) {
return RopResponse.error("AI收车报告唯一ID不能为空");
}
LiveCodeResponse response = liveCodeService.getLiveCode(request);
return RopResponse.success(response);
} catch (Exception e) {
log.error("获取群活码失败", e);
return RopResponse.error(e.getMessage());
}
}
/**
* 扫码分配空闲企微群
*/
@ServiceMethod(method = "scrm.api.stoassistant.livecode.allocate", needInSession = NeedInSessionType.YES)
@ApiOperation("扫码分配空闲企微群")
// @PostMapping("/scrm.api.stoassistant.livecode.allocate/1.0.0")
public RopResponse<GroupAllocResponse> allocateGroup(GroupAllocRequest request) {
try {
if (request == null) {
return RopResponse.error("请求参数不能为空");
}
if (request.getLiveCode() == null || request.getLiveCode().trim().isEmpty()) {
return RopResponse.error("活码编码不能为空");
}
if (request.getOpenid() == null || request.getOpenid().trim().isEmpty()) {
return RopResponse.error("微信openid不能为空");
}
if (request.getSignature() == null || request.getSignature().trim().isEmpty()) {
return RopResponse.error("签名不能为空");
}
if (request.getNonce() == null || request.getNonce().trim().isEmpty()) {
return RopResponse.error("随机字符串不能为空");
}
if (request.getSaUserId() == null || request.getSaUserId().trim().isEmpty()) {
return RopResponse.error("销售顾问ID不能为空");
}
GroupAllocResponse response = liveCodeService.allocateGroup(request);
return RopResponse.success(response);
} catch (Exception e) {
log.error("扫码分配群失败", e);
return RopResponse.error(e.getMessage());
}
}
}