Commit b0ec3965 authored by bboymoney's avatar bboymoney

swagger

parent 4c25d0df
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<annotationProcessing> <annotationProcessing>
<profile default="true" name="Default" enabled="true" />
<profile name="Maven default annotation processors profile" enabled="true"> <profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" /> <sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" /> <sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
......
...@@ -120,4 +120,26 @@ ...@@ -120,4 +120,26 @@
<!-- </plugins>--> <!-- </plugins>-->
<!-- </build>--> <!-- </build>-->
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.1.RELEASE</version>
<configuration>
<mainClass>
com.ConsoleApplication
</mainClass>
</configuration>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project> </project>
package com.servicemall.basis.micro;
import com.alibaba.fastjson.JSONObject;
import com.servicemall.systemcommon.data.Constants;
import com.servicemall.systemcommon.data.ErrorEnum;
import com.servicemall.systemcommon.data.ValidCheckException;
import com.servicemall.systemcommon.util.JsonUtil;
import io.swagger.annotations.*;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import team.bangbang.common.data.Pagination;
import team.bangbang.common.data.response.DataResponse;
import team.bangbang.common.data.response.ResponseBase;
import team.bangbang.common.net.http.HttpClient;
import team.bangbang.common.net.http.ResponseHandler;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
* 基础数据 - 微服务
* @author 帮帮组
* @version 1.0 2020-12-08
*/
@Api(tags = {"basis"})
@ApiResponses(value={@ApiResponse(code=200, message="请求的服务不存在")})
@RestController
@CrossOrigin(allowCredentials = "true", allowedHeaders = "*", origins = "*", maxAge = 3600)
@RequestMapping("/microservice/basis")
public final class BasisMicro {
/**************************************************************************
* !!除非设计、指导人员有特别说明,否则此处不得随意增加、修改、删除!!
* ------------------------------------
*
*************************************************************************/
/**
* 省市接口
*/
@ApiOperation(value = "获取省市信息", notes = "省市信息树形结构", httpMethod = "POST")
@PostMapping(value = "/province", produces = {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE})
@ApiImplicitParams({
@ApiImplicitParam(paramType = "body", name = "json", value = "入参格式:{}", dataType = "string")
})
public ResponseBase province(@RequestBody String json) {
DataResponse<Object> result = new DataResponse<>();
try {
ResponseHandler responseHandler = new HttpClient().get("http://161.189.8.153:8889/v1/wx/provinces");
result.setData(responseHandler.toJSONObject().getJSONArray("options"));
result.setMessage("成功");
return result;
} catch (IOException e) {
return new ResponseBase(ErrorEnum.E_404.getCode(), ErrorEnum.E_404.getMessage());
} catch (ValidCheckException e) {
return new ResponseBase(e.getCode(), e.getMessage());
}
}
/**
* 经销商接口
*/
@ApiOperation(value = "获取经销商信息", notes = "经销商信息", httpMethod = "POST")
@PostMapping(value = "/dealers", produces = {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE})
@ApiImplicitParams({
@ApiImplicitParam(paramType = "body", name = "json", value = "入参格式:{}", dataType = "string")
})
public ResponseBase dealers(@RequestBody String json) {
DataResponse<Map<String, Object>> result = new DataResponse<Map<String, Object>>();
try {
ResponseHandler responseHandler = new HttpClient().get("http://161.189.8.153:8889/v1/wx/dealers");
Map<String, Object> datas = new HashMap<String, Object>();
JSONObject remoteJson=responseHandler.toJSONObject();
datas.put("list", remoteJson.getJSONArray("rows"));
JSONObject paginationJson=remoteJson.getJSONObject("pagination");
Pagination pagination = new Pagination();
pagination.setRecordCount(paginationJson.getIntValue("total"));
pagination.setMaxResults(20);//每页条数,接口方默认20
pagination.setPageNo(paginationJson.getIntValue("page"));
datas.put("pagination", pagination);
result.setData(datas);
result.setMessage("成功");
return result;
} catch (IOException e) {
return new ResponseBase(ErrorEnum.E_404.getCode(), ErrorEnum.E_404.getMessage());
} catch (ValidCheckException e) {
return new ResponseBase(e.getCode(), e.getMessage());
}
}
/**
* 车型车系接口
*/
@ApiOperation(value = "获取车型车系信息", notes = "车型车系信息", httpMethod = "POST")
@PostMapping(value = "/productManagement/getSeriesModels", produces = {MediaType.APPLICATION_JSON_VALUE}, consumes = {MediaType.APPLICATION_JSON_VALUE})
@ApiImplicitParams({
@ApiImplicitParam(paramType = "body", name = "json", value = "入参格式:{}", dataType = "string")
})
public ResponseBase getSeriesModels(@RequestBody String json) {
DataResponse<Object> result = new DataResponse<>();
try {
ResponseHandler responseHandler = new HttpClient().get("http://161.189.8.153:8889/v1/product_management/get_series_models");
result.setData(responseHandler.toJSONObject().get("data"));
result.setMessage("成功");
return result;
} catch (IOException e) {
return new ResponseBase(ErrorEnum.E_404.getCode(), ErrorEnum.E_404.getMessage());
} catch (ValidCheckException e) {
return new ResponseBase(e.getCode(), e.getMessage());
}
}
}
...@@ -5,10 +5,13 @@ import com.servicemall.systemcommon.data.ValidCheckException; ...@@ -5,10 +5,13 @@ import com.servicemall.systemcommon.data.ValidCheckException;
import com.servicemall.systemcommon.util.JsonUtil; import com.servicemall.systemcommon.util.JsonUtil;
import com.servicemall.website.data.Slider; import com.servicemall.website.data.Slider;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.http.MediaType; import org.springframework.http.MediaType;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import team.bangbang.common.data.response.DataResponse; import team.bangbang.common.data.response.DataResponse;
import team.bangbang.common.data.response.ResponseBase; import team.bangbang.common.data.response.ResponseBase;
...@@ -23,7 +26,7 @@ import java.util.Map; ...@@ -23,7 +26,7 @@ import java.util.Map;
* @author 帮帮组 * @author 帮帮组
* @version 1.0 2020-12-08 * @version 1.0 2020-12-08
*/ */
@Api(description = "车龄选项获取接口API") @Api(tags = {"car"})
@RestController @RestController
@CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600) @CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600)
@RequestMapping("/microservice/car/carage") @RequestMapping("/microservice/car/carage")
...@@ -35,14 +38,13 @@ public final class CarAgeMicro { ...@@ -35,14 +38,13 @@ public final class CarAgeMicro {
*************************************************************************/ *************************************************************************/
/** /**
* 查询多条轮播图,并转化为相应的POJO对象列表 * 车龄选项接口
*
*
* @return 返回结果记录,并转化为相应的POJO对象列表
*/ */
@ApiOperation(value = "车龄选项", notes = "车龄选项列表", httpMethod = "POST") @ApiOperation(value = "车龄选项", notes = "车龄选项列表", httpMethod = "POST")
@PostMapping(value="/list", produces={ MediaType.APPLICATION_JSON_UTF8_VALUE }, consumes={ MediaType.APPLICATION_JSON_UTF8_VALUE }) @PostMapping(value="/list", produces={ MediaType.APPLICATION_JSON_VALUE }, consumes={ MediaType.APPLICATION_JSON_VALUE })
@ResponseBody @ApiImplicitParams({
@ApiImplicitParam(paramType = "body", name = "json", value = "入参格式:{}", dataType = "string")
})
public ResponseBase carAgeList(@RequestBody String json) { public ResponseBase carAgeList(@RequestBody String json) {
DataResponse<Object> result = new DataResponse<>(); DataResponse<Object> result = new DataResponse<>();
try { try {
...@@ -51,6 +53,7 @@ public final class CarAgeMicro { ...@@ -51,6 +53,7 @@ public final class CarAgeMicro {
String[] carAges= Constants.carAge; String[] carAges= Constants.carAge;
datas.put("carAge", carAges); datas.put("carAge", carAges);
result.setData(carAges); result.setData(carAges);
result.setMessage("成功");
return result; return result;
} catch (ValidCheckException e) { } catch (ValidCheckException e) {
return new ResponseBase(e.getCode(),e.getMessage()); return new ResponseBase(e.getCode(),e.getMessage());
......
package com.servicemall.loyalty.dto;
import com.sun.istack.NotNull;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
@Data
@ApiModel(value="演示类",description="请求参数类" )
public class DemoDto implements Serializable {
private static final long serialVersionUID = 1L;
@NotNull
@ApiModelProperty(value = "defaultStr",example="mockStrValue")
private String strDemo;
@NotNull
@ApiModelProperty(example="1234343523",required = true)
private Long longNum;
@NotNull
@ApiModelProperty(example="111111.111")
private Double doubleNum;
@NotNull
@ApiModelProperty(example="2018-12-04T13:46:56.711Z")
private Date date;
}
package com.servicemall.loyalty.dto;
import com.sun.istack.NotNull;
import io.swagger.annotations.ApiModelProperty;
import java.util.Date;
import lombok.Data;
@Data
public class DemoOutputDto {
private String res;
@NotNull
@ApiModelProperty(value = "defaultOutputStr",example="mockOutputStrValue")
private String outputStrDemo;
@NotNull
@ApiModelProperty(example="6666666",required = true)
private Long outputLongNum;
@NotNull
@ApiModelProperty(example="88888.888")
private Double outputDoubleNum;
@NotNull
@ApiModelProperty(example="2018-12-12T11:11:11.111Z")
private Date outputDate;
}
...@@ -8,10 +8,13 @@ import javax.servlet.http.HttpServletRequest; ...@@ -8,10 +8,13 @@ import javax.servlet.http.HttpServletRequest;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import team.bangbang.common.data.Pagination; import team.bangbang.common.data.Pagination;
import team.bangbang.common.data.response.ResponseBase; import team.bangbang.common.data.response.ResponseBase;
import team.bangbang.common.data.response.DataResponse; import team.bangbang.common.data.response.DataResponse;
...@@ -29,7 +32,8 @@ import com.servicemall.loyalty.service.PlanService; ...@@ -29,7 +32,8 @@ import com.servicemall.loyalty.service.PlanService;
* @author 帮帮组 * @author 帮帮组
* @version 1.0 2020-12-08 * @version 1.0 2020-12-08
*/ */
@Api(description = "ServiceMall首页API接口") @Api(tags = {"loyalty"})
@ApiResponses(value={@ApiResponse(code=200, message="请求的服务不存在")})
@RestController @RestController
@CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600) @CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600)
@RequestMapping("/microservice/loyalty/plan") @RequestMapping("/microservice/loyalty/plan")
...@@ -51,6 +55,7 @@ public final class PlanMicro { ...@@ -51,6 +55,7 @@ public final class PlanMicro {
* @return 1:成功 其它:失败 * @return 1:成功 其它:失败
*/ */
@PostMapping("/insert") @PostMapping("/insert")
@ApiIgnore
public ResponseBase insert(@RequestBody Plan plan, HttpServletRequest request) { public ResponseBase insert(@RequestBody Plan plan, HttpServletRequest request) {
// 是否存在重复记录? // 是否存在重复记录?
if(exist(plan)) { if(exist(plan)) {
...@@ -70,6 +75,7 @@ public final class PlanMicro { ...@@ -70,6 +75,7 @@ public final class PlanMicro {
request.setAttribute("log", log); request.setAttribute("log", log);
DataResponse<Plan> result = new DataResponse<Plan>(); DataResponse<Plan> result = new DataResponse<Plan>();
result.setMessage("成功");
result.setData(plan); result.setData(plan);
return result; return result;
...@@ -83,6 +89,7 @@ public final class PlanMicro { ...@@ -83,6 +89,7 @@ public final class PlanMicro {
* *
* @return 成功删除的记录数量 * @return 成功删除的记录数量
*/ */
@ApiIgnore
@PostMapping("/delete") @PostMapping("/delete")
public ResponseBase delete(@RequestBody Plan plan, HttpServletRequest request) { public ResponseBase delete(@RequestBody Plan plan, HttpServletRequest request) {
...@@ -123,6 +130,7 @@ public final class PlanMicro { ...@@ -123,6 +130,7 @@ public final class PlanMicro {
* *
* @return 成功修改的记录数量 * @return 成功修改的记录数量
*/ */
@ApiIgnore
@PostMapping("/update") @PostMapping("/update")
public ResponseBase update(@RequestBody Plan plan, HttpServletRequest request) { public ResponseBase update(@RequestBody Plan plan, HttpServletRequest request) {
// 为防止更新意外,必须传入id才能更新 // 为防止更新意外,必须传入id才能更新
...@@ -155,7 +163,7 @@ public final class PlanMicro { ...@@ -155,7 +163,7 @@ public final class PlanMicro {
plan = PlanService.getObject(plan, null); plan = PlanService.getObject(plan, null);
DataResponse<Plan> result = new DataResponse<Plan>(); DataResponse<Plan> result = new DataResponse<Plan>();
result.setData(plan); result.setData(plan);
result.setMessage("成功");
return result; return result;
} }
...@@ -166,6 +174,7 @@ public final class PlanMicro { ...@@ -166,6 +174,7 @@ public final class PlanMicro {
* *
* @return 返回结果记录,并转化为相应的POJO对象 * @return 返回结果记录,并转化为相应的POJO对象
*/ */
@ApiIgnore
@PostMapping("/get") @PostMapping("/get")
public ResponseBase get(@RequestBody Plan plan) { public ResponseBase get(@RequestBody Plan plan) {
...@@ -177,7 +186,7 @@ public final class PlanMicro { ...@@ -177,7 +186,7 @@ public final class PlanMicro {
plan = PlanService.getObject(plan, null); plan = PlanService.getObject(plan, null);
DataResponse<Plan> result = new DataResponse<Plan>(); DataResponse<Plan> result = new DataResponse<Plan>();
result.setData(plan); result.setData(plan);
result.setMessage("成功");
return result; return result;
} }
...@@ -188,9 +197,9 @@ public final class PlanMicro { ...@@ -188,9 +197,9 @@ public final class PlanMicro {
* *
* @return 返回结果记录,并转化为相应的POJO对象列表 * @return 返回结果记录,并转化为相应的POJO对象列表
*/ */
@ApiOperation(value = "post请求调用示例", notes = "invokePost说明", httpMethod = "POST") @ApiOperation(value = "首页API接口", notes = "首页API接口", httpMethod = "POST")
@PostMapping("/list") @PostMapping("/list")
public ResponseBase list(@RequestBody Plan plan, @EntityParam Pagination pagination) { public ResponseBase list(@RequestBody Plan plan, Pagination pagination) {
// 附加限定条件,这里可以修改附加限定条件 // 附加限定条件,这里可以修改附加限定条件
String appendix = null; String appendix = null;
...@@ -218,6 +227,7 @@ public final class PlanMicro { ...@@ -218,6 +227,7 @@ public final class PlanMicro {
* *
* @return 返回记录数量 * @return 返回记录数量
*/ */
@ApiIgnore
@PostMapping("/count") @PostMapping("/count")
public ResponseBase count(@RequestBody Plan plan) { public ResponseBase count(@RequestBody Plan plan) {
// 附加限定条件,这里可以修改附加限定条件 // 附加限定条件,这里可以修改附加限定条件
...@@ -227,7 +237,7 @@ public final class PlanMicro { ...@@ -227,7 +237,7 @@ public final class PlanMicro {
DataResponse<Integer> result = new DataResponse<Integer>(); DataResponse<Integer> result = new DataResponse<Integer>();
result.setData(n); result.setData(n);
result.setMessage("成功");
return result; return result;
} }
......
...@@ -3,10 +3,7 @@ package com.servicemall.loyalty.micro; ...@@ -3,10 +3,7 @@ package com.servicemall.loyalty.micro;
import com.servicemall.loyalty.data.Selected; import com.servicemall.loyalty.data.Selected;
import com.servicemall.loyalty.service.SeletedService; import com.servicemall.loyalty.service.SeletedService;
import io.swagger.annotations.Api; import io.swagger.annotations.*;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import team.bangbang.common.data.Pagination; import team.bangbang.common.data.Pagination;
import team.bangbang.common.data.response.DataResponse; import team.bangbang.common.data.response.DataResponse;
...@@ -17,14 +14,15 @@ import java.util.List; ...@@ -17,14 +14,15 @@ import java.util.List;
import java.util.Map; import java.util.Map;
/** /**
* 精选 - * 精选
* *
* 对应 * 对应
* *
* @author 帮帮组 * @author 帮帮组
* @version 1.0 2020-12-08 * @version 1.0 2020-12-08
*/ */
@Api(description = "ServiceMall首页精选API接口") @Api(tags = {"selected"})
@ApiResponses(value={@ApiResponse(code=200, message="请求的服务不存在")})
@RestController @RestController
@CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600) @CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600)
@RequestMapping("/microservice/loyalty/") @RequestMapping("/microservice/loyalty/")
...@@ -65,7 +63,7 @@ public class SelectedMicro { ...@@ -65,7 +63,7 @@ public class SelectedMicro {
datas.put("pagination", pagination); datas.put("pagination", pagination);
result.setData(datas); result.setData(datas);
result.setMessage("成功");
return result; return result;
} }
} }
...@@ -20,9 +20,24 @@ public class SeletedService { ...@@ -20,9 +20,24 @@ public class SeletedService {
List<Selected> selectedList = new ArrayList<>(); List<Selected> selectedList = new ArrayList<>();
Selected selected = new Selected(); Selected selected = new Selected();
selected.setId(1l); selected.setId(1l);
selected.setType(1);//1:计划2:活动3:轮胎
selected.setImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"); selected.setImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
selected.setName("轮胎"); selected.setName("计划1");
selectedList.add(selected); selectedList.add(selected);
Selected selected1 = new Selected();
selected1.setId(2l);
selected1.setType(2);//1:计划2:活动3:轮胎
selected1.setImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
selected1.setName("活动1");
selectedList.add(selected1);
Selected selected2 = new Selected();
selected2.setId(3l);
selected2.setType(3);//1:计划2:活动3:轮胎
selected2.setImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
selected2.setName("轮胎1");
selectedList.add(selected2);
return selectedList; return selectedList;
} }
} }
...@@ -72,15 +72,18 @@ public class Coupon { ...@@ -72,15 +72,18 @@ public class Coupon {
/* 有效状态{1:有效 2:暂停} */ /* 有效状态{1:有效 2:暂停} */
private Integer activeStatus = null; private Integer activeStatus = null;
/* 状态:1未领取 2已领取 */
private Integer status = null;
/* 有效期-开始时间 */ /* 有效期-开始时间 */
private Date activeStartTime = null; private String activeStartTime = null;
/* 有效期-开始时间 (查询上线) */ /* 有效期-开始时间 (查询上线) */
private Date activeStartTimeTop = null; private Date activeStartTimeTop = null;
/* 有效期-开始时间 (查询下线) */ /* 有效期-开始时间 (查询下线) */
private Date activeStartTimeBottom = null; private Date activeStartTimeBottom = null;
/* 有效期-结束时间 */ /* 有效期-结束时间 */
private Date activeEndTime = null; private String activeEndTime = null;
/* 有效期-结束时间 (查询上线) */ /* 有效期-结束时间 (查询上线) */
private Date activeEndTimeTop = null; private Date activeEndTimeTop = null;
/* 有效期-结束时间 (查询下线) */ /* 有效期-结束时间 (查询下线) */
...@@ -108,7 +111,7 @@ public class Coupon { ...@@ -108,7 +111,7 @@ public class Coupon {
/* /*
* 固定数据字典 核销类型{1:订单核销 2:快速核销} * 固定数据字典 核销类型{1:订单核销 2:快速核销}
*/ */
public static final String[] usedTypeFlags = { "核销类型{1:订单核销 2:快速核销}" }; public static final String[] usedTypeFlags = { "订单核销","快速核销" };
/* /*
* 固定数据字典 是否可核销多次{1:是 2:否} * 固定数据字典 是否可核销多次{1:是 2:否}
...@@ -448,14 +451,14 @@ public class Coupon { ...@@ -448,14 +451,14 @@ public class Coupon {
/** /**
* @return 有效期-开始时间 * @return 有效期-开始时间
*/ */
public Date getActiveStartTime() { public String getActiveStartTime() {
return activeStartTime; return activeStartTime;
} }
/** /**
* @param activeStartTime 有效期-开始时间 * @param activeStartTime 有效期-开始时间
*/ */
public void setActiveStartTime(Date activeStartTime) { public void setActiveStartTime(String activeStartTime) {
this.activeStartTime = activeStartTime; this.activeStartTime = activeStartTime;
} }
...@@ -490,14 +493,14 @@ public class Coupon { ...@@ -490,14 +493,14 @@ public class Coupon {
/** /**
* @return 有效期-结束时间 * @return 有效期-结束时间
*/ */
public Date getActiveEndTime() { public String getActiveEndTime() {
return activeEndTime; return activeEndTime;
} }
/** /**
* @param activeEndTime 有效期-结束时间 * @param activeEndTime 有效期-结束时间
*/ */
public void setActiveEndTime(Date activeEndTime) { public void setActiveEndTime(String activeEndTime) {
this.activeEndTime = activeEndTime; this.activeEndTime = activeEndTime;
} }
...@@ -630,4 +633,12 @@ public class Coupon { ...@@ -630,4 +633,12 @@ public class Coupon {
return getId().equals(((Coupon)obj).getId()); return getId().equals(((Coupon)obj).getId());
} }
public Integer getStatus() {
return status;
}
public void setStatus(Integer status) {
this.status = status;
}
} }
...@@ -8,9 +8,7 @@ import javax.servlet.http.HttpServletRequest; ...@@ -8,9 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import com.servicemall.loyalty.data.Selected; import com.servicemall.loyalty.data.Selected;
import com.servicemall.loyalty.service.SeletedService; import com.servicemall.loyalty.service.SeletedService;
import io.swagger.annotations.ApiImplicitParam; import io.swagger.annotations.*;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.CrossOrigin; import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -36,6 +34,8 @@ import com.servicemall.right.service.CouponService; ...@@ -36,6 +34,8 @@ import com.servicemall.right.service.CouponService;
* @author 帮帮组 * @author 帮帮组
* @version 1.0 2020-12-08 * @version 1.0 2020-12-08
*/ */
@Api(tags = {"right"})
@ApiResponses(value={@ApiResponse(code=200, message="请求的服务不存在")})
@RestController @RestController
@CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600) @CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600)
@RequestMapping("/microservice/right/coupon") @RequestMapping("/microservice/right/coupon")
...@@ -53,6 +53,7 @@ public final class CouponMicro { ...@@ -53,6 +53,7 @@ public final class CouponMicro {
* *
* @return 1:成功 其它:失败 * @return 1:成功 其它:失败
*/ */
@ApiIgnore
@PostMapping("/insert") @PostMapping("/insert")
public ResponseBase insert(@RequestBody Coupon coupon, HttpServletRequest request) { public ResponseBase insert(@RequestBody Coupon coupon, HttpServletRequest request) {
// 是否存在重复记录? // 是否存在重复记录?
...@@ -74,7 +75,7 @@ public final class CouponMicro { ...@@ -74,7 +75,7 @@ public final class CouponMicro {
DataResponse<Coupon> result = new DataResponse<Coupon>(); DataResponse<Coupon> result = new DataResponse<Coupon>();
result.setData(coupon); result.setData(coupon);
result.setMessage("成功");
return result; return result;
} }
...@@ -86,6 +87,7 @@ public final class CouponMicro { ...@@ -86,6 +87,7 @@ public final class CouponMicro {
* *
* @return 成功删除的记录数量 * @return 成功删除的记录数量
*/ */
@ApiIgnore
@PostMapping("/delete") @PostMapping("/delete")
public ResponseBase delete(@RequestBody Coupon coupon, HttpServletRequest request) { public ResponseBase delete(@RequestBody Coupon coupon, HttpServletRequest request) {
...@@ -126,6 +128,7 @@ public final class CouponMicro { ...@@ -126,6 +128,7 @@ public final class CouponMicro {
* *
* @return 成功修改的记录数量 * @return 成功修改的记录数量
*/ */
@ApiIgnore
@PostMapping("/update") @PostMapping("/update")
public ResponseBase update(@RequestBody Coupon coupon, HttpServletRequest request) { public ResponseBase update(@RequestBody Coupon coupon, HttpServletRequest request) {
// 为防止更新意外,必须传入id才能更新 // 为防止更新意外,必须传入id才能更新
...@@ -158,7 +161,7 @@ public final class CouponMicro { ...@@ -158,7 +161,7 @@ public final class CouponMicro {
coupon = CouponService.getObject(coupon, null); coupon = CouponService.getObject(coupon, null);
DataResponse<Coupon> result = new DataResponse<Coupon>(); DataResponse<Coupon> result = new DataResponse<Coupon>();
result.setData(coupon); result.setData(coupon);
result.setMessage("成功");
return result; return result;
} }
...@@ -169,6 +172,7 @@ public final class CouponMicro { ...@@ -169,6 +172,7 @@ public final class CouponMicro {
* *
* @return 返回结果记录,并转化为相应的POJO对象 * @return 返回结果记录,并转化为相应的POJO对象
*/ */
@ApiIgnore
@PostMapping("/get") @PostMapping("/get")
public ResponseBase get(@RequestBody Coupon coupon) { public ResponseBase get(@RequestBody Coupon coupon) {
...@@ -180,7 +184,7 @@ public final class CouponMicro { ...@@ -180,7 +184,7 @@ public final class CouponMicro {
coupon = CouponService.getObject(coupon, null); coupon = CouponService.getObject(coupon, null);
DataResponse<Coupon> result = new DataResponse<Coupon>(); DataResponse<Coupon> result = new DataResponse<Coupon>();
result.setData(coupon); result.setData(coupon);
result.setMessage("成功");
return result; return result;
} }
...@@ -191,6 +195,7 @@ public final class CouponMicro { ...@@ -191,6 +195,7 @@ public final class CouponMicro {
* *
* @return 返回结果记录,并转化为相应的POJO对象列表 * @return 返回结果记录,并转化为相应的POJO对象列表
*/ */
@ApiIgnore
@PostMapping("/list") @PostMapping("/list")
public ResponseBase list(@RequestBody Coupon coupon, @EntityParam Pagination pagination) { public ResponseBase list(@RequestBody Coupon coupon, @EntityParam Pagination pagination) {
...@@ -209,7 +214,7 @@ public final class CouponMicro { ...@@ -209,7 +214,7 @@ public final class CouponMicro {
datas.put("pagination", pagination); datas.put("pagination", pagination);
result.setData(datas); result.setData(datas);
result.setMessage("成功");
return result; return result;
} }
...@@ -220,6 +225,7 @@ public final class CouponMicro { ...@@ -220,6 +225,7 @@ public final class CouponMicro {
* *
* @return 返回记录数量 * @return 返回记录数量
*/ */
@ApiIgnore
@PostMapping("/count") @PostMapping("/count")
public ResponseBase count(@RequestBody Coupon coupon) { public ResponseBase count(@RequestBody Coupon coupon) {
// 附加限定条件,这里可以修改附加限定条件 // 附加限定条件,这里可以修改附加限定条件
...@@ -229,7 +235,7 @@ public final class CouponMicro { ...@@ -229,7 +235,7 @@ public final class CouponMicro {
DataResponse<Integer> result = new DataResponse<Integer>(); DataResponse<Integer> result = new DataResponse<Integer>();
result.setData(n); result.setData(n);
result.setMessage("成功");
return result; return result;
} }
...@@ -331,7 +337,7 @@ public final class CouponMicro { ...@@ -331,7 +337,7 @@ public final class CouponMicro {
@PostMapping("/querycouponlist") @PostMapping("/querycouponlist")
@ApiOperation(value = "获取优惠券列表", notes = "优惠券列表", httpMethod = "POST") @ApiOperation(value = "获取优惠券列表", notes = "优惠券列表", httpMethod = "POST")
@ApiImplicitParams({ @ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "dms_code", value = "经销商code", dataType = "String"), @ApiImplicitParam(paramType = "query", name = "dms_code", value = "经销商code", dataType = "string"),
@ApiImplicitParam(paramType = "query", name = "pageNo", value = "分页参数 - 页号,默认为1", dataType = "Integer"), @ApiImplicitParam(paramType = "query", name = "pageNo", value = "分页参数 - 页号,默认为1", dataType = "Integer"),
@ApiImplicitParam(paramType = "query", name = "pageSize", value = "分页参数 - 每页最大记录数量,默认为10", dataType = "Integer") @ApiImplicitParam(paramType = "query", name = "pageSize", value = "分页参数 - 每页最大记录数量,默认为10", dataType = "Integer")
}) })
...@@ -357,7 +363,7 @@ public final class CouponMicro { ...@@ -357,7 +363,7 @@ public final class CouponMicro {
datas.put("pagination", pagination); datas.put("pagination", pagination);
result.setData(datas); result.setData(datas);
result.setMessage("成功");
return result; return result;
} }
} }
...@@ -4,6 +4,7 @@ import java.util.*; ...@@ -4,6 +4,7 @@ import java.util.*;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import javax.annotation.Resource; import javax.annotation.Resource;
import com.servicemall.systemcommon.util.DateUtil;
import team.bangbang.common.CommonMPI; import team.bangbang.common.CommonMPI;
import team.bangbang.common.data.KeyValue; import team.bangbang.common.data.KeyValue;
import team.bangbang.common.data.Pagination; import team.bangbang.common.data.Pagination;
...@@ -223,17 +224,32 @@ public final class CouponService { ...@@ -223,17 +224,32 @@ public final class CouponService {
public static List<Coupon> queryCouponList(String dms_code,Pagination pagination){ public static List<Coupon> queryCouponList(String dms_code,Pagination pagination){
List<Coupon> couponList = new ArrayList<>(); List<Coupon> couponList = new ArrayList<>();
Coupon coupon = new Coupon(); Coupon coupon = new Coupon();
coupon.setActiveEndTime(new Date()); coupon.setActiveEndTime(DateUtil.getTime());
coupon.setActiveStartTime(new Date()); coupon.setActiveStartTime(DateUtil.getTime());
coupon.setRightName("代金券"); coupon.setRightName("代金券");
coupon.setUsedTypeFlag(1); coupon.setUsedTypeFlag(1);
coupon.setTotalUseNum(-1); coupon.setTotalUseNum(-1);
coupon.setId(1l); coupon.setId(1l);
coupon.setSortValue(1); coupon.setSortValue(1);
coupon.setStatus(1);
Map<String,Integer> map = new HashMap<String,Integer>(); Map<String,Integer> map = new HashMap<String,Integer>();
map.put("price",10); map.put("price",10);
coupon.setRightContent(map.toString()); coupon.setRightContent(map.toString());
couponList.add(coupon); couponList.add(coupon);
Coupon coupon1 = new Coupon();
coupon1.setActiveEndTime(DateUtil.getTime());
coupon1.setActiveStartTime(DateUtil.getTime());
coupon1.setRightName("折扣券");
coupon1.setUsedTypeFlag(2);
coupon1.setTotalUseNum(-1);
coupon1.setId(2l);
coupon1.setSortValue(1);
coupon1.setStatus(2);
Map<String,Integer> map1= new HashMap<String,Integer>();
map1.put("price",10);
coupon1.setRightContent(map1.toString());
couponList.add(coupon1);
return couponList; return couponList;
} }
} }
...@@ -18,25 +18,26 @@ public enum ErrorEnum { ...@@ -18,25 +18,26 @@ public enum ErrorEnum {
E_202(202, "请求参数缺少必要字段"), E_202(202, "请求参数缺少必要字段"),
E_203(203, "json格式有误"), E_203(203, "json格式有误"),
E_301(300,"当前操作无权限"), E_300(300,"当前操作无权限"),
E_302(301,"Token过期"), E_301(301,"Token过期"),
E_303(302,"签名sign无效"), E_302(302,"签名sign无效"),
E_304(303,"请求IP不被允许"), E_303(303,"请求IP不被允许"),
E_401(400,"网络错误"), E_400(400,"网络错误"),
E_402(401,"业务逻辑错误"), E_401(401,"业务逻辑错误"),
E_403(402,"数据库错误"), E_402(402,"数据库错误"),
E_404(403,"文件操作错误"), E_403(403,"文件操作错误"),
E_404(404,"调用第三方接口异常"),
E_501(500,"记录未发现"),
E_502(501,"数据库中存在重复的记录"), E_500(500,"记录未发现"),
E_503(502,"无数据"), E_501(501,"数据库中存在重复的记录"),
E_504(503,"系统保护数据,不可修改或删除"), E_502(502,"无数据"),
E_503(503,"系统保护数据,不可修改或删除"),
E_1001(1000,"账号或者密码错误"),
E_1002(1001,"账号已经被禁用"), E_1000(1000,"账号或者密码错误"),
E_1003(1002,"没有登录或者长时间未操作导致登录信息丢失"); E_1001(1001,"账号已经被禁用"),
E_1002(1002,"没有登录或者长时间未操作导致登录信息丢失");
// 成员变量 // 成员变量
......
package com.servicemall.systemcommon.util;
import org.springframework.util.StringUtils;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
/**
* 说明:日期处理 创建人:warren 修改时间:2015年11月24日
*
* @version
*/
public class DateUtil {
private final static SimpleDateFormat sdfYear = new SimpleDateFormat("yyyy");
private final static SimpleDateFormat sdfMonth = new SimpleDateFormat("MM");
private final static SimpleDateFormat sdfDate = new SimpleDateFormat("dd");
private final static SimpleDateFormat sdfDay = new SimpleDateFormat("yyyy-MM-dd");
private final static SimpleDateFormat sdfDays = new SimpleDateFormat("yyyyMMdd");
private final static SimpleDateFormat sdfTime = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
private final static SimpleDateFormat sdfTimes = new SimpleDateFormat("yyyyMMddHHmmss");
/**
* 获取YYYY格式
*
* @return
*/
public static String getSdfTimes() {
return sdfTimes.format(new Date());
}
/**
* 获取YYYY格式
*
* @return
*/
public static String getYear() {
return sdfYear.format(new Date());
}
/**
* 获取MM格式
*
* @return
*/
public static String getMonth() {
return sdfMonth.format(new Date());
}
/**
* 获取YYYY-MM-DD格式
*
* @return
*/
public static String getDay() {
return sdfDay.format(new Date());
}
/**
* 获取YYYYMMDD格式
*
* @return
*/
public static String getDays() {
return sdfDays.format(new Date());
}
/**
* 获取DD格式
*
* @return
*/
public static String getDate() {
return sdfDate.format(new Date());
}
/**
* 获取YYYY-MM-DD HH:mm:ss格式
*
* @return
*/
public static String getTime() {
return sdfTime.format(new Date());
}
/**
* @Title: compareDate
* @Description: TODO(日期比较,如果s>=e 返回true 否则返回false)
* @param s
* @param e
* @return boolean
* @throws @author
* fh
*/
public static boolean compareDate(String s, String e) {
if (fomatDate(s) == null || fomatDate(e) == null) {
return false;
}
return fomatDate(s).getTime() >= fomatDate(e).getTime();
}
/**
* 格式化日期
*
* @return
*/
public static Date fomatDate(String date) {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
return fmt.parse(date);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
/**
* 校验日期是否合法
*
* @return
*/
public static boolean isValidDate(String s) {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
fmt.parse(s);
return true;
} catch (Exception e) {
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
return false;
}
}
/**
* @param startTime
* @param endTime
* @return
*/
public static int getDiffYear(String startTime, String endTime) {
DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd");
try {
// long aa=0;
int years = (int) (((fmt.parse(endTime).getTime() - fmt.parse(startTime).getTime()) / (1000 * 60 * 60 * 24))
/ 365);
return years;
} catch (Exception e) {
// 如果throw java.text.ParseException或者NullPointerException,就说明格式不对
return 0;
}
}
/**
* <li>功能描述:时间相减得到天数
*
* @param beginDateStr
* @param endDateStr
* @return long
* @author Administrator
*/
public static long getDaySub(String beginDateStr, String endDateStr) {
long day = 0;
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
Date beginDate = null;
Date endDate = null;
try {
beginDate = format.parse(beginDateStr);
endDate = format.parse(endDateStr);
} catch (ParseException e) {
e.printStackTrace();
}
day = (endDate.getTime() - beginDate.getTime()) / (24 * 60 * 60 * 1000);
// System.out.println("相隔的天数="+day);
return day;
}
/**
* 得到n天之后的日期
*
* @param days
* @return
*/
public static String getAfterDayDate(String days) {
int daysInt = Integer.parseInt(days);
Calendar canlendar = Calendar.getInstance(); // java.util包
canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动
Date date = canlendar.getTime();
SimpleDateFormat sdfd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String dateStr = sdfd.format(date);
return dateStr;
}
/**
* 得到n天之后是周几
*
* @param days
* @return
*/
public static String getAfterDayWeek(String days) {
int daysInt = Integer.parseInt(days);
Calendar canlendar = Calendar.getInstance(); // java.util包
canlendar.add(Calendar.DATE, daysInt); // 日期减 如果不够减会将月变动
Date date = canlendar.getTime();
SimpleDateFormat sdf = new SimpleDateFormat("E");
String dateStr = sdf.format(date);
return dateStr;
}
public static Long dateToStamp(String s) throws ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("HH:mm");
Date date = simpleDateFormat.parse(s);
long ts = date.getTime();
return ts;
}
public static String getHMS(long timetemp) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(timetemp);
SimpleDateFormat fmat = new SimpleDateFormat("HH:mm");
String time = fmat.format(calendar.getTime());
return time;
}
public static String getYMDHMS(long timetemp) {
Calendar calendar = Calendar.getInstance();
calendar.setTimeInMillis(timetemp);
SimpleDateFormat fmat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String time = fmat.format(calendar.getTime());
return time;
}
public static void main(String[] args) {
}
/**
* 获取开始日期到今天的间隔天数
*
* @param startDate
* 开始时间
* @return 相差天数
*/
public static long daysBetween(Date startDate) {
return daysBetween(startDate, new Date());
}
/**
* 获取两个日期之间间隔的天数
*
* @param startDate
* 开始时间
* @param endDate
* 结束时间
* @return 相差天数
*/
public static long daysBetween(Date startDate, Date endDate) {
return (endDate.getTime() - startDate.getTime()) / (1000 * 3600 * 24) + 1;
}
/**
* 字符串转日期
* @param datestr
* @return
*/
public static Date getDateFromStr(String datestr) {
SimpleDateFormat fmt = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss");
try {
return fmt.parse(datestr);
} catch (ParseException e) {
e.printStackTrace();
return null;
}
}
/**
* 字符串转日期
* @param date
* @param fmt 形如yyyy-MM-dd HH:mm:ss
* @return
*/
public static String getStrFromDate(Date date,String fmt) {
if(StringUtils.isEmpty(fmt)){
return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(date);
}
SimpleDateFormat sdf = new SimpleDateFormat(fmt);
return sdf.format(date);
}
}
...@@ -9,6 +9,8 @@ import javax.servlet.http.HttpServletRequest; ...@@ -9,6 +9,8 @@ import javax.servlet.http.HttpServletRequest;
import com.servicemall.website.service.SliderService; import com.servicemall.website.service.SliderService;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore; import springfox.documentation.annotations.ApiIgnore;
...@@ -28,7 +30,8 @@ import com.servicemall.website.data.Slider; ...@@ -28,7 +30,8 @@ import com.servicemall.website.data.Slider;
* @author 帮帮组 * @author 帮帮组
* @version 1.0 2020-12-08 * @version 1.0 2020-12-08
*/ */
@Api(description = "ServiceMall首页轮播图接口") @Api(tags = {"slide"})
@ApiResponses(value={@ApiResponse(code=200, message="请求的服务不存在")})
@RestController @RestController
@CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600) @CrossOrigin(allowCredentials="true", allowedHeaders="*", origins="*", maxAge=3600)
@RequestMapping("/microservice/website/slider") @RequestMapping("/microservice/website/slider")
......
...@@ -21,9 +21,20 @@ public class SliderService { ...@@ -21,9 +21,20 @@ public class SliderService {
Slider slider = new Slider(); Slider slider = new Slider();
slider.setId(1l); slider.setId(1l);
slider.setImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg"); slider.setImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
slider.setJumpUrl("轮胎"); slider.setJumpUrl("https://www.baidu.com");
slider.setSortNo(1); slider.setSortNo(1);
slider.setDblclickImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
slider.setSliderName("轮播1名称");
sliderList.add(slider); sliderList.add(slider);
Slider slider1 = new Slider();
slider1.setId(1l);
slider1.setImageUrl("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
slider1.setJumpUrl("https://www.baidu.com");
slider1.setSortNo(2);
slider1.setDblclickImage("https://timgsa.baidu.com/timg?image&quality=80&size=b9999_10000&sec=1607427778447&di=b0d30539b93ff6e7394b9c80801e11c7&imgtype=0&src=http%3A%2F%2Fimg000.hc360.cn%2Fm6%2FM04%2F58%2F6A%2FwKhQolWVsnmEGYk8AAAAAIA_Z48561.jpg");
slider1.setSliderName("轮播2名称");
sliderList.add(slider1);
return sliderList; return sliderList;
} }
} }
...@@ -7,7 +7,9 @@ import org.springframework.context.annotation.Configuration; ...@@ -7,7 +7,9 @@ import org.springframework.context.annotation.Configuration;
import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestMethod;
import springfox.documentation.builders.ResponseMessageBuilder; import springfox.documentation.builders.ResponseMessageBuilder;
import springfox.documentation.schema.ModelRef; import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.Contact;
import springfox.documentation.service.ResponseMessage; import springfox.documentation.service.ResponseMessage;
import springfox.documentation.service.Tag;
import springfox.documentation.swagger2.annotations.EnableSwagger2; import springfox.documentation.swagger2.annotations.EnableSwagger2;
import team.bangbang.common.config.Config; import team.bangbang.common.config.Config;
import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.ApiInfoBuilder;
...@@ -62,19 +64,37 @@ public class Swagger2 { ...@@ -62,19 +64,37 @@ public class Swagger2 {
.globalResponseMessage(RequestMethod.PUT, responseMessageList) .globalResponseMessage(RequestMethod.PUT, responseMessageList)
.globalResponseMessage(RequestMethod.DELETE, responseMessageList) .globalResponseMessage(RequestMethod.DELETE, responseMessageList)
.apiInfo(apiInfo()).select() .apiInfo(apiInfo())
.tags(new Tag("loyalty", "礼遇计划相关"), getTags())
.select()
.apis(RequestHandlerSelectors.basePackage("com.servicemall")).paths(PathSelectors.any()) .apis(RequestHandlerSelectors.basePackage("com.servicemall")).paths(PathSelectors.any())
.build(); .build();
} }
private Tag[] getTags() {
Tag[] tags = {
new Tag("basis", "基础数据相关"),
new Tag("car", "车辆相关"),
new Tag("selected", "精选相关"),
new Tag("right", "权益相关"),
new Tag("slide", "轮播相关")
};
return tags;
}
/** /**
* 创建该API的基本信息(这些基本信息会展现在文档页面中) 访问地址:http://项目实际地址/swagger-ui.html * 创建该API的基本信息(这些基本信息会展现在文档页面中) 访问地址:http://项目实际地址/swagger-ui.html
* *
* @return * @return
*/ */
private ApiInfo apiInfo() { private ApiInfo apiInfo() {
return new ApiInfoBuilder().title(Config.getProperty("spring.application.name")) return new ApiInfoBuilder()
.description("更多请关注http://console.bangbang.team/").termsOfServiceUrl("http://console.bangbang.team/") .title("ServiceMall 后端接口 APIs")
.version("1.0").build(); .description("api根地址:http://49.234.59.211/")
//.termsOfServiceUrl("http://49.234.59.211/")
//.contact(new Contact("钱旺", "", ""))
.version("1.0")
.build();
} }
} }
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