Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
cloud-platform
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
youjj
cloud-platform
Commits
cf028f84
Commit
cf028f84
authored
Jul 17, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
123
parent
503ff148
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
230 additions
and
4 deletions
+230
-4
ActivityRule.java
.../java/com/xxfc/platform/activity/entity/ActivityRule.java
+10
-2
Coupon.java
...c/main/java/com/xxfc/platform/activity/entity/Coupon.java
+5
-1
ActivityRuleVo.java
...in/java/com/xxfc/platform/activity/vo/ActivityRuleVo.java
+92
-0
ActivityRuleBiz.java
.../java/com/xxfc/platform/activity/biz/ActivityRuleBiz.java
+49
-1
RabbitConfig.java
.../java/com/xxfc/platform/activity/config/RabbitConfig.java
+52
-0
ActivityRuleController.java
...m/xxfc/platform/activity/rest/ActivityRuleController.java
+22
-0
No files found.
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/ActivityRule.java
View file @
cf028f84
...
...
@@ -33,8 +33,16 @@ public class ActivityRule implements Serializable {
@Column
(
name
=
"name"
)
@ApiModelProperty
(
value
=
"活动名称"
)
private
String
name
;
/**
/**
* 活动名称
*/
@Column
(
name
=
"img"
)
@ApiModelProperty
(
value
=
"活动名称"
)
private
String
img
;
/**
* 活动描述
*/
@Column
(
name
=
"descr"
)
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/Coupon.java
View file @
cf028f84
...
...
@@ -37,7 +37,11 @@ public class Coupon implements Serializable {
@Column
(
name
=
"title"
)
@ApiModelProperty
(
value
=
"优惠券标题(有图片则显示图片):无门槛50元优惠券 | 单品最高减2000元"
)
private
String
title
;
@Column
(
name
=
"subtitle"
)
@ApiModelProperty
(
value
=
"副标题"
)
private
String
subtitle
;
/**
* 图片
*/
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/vo/ActivityRuleVo.java
0 → 100644
View file @
cf028f84
package
com
.
xxfc
.
platform
.
activity
.
vo
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.io.Serializable
;
import
java.util.List
;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Data
public
class
ActivityRuleVo
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 活动名称
*/
@ApiModelProperty
(
value
=
"活动名称"
)
private
String
name
;
/**
* 活动名称
*/
@ApiModelProperty
(
value
=
"活动名称"
)
private
String
img
;
/**
* 活动描述
*/
@ApiModelProperty
(
value
=
"活动描述"
)
private
String
descr
;
/**
* 活动人数限制
*/
@ApiModelProperty
(
value
=
"活动人数限制"
)
private
Integer
number
;
/**
* 参加活动人数
*/
@ApiModelProperty
(
value
=
"参加活动人数"
)
private
Integer
joinNumber
;
/**
* 活动是否开启:0-未开启;1-已开启;2-已关闭
*/
@ApiModelProperty
(
value
=
"活动是否开启:0-未开启;1-已开启;2-已关闭"
)
private
Integer
status
;
/**
* 活动奖励规则,json数组格式 [{"type":1, "detail":{...}},...] //// type分类 1--现金;
*/
@ApiModelProperty
(
value
=
"活动奖励规则,json数组格式 [{type:1, detail:{...}},...] //// type分类 1--现金;"
)
private
String
value
;
/**
* 创建时间
*/
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
private
Long
crtTime
;
/**
* 更新时间
*/
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
/**
* 是否删除:0-正常;1-删除
*/
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
@ApiModelProperty
(
value
=
"优惠卷列表"
)
List
<
Coupon
>
coupons
;
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityRuleBiz.java
View file @
cf028f84
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
com.xxfc.platform.activity.vo.ActivityRuleVo
;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.entity.ActivityRule
;
...
...
@@ -7,6 +15,7 @@ import com.xxfc.platform.activity.mapper.ActivityRuleMapper;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
...
...
@@ -20,15 +29,54 @@ import java.util.List;
public
class
ActivityRuleBiz
extends
BaseBiz
<
ActivityRuleMapper
,
ActivityRule
>
{
@Autowired
CouponBiz
couponBiz
;
//获取最新的生效的活动
public
ActivityRule
getActity
(){
Example
example
=
new
Example
(
ActivityRule
.
class
);
example
.
createCriteria
().
andEqualTo
(
"status"
,
1
).
andEqualTo
(
"isDel"
,
0
);
example
.
orderBy
(
"id desc"
);
example
.
setOrderByClause
(
"id desc"
);
List
<
ActivityRule
>
list
=
mapper
.
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
return
list
.
get
(
0
);
}
return
null
;
}
//获取最新活动的H5页面
public
ObjectRestResponse
getActivityH5
(){
ActivityRule
activityRule
=
getActity
();
if
(
activityRule
==
null
){
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"无有效的活动"
);
}
ActivityRuleVo
ruleVo
=
new
ActivityRuleVo
();
try
{
BeanUtils
.
copyProperties
(
ruleVo
,
activityRule
);
String
value
=
activityRule
.
getValue
();
JSONObject
json
=
JSONObject
.
parseObject
(
value
);
if
(
json
!=
null
){
Integer
type
=
json
.
getInteger
(
"type"
);
if
(
type
==
1
){
JSONArray
array
=
json
.
getJSONArray
(
"value"
);
List
<
Coupon
>
coupons
=
new
ArrayList
<>();
if
(
array
.
size
()>
0
){
for
(
int
i
=
0
;
i
<
array
.
size
();
i
++){
Integer
id
=
array
.
getJSONObject
(
i
).
getInteger
(
"id"
);
coupons
.
add
(
couponBiz
.
selectById
(
id
));
}
}
ruleVo
.
setCoupons
(
coupons
);
}
}
return
ObjectRestResponse
.
succ
(
ruleVo
);
}
catch
(
Exception
e
){
e
.
printStackTrace
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/config/RabbitConfig.java
0 → 100644
View file @
cf028f84
package
com
.
xxfc
.
platform
.
activity
.
config
;
import
org.springframework.amqp.core.Binding
;
import
org.springframework.amqp.core.BindingBuilder
;
import
org.springframework.amqp.core.DirectExchange
;
import
org.springframework.amqp.core.Queue
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
* @author zhoujw
* @date 2019/7/15
*/
@Configuration
public
class
RabbitConfig
{
public
static
final
String
HZ_EXC
=
"hz_exchange"
;
public
static
final
String
INTEGRAL_QUEUE
=
"integral_queue"
;
public
static
final
String
ORDER_WATER_KEY
=
"order"
;
// /**
// * 队列交换机
// * 注意这里的交换机类型:CustomExchange
// * @return
// */
// @Bean
// public DirectExchange directExchange(){
// return new DirectExchange(HZ_EXC, true, false);
// }
/**
* 队列
* @return
*/
@Bean
public
Queue
orderWaterQueue
(){
return
new
Queue
(
INTEGRAL_QUEUE
,
true
);
}
// /**
// * 队列绑定交换机
// * @return
// */
// @Bean
// public Binding orderWaterBinding(Queue orderWaterQueue, DirectExchange directExchange){
// return BindingBuilder.bind(orderWaterQueue).to(directExchange).with(ORDER_WATER_KEY);
// }
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/ActivityRuleController.java
0 → 100644
View file @
cf028f84
package
com
.
xxfc
.
platform
.
activity
.
rest
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.activity.biz.ActivityRuleBiz
;
import
com.xxfc.platform.activity.entity.ActivityRule
;
import
com.xxfc.platform.activity.entity.ActivityUserJoin
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RequestMapping
(
"rule"
)
public
class
ActivityRuleController
extends
BaseController
<
ActivityRuleBiz
,
ActivityRule
>
{
@ApiOperation
(
"新人有礼参加活动"
)
@RequestMapping
(
value
=
"/app/unauth/H5"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
H5
(){
return
baseBiz
.
getActivityH5
();
}
}
\ No newline at end of file
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