Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
afanti-open-api
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
JIRA
JIRA
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
java-ms
afanti-open-api
Commits
d7494017
Commit
d7494017
authored
Sep 19, 2024
by
严俊
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
新增活动增删改查接口
parent
93ca9cf7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
181 additions
and
5 deletions
+181
-5
pom.xml
pom.xml
+22
-2
AfantiOpenApiApplication.java
...com/afanticar/afantiopenapi/AfantiOpenApiApplication.java
+3
-3
FawOpenController.java
...afanticar/afantiopenapi/controller/FawOpenController.java
+151
-0
BaseResponse.java
.../java/com/afanticar/afantiopenapi/model/BaseResponse.java
+1
-0
bootstrap.yml
src/main/resources/bootstrap.yml
+4
-0
No files found.
pom.xml
View file @
d7494017
...
@@ -16,6 +16,14 @@
...
@@ -16,6 +16,14 @@
<java.version>
1.8
</java.version>
<java.version>
1.8
</java.version>
</properties>
</properties>
<dependencies>
<dependencies>
<!-- 活动服务API -->
<dependency>
<groupId>
com.afanticar
</groupId>
<artifactId>
afanti-activity-api
</artifactId>
<version>
1.0.1-SNAPSHOT
</version>
</dependency>
<dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter
</artifactId>
<artifactId>
spring-boot-starter
</artifactId>
...
@@ -204,13 +212,13 @@
...
@@ -204,13 +212,13 @@
<dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger-ui
</artifactId>
<artifactId>
springfox-swagger-ui
</artifactId>
<version>
2.
9.2
</version>
<version>
2.
10.5
</version>
</dependency>
</dependency>
<dependency>
<dependency>
<groupId>
io.springfox
</groupId>
<groupId>
io.springfox
</groupId>
<artifactId>
springfox-swagger2
</artifactId>
<artifactId>
springfox-swagger2
</artifactId>
<version>
2.
9.2
</version>
<version>
2.
10.5
</version>
<exclusions>
<exclusions>
<exclusion>
<exclusion>
<artifactId>
mapstruct
</artifactId>
<artifactId>
mapstruct
</artifactId>
...
@@ -219,6 +227,18 @@
...
@@ -219,6 +227,18 @@
</exclusions>
</exclusions>
</dependency>
</dependency>
<!--解决Swagger 2.9.2版本NumberFormatException-->
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-models
</artifactId>
<version>
1.6.0
</version>
</dependency>
<dependency>
<groupId>
io.swagger
</groupId>
<artifactId>
swagger-annotations
</artifactId>
<version>
1.6.0
</version>
</dependency>
</dependencies>
</dependencies>
<repositories>
<repositories>
...
...
src/main/java/com/afanticar/afantiopenapi/AfantiOpenApiApplication.java
View file @
d7494017
...
@@ -5,17 +5,17 @@ import org.springframework.boot.SpringApplication;
...
@@ -5,17 +5,17 @@ import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.boot.autoconfigure.SpringBootApplication
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.cloud.openfeign.EnableFeignClients
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
;
import
springfox.documentation.swagger2.annotations.EnableSwagger2
WebMvc
;
/**
/**
*
*
* @author Chin
* @author Chin
*
*
*/
*/
@EnableSwagger2
//@EnableSwagger2WebMvc
@SpringBootApplication
@SpringBootApplication
@EnableScheduling
@EnableScheduling
@EnableFeignClients
@EnableFeignClients
(
basePackages
=
{
"com.afanticar"
})
@MapperScan
(
basePackages
=
{
"com.afanticar.afantiopenapi.mapper"
})
@MapperScan
(
basePackages
=
{
"com.afanticar.afantiopenapi.mapper"
})
public
class
AfantiOpenApiApplication
{
public
class
AfantiOpenApiApplication
{
...
...
src/main/java/com/afanticar/afantiopenapi/controller/FawOpenController.java
View file @
d7494017
package
com
.
afanticar
.
afantiopenapi
.
controller
;
package
com
.
afanticar
.
afantiopenapi
.
controller
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.date.DateUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.afanticar.activity.client.IActivityManagerApiClient
;
import
com.afanticar.activity.domain.param.*
;
import
com.afanticar.activity.domain.vo.ApiActivityInfoVO
;
import
com.afanticar.afantiopenapi.constant.Constant
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.BaseResponse
;
import
com.afanticar.afantiopenapi.model.dto.FawActivityDTO
;
import
com.afanticar.afantiopenapi.model.dto.FawActivityDTO
;
import
com.afanticar.afantiopenapi.model.vo.*
;
import
com.afanticar.afantiopenapi.model.vo.*
;
import
com.afanticar.afantiopenapi.service.BaseService
;
import
com.afanticar.afantiopenapi.service.BaseService
;
import
com.afanticar.afantiopenapi.service.FawOpenService
;
import
com.afanticar.afantiopenapi.service.FawOpenService
;
import
com.afanticar.common.base.domain.BasePage
;
import
com.afanticar.common.core.api.CommonResult
;
import
com.alibaba.fastjson.JSONObject
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParam
;
import
io.swagger.annotations.ApiImplicitParams
;
import
io.swagger.annotations.ApiImplicitParams
;
...
@@ -36,6 +44,9 @@ public class FawOpenController extends BaseController {
...
@@ -36,6 +44,9 @@ public class FawOpenController extends BaseController {
@Autowired
@Autowired
FawOpenService
fawOpenService
;
FawOpenService
fawOpenService
;
@Autowired
private
IActivityManagerApiClient
activityManagerApiClient
;
@Autowired
@Autowired
BaseService
baseService
;
BaseService
baseService
;
...
@@ -48,6 +59,30 @@ public class FawOpenController extends BaseController {
...
@@ -48,6 +59,30 @@ public class FawOpenController extends BaseController {
@Value
(
"${faw.limit.threshold:5}"
)
@Value
(
"${faw.limit.threshold:5}"
)
Integer
limit
;
Integer
limit
;
/**
* 活动创建, 1天不能超过100个 -uat环境
*/
@Value
(
"${faw.activity.create.limit.period:86400}"
)
Integer
activityCreateLimitPeriod
;
@Value
(
"${faw.activity.create.limit.threshold:100}"
)
Integer
activityCreateLimit
;
/**
* 活动查询修改、删除60秒内不能超过120次
*/
@Value
(
"${faw.activity.query.limit.period:60}"
)
Integer
activityCurdLimitPeriod
;
@Value
(
"${faw.activity.query.limit.threshold:120}"
)
Integer
activityCurdLimit
;
/**
* 红旗主体id
*/
@Value
(
"${faw.principalId:869752931296989184}"
)
String
fawPrincipalId
;
static
String
dataType
=
"faw"
;
static
String
dataType
=
"faw"
;
static
String
monthly
=
"monthly"
,
quarter
=
"quarter"
;
static
String
monthly
=
"monthly"
,
quarter
=
"quarter"
;
...
@@ -163,4 +198,120 @@ public class FawOpenController extends BaseController {
...
@@ -163,4 +198,120 @@ public class FawOpenController extends BaseController {
return
success
(
fawOpenService
.
kuaishouActivityLives
(
dto
));
return
success
(
fawOpenService
.
kuaishouActivityLives
(
dto
));
}
}
@ApiOperation
(
value
=
"创建活动"
,
notes
=
"创建活动"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/create"
)
public
BaseResponse
<
String
>
activityCreate
(
@RequestBody
ApiActivityCreateParam
param
)
{
log
.
info
(
"红旗活动-活动创建req={}"
,
JSONObject
.
toJSONString
(
param
));
BaseResponse
check
=
baseService
.
baseLimit
(
dataType
+
":activity_create"
,
activityCreateLimit
,
activityCreateLimitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
if
(
StrUtil
.
isEmpty
(
param
.
getActor
())){
param
.
setActor
(
"external-system"
);
}
param
.
setPrincipalId
(
fawPrincipalId
);
CommonResult
<
String
>
res
=
activityManagerApiClient
.
activityCreate
(
param
);
if
(
Constant
.
SUCCESS_CODE
.
equals
(
res
.
getCode
().
toString
())){
return
success
(
res
.
getData
());
}
else
{
return
error
(
res
.
getCode
().
toString
(),
res
.
getMessage
());
}
}
@ApiOperation
(
value
=
"活动更新"
,
notes
=
"活动更新"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/update"
)
public
BaseResponse
<
String
>
activityUpdate
(
@RequestBody
ApiActivityUpdateParam
param
)
{
log
.
info
(
"红旗活动-活动更新req={}"
,
JSONObject
.
toJSONString
(
param
));
BaseResponse
check
=
baseService
.
baseLimit
(
dataType
+
":activity_curd"
,
activityCurdLimit
,
activityCurdLimitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
if
(
StrUtil
.
isEmpty
(
param
.
getActor
())){
param
.
setActor
(
"external-system"
);
}
param
.
setPrincipalId
(
fawPrincipalId
);
CommonResult
<
String
>
res
=
activityManagerApiClient
.
activityUpdate
(
param
);
if
(
Constant
.
SUCCESS_CODE
.
equals
(
res
.
getCode
().
toString
())){
return
success
(
res
.
getData
());
}
else
{
return
error
(
res
.
getCode
().
toString
(),
res
.
getMessage
());
}
}
@ApiOperation
(
value
=
"删除活动"
,
notes
=
"删除活动"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/delete"
)
public
BaseResponse
<
String
>
activityDelete
(
@RequestBody
ApiActivityDeletedParam
param
)
{
log
.
info
(
"红旗活动-删除活动req={}"
,
JSONObject
.
toJSONString
(
param
));
BaseResponse
check
=
baseService
.
baseLimit
(
dataType
+
":activity_curd"
,
activityCurdLimit
,
activityCurdLimitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
if
(
StrUtil
.
isEmpty
(
param
.
getActor
())){
param
.
setActor
(
"external-system"
);
}
param
.
setPrincipalId
(
fawPrincipalId
);
CommonResult
<
String
>
res
=
activityManagerApiClient
.
activityDeleted
(
param
);
if
(
Constant
.
SUCCESS_CODE
.
equals
(
res
.
getCode
().
toString
())){
return
success
();
}
else
{
return
error
(
res
.
getCode
().
toString
(),
res
.
getMessage
());
}
}
@ApiOperation
(
value
=
"活动列表"
,
notes
=
"活动列表"
,
produces
=
"application/json"
)
@PostMapping
(
"/activity/list"
)
public
BaseResponse
<
BasePageVO
<
ApiActivityInfoVO
>>
activityList
(
@RequestBody
ApiActivityListParam
param
)
{
log
.
info
(
"红旗活动-活动列表req={}"
,
JSONObject
.
toJSONString
(
param
));
BaseResponse
check
=
baseService
.
baseLimit
(
dataType
+
":activity_curd"
,
activityCurdLimit
,
activityCurdLimitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
if
(
StrUtil
.
isEmpty
(
param
.
getActor
())){
param
.
setActor
(
"external-system"
);
}
param
.
setPrincipalId
(
fawPrincipalId
);
CommonResult
<
BasePage
<
ApiActivityInfoVO
>>
res
=
activityManagerApiClient
.
activityList
(
param
);
if
(
Constant
.
SUCCESS_CODE
.
equals
(
res
.
getCode
().
toString
())){
BasePageVO
basePageVO
=
new
BasePageVO
();
basePageVO
.
setPages
(
res
.
getData
().
getTotalPage
().
intValue
());
basePageVO
.
setTotal
(
res
.
getData
().
getTotal
().
intValue
());
basePageVO
.
setCurrent
(
res
.
getData
().
getPage
().
intValue
());
basePageVO
.
setRecords
(
res
.
getData
().
getList
());
basePageVO
.
setSize
(
res
.
getData
().
getSize
().
intValue
());
return
success
(
basePageVO
);
}
else
{
return
error
(
res
.
getCode
().
toString
(),
res
.
getMessage
());
}
}
@ApiOperation
(
value
=
"活动详情"
,
notes
=
"活动详情"
)
@GetMapping
(
"/activity/info"
)
public
BaseResponse
<
ApiActivityInfoVO
>
activityList
(
@RequestBody
(
required
=
false
)
ApiActivityInfoParam
param
,
@RequestParam
(
value
=
"activity_id"
,
required
=
false
)
String
activityId
,
@RequestParam
(
value
=
"actor"
,
required
=
false
)
String
actor
)
{
log
.
info
(
"红旗活动-活动详情req={},activityId={},actor={}"
,
JSONObject
.
toJSONString
(
param
),
activityId
,
actor
);
BaseResponse
check
=
baseService
.
baseLimit
(
dataType
+
":activity_curd"
,
activityCurdLimit
,
activityCurdLimitPeriod
);
if
(
check
!=
null
)
{
return
check
;
}
boolean
paramIsEmpty
=
param
==
null
||
StrUtil
.
isEmpty
(
param
.
getActivityId
());
if
(
paramIsEmpty
&&
StrUtil
.
isEmpty
(
activityId
)){
return
error
(
"400"
,
"活动id不能为空"
);
}
if
(
param
==
null
){
param
=
new
ApiActivityInfoParam
();
param
.
setActivityId
(
activityId
);
param
.
setActor
(
actor
);
}
if
(
StrUtil
.
isEmpty
(
param
.
getActor
())){
param
.
setActor
(
"external-system"
);
}
param
.
setPrincipalId
(
fawPrincipalId
);
CommonResult
<
ApiActivityInfoVO
>
res
=
activityManagerApiClient
.
activityInfo
(
param
);
if
(
Constant
.
SUCCESS_CODE
.
equals
(
res
.
getCode
().
toString
())){
return
success
(
res
.
getData
());
}
else
{
return
error
(
res
.
getCode
().
toString
(),
res
.
getMessage
());
}
}
}
}
src/main/java/com/afanticar/afantiopenapi/model/BaseResponse.java
View file @
d7494017
...
@@ -25,4 +25,5 @@ public class BaseResponse<T> {
...
@@ -25,4 +25,5 @@ public class BaseResponse<T> {
@ApiModelProperty
(
value
=
"是否成功"
,
example
=
"true"
)
@ApiModelProperty
(
value
=
"是否成功"
,
example
=
"true"
)
private
Boolean
success
;
private
Boolean
success
;
}
}
src/main/resources/bootstrap.yml
View file @
d7494017
...
@@ -53,6 +53,10 @@ spring:
...
@@ -53,6 +53,10 @@ spring:
username-property
:
spring.datasource.dynamic.datasource.tmp.username
username-property
:
spring.datasource.dynamic.datasource.tmp.username
password-property
:
spring.datasource.dynamic.datasource.tmp.password
password-property
:
spring.datasource.dynamic.datasource.tmp.password
ali
:
ons
:
rocketmq
:
enable
:
false
#
#
#
#
#
#
...
...
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