Commit c406bf5f authored by 黎博's avatar 黎博

优化

parent 77f7792f
...@@ -47,7 +47,7 @@ public class JsonResult<T> { ...@@ -47,7 +47,7 @@ public class JsonResult<T> {
} }
/** /**
* 服务器失败 * 服务器异常
*/ */
public static <T> JsonResult<T> serverFailed() { public static <T> JsonResult<T> serverFailed() {
return buildResult(ErrorType.SERVER_FAILED); return buildResult(ErrorType.SERVER_FAILED);
......
...@@ -5,11 +5,11 @@ package cn.qg.qaplatform.common.enums; ...@@ -5,11 +5,11 @@ package cn.qg.qaplatform.common.enums;
*/ */
public enum ErrorType { public enum ErrorType {
SUCCESS(200L, "请求成功"), SUCCESS(200L, "请求成功"),
CLIENT_FAILED(400L, "客户端请求失败"), CLIENT_FAILED(400L, "传参有误"),
SERVER_FAILED(500L, "服务器异常"); SERVER_FAILED(500L, "系统异常");
private Long code; private final Long code;
private String message; private final String message;
ErrorType(Long code, String message) { ErrorType(Long code, String message) {
this.code = code; this.code = code;
......
...@@ -6,10 +6,7 @@ import cn.qg.qaplatform.service.VccDataService; ...@@ -6,10 +6,7 @@ import cn.qg.qaplatform.service.VccDataService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@CrossOrigin @CrossOrigin
@RestController @RestController
...@@ -22,7 +19,10 @@ public class GenVccController { ...@@ -22,7 +19,10 @@ public class GenVccController {
@PostMapping("/gen") @PostMapping("/gen")
@ApiOperation(value = "vcc造数据") @ApiOperation(value = "vcc造数据")
public JsonResult genVccUser(String namespace, String phoneNo, String channel, Integer status) throws Exception { public JsonResult genVccUser(@RequestParam(value = "namespace") String namespace,
@RequestParam(value = "phoneNo") String phoneNo,
@RequestParam(value = "channel") String channel,
@RequestParam(value = "status") Integer status) throws Exception {
if (status !=1 && status !=2 && status !=3 && status !=4) { if (status !=1 && status !=2 && status !=3 && status !=4) {
return JsonResult.clientFailed("状态值必须是1、2、3、4中的一个!"); return JsonResult.clientFailed("状态值必须是1、2、3、4中的一个!");
} }
...@@ -30,6 +30,9 @@ public class GenVccController { ...@@ -30,6 +30,9 @@ public class GenVccController {
return JsonResult.clientFailed("渠道必须为214或217"); return JsonResult.clientFailed("渠道必须为214或217");
} }
GenVccUser result = vccDataService.makeVccUser(namespace, phoneNo, channel, status); GenVccUser result = vccDataService.makeVccUser(namespace, phoneNo, channel, status);
if (result == null) {
return JsonResult.serverFailed();
}
return JsonResult.success(result); return JsonResult.success(result);
} }
} }
...@@ -48,8 +48,8 @@ public class QueryLoanUserDataController { ...@@ -48,8 +48,8 @@ public class QueryLoanUserDataController {
/** /**
* @param status 用户状态 * @param status 用户状态
* @param pageNum * @param pageNum 页码
* @param pageSize * @param pageSize 每页数量
* @return 所有借款用户数据 * @return 所有借款用户数据
*/ */
@ApiOperation(value = "捞数据接口") @ApiOperation(value = "捞数据接口")
......
...@@ -31,6 +31,9 @@ public class QueryVccController { ...@@ -31,6 +31,9 @@ public class QueryVccController {
@GetMapping("/getStatus") @GetMapping("/getStatus")
public JsonResult getUserStatus(String namespace, String phoneNo) { public JsonResult getUserStatus(String namespace, String phoneNo) {
QueryVccUser queryVccUser = vccDataService.queryUserVccStatus(namespace, phoneNo); QueryVccUser queryVccUser = vccDataService.queryUserVccStatus(namespace, phoneNo);
if (queryVccUser == null) {
return JsonResult.serverFailed("该用户不存在!");
}
return JsonResult.success(queryVccUser); return JsonResult.success(queryVccUser);
} }
...@@ -38,7 +41,7 @@ public class QueryVccController { ...@@ -38,7 +41,7 @@ public class QueryVccController {
public JsonResult checkUserData(String namespace, String phoneNo, String idCardNo) { public JsonResult checkUserData(String namespace, String phoneNo, String idCardNo) {
QueryVccUser queryVccUser = vccDataService.queryUserVccStatus(namespace, phoneNo); QueryVccUser queryVccUser = vccDataService.queryUserVccStatus(namespace, phoneNo);
if (queryVccUser == null) { if (queryVccUser == null) {
return JsonResult.serverFailed("数据不存在!"); return JsonResult.serverFailed("该用户不存在!");
} }
Map<String, Object> map = new HashMap<>(); Map<String, Object> map = new HashMap<>();
map.put("phoneNo", queryVccUser.getPhoneNo()); map.put("phoneNo", queryVccUser.getPhoneNo());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment