generated from msb_55675/Demo
Compare commits
No commits in common. 'fac441d3e299729addfccfc3229e1640adc9becf' and '5f90be193b02e3969071c5dbfd879a10bef063a6' have entirely different histories.
fac441d3e2
...
5f90be193b
@ -1,16 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
|
||||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
|
||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
|
||||||
<parent>
|
|
||||||
<artifactId>online-taxi-public</artifactId>
|
|
||||||
<groupId>org.mashibing</groupId>
|
|
||||||
<version>1.0-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
|
|
||||||
<artifactId>internal-common</artifactId>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</project>
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.mashibing.common.constant;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
import lombok.Getter;
|
|
||||||
|
|
||||||
public enum CommonStatusEnum {
|
|
||||||
/**
|
|
||||||
* 成功
|
|
||||||
*/
|
|
||||||
SUCCESS(1,"success"),
|
|
||||||
/**
|
|
||||||
* 失败
|
|
||||||
*/
|
|
||||||
FAIL(0,"fail");
|
|
||||||
@Getter
|
|
||||||
private int code;
|
|
||||||
@Getter
|
|
||||||
private String msg;
|
|
||||||
|
|
||||||
CommonStatusEnum(int code,String msg){
|
|
||||||
this.code = code;
|
|
||||||
this.msg = msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.mashibing.common.response;
|
|
||||||
|
|
||||||
import lombok.Data;
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public class NumberCodeResponse {
|
|
||||||
private int numberCode;
|
|
||||||
}
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,3 +0,0 @@
|
|||||||
artifactId=internal-common
|
|
||||||
groupId=org.mashibing
|
|
||||||
version=1.0-SNAPSHOT
|
|
@ -1,3 +0,0 @@
|
|||||||
com\mashibing\common\dto\ResponseResult.class
|
|
||||||
com\mashibing\common\constant\CommonStatusEnum.class
|
|
||||||
com\mashibing\common\response\NumberCodeResponse.class
|
|
@ -1,3 +0,0 @@
|
|||||||
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
|
|
@ -1,36 +0,0 @@
|
|||||||
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;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
|
||||||
|
|
||||||
import static java.lang.Math.pow;
|
|
||||||
|
|
||||||
@RestController
|
|
||||||
public class NumberCodeController {
|
|
||||||
@GetMapping("/numberCode/{size}")
|
|
||||||
public ResponseResult getNumberCode(@PathVariable("size") int size){
|
|
||||||
System.out.println("size:" + size);
|
|
||||||
|
|
||||||
//获取随机数
|
|
||||||
double mathRandom = (Math.random() * 9 + 1) * pow(10, size-1);
|
|
||||||
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 ResponseResult.success(response);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Loading…
Reference in new issue