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
00eda213
Commit
00eda213
authored
Jun 21, 2019
by
hezhen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
添加优惠卷
parent
38baf36c
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
79 additions
and
6 deletions
+79
-6
AppUserDTO.java
...m/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
+1
-0
pom.xml
ace-modules/ace-admin/pom.xml
+5
-0
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+10
-0
pom.xml
xx-activity/xx-activity-api/pom.xml
+6
-0
ActivityFeign.java
.../java/com/xxfc/platform/activity/Feign/ActivityFeign.java
+23
-0
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+22
-5
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+12
-1
No files found.
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
View file @
00eda213
...
...
@@ -11,6 +11,7 @@ public class AppUserDTO {
private
Integer
id
;
private
Integer
userid
;
private
Integer
isMember
;
private
String
username
;
private
String
nickname
;
private
String
realname
;
private
String
headimgurl
;
...
...
ace-modules/ace-admin/pom.xml
View file @
00eda213
...
...
@@ -45,6 +45,11 @@
<artifactId>
xx-im-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-activity-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
org.springframework.boot
</groupId>
<artifactId>
spring-boot-starter-data-redis
</artifactId>
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
00eda213
...
...
@@ -17,6 +17,7 @@ import com.github.wxiaoqi.security.common.util.VerificationUtils;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
com.xxfc.platform.activity.Feign.ActivityFeign
;
import
com.xxfc.platform.im.feign.ImFeign
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
lombok.extern.slf4j.Slf4j
;
...
...
@@ -51,6 +52,9 @@ public class AppPermissionService {
@Autowired
ImFeign
imFeign
;
@Autowired
ActivityFeign
activityFeign
;
private
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
(
12
);
@Autowired
private
RedisTemplate
userRedisTemplate
;
...
...
@@ -219,6 +223,8 @@ public class AppPermissionService {
rsUserDetail
.
setIsdel
(
0
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//自动登录获取优惠卷
authCoupn
(
userid
);
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
...
...
@@ -625,6 +631,10 @@ public class AppPermissionService {
log
.
error
(
"------im登录----access_token======"
+
access_token
);
return
access_token
;
}
//自动领取新人优惠卷
public
String
authCoupn
(
Integer
userId
){
return
activityFeign
.
led
(
userId
);
}
}
xx-activity/xx-activity-api/pom.xml
View file @
00eda213
...
...
@@ -17,6 +17,12 @@
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-universal-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
</dependencies>
</project>
\ No newline at end of file
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/Feign/ActivityFeign.java
0 → 100644
View file @
00eda213
package
com
.
xxfc
.
platform
.
activity
.
Feign
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
/**
* ${DESCRIPTION}
*
* @author wanghaobin
* @create 2017-06-21 8:11
*/
@FeignClient
(
value
=
"xx-activity"
)
public
interface
ActivityFeign
{
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/user/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
);
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
00eda213
...
...
@@ -4,8 +4,10 @@ import com.alibaba.fastjson.JSONObject;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.SystemConfig
;
import
com.xxfc.platform.activity.constant.CouponUsed
;
import
com.xxfc.platform.activity.entity.Coupon
;
import
com.xxfc.platform.activity.entity.UserCoupon
;
import
com.xxfc.platform.universal.weixin.util.Snowflake
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -13,6 +15,8 @@ import com.xxfc.platform.activity.mapper.UserCouponMapper;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
/**
* 我的优惠卷
*
...
...
@@ -29,19 +33,32 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
private
CouponBiz
couponBiz
;
//自动发送优惠卷
public
ObjectRestResponse
authledCoupon
(
Integer
userId
){
public
String
authledCoupon
(
Integer
userId
){
if
(
userId
==
null
||
userId
==
0
){
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数不能为空"
);
log
.
error
(
"----参数不能为空"
);
return
null
;
}
Coupon
coupon
=
couponBiz
.
getCouponByUsed
(
userId
);
Coupon
coupon
=
couponBiz
.
getCouponByUsed
(
CouponUsed
.
ALLNEW
.
getCode
()
);
if
(
coupon
==
null
){
log
.
error
(
userId
+
"----无可领取优惠卷"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"无可领取优惠卷"
)
;
return
null
;
}
Integer
couponId
=
coupon
.
getId
();
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
couponId
);
return
ObjectRestResponse
.
succ
();
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
log
.
error
(
userId
+
"----已领优惠卷"
);
return
null
;
}
String
ticker_no
=
Snowflake
.
build
()+
""
;
UserCoupon
userCoupon
=
new
UserCoupon
();
userCoupon
.
setUserId
(
userId
);
userCoupon
.
setCouponId
(
couponId
);
userCoupon
.
setTickerNo
(
ticker_no
);
insertSelective
(
userCoupon
);
return
ticker_no
;
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/UserCouponController.java
View file @
00eda213
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.UserCouponBiz
;
import
com.xxfc.platform.activity.entity.UserCoupon
;
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
(
"user
Coupon
"
)
@RequestMapping
(
"user"
)
public
class
UserCouponController
extends
BaseController
<
UserCouponBiz
,
UserCoupon
>
{
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
)
{
return
baseBiz
.
authledCoupon
(
userId
);
}
}
\ 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