internal-common

master
liuyuanqiang 2 years ago
parent 539eafcb5e
commit fac441d3e2

@ -2,6 +2,7 @@
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />

@ -0,0 +1,8 @@
package com.mashibing.common.response;
import lombok.Data;
@Data
public class NumberCodeResponse {
private int numberCode;
}

@ -0,0 +1,3 @@
artifactId=internal-common
groupId=org.mashibing
version=1.0-SNAPSHOT

@ -0,0 +1,3 @@
com\mashibing\common\dto\ResponseResult.class
com\mashibing\common\constant\CommonStatusEnum.class
com\mashibing\common\response\NumberCodeResponse.class

@ -0,0 +1,3 @@
D:\Works\workspaces\online-taxi-public\internal-common\src\main\java\com\mashibing\common\constant\CommonStatusEnum.java
D:\Works\workspaces\online-taxi-public\internal-common\src\main\java\com\mashibing\common\dto\ResponseResult.java
D:\Works\workspaces\online-taxi-public\internal-common\src\main\java\com\mashibing\common\response\NumberCodeResponse.java

@ -26,6 +26,12 @@
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mashibing</groupId>
<artifactId>internal-common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies>
<build>

@ -1,5 +1,7 @@
package com.mashibing.service.controller;
import com.mashibing.common.dto.ResponseResult;
import com.mashibing.common.response.NumberCodeResponse;
import net.sf.json.JSONObject;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@ -10,7 +12,7 @@ import static java.lang.Math.pow;
@RestController
public class NumberCodeController {
@GetMapping("/numberCode/{size}")
public String getNumberCode(@PathVariable("size") int size){
public ResponseResult getNumberCode(@PathVariable("size") int size){
System.out.println("size:" + size);
//获取随机数
@ -18,13 +20,17 @@ public class NumberCodeController {
int resultInt = (int) mathRandom;
System.out.println(resultInt);
NumberCodeResponse response = new NumberCodeResponse();
response.setNumberCode(resultInt);
/*
JSONObject result = new JSONObject();
result.put("code",1);
result.put("message","success");
JSONObject data = new JSONObject();
data.put("numberCode",resultInt);
result.put("data",data);
return result.toString();
*/
return ResponseResult.success(response);
}
}

Loading…
Cancel
Save