Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
service_mall
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
冯秋丽
service_mall
Commits
b0ec3965
Commit
b0ec3965
authored
Dec 08, 2020
by
bboymoney
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swagger
parent
4c25d0df
Changes
17
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
664 additions
and
192 deletions
+664
-192
compiler.xml
.idea/compiler.xml
+1
-0
pom.xml
pom.xml
+22
-0
BasisMicro.java
src/main/java/com/servicemall/basis/micro/BasisMicro.java
+115
-0
CarAgeMicro.java
src/main/java/com/servicemall/car/micro/CarAgeMicro.java
+10
-7
DemoDto.java
src/main/java/com/servicemall/loyalty/dto/DemoDto.java
+0
-33
DemoOutputDto.java
src/main/java/com/servicemall/loyalty/dto/DemoOutputDto.java
+0
-29
PlanMicro.java
src/main/java/com/servicemall/loyalty/micro/PlanMicro.java
+33
-23
SelectedMicro.java
...ain/java/com/servicemall/loyalty/micro/SelectedMicro.java
+5
-7
SeletedService.java
.../java/com/servicemall/loyalty/service/SeletedService.java
+16
-1
Coupon.java
src/main/java/com/servicemall/right/data/Coupon.java
+50
-39
CouponMicro.java
src/main/java/com/servicemall/right/micro/CouponMicro.java
+31
-25
CouponService.java
...ain/java/com/servicemall/right/service/CouponService.java
+18
-2
ErrorEnum.java
...ain/java/com/servicemall/systemcommon/data/ErrorEnum.java
+20
-19
DateUtil.java
...main/java/com/servicemall/systemcommon/util/DateUtil.java
+302
-0
SliderMicro.java
src/main/java/com/servicemall/website/micro/SliderMicro.java
+5
-2
SliderService.java
...n/java/com/servicemall/website/service/SliderService.java
+12
-1
Swagger2.java
src/main/java/team/bangbang/Swagger2.java
+24
-4
No files found.
.idea/compiler.xml
View file @
b0ec3965
...
@@ -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"
/>
...
...
pom.xml
View file @
b0ec3965
...
@@ -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>
src/main/java/com/servicemall/basis/micro/BasisMicro.java
0 → 100644
View file @
b0ec3965
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
());
}
}
}
src/main/java/com/servicemall/car/micro/CarAgeMicro.java
View file @
b0ec3965
...
@@ -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
());
...
...
src/main/java/com/servicemall/loyalty/dto/DemoDto.java
deleted
100644 → 0
View file @
4c25d0df
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
;
}
src/main/java/com/servicemall/loyalty/dto/DemoOutputDto.java
deleted
100644 → 0
View file @
4c25d0df
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
;
}
src/main/java/com/servicemall/loyalty/micro/PlanMicro.java
View file @
b0ec3965
...
@@ -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
))
{
...
@@ -58,7 +63,7 @@ public final class PlanMicro {
...
@@ -58,7 +63,7 @@ public final class PlanMicro {
}
}
int
n
=
PlanService
.
insert
(
plan
);
int
n
=
PlanService
.
insert
(
plan
);
if
(
n
!=
1
)
{
if
(
n
!=
1
)
{
return
ResponseBase
.
ERROR_LOGIC
;
return
ResponseBase
.
ERROR_LOGIC
;
}
}
...
@@ -68,10 +73,11 @@ public final class PlanMicro {
...
@@ -68,10 +73,11 @@ public final class PlanMicro {
log
.
setType
(
"新增礼遇计划"
);
log
.
setType
(
"新增礼遇计划"
);
log
.
setBizData
(
plan
);
log
.
setBizData
(
plan
);
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
)
{
...
@@ -99,9 +106,9 @@ public final class PlanMicro {
...
@@ -99,9 +106,9 @@ public final class PlanMicro {
// 限定条件
// 限定条件
Plan
where
=
new
Plan
();
Plan
where
=
new
Plan
();
where
.
setId
(
plan
.
getId
());
where
.
setId
(
plan
.
getId
());
int
result
=
PlanService
.
delete
(
where
,
null
);
int
result
=
PlanService
.
delete
(
where
,
null
);
if
(
result
!=
1
)
{
if
(
result
!=
1
)
{
return
ResponseBase
.
DATA_NOT_FOUND
;
return
ResponseBase
.
DATA_NOT_FOUND
;
}
}
...
@@ -111,7 +118,7 @@ public final class PlanMicro {
...
@@ -111,7 +118,7 @@ public final class PlanMicro {
log
.
setType
(
"删除礼遇计划"
);
log
.
setType
(
"删除礼遇计划"
);
log
.
setBizData
(
where
);
log
.
setBizData
(
where
);
request
.
setAttribute
(
"log"
,
log
);
request
.
setAttribute
(
"log"
,
log
);
return
ResponseBase
.
SUCCESS
;
return
ResponseBase
.
SUCCESS
;
}
}
...
@@ -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才能更新
...
@@ -140,7 +148,7 @@ public final class PlanMicro {
...
@@ -140,7 +148,7 @@ public final class PlanMicro {
// 第1个参数plan,取关键字段plan.id为条件
// 第1个参数plan,取关键字段plan.id为条件
// 第3个参数plan,取plan内关键字段以外其它属性数据
// 第3个参数plan,取plan内关键字段以外其它属性数据
int
n
=
PlanService
.
update
(
plan
,
null
,
plan
);
int
n
=
PlanService
.
update
(
plan
,
null
,
plan
);
if
(
n
!=
1
)
{
if
(
n
!=
1
)
{
return
ResponseBase
.
DATA_NOT_FOUND
;
return
ResponseBase
.
DATA_NOT_FOUND
;
}
}
...
@@ -149,13 +157,13 @@ public final class PlanMicro {
...
@@ -149,13 +157,13 @@ public final class PlanMicro {
OperationLog
log
=
new
OperationLog
();
OperationLog
log
=
new
OperationLog
();
log
.
setType
(
"修改礼遇计划"
);
log
.
setType
(
"修改礼遇计划"
);
log
.
setBizData
(
plan
);
log
.
setBizData
(
plan
);
request
.
setAttribute
(
"log"
,
log
);
request
.
setAttribute
(
"log"
,
log
);
// 重新查询,返回到前端
// 重新查询,返回到前端
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,26 +197,26 @@ public final class PlanMicro {
...
@@ -188,26 +197,26 @@ 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
;
List
<
Plan
>
planList
=
PlanService
.
list
(
plan
,
appendix
,
pagination
);
List
<
Plan
>
planList
=
PlanService
.
list
(
plan
,
appendix
,
pagination
);
// 统计符合条件的结果记录数量
// 统计符合条件的结果记录数量
int
recordCount
=
PlanService
.
count
(
plan
,
appendix
);
int
recordCount
=
PlanService
.
count
(
plan
,
appendix
);
pagination
.
setRecordCount
(
recordCount
);
pagination
.
setRecordCount
(
recordCount
);
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<
Map
<
String
,
Object
>>();
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
datas
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
datas
=
new
HashMap
<
String
,
Object
>();
datas
.
put
(
"list"
,
planList
);
datas
.
put
(
"list"
,
planList
);
datas
.
put
(
"pagination"
,
pagination
);
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setData
(
datas
);
return
result
;
return
result
;
}
}
...
@@ -218,22 +227,23 @@ public final class PlanMicro {
...
@@ -218,22 +227,23 @@ public final class PlanMicro {
*
*
* @return 返回记录数量
* @return 返回记录数量
*/
*/
@ApiIgnore
@PostMapping
(
"/count"
)
@PostMapping
(
"/count"
)
public
ResponseBase
count
(
@RequestBody
Plan
plan
)
{
public
ResponseBase
count
(
@RequestBody
Plan
plan
)
{
// 附加限定条件,这里可以修改附加限定条件
// 附加限定条件,这里可以修改附加限定条件
String
appendix
=
null
;
String
appendix
=
null
;
int
n
=
PlanService
.
count
(
plan
,
appendix
);
int
n
=
PlanService
.
count
(
plan
,
appendix
);
DataResponse
<
Integer
>
result
=
new
DataResponse
<
Integer
>();
DataResponse
<
Integer
>
result
=
new
DataResponse
<
Integer
>();
result
.
setData
(
n
);
result
.
setData
(
n
);
result
.
setMessage
(
"成功"
);
return
result
;
return
result
;
}
}
/**
/**
* 用在新增、修改时检查数据库中是否存在重复记录(请务必保留该方法)
* 用在新增、修改时检查数据库中是否存在重复记录(请务必保留该方法)
*
*
* @param temp
* @param temp
* 将要修改的礼遇计划POJO
* 将要修改的礼遇计划POJO
* @return true:已经存在 false:不存在
* @return true:已经存在 false:不存在
...
@@ -241,7 +251,7 @@ public final class PlanMicro {
...
@@ -241,7 +251,7 @@ public final class PlanMicro {
private
boolean
exist
(
Plan
temp
)
{
private
boolean
exist
(
Plan
temp
)
{
// 检查修改的礼遇计划是否有重复记录
// 检查修改的礼遇计划是否有重复记录
Plan
form
=
new
Plan
();
Plan
form
=
new
Plan
();
// 关键字限定条件
// 关键字限定条件
String
str
=
(
temp
.
getId
()
==
null
?
null
:
"id != "
+
temp
.
getId
());
String
str
=
(
temp
.
getId
()
==
null
?
null
:
"id != "
+
temp
.
getId
());
...
...
src/main/java/com/servicemall/loyalty/micro/SelectedMicro.java
View file @
b0ec3965
...
@@ -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
;
}
}
}
}
src/main/java/com/servicemall/loyalty/service/SeletedService.java
View file @
b0ec3965
...
@@ -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
(
1
l
);
selected
.
setId
(
1
l
);
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
(
2
l
);
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
(
3
l
);
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
;
}
}
}
}
src/main/java/com/servicemall/right/data/Coupon.java
View file @
b0ec3965
...
@@ -17,89 +17,92 @@ public class Coupon {
...
@@ -17,89 +17,92 @@ public class Coupon {
/* 礼遇编号 */
/* 礼遇编号 */
private
Long
loyaltyId
=
null
;
private
Long
loyaltyId
=
null
;
/* 权益名称 */
/* 权益名称 */
private
String
rightName
=
null
;
private
String
rightName
=
null
;
/* 有效期类型标识{1:按日期期间 2:按有效期} */
/* 有效期类型标识{1:按日期期间 2:按有效期} */
private
Integer
activeTypeFlag
=
null
;
private
Integer
activeTypeFlag
=
null
;
/* 有效期-月数{-1无限制} */
/* 有效期-月数{-1无限制} */
private
Integer
activeMonth
=
null
;
private
Integer
activeMonth
=
null
;
/* 核销类型{1:订单核销 2:快速核销} */
/* 核销类型{1:订单核销 2:快速核销} */
private
Integer
usedTypeFlag
=
null
;
private
Integer
usedTypeFlag
=
null
;
/* 是否可核销多次{1:是 2:否} */
/* 是否可核销多次{1:是 2:否} */
private
Integer
useNumTypeFlag
=
null
;
private
Integer
useNumTypeFlag
=
null
;
/* 阶段性可核销次数 */
/* 阶段性可核销次数 */
private
Integer
phasedUseNum
=
null
;
private
Integer
phasedUseNum
=
null
;
/* 每{1:不限制 2:年 3:季度 4:月} */
/* 每{1:不限制 2:年 3:季度 4:月} */
private
Integer
phaseTypeFlag
=
null
;
private
Integer
phaseTypeFlag
=
null
;
/* 共可核销次数{-1不限制} */
/* 共可核销次数{-1不限制} */
private
Integer
totalUseNum
=
null
;
private
Integer
totalUseNum
=
null
;
/* 权益使用必须完成订单次数 */
/* 权益使用必须完成订单次数 */
private
Integer
useLimitOrderNum
=
null
;
private
Integer
useLimitOrderNum
=
null
;
/* 权益类型{1:满减券金额类-整单减2:满减券金额类-每满减3:满减券产品类-整单减4:满减券产品类-每满减 5:折扣券6赠品券7免单券8代金券9动态折扣券} */
/* 权益类型{1:满减券金额类-整单减2:满减券金额类-每满减3:满减券产品类-整单减4:满减券产品类-每满减 5:折扣券6赠品券7免单券8代金券9动态折扣券} */
private
Integer
rightTypeFlag
=
null
;
private
Integer
rightTypeFlag
=
null
;
/* 权益内容 */
/* 权益内容 */
private
String
rightContent
=
null
;
private
String
rightContent
=
null
;
/* 权益描述 */
/* 权益描述 */
private
String
description
=
null
;
private
String
description
=
null
;
/* 使用说明 */
/* 使用说明 */
private
String
useDescription
=
null
;
private
String
useDescription
=
null
;
/* 排序值 */
/* 排序值 */
private
Integer
sortValue
=
null
;
private
Integer
sortValue
=
null
;
/* 创建人编号 */
/* 创建人编号 */
private
Long
creatorId
=
null
;
private
Long
creatorId
=
null
;
/* 修改人编号 */
/* 修改人编号 */
private
Long
updatorId
=
null
;
private
Long
updatorId
=
null
;
/* 删除状态{0:未删除1:已删除} */
/* 删除状态{0:未删除1:已删除} */
private
Integer
delStatus
=
null
;
private
Integer
delStatus
=
null
;
/* 有效状态{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
;
/* 有效期-结束时间 (查询下线) */
/* 有效期-结束时间 (查询下线) */
private
Date
activeEndTimeBottom
=
null
;
private
Date
activeEndTimeBottom
=
null
;
/* 创建时间 */
/* 创建时间 */
private
Date
createAt
=
null
;
private
Date
createAt
=
null
;
/* 创建时间 (查询上线) */
/* 创建时间 (查询上线) */
private
Date
createAtTop
=
null
;
private
Date
createAtTop
=
null
;
/* 创建时间 (查询下线) */
/* 创建时间 (查询下线) */
private
Date
createAtBottom
=
null
;
private
Date
createAtBottom
=
null
;
/* 更新时间 */
/* 更新时间 */
private
Date
updateAt
=
null
;
private
Date
updateAt
=
null
;
/* 更新时间 (查询上线) */
/* 更新时间 (查询上线) */
private
Date
updateAtTop
=
null
;
private
Date
updateAtTop
=
null
;
/* 更新时间 (查询下线) */
/* 更新时间 (查询下线) */
private
Date
updateAtBottom
=
null
;
private
Date
updateAtBottom
=
null
;
/*
/*
* 固定数据字典 有效期类型{1:按日期期间 2:按有效期}
* 固定数据字典 有效期类型{1:按日期期间 2:按有效期}
*/
*/
...
@@ -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:否}
...
@@ -188,7 +191,7 @@ public class Coupon {
...
@@ -188,7 +191,7 @@ public class Coupon {
Integer
nFlag
=
getActiveTypeFlag
();
Integer
nFlag
=
getActiveTypeFlag
();
return
CommonMPI
.
getDictionaryName
(
activeTypeFlags
,
nFlag
);
return
CommonMPI
.
getDictionaryName
(
activeTypeFlags
,
nFlag
);
}
}
/**
/**
* @return 有效期-月数{-1无限制}
* @return 有效期-月数{-1无限制}
*/
*/
...
@@ -224,7 +227,7 @@ public class Coupon {
...
@@ -224,7 +227,7 @@ public class Coupon {
Integer
nFlag
=
getUsedTypeFlag
();
Integer
nFlag
=
getUsedTypeFlag
();
return
CommonMPI
.
getDictionaryName
(
usedTypeFlags
,
nFlag
);
return
CommonMPI
.
getDictionaryName
(
usedTypeFlags
,
nFlag
);
}
}
/**
/**
* @return 是否可核销多次{1:是 2:否}
* @return 是否可核销多次{1:是 2:否}
*/
*/
...
@@ -246,7 +249,7 @@ public class Coupon {
...
@@ -246,7 +249,7 @@ public class Coupon {
Integer
nFlag
=
getUseNumTypeFlag
();
Integer
nFlag
=
getUseNumTypeFlag
();
return
CommonMPI
.
getDictionaryName
(
useNumTypeFlags
,
nFlag
);
return
CommonMPI
.
getDictionaryName
(
useNumTypeFlags
,
nFlag
);
}
}
/**
/**
* @return 阶段性可核销次数
* @return 阶段性可核销次数
*/
*/
...
@@ -282,7 +285,7 @@ public class Coupon {
...
@@ -282,7 +285,7 @@ public class Coupon {
Integer
nFlag
=
getPhaseTypeFlag
();
Integer
nFlag
=
getPhaseTypeFlag
();
return
CommonMPI
.
getDictionaryName
(
phaseTypeFlags
,
nFlag
);
return
CommonMPI
.
getDictionaryName
(
phaseTypeFlags
,
nFlag
);
}
}
/**
/**
* @return 共可核销次数{-1不限制}
* @return 共可核销次数{-1不限制}
*/
*/
...
@@ -332,7 +335,7 @@ public class Coupon {
...
@@ -332,7 +335,7 @@ public class Coupon {
Integer
nFlag
=
getRightTypeFlag
();
Integer
nFlag
=
getRightTypeFlag
();
return
CommonMPI
.
getDictionaryName
(
rightTypeFlags
,
nFlag
);
return
CommonMPI
.
getDictionaryName
(
rightTypeFlags
,
nFlag
);
}
}
/**
/**
* @return 权益内容
* @return 权益内容
*/
*/
...
@@ -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
;
}
}
...
@@ -486,18 +489,18 @@ public class Coupon {
...
@@ -486,18 +489,18 @@ public class Coupon {
public
void
setActiveStartTimeBottom
(
Date
activeStartTimeBottom
)
{
public
void
setActiveStartTimeBottom
(
Date
activeStartTimeBottom
)
{
this
.
activeStartTimeBottom
=
activeStartTimeBottom
;
this
.
activeStartTimeBottom
=
activeStartTimeBottom
;
}
}
/**
/**
* @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
;
}
}
...
@@ -528,7 +531,7 @@ public class Coupon {
...
@@ -528,7 +531,7 @@ public class Coupon {
public
void
setActiveEndTimeBottom
(
Date
activeEndTimeBottom
)
{
public
void
setActiveEndTimeBottom
(
Date
activeEndTimeBottom
)
{
this
.
activeEndTimeBottom
=
activeEndTimeBottom
;
this
.
activeEndTimeBottom
=
activeEndTimeBottom
;
}
}
/**
/**
* @return 创建时间
* @return 创建时间
*/
*/
...
@@ -570,7 +573,7 @@ public class Coupon {
...
@@ -570,7 +573,7 @@ public class Coupon {
public
void
setCreateAtBottom
(
Date
createAtBottom
)
{
public
void
setCreateAtBottom
(
Date
createAtBottom
)
{
this
.
createAtBottom
=
createAtBottom
;
this
.
createAtBottom
=
createAtBottom
;
}
}
/**
/**
* @return 更新时间
* @return 更新时间
*/
*/
...
@@ -612,7 +615,7 @@ public class Coupon {
...
@@ -612,7 +615,7 @@ public class Coupon {
public
void
setUpdateAtBottom
(
Date
updateAtBottom
)
{
public
void
setUpdateAtBottom
(
Date
updateAtBottom
)
{
this
.
updateAtBottom
=
updateAtBottom
;
this
.
updateAtBottom
=
updateAtBottom
;
}
}
/* (non-Javadoc)
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
* @see java.lang.Object#hashCode()
*/
*/
...
@@ -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
;
}
}
}
src/main/java/com/servicemall/right/micro/CouponMicro.java
View file @
b0ec3965
...
@@ -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
)
{
// 是否存在重复记录?
// 是否存在重复记录?
...
@@ -61,7 +62,7 @@ public final class CouponMicro {
...
@@ -61,7 +62,7 @@ public final class CouponMicro {
}
}
int
n
=
CouponService
.
insert
(
coupon
);
int
n
=
CouponService
.
insert
(
coupon
);
if
(
n
!=
1
)
{
if
(
n
!=
1
)
{
return
ResponseBase
.
ERROR_LOGIC
;
return
ResponseBase
.
ERROR_LOGIC
;
}
}
...
@@ -71,10 +72,10 @@ public final class CouponMicro {
...
@@ -71,10 +72,10 @@ public final class CouponMicro {
log
.
setType
(
"新增优惠权益"
);
log
.
setType
(
"新增优惠权益"
);
log
.
setBizData
(
coupon
);
log
.
setBizData
(
coupon
);
request
.
setAttribute
(
"log"
,
log
);
request
.
setAttribute
(
"log"
,
log
);
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
)
{
...
@@ -102,9 +104,9 @@ public final class CouponMicro {
...
@@ -102,9 +104,9 @@ public final class CouponMicro {
// 限定条件
// 限定条件
Coupon
where
=
new
Coupon
();
Coupon
where
=
new
Coupon
();
where
.
setId
(
coupon
.
getId
());
where
.
setId
(
coupon
.
getId
());
int
result
=
CouponService
.
delete
(
where
,
null
);
int
result
=
CouponService
.
delete
(
where
,
null
);
if
(
result
!=
1
)
{
if
(
result
!=
1
)
{
return
ResponseBase
.
DATA_NOT_FOUND
;
return
ResponseBase
.
DATA_NOT_FOUND
;
}
}
...
@@ -114,7 +116,7 @@ public final class CouponMicro {
...
@@ -114,7 +116,7 @@ public final class CouponMicro {
log
.
setType
(
"删除优惠权益"
);
log
.
setType
(
"删除优惠权益"
);
log
.
setBizData
(
where
);
log
.
setBizData
(
where
);
request
.
setAttribute
(
"log"
,
log
);
request
.
setAttribute
(
"log"
,
log
);
return
ResponseBase
.
SUCCESS
;
return
ResponseBase
.
SUCCESS
;
}
}
...
@@ -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才能更新
...
@@ -143,7 +146,7 @@ public final class CouponMicro {
...
@@ -143,7 +146,7 @@ public final class CouponMicro {
// 第1个参数coupon,取关键字段coupon.id为条件
// 第1个参数coupon,取关键字段coupon.id为条件
// 第3个参数coupon,取coupon内关键字段以外其它属性数据
// 第3个参数coupon,取coupon内关键字段以外其它属性数据
int
n
=
CouponService
.
update
(
coupon
,
null
,
coupon
);
int
n
=
CouponService
.
update
(
coupon
,
null
,
coupon
);
if
(
n
!=
1
)
{
if
(
n
!=
1
)
{
return
ResponseBase
.
DATA_NOT_FOUND
;
return
ResponseBase
.
DATA_NOT_FOUND
;
}
}
...
@@ -152,13 +155,13 @@ public final class CouponMicro {
...
@@ -152,13 +155,13 @@ public final class CouponMicro {
OperationLog
log
=
new
OperationLog
();
OperationLog
log
=
new
OperationLog
();
log
.
setType
(
"修改优惠权益"
);
log
.
setType
(
"修改优惠权益"
);
log
.
setBizData
(
coupon
);
log
.
setBizData
(
coupon
);
request
.
setAttribute
(
"log"
,
log
);
request
.
setAttribute
(
"log"
,
log
);
// 重新查询,返回到前端
// 重新查询,返回到前端
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,25 +195,26 @@ public final class CouponMicro {
...
@@ -191,25 +195,26 @@ 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
)
{
// 附加限定条件,这里可以修改附加限定条件
// 附加限定条件,这里可以修改附加限定条件
String
appendix
=
null
;
String
appendix
=
null
;
List
<
Coupon
>
couponList
=
CouponService
.
list
(
coupon
,
appendix
,
pagination
);
List
<
Coupon
>
couponList
=
CouponService
.
list
(
coupon
,
appendix
,
pagination
);
// 统计符合条件的结果记录数量
// 统计符合条件的结果记录数量
int
recordCount
=
CouponService
.
count
(
coupon
,
appendix
);
int
recordCount
=
CouponService
.
count
(
coupon
,
appendix
);
pagination
.
setRecordCount
(
recordCount
);
pagination
.
setRecordCount
(
recordCount
);
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<
Map
<
String
,
Object
>>();
DataResponse
<
Map
<
String
,
Object
>>
result
=
new
DataResponse
<
Map
<
String
,
Object
>>();
Map
<
String
,
Object
>
datas
=
new
HashMap
<
String
,
Object
>();
Map
<
String
,
Object
>
datas
=
new
HashMap
<
String
,
Object
>();
datas
.
put
(
"list"
,
couponList
);
datas
.
put
(
"list"
,
couponList
);
datas
.
put
(
"pagination"
,
pagination
);
datas
.
put
(
"pagination"
,
pagination
);
result
.
setData
(
datas
);
result
.
setData
(
datas
);
result
.
setMessage
(
"成功"
);
return
result
;
return
result
;
}
}
...
@@ -220,22 +225,23 @@ public final class CouponMicro {
...
@@ -220,22 +225,23 @@ public final class CouponMicro {
*
*
* @return 返回记录数量
* @return 返回记录数量
*/
*/
@ApiIgnore
@PostMapping
(
"/count"
)
@PostMapping
(
"/count"
)
public
ResponseBase
count
(
@RequestBody
Coupon
coupon
)
{
public
ResponseBase
count
(
@RequestBody
Coupon
coupon
)
{
// 附加限定条件,这里可以修改附加限定条件
// 附加限定条件,这里可以修改附加限定条件
String
appendix
=
null
;
String
appendix
=
null
;
int
n
=
CouponService
.
count
(
coupon
,
appendix
);
int
n
=
CouponService
.
count
(
coupon
,
appendix
);
DataResponse
<
Integer
>
result
=
new
DataResponse
<
Integer
>();
DataResponse
<
Integer
>
result
=
new
DataResponse
<
Integer
>();
result
.
setData
(
n
);
result
.
setData
(
n
);
result
.
setMessage
(
"成功"
);
return
result
;
return
result
;
}
}
/**
/**
* 用在新增、修改时检查数据库中是否存在重复记录(请务必保留该方法)
* 用在新增、修改时检查数据库中是否存在重复记录(请务必保留该方法)
*
*
* @param temp
* @param temp
* 将要修改的优惠权益POJO
* 将要修改的优惠权益POJO
* @return true:已经存在 false:不存在
* @return true:已经存在 false:不存在
...
@@ -243,7 +249,7 @@ public final class CouponMicro {
...
@@ -243,7 +249,7 @@ public final class CouponMicro {
private
boolean
exist
(
Coupon
temp
)
{
private
boolean
exist
(
Coupon
temp
)
{
// 检查修改的优惠权益是否有重复记录
// 检查修改的优惠权益是否有重复记录
Coupon
form
=
new
Coupon
();
Coupon
form
=
new
Coupon
();
// 关键字限定条件
// 关键字限定条件
String
str
=
(
temp
.
getId
()
==
null
?
null
:
"Id != "
+
temp
.
getId
());
String
str
=
(
temp
.
getId
()
==
null
?
null
:
"Id != "
+
temp
.
getId
());
...
@@ -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
=
"
S
tring"
),
@ApiImplicitParam
(
paramType
=
"query"
,
name
=
"dms_code"
,
value
=
"经销商code"
,
dataType
=
"
s
tring"
),
@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
;
}
}
}
}
src/main/java/com/servicemall/right/service/CouponService.java
View file @
b0ec3965
...
@@ -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
Dat
e
());
coupon
.
setActiveEndTime
(
DateUtil
.
getTim
e
());
coupon
.
setActiveStartTime
(
new
Dat
e
());
coupon
.
setActiveStartTime
(
DateUtil
.
getTim
e
());
coupon
.
setRightName
(
"代金券"
);
coupon
.
setRightName
(
"代金券"
);
coupon
.
setUsedTypeFlag
(
1
);
coupon
.
setUsedTypeFlag
(
1
);
coupon
.
setTotalUseNum
(-
1
);
coupon
.
setTotalUseNum
(-
1
);
coupon
.
setId
(
1
l
);
coupon
.
setId
(
1
l
);
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
(
2
l
);
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
;
}
}
}
}
src/main/java/com/servicemall/systemcommon/data/ErrorEnum.java
View file @
b0ec3965
...
@@ -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
,
"没有登录或者长时间未操作导致登录信息丢失"
);
// 成员变量
// 成员变量
...
...
src/main/java/com/servicemall/systemcommon/util/DateUtil.java
0 → 100644
View file @
b0ec3965
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
);
}
}
src/main/java/com/servicemall/website/micro/SliderMicro.java
View file @
b0ec3965
...
@@ -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"
)
...
@@ -54,7 +57,7 @@ public final class SliderMicro {
...
@@ -54,7 +57,7 @@ public final class SliderMicro {
List
<
Slider
>
sliderList
=
SliderService
.
list
();
List
<
Slider
>
sliderList
=
SliderService
.
list
();
datas
.
put
(
"list"
,
sliderList
);
datas
.
put
(
"list"
,
sliderList
);
result
.
setData
(
datas
);
result
.
setData
(
datas
);
return
result
;
return
result
;
}
}
...
...
src/main/java/com/servicemall/website/service/SliderService.java
View file @
b0ec3965
...
@@ -21,9 +21,20 @@ public class SliderService {
...
@@ -21,9 +21,20 @@ public class SliderService {
Slider
slider
=
new
Slider
();
Slider
slider
=
new
Slider
();
slider
.
setId
(
1
l
);
slider
.
setId
(
1
l
);
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
(
1
l
);
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
;
}
}
}
}
src/main/java/team/bangbang/Swagger2.java
View file @
b0ec3965
...
@@ -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
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment