Commit 0bd515bc by 林冲

refactor(livecode): 重构签名字段名称及清理注释代码

- 将 GroupAllocRequest 中 sign 字段重命名为 signature
- 修正 LiveCodeController 中对签名字段的访问为 signature
- 更新 LiveCodeService 中参数映射,使用 signature 替代 sign
- 暂时注释 LiveCodeController 中的@RestController 和@PostMapping 注解
- 新增 LiveCodeServiceTest 测试类及基本测试用例用于接口测试验证
1 parent 93efff79
...@@ -13,6 +13,8 @@ import io.swagger.annotations.Api; ...@@ -13,6 +13,8 @@ import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
/** /**
* 活码管理 * 活码管理
...@@ -20,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -20,6 +22,7 @@ import org.springframework.beans.factory.annotation.Autowired;
@Slf4j @Slf4j
@Api("活码管理") @Api("活码管理")
@ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES) @ServiceMethodBean(version = "1.0.0", needInSession = NeedInSessionType.YES)
//@RestController
public class LiveCodeController { public class LiveCodeController {
@Autowired @Autowired
...@@ -30,6 +33,7 @@ public class LiveCodeController { ...@@ -30,6 +33,7 @@ public class LiveCodeController {
*/ */
@ServiceMethod(method = "scrm.api.stoassistant.livecode.get", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "scrm.api.stoassistant.livecode.get", needInSession = NeedInSessionType.YES)
@ApiOperation("获取群活码") @ApiOperation("获取群活码")
// @PostMapping("/scrm.api.stoassistant.livecode.get/1.0.0")
public RopResponse<LiveCodeResponse> getLiveCode(LiveCodeRequest request) { public RopResponse<LiveCodeResponse> getLiveCode(LiveCodeRequest request) {
try { try {
if (request == null || request.getReportUuidId() == null || request.getReportUuidId().trim().isEmpty()) { if (request == null || request.getReportUuidId() == null || request.getReportUuidId().trim().isEmpty()) {
...@@ -49,6 +53,7 @@ public class LiveCodeController { ...@@ -49,6 +53,7 @@ public class LiveCodeController {
*/ */
@ServiceMethod(method = "scrm.api.stoassistant.livecode.allocate", needInSession = NeedInSessionType.YES) @ServiceMethod(method = "scrm.api.stoassistant.livecode.allocate", needInSession = NeedInSessionType.YES)
@ApiOperation("扫码分配空闲企微群") @ApiOperation("扫码分配空闲企微群")
// @PostMapping("/scrm.api.stoassistant.livecode.allocate/1.0.0")
public RopResponse<GroupAllocResponse> allocateGroup(GroupAllocRequest request) { public RopResponse<GroupAllocResponse> allocateGroup(GroupAllocRequest request) {
try { try {
if (request == null) { if (request == null) {
...@@ -60,7 +65,7 @@ public class LiveCodeController { ...@@ -60,7 +65,7 @@ public class LiveCodeController {
if (request.getOpenid() == null || request.getOpenid().trim().isEmpty()) { if (request.getOpenid() == null || request.getOpenid().trim().isEmpty()) {
return RopResponse.error("微信openid不能为空"); return RopResponse.error("微信openid不能为空");
} }
if (request.getSign() == null || request.getSign().trim().isEmpty()) { if (request.getSignature() == null || request.getSignature().trim().isEmpty()) {
return RopResponse.error("签名不能为空"); return RopResponse.error("签名不能为空");
} }
if (request.getNonce() == null || request.getNonce().trim().isEmpty()) { if (request.getNonce() == null || request.getNonce().trim().isEmpty()) {
......
...@@ -34,7 +34,7 @@ public class GroupAllocRequest extends AbstractRopRequest implements Serializabl ...@@ -34,7 +34,7 @@ public class GroupAllocRequest extends AbstractRopRequest implements Serializabl
* 签名 * 签名
*/ */
@ApiModelProperty("签名") @ApiModelProperty("签名")
private String sign; private String signature;
/** /**
* 过期时间戳 * 过期时间戳
......
...@@ -107,7 +107,7 @@ public class LiveCodeService { ...@@ -107,7 +107,7 @@ public class LiveCodeService {
Map<String, Object> params = new HashMap<>(); Map<String, Object> params = new HashMap<>();
params.put("liveCode", request.getLiveCode()); params.put("liveCode", request.getLiveCode());
params.put("openid", request.getOpenid()); params.put("openid", request.getOpenid());
params.put("sign", request.getSign()); params.put("signature", request.getSignature());
params.put("exp", request.getExp()); params.put("exp", request.getExp());
params.put("nonce", request.getNonce()); params.put("nonce", request.getNonce());
params.put("saUserId", request.getSaUserId()); params.put("saUserId", request.getSaUserId());
......
package cn.com.glsx.stoassistant.service;
import cn.com.glsx.stoassistant.request.LiveCodeRequest;
import org.junit.Test;
import org.springframework.beans.factory.annotation.Autowired;
public class LiveCodeServiceTest extends BaseServiceTest {
@Autowired
private LiveCodeService liveCodeService;
@Test
public void testGetLiveCode() {
LiveCodeRequest request = new LiveCodeRequest();
request.setReportUuidId("919220012001jjjka");
liveCodeService.getLiveCode(request);
}
@Test
public void testAllocateGroup() {
}
}
\ No newline at end of file \ No newline at end of file
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!