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
a4de09fa
Commit
a4de09fa
authored
Jul 19, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'base-modify' of
http://10.5.52.3/youjj/cloud-platform
into base-modify
parents
c3d9f31c
05868302
Changes
93
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
93 changed files
with
1488 additions
and
440 deletions
+1488
-440
AuthController.java
...thub/wxiaoqi/security/auth/controller/AuthController.java
+3
-2
RabbitCommonConfig.java
...ub/wxiaoqi/security/common/config/RabbitCommonConfig.java
+8
-2
RabbitConstant.java
...wxiaoqi/security/common/config/rabbit/RabbitConstant.java
+6
-1
bootstrap.yml
ace-gate/src/main/resources/bootstrap.yml
+2
-1
InviteMemberBO.java
.../com/github/wxiaoqi/security/admin/bo/InviteMemberBO.java
+17
-0
PromoteBO.java
.../java/com/github/wxiaoqi/security/admin/bo/PromoteBO.java
+40
-0
UserTeamMemberBo.java
...om/github/wxiaoqi/security/admin/bo/UserTeamMemberBo.java
+4
-0
PersonalConsumptionDTO.java
...ub/wxiaoqi/security/admin/dto/PersonalConsumptionDTO.java
+17
-0
RegisterParamDTO.java
...m/github/wxiaoqi/security/admin/dto/RegisterParamDTO.java
+1
-0
RegisterQueueDTO.java
...m/github/wxiaoqi/security/admin/dto/RegisterQueueDTO.java
+17
-2
WalletCathFindDTO.java
.../github/wxiaoqi/security/admin/dto/WalletCathFindDTO.java
+1
-1
WalletDetailFindDTO.java
...ithub/wxiaoqi/security/admin/dto/WalletDetailFindDTO.java
+20
-0
WalletDetailListDTO.java
...ithub/wxiaoqi/security/admin/dto/WalletDetailListDTO.java
+13
-15
AppUserDetail.java
...m/github/wxiaoqi/security/admin/entity/AppUserDetail.java
+4
-0
AppUserDTO.java
...m/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
+9
-1
AppUserInfoVo.java
...a/com/github/wxiaoqi/security/admin/vo/AppUserInfoVo.java
+1
-0
AppUserVo.java
.../java/com/github/wxiaoqi/security/admin/vo/AppUserVo.java
+4
-1
InviteMemberVo.java
.../com/github/wxiaoqi/security/admin/vo/InviteMemberVo.java
+27
-0
WalletDetailAdminVo.java
...github/wxiaoqi/security/admin/vo/WalletDetailAdminVo.java
+54
-0
WalletPageVo.java
...va/com/github/wxiaoqi/security/admin/vo/WalletPageVo.java
+7
-1
AppUserRelationBiz.java
...github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
+86
-1
AppUserSellingWaterBiz.java
...ub/wxiaoqi/security/admin/biz/AppUserSellingWaterBiz.java
+147
-143
MyWalletBiz.java
...va/com/github/wxiaoqi/security/admin/biz/MyWalletBiz.java
+21
-3
MyWalletCathBiz.java
...om/github/wxiaoqi/security/admin/biz/MyWalletCathBiz.java
+10
-2
MyWalletDetailBiz.java
.../github/wxiaoqi/security/admin/biz/MyWalletDetailBiz.java
+44
-0
UserBusinessBiz.java
...om/github/wxiaoqi/security/admin/biz/UserBusinessBiz.java
+22
-3
RabbitAdminConfig.java
...thub/wxiaoqi/security/admin/config/RabbitAdminConfig.java
+8
-7
IntegralMQHandler.java
...hub/wxiaoqi/security/admin/handler/IntegralMQHandler.java
+19
-1
AppUserDetailMapper.java
...ub/wxiaoqi/security/admin/mapper/AppUserDetailMapper.java
+1
-1
AppUserSellingWaterMapper.java
...aoqi/security/admin/mapper/AppUserSellingWaterMapper.java
+3
-0
MyWalletCathMapper.java
...hub/wxiaoqi/security/admin/mapper/MyWalletCathMapper.java
+3
-0
MyWalletDetailMapper.java
...b/wxiaoqi/security/admin/mapper/MyWalletDetailMapper.java
+9
-1
AppUserRelationController.java
...xiaoqi/security/admin/rest/AppUserRelationController.java
+31
-5
UserBussinessController.java
.../wxiaoqi/security/admin/rest/UserBussinessController.java
+13
-2
WalletDetailAdminController.java
...ecurity/admin/rest/admin/WalletDetailAdminController.java
+31
-0
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+8
-4
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+79
-34
bootstrap.yml
ace-modules/ace-admin/src/main/resources/bootstrap.yml
+1
-1
AppUserDetailMapper.xml
...e-admin/src/main/resources/mapper/AppUserDetailMapper.xml
+1
-0
AppUserSellingWaterMapper.xml
...n/src/main/resources/mapper/AppUserSellingWaterMapper.xml
+4
-0
MyWalletCathMapper.xml
...ce-admin/src/main/resources/mapper/MyWalletCathMapper.xml
+11
-3
MyWalletDetailMapper.xml
...-admin/src/main/resources/mapper/MyWalletDetailMapper.xml
+43
-0
log.2019-07-18.log
logs/log.2019-07-18.log
+0
-0
sys.2019-07-18.log
logs/sys.2019-07-18.log
+0
-0
ActivityPopularizeLog.java
.../xxfc/platform/activity/entity/ActivityPopularizeLog.java
+1
-1
ActivityPopularizeUser.java
...xxfc/platform/activity/entity/ActivityPopularizeUser.java
+7
-1
Coupon.java
...c/main/java/com/xxfc/platform/activity/entity/Coupon.java
+6
-2
IntegralUserRecord.java
...com/xxfc/platform/activity/entity/IntegralUserRecord.java
+1
-2
ActivityFeign.java
.../java/com/xxfc/platform/activity/feign/ActivityFeign.java
+6
-2
IntegralUserRecordDto.java
.../com/xxfc/platform/activity/vo/IntegralUserRecordDto.java
+2
-2
UserCouponVo.java
...main/java/com/xxfc/platform/activity/vo/UserCouponVo.java
+6
-0
FinishUserVO.java
...om/xxfc/platform/activity/vo/popularize/FinishUserVO.java
+13
-0
ActivityPopularizeBiz.java
...com/xxfc/platform/activity/biz/ActivityPopularizeBiz.java
+86
-0
ActivityUserJoinBiz.java
...a/com/xxfc/platform/activity/biz/ActivityUserJoinBiz.java
+7
-4
IntegralSignRecordBiz.java
...com/xxfc/platform/activity/biz/IntegralSignRecordBiz.java
+1
-1
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+38
-7
RabbitActivityConfig.java
...m/xxfc/platform/activity/config/RabbitActivityConfig.java
+13
-39
RabbitIntegralConfig.java
...m/xxfc/platform/activity/config/RabbitIntegralConfig.java
+0
-49
IntegralMQHandler.java
...com/xxfc/platform/activity/handler/IntegralMQHandler.java
+2
-1
PopularizeMQHandler.java
...m/xxfc/platform/activity/handler/PopularizeMQHandler.java
+107
-0
UserCouponMapper.java
...a/com/xxfc/platform/activity/mapper/UserCouponMapper.java
+1
-1
ActivityPopularizeController.java
.../platform/activity/rest/ActivityPopularizeController.java
+25
-12
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+17
-8
IntegralUserRecordMapper.xml
...er/src/main/resources/mapper/IntegralUserRecordMapper.xml
+1
-1
UserCouponMapper.xml
...ity-server/src/main/resources/mapper/UserCouponMapper.xml
+4
-0
BannerBiz.java
...er/src/main/java/com/xxfc/platform/app/biz/BannerBiz.java
+1
-1
CofigBiz.java
...ver/src/main/java/com/xxfc/platform/app/biz/CofigBiz.java
+23
-1
CofigAdminController.java
...om/xxfc/platform/app/rest/admin/CofigAdminController.java
+18
-3
pom.xml
xx-im/xx-im-api/pom.xml
+6
-1
ImCommentBiz.java
.../src/main/java/com/xxfc/platform/im/biz/ImCommentBiz.java
+12
-1
ImQuestionBiz.java
...src/main/java/com/xxfc/platform/im/biz/ImQuestionBiz.java
+13
-1
MsgBiz.java
...server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
+17
-22
bootstrap.yml
xx-im/xx-im-server/src/main/resources/bootstrap.yml
+2
-1
BaseOrder.java
...c/main/java/com/xxfc/platform/order/entity/BaseOrder.java
+13
-6
AddRentVehicleDTO.java
.../java/com/xxfc/platform/order/pojo/AddRentVehicleDTO.java
+6
-0
AddTourDTO.java
...rc/main/java/com/xxfc/platform/order/pojo/AddTourDTO.java
+3
-3
OrderMQDTO.java
...main/java/com/xxfc/platform/order/pojo/mq/OrderMQDTO.java
+25
-0
MemberBO.java
...ain/java/com/xxfc/platform/order/pojo/order/MemberBO.java
+2
-1
RentVehicleBO.java
...ava/com/xxfc/platform/order/pojo/order/RentVehicleBO.java
+1
-1
TourBO.java
.../main/java/com/xxfc/platform/order/pojo/order/TourBO.java
+1
-1
RentVehiclePriceVO.java
...om/xxfc/platform/order/pojo/price/RentVehiclePriceVO.java
+2
-0
TourPriceVO.java
.../java/com/xxfc/platform/order/pojo/price/TourPriceVO.java
+4
-0
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+18
-0
OrderRentVehicleController.java
.../xxfc/platform/order/rest/OrderRentVehicleController.java
+10
-0
OrderTourController.java
...ava/com/xxfc/platform/order/rest/OrderTourController.java
+11
-0
AbstractOrderHandle.java
.../com/xxfc/platform/order/service/AbstractOrderHandle.java
+2
-0
OrderRentVehicleService.java
.../xxfc/platform/order/service/OrderRentVehicleService.java
+19
-5
OrderTourService.java
...ava/com/xxfc/platform/order/service/OrderTourService.java
+27
-5
MQconstant.java
...java/com/xxfc/platform/universal/constant/MQconstant.java
+8
-0
MQSenderFeign.java
...java/com/xxfc/platform/universal/feign/MQSenderFeign.java
+2
-2
1.jar
xx-universal/xx-universal-api/src/main/lib/1.jar
+0
-0
MQServiceBiZ.java
...in/java/com/xxfc/platform/universal/biz/MQServiceBiZ.java
+7
-2
OrderPayBiz.java
...ain/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
+41
-12
No files found.
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/controller/AuthController.java
View file @
a4de09fa
...
...
@@ -9,6 +9,7 @@ import com.github.wxiaoqi.security.common.util.ClientUtil;
import
com.github.wxiaoqi.security.common.util.EntityUtils
;
import
com.github.wxiaoqi.security.common.util.IpUtil
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.result.JsonResultUtil
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -217,8 +218,8 @@ public class AuthController {
}
@PostMapping
(
"/imi/login"
)
public
String
loginImiWithToken
(){
return
authService
.
loginImiWithToken
(
);
public
JSONObject
loginImiWithToken
(){
return
JsonResultUtil
.
createSuccessResultWithObj
(
authService
.
loginImiWithToken
()
);
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/config/RabbitCommonConfig.java
View file @
a4de09fa
...
...
@@ -51,8 +51,14 @@ public abstract class RabbitCommonConfig {
if
(
null
!=
myQueue
)
{
myQueue
.
forEach
(
en
->
{
registerBean
(
StrUtil
.
toCamelCase
(
en
.
getQueue
()),
Queue
.
class
,
en
.
getQueue
(),
Boolean
.
TRUE
);
registerBean
(
StrUtil
.
toCamelCase
(
en
.
getQueue
())+
"Binding"
,
Binding
.
class
,
en
.
getQueue
(),
Binding
.
DestinationType
.
QUEUE
,
en
.
getExchange
(),
en
.
getKey
(),
Collections
.
EMPTY_MAP
);
//避免一个队列绑定多个exchange+key 时 再次创建queueBean
try
{
Queue
queue
=
applicationContext
.
getBean
(
StrUtil
.
toCamelCase
(
en
.
getQueue
()),
Queue
.
class
);
}
catch
(
Exception
e
)
{
registerBean
(
StrUtil
.
toCamelCase
(
en
.
getQueue
()),
Queue
.
class
,
en
.
getQueue
(),
Boolean
.
TRUE
);
}
String
bindName
=
StrUtil
.
toCamelCase
(
en
.
getQueue
())+
"Binding"
+
en
.
getExchange
()+
"_"
+
en
.
getKey
();
registerBean
(
bindName
,
Binding
.
class
,
en
.
getQueue
(),
Binding
.
DestinationType
.
QUEUE
,
en
.
getExchange
(),
en
.
getKey
(),
Collections
.
EMPTY_MAP
);
});
}
}
...
...
ace-common/src/main/java/com/github/wxiaoqi/security/common/config/rabbit/RabbitConstant.java
View file @
a4de09fa
...
...
@@ -15,7 +15,12 @@ public class RabbitConstant {
public
static
final
String
ORDER_TOPIC
=
ORDER
+
TOPIC_EXC
;
/**************************key*********************************/
public
static
final
String
KEY_REGISTER_SUCCESS
=
"register.success"
;
public
static
final
String
KEY_APPUSER_REGISTER
=
"appUser.register"
;
public
static
final
String
KEY_APPUSER_AUTH
=
"appUser.auth"
;
public
static
final
String
KEY_ORDER_PAY
=
"order.pay"
;
public
static
final
String
KEY_ORDER_FINLISH
=
"order.finlish"
;
public
static
final
String
KEY_ORDER_CANCEL
=
"order.cancel"
;
static
{
exchangeTopicSet
=
new
HashSet
<
String
>()
{{
...
...
ace-gate/src/main/resources/bootstrap.yml
View file @
a4de09fa
...
...
@@ -17,7 +17,8 @@ spring:
nacos
:
config
:
server-addr
:
127.0.0.1:8848
#共用配置,暂定一个
shared-dataids
:
common-dev.yaml,mongodb-log-dev.yaml
---
spring
:
profiles
:
pro
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/bo/InviteMemberBO.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
bo
;
import
lombok.Data
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 19:25
*/
@Data
public
class
InviteMemberBO
{
private
String
username
;
private
String
headUrl
;
private
Long
joinTime
;
private
Long
bindTime
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/bo/PromoteBO.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
bo
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 20:11
*/
@Data
public
class
PromoteBO
{
/**
* 累计收益
*/
private
BigDecimal
totalIncome
;
/**
* 已邀请人数
*/
private
Integer
inviteNumber
;
/**
* 已激活人数
*/
private
Integer
activatedNumber
;
/**
* 上级用户名
*/
private
String
leaderUsername
;
/**
* 上级头像
*/
private
String
leaderHeadUrl
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/bo/UserTeamMemberBo.java
View file @
a4de09fa
...
...
@@ -45,4 +45,8 @@ public class UserTeamMemberBo {
* 收入
*/
private
BigDecimal
income
;
private
BigDecimal
orderAmount
;
private
Integer
recordedState
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/PersonalConsumptionDTO.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 15:59
*/
@Data
public
class
PersonalConsumptionDTO
{
private
Integer
userId
;
private
BigDecimal
totalConsumption
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/RegisterParamDTO.java
View file @
a4de09fa
...
...
@@ -15,4 +15,5 @@ public class RegisterParamDTO {
String
unionid
;
Integer
type
;
String
code
;
String
activityCode
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/RegisterQueueDTO.java
View file @
a4de09fa
...
...
@@ -5,7 +5,22 @@ import lombok.Data;
@Data
public
class
RegisterQueueDTO
{
RegisterParamDTO
registerParamDTO
;
public
static
final
Integer
SIGN_NEW
=
1
;
public
static
final
Integer
SIGN_ACTIVATE
=
2
;
public
static
final
Integer
SIGN_LOGIN
=
3
;
/**
* 执行方法的入参
*/
RegisterParamDTO
InParamDTO
;
/**
* app用户id
*/
Integer
appUserId
;
JSONObject
data
;
/**
* 标识:1--新注册;2--激活;3--登录
*/
Integer
sign
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/WalletCathFindDTO.java
View file @
a4de09fa
...
...
@@ -12,7 +12,7 @@ import lombok.Data;
@Data
public
class
WalletCathFindDTO
extends
PageParam
{
private
String
user
N
ame
;
private
String
user
n
ame
;
private
String
phone
;
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/WalletDetailFindDTO.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
dto
;
import
com.github.wxiaoqi.security.common.vo.PageParam
;
import
lombok.Data
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 11:12
*/
@Data
public
class
WalletDetailFindDTO
extends
PageParam
{
private
String
username
;
private
String
phone
;
private
Integer
source
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/WalletDetailListDTO.java
View file @
a4de09fa
...
...
@@ -25,25 +25,28 @@ public class WalletDetailListDTO {
private
String
phone
;
@ApiModelProperty
(
value
=
"来源:0-活动,1-佣金,2-会员充值,10-提现,11-转账,12-购买"
)
private
Integer
source
Type
;
private
Integer
source
;
@ApiModelProperty
(
"
活动名称或
佣金商品名称"
)
private
String
sourc
e
;
@ApiModelProperty
(
"佣金商品名称"
)
private
String
titl
e
;
@ApiModelProperty
(
value
=
"收入/支出:0-收入,1-支出
"
)
private
Integer
ityp
e
;
@ApiModelProperty
(
"商品价格
"
)
private
BigDecimal
pric
e
;
@ApiModelProperty
(
value
=
"收入/支出的金额(分)
"
)
private
BigDecimal
amoun
t
;
@ApiModelProperty
(
"提成比例
"
)
private
Integer
extrac
t
;
@ApiModelProperty
(
"入帐状态"
)
private
Integer
waiting
;
@ApiModelProperty
(
value
=
"活动类型"
)
private
Integer
type
;
@ApiModelProperty
(
value
=
"收入/支出的金额(分)"
)
private
BigDecimal
amount
;
@ApiModelProperty
(
value
=
"活动id"
)
private
Integer
activityId
;
@ApiModelProperty
(
value
=
"0 收入 1 支出"
)
private
Integer
itype
;
@ApiModelProperty
(
"活动名称"
)
private
String
activityName
;
...
...
@@ -52,11 +55,6 @@ public class WalletDetailListDTO {
@ApiModelProperty
(
value
=
"单号"
)
private
Integer
cono
;
@ApiModelProperty
(
value
=
"加上当时的收入的余额"
)
private
BigDecimal
balance
;
@ApiModelProperty
(
value
=
"操作时间"
,
hidden
=
true
)
private
Long
crtTime
;
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppUserDetail.java
View file @
a4de09fa
...
...
@@ -74,4 +74,8 @@ public class AppUserDetail {
@ApiModelProperty
(
value
=
"邀请人账号:"
)
@Column
(
name
=
"inviter_account"
)
private
Integer
inviterAccount
;
@ApiModelProperty
(
value
=
"1-新人用户;2-未激活;3-激活"
)
@Column
(
name
=
"state"
)
private
Integer
state
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/dto/AppUserDTO.java
View file @
a4de09fa
...
...
@@ -9,6 +9,12 @@ import lombok.Data;
@Data
public
class
AppUserDTO
{
public
static
final
Integer
CHANNEL_APP
=
1
;
public
static
final
Integer
CHANNEL_SMALL
=
2
;
public
static
final
Integer
source_APP
=
1
;
public
static
final
Integer
source_SMALL
=
2
;
private
Integer
id
;
private
Integer
userid
;
private
Integer
isMember
;
...
...
@@ -57,7 +63,9 @@ public class AppUserDTO {
private
String
code
;
@ApiModelProperty
(
value
=
"邀请人id:"
)
private
String
inviterAccount
;
private
Integer
inviterAccount
;
@ApiModelProperty
(
value
=
"1-新人用户;2-未激活;3-激活:"
)
private
Integer
state
;
private
Integer
imUserid
;
private
String
wxOpenid
;
private
String
unionid
;
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/AppUserInfoVo.java
View file @
a4de09fa
...
...
@@ -38,4 +38,5 @@ public class AppUserInfoVo {
private
Long
updatetime
;
private
Integer
isdel
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/AppUserVo.java
View file @
a4de09fa
...
...
@@ -80,6 +80,9 @@ public class AppUserVo {
private
String
code
;
@ApiModelProperty
(
value
=
"邀请人id:"
)
private
String
inviterAccount
;
private
Integer
inviterAccount
;
@ApiModelProperty
(
value
=
"1-未激活;2-激活:"
)
private
Integer
state
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/InviteMemberVo.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
;
import
com.github.wxiaoqi.security.admin.bo.InviteMemberBO
;
import
lombok.Data
;
import
java.util.List
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 19:57
*/
@Data
public
class
InviteMemberVo
{
private
Long
failureTime
;
private
List
<
InviteMemberBO
>
inviteMembers
;
private
Integer
page
;
private
Integer
limit
;
private
Integer
totalCount
;
private
Integer
totalPage
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/WalletDetailAdminVo.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
java.math.BigDecimal
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 10:50
*/
@Data
public
class
WalletDetailAdminVo
{
private
Integer
id
;
private
String
username
;
private
String
phone
;
@ApiModelProperty
(
value
=
"来源:0-活动,1-佣金,2-会员充值,10-提现,11-转账,12-购买"
)
private
Integer
source
;
@ApiModelProperty
(
"佣金商品名称"
)
private
String
title
;
@ApiModelProperty
(
"商品价格"
)
private
BigDecimal
price
;
@ApiModelProperty
(
"提成比例"
)
private
Integer
extract
;
@ApiModelProperty
(
"入帐状态"
)
private
Integer
waiting
;
@ApiModelProperty
(
value
=
"收入/支出的金额(分)"
)
private
BigDecimal
amount
;
@ApiModelProperty
(
value
=
"0收入 1支出"
)
private
Integer
itype
;
@ApiModelProperty
(
"活动名称"
)
private
String
activityName
;
@ApiModelProperty
(
value
=
"单号"
)
private
Integer
cono
;
@ApiModelProperty
(
value
=
"操作时间"
,
hidden
=
true
)
private
Long
crtTime
;
private
String
sourceName
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/WalletPageVo.java
View file @
a4de09fa
...
...
@@ -30,12 +30,18 @@ public class WalletPageVo {
@ApiModelProperty
(
value
=
"已提现金额"
)
private
BigDecimal
withdrawals
;
@ApiModelProperty
(
"提现中的金额"
)
private
BigDecimal
withdrawaling
;
@ApiModelProperty
(
value
=
"总消费"
)
private
BigDecimal
totalConsumption
;
@ApiModelProperty
(
value
=
"进账总额(元)"
)
private
BigDecimal
totalAmount
;
@ApiModelProperty
(
value
=
"
进账
总额(元)"
)
@ApiModelProperty
(
value
=
"
日收益
总额(元)"
)
private
BigDecimal
todayAmount
;
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
View file @
a4de09fa
...
...
@@ -2,20 +2,28 @@ package com.github.wxiaoqi.security.admin.biz;
import
com.ace.cache.annotation.Cache
;
import
com.ace.cache.annotation.CacheClear
;
import
com.github.wxiaoqi.security.admin.bo.UserTeamMemberBo
;
import
com.github.wxiaoqi.security.admin.entity.AppUserDetail
;
import
com.github.wxiaoqi.security.admin.entity.AppUserLogin
;
import
com.github.wxiaoqi.security.admin.entity.AppUserRelationTemp
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.bo.InviteMemberBO
;
import
com.github.wxiaoqi.security.admin.vo.InviteMemberVo
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.aop.framework.AopContext
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
com.github.wxiaoqi.security.admin.entity.AppUserRelation
;
import
com.github.wxiaoqi.security.admin.mapper.AppUserRelationMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* 用户关系表
*
...
...
@@ -32,6 +40,12 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
@Autowired
AppUserDetailBiz
userDetailBiz
;
@Autowired
private
AppUserLoginBiz
appUserLoginBiz
;
@Value
(
"${temamember.failureTime:60}"
)
private
Long
failureTime
;
/**
* 关系绑定
* @param userId
...
...
@@ -62,6 +76,15 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
}
}
}
//永久稳定关系
public
void
foreverBind
(
Integer
user_id
){
AppUserRelation
relation
=
getMyBiz
().
getRelationByUserId
(
user_id
);
if
(
relation
!=
null
&&
relation
.
getIsForever
()==
0
){
relation
.
setIsForever
(
1
);
getMyBiz
().
updRelation
(
relation
);
}
}
/**
* 小程序分享上下线绑定
...
...
@@ -153,4 +176,66 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
public
PageDataVO
<
AppUserRelation
>
findMemberPageByLeaderId
(
Integer
leaderId
,
Integer
pageNo
,
Integer
pageSize
)
{
return
PageDataVO
.
pageInfo
(
pageNo
,
pageSize
,
()
->
mapper
.
selectByLeaderId
(
leaderId
));
}
public
InviteMemberVo
findInviteMemberByActivitState
(
Integer
leaderId
,
Integer
state
,
Integer
page
,
Integer
limit
)
{
InviteMemberVo
inviteMemberVo
=
new
InviteMemberVo
();
inviteMemberVo
.
setPage
(
page
);
inviteMemberVo
.
setLimit
(
limit
);
inviteMemberVo
.
setFailureTime
(
failureTime
*
24
*
60
*
60
);
Example
example
=
new
Example
(
AppUserRelation
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
if
(
state
!=
null
)
{
criteria
.
andEqualTo
(
"isForever"
,
state
);
}
criteria
.
andEqualTo
(
"parentId"
,
leaderId
);
PageDataVO
<
AppUserRelation
>
pageDataVO
=
PageDataVO
.
pageInfo
(
page
,
limit
,
()
->
mapper
.
selectByExample
(
example
));
List
<
AppUserRelation
>
appUserRelations
=
pageDataVO
.
getData
();
if
(
CollectionUtils
.
isEmpty
(
appUserRelations
)){
inviteMemberVo
.
setInviteMembers
(
Collections
.
EMPTY_LIST
);
return
inviteMemberVo
;
}
List
<
Integer
>
memberIds
=
appUserRelations
.
stream
().
map
(
AppUserRelation:
:
getUserId
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
AppUserLogin
>
userIdAndUserLoginMap
=
appUserLoginBiz
.
findUserIdAndUserLoginMapByMemberIds
(
memberIds
);
Map
<
Integer
,
AppUserDetail
>
userIdAndUserDetailMap
=
userDetailBiz
.
findUserIdAndUserDetailMapByMemberIds
(
memberIds
);
List
<
InviteMemberBO
>
inviteMemberBOS
=
new
ArrayList
<>();
InviteMemberBO
inviteMemberBO
;
for
(
AppUserRelation
appUserRelation
:
appUserRelations
)
{
inviteMemberBO
=
new
InviteMemberBO
();
inviteMemberBO
.
setBindTime
(
appUserRelation
.
getBindTime
());
inviteMemberBO
.
setJoinTime
(
appUserRelation
.
getBindTime
());
inviteMemberBO
.
setUsername
(
userIdAndUserLoginMap
.
get
(
appUserRelation
.
getUserId
()).
getUsername
());
inviteMemberBO
.
setHeadUrl
(
userIdAndUserDetailMap
.
get
(
appUserRelation
.
getUserId
()).
getHeadimgurl
());
inviteMemberBOS
.
add
(
inviteMemberBO
);
}
inviteMemberVo
.
setTotalCount
(
pageDataVO
.
getTotalCount
().
intValue
());
inviteMemberVo
.
setTotalPage
(
pageDataVO
.
getTotalPage
());
inviteMemberVo
.
setInviteMembers
(
inviteMemberBOS
);
return
inviteMemberVo
;
}
public
Integer
findLeaderIdByMemberId
(
Integer
userId
)
{
Example
example
=
new
Example
(
AppUserRelation
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"userId"
,
userId
);
List
<
AppUserRelation
>
appUserRelations
=
mapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isEmpty
(
appUserRelations
)){
return
0
;
}
return
appUserRelations
.
get
(
0
).
getParentId
();
}
public
Map
<
Integer
,
Integer
>
findMemberSateAndCountMapByLeaderId
(
Integer
userId
)
{
Map
<
Integer
,
Integer
>
memberSateAndCountMap
=
new
HashMap
<>();
AppUserRelation
appUserRelation
=
new
AppUserRelation
();
appUserRelation
.
setParentId
(
userId
);
int
totalCount
=
mapper
.
selectCount
(
appUserRelation
);
appUserRelation
.
setIsForever
(
1
);
int
activityCount
=
mapper
.
selectCount
(
appUserRelation
);
memberSateAndCountMap
.
put
(
0
,
totalCount
);
memberSateAndCountMap
.
put
(
1
,
activityCount
);
return
memberSateAndCountMap
;
}
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserSellingWaterBiz.java
View file @
a4de09fa
This diff is collapsed.
Click to expand it.
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletBiz.java
View file @
a4de09fa
...
...
@@ -10,14 +10,15 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
tk.mybatis.mapper.entity.Example
;
import
java.
util.ArrayList
;
import
java.util.
Comparator
;
import
java.util.
List
;
import
java.
math.BigDecimal
;
import
java.util.
*
;
import
java.util.
stream.Collectors
;
/**
* @author libin
...
...
@@ -29,6 +30,11 @@ import java.util.List;
@Service
public
class
MyWalletBiz
extends
BaseBiz
<
MyWalletMapper
,
MyWallet
>
{
@Autowired
private
MyWalletDetailBiz
myWalletDetailBiz
;
@Autowired
private
MyWalletCathBiz
myWalletCathBiz
;
public
AppletWalletVo
findMyWallet
(
Integer
userId
)
{
...
...
@@ -53,6 +59,10 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
return
walletPageVo
;
}
List
<
Integer
>
userIds
=
wallets
.
stream
().
map
(
WalletListDTO:
:
getUserId
).
collect
(
Collectors
.
toList
());
Map
<
Integer
,
BigDecimal
>
userIdAndTotalConsumptionMap
=
myWalletDetailBiz
.
finduserIdAndPersonalTotalConsumptionMapByUserIds
(
userIds
);
Map
<
Integer
,
BigDecimal
>
userIdAndWithdrawalingMap
=
myWalletCathBiz
.
findUserIdAndWithdrawalingMapByUserIds
(
userIds
);
List
<
WalletPageVo
>
walletPageVos
=
new
ArrayList
<>();
WalletPageVo
walletpg
;
for
(
WalletListDTO
wallet
:
wallets
)
{
...
...
@@ -60,8 +70,16 @@ public class MyWalletBiz extends BaseBiz<MyWalletMapper, MyWallet> {
BeanUtils
.
copyProperties
(
wallet
,
walletpg
);
walletpg
.
setUsername
(
StringUtils
.
isEmpty
(
wallet
.
getRealname
())?
wallet
.
getNickname
():
wallet
.
getRealname
());
walletpg
.
setPhone
(
wallet
.
getUsername
());
BigDecimal
totalConsumpution
=
userIdAndTotalConsumptionMap
==
null
?
new
BigDecimal
(
0
):
userIdAndTotalConsumptionMap
.
get
(
wallet
.
getUserId
())==
null
?
new
BigDecimal
(
0
):
userIdAndTotalConsumptionMap
.
get
(
wallet
.
getUserId
());
BigDecimal
withDrawaling
=
userIdAndWithdrawalingMap
==
null
?
new
BigDecimal
(
0
):
userIdAndWithdrawalingMap
.
get
(
wallet
.
getUserId
())==
null
?
new
BigDecimal
(
0
):
userIdAndWithdrawalingMap
.
get
(
wallet
.
getUserId
());
walletpg
.
setWithdrawaling
(
withDrawaling
);
walletpg
.
setTotalConsumption
(
totalConsumpution
);
walletPageVos
.
add
(
walletpg
);
}
walletPageVos
.
sort
(
Comparator
.
comparing
(
WalletPageVo:
:
getTotalAmount
).
reversed
());
walletPageVo
.
setPageNum
(
walletFindDTO
.
getPage
());
walletPageVo
.
setPageSize
(
walletFindDTO
.
getLimit
());
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletCathBiz.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO
;
import
com.github.wxiaoqi.security.admin.dto.WalletCathFindDTO
;
import
com.github.wxiaoqi.security.admin.dto.WalletCathListDTO
;
import
com.github.wxiaoqi.security.admin.entity.MyWalletCath
;
...
...
@@ -10,6 +11,7 @@ import com.github.wxiaoqi.security.admin.vo.WalletCathPageVo;
import
com.github.wxiaoqi.security.admin.vo.WalletCathVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.google.common.collect.Maps
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -19,6 +21,7 @@ import tk.mybatis.mapper.entity.Example;
import
java.math.BigDecimal
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
* @author libin
...
...
@@ -84,10 +87,9 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
PageDataVO
<
WalletCathAdminVo
>
walletCathAdminVoPage
=
new
PageDataVO
<>();
// List<WalletCathListDTO> walletCathListDTOS = mapper.selectByUserNameOrPhoneOrWithDrawSate(walletCathFindDTO.getUserName(), walletCathFindDTO.getPhone(), walletCathFindDTO.getState());
PageDataVO
<
WalletCathListDTO
>
walletCathListDTOPage
=
PageDataVO
.
pageInfo
(
walletCathFindDTO
.
getPage
(),
walletCathFindDTO
.
getLimit
(),
()
->
mapper
.
selectByUserNameOrPhoneOrWithDrawSate
(
walletCathFindDTO
.
getUser
N
ame
(),
walletCathFindDTO
.
getPhone
(),
walletCathFindDTO
.
getState
()));
()
->
mapper
.
selectByUserNameOrPhoneOrWithDrawSate
(
walletCathFindDTO
.
getUser
n
ame
(),
walletCathFindDTO
.
getPhone
(),
walletCathFindDTO
.
getState
()));
List
<
WalletCathListDTO
>
walletCathListDTOList
=
walletCathListDTOPage
.
getData
();
if
(
CollectionUtils
.
isEmpty
(
walletCathListDTOList
)){
...
...
@@ -111,4 +113,10 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
return
walletCathAdminVoPage
;
}
public
Map
<
Integer
,
BigDecimal
>
findUserIdAndWithdrawalingMapByUserIds
(
List
<
Integer
>
userIds
)
{
List
<
PersonalConsumptionDTO
>
personalConsumptions
=
mapper
.
findUserWithDrawingByUserIds
(
userIds
);
Map
<
Integer
,
BigDecimal
>
userIdAndPersonalConsumptionMap
=
personalConsumptions
.
stream
().
collect
(
Collectors
.
toMap
(
PersonalConsumptionDTO:
:
getUserId
,
PersonalConsumptionDTO:
:
getTotalConsumption
));
return
userIdAndPersonalConsumptionMap
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletDetailBiz.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO
;
import
com.github.wxiaoqi.security.admin.dto.WalletDetailFindDTO
;
import
com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO
;
import
com.github.wxiaoqi.security.admin.entity.MyWalletDetail
;
import
com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper
;
import
com.github.wxiaoqi.security.admin.vo.WalletDetailAdminVo
;
import
com.github.wxiaoqi.security.admin.vo.WalletDetailPageVo
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
lombok.Data
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.beans.BeanUtils
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
import
tk.mybatis.mapper.entity.Example
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -23,6 +32,7 @@ import java.util.List;
*/
@Transactional
@Service
@Data
public
class
MyWalletDetailBiz
extends
BaseBiz
<
MyWalletDetailMapper
,
MyWalletDetail
>
{
...
...
@@ -53,4 +63,38 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
return
walletDetailPageVo
;
}
public
PageDataVO
<
WalletDetailAdminVo
>
findWalletDetailPage
(
WalletDetailFindDTO
walletDetailFindDTO
){
PageDataVO
<
WalletDetailAdminVo
>
pageDataVO
=
new
PageDataVO
<>();
PageDataVO
<
WalletDetailListDTO
>
walletDetailPage
=
PageDataVO
.
pageInfo
(
walletDetailFindDTO
.
getPage
(),
walletDetailFindDTO
.
getLimit
(),
()->
mapper
.
findWalletDetailsByUserNameOrPhoneOrsourceType
(
walletDetailFindDTO
.
getUsername
(),
walletDetailFindDTO
.
getPhone
(),
walletDetailFindDTO
.
getSource
()));
List
<
WalletDetailListDTO
>
detailListDTOS
=
walletDetailPage
.
getData
();
if
(
CollectionUtils
.
isEmpty
(
detailListDTOS
)){
return
pageDataVO
;
}
List
<
WalletDetailAdminVo
>
walletDetailAdminVos
=
new
ArrayList
<>();
WalletDetailAdminVo
walletDetailAdminVo
;
for
(
WalletDetailListDTO
detailListDTO
:
detailListDTOS
)
{
walletDetailAdminVo
=
new
WalletDetailAdminVo
();
BeanUtils
.
copyProperties
(
detailListDTO
,
walletDetailAdminVo
);
walletDetailAdminVo
.
setUsername
(
StringUtils
.
isEmpty
(
detailListDTO
.
getRealname
())?
detailListDTO
.
getNickname
():
detailListDTO
.
getRealname
());
walletDetailAdminVos
.
add
(
walletDetailAdminVo
);
walletDetailAdminVo
.
setSourceName
(
StringUtils
.
isEmpty
(
detailListDTO
.
getTitle
())?
detailListDTO
.
getActivityName
():
detailListDTO
.
getTitle
());
}
pageDataVO
.
setPageNum
(
walletDetailFindDTO
.
getPage
());
pageDataVO
.
setPageSize
(
walletDetailFindDTO
.
getLimit
());
pageDataVO
.
setTotalCount
(
walletDetailPage
.
getTotalCount
());
pageDataVO
.
setTotalPage
(
walletDetailPage
.
getTotalPage
());
pageDataVO
.
setData
(
walletDetailAdminVos
);
return
pageDataVO
;
}
public
Map
<
Integer
,
BigDecimal
>
finduserIdAndPersonalTotalConsumptionMapByUserIds
(
List
<
Integer
>
userIds
)
{
List
<
PersonalConsumptionDTO
>
personalConsumptions
=
mapper
.
findpersonalConsumptionsByUserIds
(
userIds
);
Map
<
Integer
,
BigDecimal
>
userIdAndPersonalConsumptionMap
=
personalConsumptions
.
stream
().
collect
(
Collectors
.
toMap
(
PersonalConsumptionDTO:
:
getUserId
,
PersonalConsumptionDTO:
:
getTotalConsumption
));
return
userIdAndPersonalConsumptionMap
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/UserBusinessBiz.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
biz
;
import
com.github.wxiaoqi.security.admin.bo.PromoteBO
;
import
com.github.wxiaoqi.security.admin.bo.UserTeamMemberBo
;
import
com.github.wxiaoqi.security.admin.entity.AppUserDetail
;
import
com.github.wxiaoqi.security.admin.entity.AppUserLogin
;
...
...
@@ -12,9 +13,7 @@ import org.springframework.stereotype.Service;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.stream.Collectors
;
/**
...
...
@@ -89,4 +88,24 @@ public class UserBusinessBiz {
userTeamMemberVo
.
setTotalIncome
(
totalIncome
);
return
userTeamMemberVo
;
}
public
PromoteBO
getPromoteBoByUserId
(
Integer
userId
)
{
PromoteBO
promoteBO
=
new
PromoteBO
();
Integer
leaderId
=
appUserRelationBiz
.
findLeaderIdByMemberId
(
userId
);
Map
<
Integer
,
Integer
>
memberStateAndCountMap
=
appUserRelationBiz
.
findMemberSateAndCountMapByLeaderId
(
userId
);
if
(
leaderId
!=
0
)
{
Map
<
Integer
,
AppUserLogin
>
userIdAndUserLoginMap
=
appUserLoginBiz
.
findUserIdAndUserLoginMapByMemberIds
(
Arrays
.
asList
(
leaderId
));
Map
<
Integer
,
AppUserDetail
>
userIdAndUserDetailMap
=
appUserDetailBiz
.
findUserIdAndUserDetailMapByMemberIds
(
Arrays
.
asList
(
leaderId
));
promoteBO
.
setLeaderUsername
(
userIdAndUserLoginMap
.
get
(
leaderId
).
getUsername
());
promoteBO
.
setLeaderHeadUrl
(
userIdAndUserDetailMap
.
get
(
leaderId
).
getHeadimgurl
());
}
promoteBO
.
setInviteNumber
(
memberStateAndCountMap
.
get
(
0
));
promoteBO
.
setActivatedNumber
(
memberStateAndCountMap
.
get
(
1
));
BigDecimal
totalIncome
=
appUserSellingWaterBiz
.
selectTotalIncomeByUserId
(
userId
);
promoteBO
.
setTotalIncome
(
totalIncome
==
null
?
new
BigDecimal
(
0
):
totalIncome
);
return
promoteBO
;
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/config/RabbitAdminConfig.java
View file @
a4de09fa
...
...
@@ -3,15 +3,11 @@ package com.github.wxiaoqi.security.admin.config;
import
com.github.wxiaoqi.security.common.config.RabbitCommonConfig
;
import
com.github.wxiaoqi.security.common.config.rabbit.BindDTO
;
import
com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant
;
import
org.springframework.amqp.core.*
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
javax.annotation.PostConstruct
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.Map
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
...
...
@@ -22,9 +18,14 @@ import java.util.Map;
public
class
RabbitAdminConfig
extends
RabbitCommonConfig
{
public
static
final
String
ORDER_WATER_QUEUE
=
"order.water.queue"
;
public
static
final
String
ORDER_FINLISH_USER_RE_QUEUE
=
"order.cancel.userRe.queue"
;
static
{
myQueue
=
new
ArrayList
<
BindDTO
>(){{
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
RabbitConstant
.
ADMIN_TOPIC
,
"order.#"
));
myQueue
=
new
ArrayList
<
BindDTO
>(){{
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ADMIN_TOPIC
,
KEY_ORDER_PAY
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ADMIN_TOPIC
,
KEY_ORDER_FINLISH
));
add
(
new
BindDTO
(
ORDER_WATER_QUEUE
,
ADMIN_TOPIC
,
KEY_ORDER_CANCEL
));
add
(
new
BindDTO
(
ORDER_FINLISH_USER_RE_QUEUE
,
ADMIN_TOPIC
,
KEY_ORDER_FINLISH
));
}};
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/handler/IntegralMQHandler.java
View file @
a4de09fa
...
...
@@ -10,16 +10,19 @@ import org.springframework.amqp.rabbit.annotation.RabbitListener;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Component
;
import
static
com
.
github
.
wxiaoqi
.
security
.
admin
.
config
.
RabbitAdminConfig
.*;
@Component
@Slf4j
public
class
IntegralMQHandler
{
@Autowired
AppUserSellingWaterBiz
waterBiz
;
@RabbitListener
(
queues
=
RabbitAdminConfig
.
ORDER_WATER_QUEUE
)
@RabbitListener
(
queues
=
ORDER_WATER_QUEUE
)
public
void
integralHandler
(
String
json
)
{
log
.
info
(
"接收到的消息:json = {}"
,
json
);
try
{
OrderWaterDTO
orderWaterDTO
=
JSONObject
.
parseObject
(
json
,
OrderWaterDTO
.
class
);
waterBiz
.
orderWater
(
orderWaterDTO
);
}
catch
(
Exception
e
){
...
...
@@ -28,4 +31,19 @@ public class IntegralMQHandler {
}
}
@RabbitListener
(
queues
=
{
ORDER_FINLISH_USER_RE_QUEUE
})
public
void
integralHandler2
(
String
json
)
{
log
.
info
(
"接收到的消息:json = {}"
,
json
);
try
{
OrderWaterDTO
orderWaterDTO
=
JSONObject
.
parseObject
(
json
,
OrderWaterDTO
.
class
);
waterBiz
.
orderWater
(
orderWaterDTO
);
}
catch
(
Exception
e
){
log
.
info
(
"接收到的消息失败"
);
e
.
printStackTrace
();
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserDetailMapper.java
View file @
a4de09fa
...
...
@@ -12,7 +12,7 @@ import java.util.List;
public
interface
AppUserDetailMapper
extends
Mapper
<
AppUserDetail
>
{
//查询用户信息
public
AppUserVo
getUserInfo
(
@Param
(
"userId"
)
Integer
userId
);
AppUserVo
getUserInfo
(
@Param
(
"userId"
)
Integer
userId
);
List
<
AppUserManageVo
>
selectAppUserManage
(
AppUserManageDTO
appUserManageDTO
);
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/AppUserSellingWaterMapper.java
View file @
a4de09fa
...
...
@@ -5,6 +5,7 @@ import com.github.wxiaoqi.security.admin.entity.AppUserSellingWater;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.math.BigDecimal
;
import
java.util.List
;
/**
...
...
@@ -17,4 +18,6 @@ import java.util.List;
public
interface
AppUserSellingWaterMapper
extends
Mapper
<
AppUserSellingWater
>
{
List
<
UserIncomeBo
>
accquireIncomeByMemberIds
(
@Param
(
"memberIds"
)
List
<
Integer
>
memberIds
);
BigDecimal
selectTotalIncomeByUserId
(
@Param
(
"userId"
)
Integer
userId
);
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/MyWalletCathMapper.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO
;
import
com.github.wxiaoqi.security.admin.dto.WalletCathListDTO
;
import
com.github.wxiaoqi.security.admin.entity.MyWalletCath
;
import
org.apache.ibatis.annotations.Param
;
...
...
@@ -19,4 +20,6 @@ public interface MyWalletCathMapper extends Mapper<MyWalletCath> {
List
<
WalletCathListDTO
>
selectByUserNameOrPhoneOrWithDrawSate
(
@Param
(
"userName"
)
String
userName
,
@Param
(
"phone"
)
String
phone
,
@Param
(
"state"
)
Integer
state
);
List
<
PersonalConsumptionDTO
>
findUserWithDrawingByUserIds
(
@Param
(
"userIds"
)
List
<
Integer
>
userIds
);
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/mapper/MyWalletDetailMapper.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
mapper
;
import
com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO
;
import
com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO
;
import
com.github.wxiaoqi.security.admin.entity.MyWalletDetail
;
import
org.apache.ibatis.annotations.Param
;
import
tk.mybatis.mapper.common.Mapper
;
import
java.util.List
;
/**
* 收入/支持明细表,每笔的进账,出账的详细记录
*
...
...
@@ -11,5 +16,8 @@ import tk.mybatis.mapper.common.Mapper;
* @date 2019-07-11 14:14:54
*/
public
interface
MyWalletDetailMapper
extends
Mapper
<
MyWalletDetail
>
{
List
<
WalletDetailListDTO
>
findWalletDetailsByUserNameOrPhoneOrsourceType
(
@Param
(
"userName"
)
String
userName
,
@Param
(
"phone"
)
String
phone
,
@Param
(
"sourceType"
)
Integer
sourceType
);
List
<
PersonalConsumptionDTO
>
findpersonalConsumptionsByUserIds
(
@Param
(
"userIds"
)
List
<
Integer
>
userIds
);
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUserRelationController.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.vo.InviteMemberVo
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.auth.client.jwt.UserAuthUtil
;
import
com.github.wxiaoqi.security.auth.common.util.jwt.IJWTInfo
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.admin.biz.AppUserRelationBiz
;
import
com.github.wxiaoqi.security.admin.entity.AppUserRelation
;
import
io.swagger.annotations.ApiModelProperty
;
import
org.springframework.stereotype.Controller
;
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
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.
beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.
*
;
import
javax.servlet.http.HttpServletRequest
;
@RestController
@RequestMapping
(
"relation"
)
public
class
AppUserRelationController
extends
BaseController
<
AppUserRelationBiz
,
AppUserRelation
>
{
@Autowired
private
UserAuthUtil
userAuthUtil
;
@Autowired
private
UserAuthConfig
userAuthConfig
;
@RequestMapping
(
value
=
"app/unauth/small/share"
,
method
=
RequestMethod
.
GET
)
@ApiModelProperty
(
"小程序分享绑定"
)
...
...
@@ -26,4 +37,19 @@ public class AppUserRelationController extends BaseController<AppUserRelationBiz
return
baseBiz
.
shareParentByUserId
(
userid
,
pid
,
platform_userid
);
}
@ApiOperation
(
"查询邀请的成员"
)
@GetMapping
(
"/pages"
)
public
ObjectRestResponse
<
InviteMemberVo
>
findInviteMemberByActivitState
(
@RequestParam
(
value
=
"state"
,
required
=
false
)
Integer
state
,
@RequestParam
(
"page"
)
Integer
page
,
@RequestParam
(
"limit"
)
Integer
limit
,
HttpServletRequest
request
){
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
InviteMemberVo
inviteMemberVo
=
baseBiz
.
findInviteMemberByActivitState
(
Integer
.
valueOf
(
infoFromToken
.
getId
()),
state
,
page
,
limit
);
return
ObjectRestResponse
.
succ
(
inviteMemberVo
);
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
}
}
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/UserBussinessController.java
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
;
import
com.github.wxiaoqi.security.admin.biz.UserBusinessBiz
;
import
com.github.wxiaoqi.security.admin.bo.PromoteBO
;
import
com.github.wxiaoqi.security.admin.bo.UserTeamMemberBo
;
import
com.github.wxiaoqi.security.admin.vo.UserTeamMemberVo
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
...
...
@@ -45,6 +46,16 @@ public class UserBussinessController {
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
}
}
}
@GetMapping
(
"/promote"
)
public
ObjectRestResponse
<
PromoteBO
>
findPromoteBo
(
HttpServletRequest
request
){
try
{
IJWTInfo
infoFromToken
=
userAuthUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
PromoteBO
promoteBO
=
businessBiz
.
getPromoteBoByUserId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
return
ObjectRestResponse
.
succ
(
promoteBO
);
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/admin/WalletDetailAdminController.java
0 → 100644
View file @
a4de09fa
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
rest
.
admin
;
import
com.github.wxiaoqi.security.admin.biz.MyWalletDetailBiz
;
import
com.github.wxiaoqi.security.admin.dto.WalletDetailFindDTO
;
import
com.github.wxiaoqi.security.admin.vo.WalletDetailAdminVo
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/18 13:30
*/
@RestController
@RequestMapping
(
"/walletdetail/admin"
)
public
class
WalletDetailAdminController
{
@Autowired
private
MyWalletDetailBiz
myWalletDetailBiz
;
@GetMapping
(
"/page"
)
public
ObjectRestResponse
<
PageDataVO
<
WalletDetailAdminVo
>>
findWalletDetailPage
(
WalletDetailFindDTO
walletDetailFindDTO
){
PageDataVO
<
WalletDetailAdminVo
>
walletDetailPage
=
myWalletDetailBiz
.
findWalletDetailPage
(
walletDetailFindDTO
);
return
ObjectRestResponse
.
succ
(
walletDetailPage
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
a4de09fa
...
...
@@ -144,8 +144,11 @@ public class AppUserRest {
@RequestMapping
(
value
=
"/user/wxlogin"
)
public
@ResponseBody
JSONObject
wxlogin
(
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
)
{
return
appPermissionService
.
weCahtLogin
(
openid
,
isQQ
);
public
@ResponseBody
JSONObject
wxlogin
(
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
)
{
return
appPermissionService
.
weCahtLogin
(
openid
,
isQQ
,
code
);
}
/**
...
...
@@ -162,10 +165,11 @@ public class AppUserRest {
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
){
return
appPermissionService
.
login
(
username
,
password
,
mobilecode
,
type
);
return
appPermissionService
.
login
(
username
,
password
,
mobilecode
,
type
,
code
);
}
@RequestMapping
(
value
=
"/user/reset"
,
method
=
RequestMethod
.
POST
)
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
a4de09fa
This diff is collapsed.
Click to expand it.
ace-modules/ace-admin/src/main/resources/bootstrap.yml
View file @
a4de09fa
...
...
@@ -17,7 +17,7 @@ spring:
config
:
server-addr
:
127.0.0.1:8848
#共用配置,暂定一个
shared-dataids
:
common-dev.yaml
shared-dataids
:
common-dev.yaml
,mongodb-log-dev.yaml
---
spring
:
...
...
ace-modules/ace-admin/src/main/resources/mapper/AppUserDetailMapper.xml
View file @
a4de09fa
...
...
@@ -30,6 +30,7 @@
<result
column=
"source"
property=
"source"
/>
<result
column=
"code"
property=
"code"
/>
<result
column=
"invitera_ccount"
property=
"inviterAccount"
/>
<result
column=
"state"
property=
"state"
/>
</resultMap>
...
...
ace-modules/ace-admin/src/main/resources/mapper/AppUserSellingWaterMapper.xml
View file @
a4de09fa
...
...
@@ -16,4 +16,8 @@ WHERE
#{memberId}
</foreach>
</select>
<select
id=
"selectTotalIncomeByUserId"
resultType=
"java.math.BigDecimal"
>
SELECT SUM(commission) FROM app_user_selling_water WHERE `user_id`=#{userId}
</select>
</mapper>
\ No newline at end of file
ace-modules/ace-admin/src/main/resources/mapper/MyWalletCathMapper.xml
View file @
a4de09fa
...
...
@@ -3,7 +3,7 @@
<mapper
namespace=
"com.github.wxiaoqi.security.admin.mapper.MyWalletCathMapper"
>
<select
id=
"selectByUserNameOrPhoneOrWithDrawSate"
resultType=
"com.github.wxiaoqi.security.admin.dto.WalletListDTO"
>
<select
id=
"selectByUserNameOrPhoneOrWithDrawSate"
resultType=
"com.github.wxiaoqi.security.admin.dto.Wallet
Cath
ListDTO"
>
SELECT
wc.id,
aud.nickname,
...
...
@@ -20,10 +20,18 @@
</if>
) AS `wc`
INNER JOIN ( SELECT `id`, `username` FROM `app_user_login`
<if
test=
"phone != null and phone != ''"
>
WHERE `username`=#{phone}
</if>
) AS `aul` ON aul.id = w.user_id
</if>
) AS `aul` ON aul.id = w
c
.user_id
INNER JOIN ( SELECT `userid`, `nickname`, `realname` FROM `app_user_detail`
<if
test=
"userName != null and userName != ''"
>
WHERE nickname =#{user
n
ame} OR realname =#{userName}
WHERE nickname =#{user
N
ame} OR realname =#{userName}
</if>
) AS `aud` ON aud.userid = aul.id
</select>
<select
id=
"findUserWithDrawingByUserIds"
resultType=
"com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"
>
select `user_id` AS `userId`,SUM(amount) AS `totalConsumption` from `my_wallet_cath` where `stauts`=0 AND `user_id` in
<foreach
collection=
"userIds"
item=
"userId"
open=
"("
close=
")"
separator=
","
>
#{userId}
</foreach>
GROUP BY `user_id`
</select>
</mapper>
\ No newline at end of file
ace-modules/ace-admin/src/main/resources/mapper/MyWalletDetailMapper.xml
0 → 100644
View file @
a4de09fa
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
<mapper
namespace=
"com.github.wxiaoqi.security.admin.mapper.MyWalletDetailMapper"
>
<select
id=
"findWalletDetailsByUserNameOrPhoneOrsourceType"
resultType=
"com.github.wxiaoqi.security.admin.dto.WalletDetailListDTO"
>
SELECT
wd.id,
wd.source,
wd.amount,
wd.cono,
wd.itype,
wd.activity_id AS `activityId`,
wd.activity_name AS `activityName`,
wd.crt_time AS `crtTime`,
aul.username AS `phone`,
aud.nickname,
aud.realname,
ausw.price,
ausw.extract,
ausw.waiting,
ausw.title
FROM
(select id,user_id,source,amount,cono,itype,activity_id,activity_name,`crt_time` FROM `my_wallet_detail`
<if
test=
"sourceType != null"
>
WHERE `source`=#{sourceType}
</if>
) AS `wd`
LEFT JOIN (SELECT id,username FROM `app_user_login`
<if
test=
"phone != null and phone != ''"
>
WHERE `username`=#{phone}
</if>
) AS `aul` ON aul.id = wd.user_id
LEFT JOIN (SELECT userid,nickname,realname FROM `app_user_detail`
<if
test=
"userName != null and userName != ''"
>
WHERE `nickname`=#{userName} OR `realname`=#{userName}
</if>
) AS `aud` ON aud.userid = aul.id
LEFT JOIN (SELECT DISTINCT order_id,id,price,extract,waiting,title FROM `app_user_selling_water`) AS `ausw` ON ausw.order_id = wd.cono
</select>
<select
id=
"findpersonalConsumptionsByUserIds"
resultType=
"com.github.wxiaoqi.security.admin.dto.PersonalConsumptionDTO"
>
select `user_id` AS `userId`,SUM(amount) AS `totalConsumption` FROM my_wallet_cath
<if
test=
"userIds != null and userIds.size() != 0"
>
WHERE `user_id` IN
<foreach
collection=
"userIds"
item=
"userId"
open=
"("
close=
")"
separator=
","
>
#{userId}
</foreach>
</if>
GROUP BY user_id;
</select>
</mapper>
\ No newline at end of file
logs/log.2019-07-18.log
deleted
100644 → 0
View file @
c3d9f31c
logs/sys.2019-07-18.log
deleted
100644 → 0
View file @
c3d9f31c
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/ActivityPopularizeLog.java
View file @
a4de09fa
...
...
@@ -78,7 +78,7 @@ public class ActivityPopularizeLog implements Serializable {
/**
*
推广活动项id
*
状态 0--未完成;1--完成;-1--失败
*/
@Column
(
name
=
"status"
)
@ApiModelProperty
(
value
=
"状态 0--未完成;1--完成;-1--失败"
)
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/ActivityPopularizeUser.java
View file @
a4de09fa
...
...
@@ -89,6 +89,12 @@ public class ActivityPopularizeUser implements Serializable {
@Column
(
name
=
"user_id"
)
@ApiModelProperty
(
value
=
"参与的用户的id"
)
private
Integer
userId
;
/**
* 状态 0--未完成;1--完成;-1--失败
*/
@Column
(
name
=
"status"
)
@ApiModelProperty
(
value
=
"状态 0--未完成;1--完成;-1--失败"
)
private
Integer
status
;
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/Coupon.java
View file @
a4de09fa
...
...
@@ -22,7 +22,12 @@ import java.math.BigDecimal;
@Table
(
name
=
"coupon"
)
public
class
Coupon
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
public
static
final
Integer
CHANNEL_ALL
=
0
;
public
static
final
Integer
CHANNEL_RENT
=
1
;
public
static
final
Integer
CHANNEL_TOUR
=
2
;
public
static
final
Integer
CHANNEL_CAMPSITE
=
3
;
/**
* 主键id
*/
...
...
@@ -237,6 +242,5 @@ public class Coupon implements Serializable {
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除;0-正常;1-删除"
)
private
Integer
isDel
;
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/IntegralUserRecord.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
activity
.
entity
;
import
lombok.Builder
;
import
lombok.Data
;
import
javax.persistence.Column
;
...
...
@@ -59,7 +58,7 @@ public class IntegralUserRecord {
* 获取积分的途径id:如订单id,评论id,签到记录id
*/
@Column
(
name
=
"channel_id"
)
private
Integer
channelId
;
private
String
channelId
;
}
\ No newline at end of file
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/feign/ActivityFeign.java
View file @
a4de09fa
...
...
@@ -18,6 +18,10 @@ import java.math.BigDecimal;
@FeignClient
(
value
=
"xx-activity"
)
public
interface
ActivityFeign
{
public
static
final
Integer
TYPE_USE
=
1
;
public
static
final
Integer
TYPE_NO_USE
=
0
;
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/user/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
);
...
...
@@ -30,10 +34,10 @@ public interface ActivityFeign {
@RequestMapping
(
value
=
"/user/use"
,
method
=
RequestMethod
.
POST
)
public
BigDecimal
use
(
@RequestParam
(
value
=
"userId"
)
Integer
userId
,
@RequestParam
(
value
=
"
TickerNo"
)
String
T
ickerNo
,
@RequestParam
(
value
=
"
tickerNo"
)
String
t
ickerNo
,
@RequestParam
(
value
=
"orderNo"
)
String
orderNo
,
@RequestParam
(
value
=
"channel"
)
Integer
channel
,
@RequestParam
(
value
=
"amou
t"
)
BigDecimal
amou
t
,
@RequestParam
(
value
=
"amou
nt"
)
BigDecimal
amoun
t
,
@RequestParam
(
value
=
"type"
)
Integer
type
);
@ApiOperation
(
"优惠卷取消使用"
)
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/vo/IntegralUserRecordDto.java
View file @
a4de09fa
...
...
@@ -14,7 +14,7 @@ public class IntegralUserRecordDto extends PageParam {
/**
* 0-获取积分;1-抵扣积分
*/
private
Integer
type
;
private
Integer
type
=
0
;
/**
* 积分数
...
...
@@ -23,7 +23,7 @@ public class IntegralUserRecordDto extends PageParam {
/**
* 获取积分的途径id:如订单id,评论id,签到记录id
*/
private
Integer
channelId
;
private
String
channelId
;
public
IntegralUserRecord
getIntegralUserRecord
()
{
IntegralUserRecord
integralUserRecord
=
new
IntegralUserRecord
();
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/vo/UserCouponVo.java
View file @
a4de09fa
...
...
@@ -77,6 +77,12 @@ public class UserCouponVo {
@ApiModelProperty
(
value
=
"优惠券标题(有图片则显示图片):无门槛50元优惠券 | 单品最高减2000元"
)
private
String
title
;
/**
* 副标题
*/
@ApiModelProperty
(
value
=
"副标题"
)
private
String
subtitle
;
/**
* 图片
*/
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/vo/popularize/FinishUserVO.java
0 → 100644
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
activity
.
vo
.
popularize
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
@Data
public
class
FinishUserVO
extends
UserVO
{
/**
* 头像
*/
@ApiModelProperty
(
value
=
"手机号"
)
private
String
phone
;
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityPopularizeBiz.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.xxfc.platform.activity.entity.ActivityPopularizeLog
;
import
com.xxfc.platform.activity.entity.ActivityPopularizeRelation
;
import
com.xxfc.platform.activity.entity.ActivityPopularizeUser
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.entity.ActivityPopularize
;
import
com.xxfc.platform.activity.mapper.ActivityPopularizeMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
/**
* 推广活动(邀请有礼)
*
...
...
@@ -15,4 +25,80 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
*/
@Service
public
class
ActivityPopularizeBiz
extends
BaseBiz
<
ActivityPopularizeMapper
,
ActivityPopularize
>
{
@Autowired
ActivityPopularizeRelationBiz
relationBiz
;
@Autowired
ActivityPopularizeBiz
popularizeBiz
;
@Autowired
ActivityPopularizeUserBiz
popularizeUserBiz
;
@Autowired
ActivityPopularizeLogBiz
popularizeLogBiz
;
@Autowired
UserFeign
userFeign
;
public
static
final
String
POPULARIZE_0101
=
"0101"
;
public
void
handleRegister
(
RegisterQueueDTO
registerQueueDTO
)
{
String
activityCode
=
registerQueueDTO
.
getInParamDTO
().
getActivityCode
();
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
registerQueueDTO
.
getAppUserId
()).
getData
();
//获取活动code,并且注册来源是app 并且 是邀请注册
if
(
POPULARIZE_0101
.
equals
(
registerQueueDTO
.
getInParamDTO
().
getActivityCode
())
&&
RegisterQueueDTO
.
SIGN_LOGIN
.
equals
(
registerQueueDTO
.
getSign
()))
{
ActivityPopularize
activityPopularize
=
popularizeBiz
.
selectOne
(
new
ActivityPopularize
(){{
setCode
(
activityCode
);
}});
Integer
majorUserId
=
Integer
.
valueOf
(
appUserDTO
.
getInviterAccount
());
//添加活动关系
relationBiz
.
insertSelective
(
new
ActivityPopularizeRelation
(){{
setPopularizeId
(
activityPopularize
.
getId
());
setMajorUserId
(
majorUserId
);
setMinorUserId
(
appUserDTO
.
getUserid
());
}});
ActivityPopularizeLog
popularizeLog
=
popularizeLogBiz
.
selectOne
(
new
ActivityPopularizeLog
(){{
setUserId
(
majorUserId
);
setItemId
(
3
);
}});
//生成任务项
if
(
null
==
popularizeLog
){
popularizeLogBiz
.
insertSelectiveRe
(
new
ActivityPopularizeLog
(){{
setItemId
(
3
);
setUserId
(
majorUserId
);
setStatus
(
SYS_FALSE
);
setPopularizeId
(
activityPopularize
.
getId
());
}});
}
//查出majorUser参与活动信息
ActivityPopularizeUser
activityPopularizeUser
=
popularizeUserBiz
.
selectOne
(
new
ActivityPopularizeUser
(){{
setUserId
(
majorUserId
);
setPopularizeId
(
activityPopularize
.
getId
());
}});
//任务没有完成
if
(!
SYS_TRUE
.
equals
(
activityPopularizeUser
.
getStatus
()))
{
//检查是否满足奖励
if
(
relationBiz
.
selectList
(
new
ActivityPopularizeRelation
(){{
setMajorUserId
(
appUserDTO
.
getUserid
());
setPopularizeId
(
activityPopularize
.
getId
());
}}).
size
()
>=
10
)
{
activityPopularizeUser
.
setStatus
(
SYS_TRUE
);
popularizeUserBiz
.
updateSelectiveById
(
activityPopularizeUser
);
popularizeLog
.
setStatus
(
SYS_TRUE
);
popularizeLogBiz
.
updateSelectiveById
(
popularizeLog
);
}
}
}
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityUserJoinBiz.java
View file @
a4de09fa
...
...
@@ -2,6 +2,8 @@ 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.ActivityRule
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -53,11 +55,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
}
//领取优惠卷
public
void
receiveCoupn
(
Integer
userId
)
{
public
ObjectRestResponse
receiveCoupn
(
Integer
userId
)
{
ActivityRule
rule
=
ruleBiz
.
getActity
();
if
(
rule
==
null
)
{
log
.
error
(
"----没有开启的活动----"
);
return
;
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"没有开启的活动"
)
;
}
Integer
activityId
=
rule
.
getId
();
ActivityUserJoin
userJoin
=
new
ActivityUserJoin
();
...
...
@@ -66,11 +68,11 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
userJoin
=
selectOne
(
userJoin
);
if
(
userJoin
==
null
)
{
log
.
error
(
"----用户没有此参与活动----userId===="
+
userId
);
return
;
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"不是新用户,无法参与此活动"
)
;
}
if
(
userJoin
.
getStatus
()!=
0
){
log
.
error
(
"----用户已领取----userId===="
+
userId
);
return
;
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"用户已领取"
)
;
}
String
value
=
rule
.
getValue
();
JSONObject
json
=
JSONObject
.
parseObject
(
value
);
...
...
@@ -88,6 +90,7 @@ public class ActivityUserJoinBiz extends BaseBiz<ActivityUserJoinMapper,Activity
}
userJoin
.
setStatus
(
1
);
updateById
(
userJoin
);
return
ObjectRestResponse
.
succ
();
}
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/IntegralSignRecordBiz.java
View file @
a4de09fa
...
...
@@ -138,7 +138,7 @@ public class IntegralSignRecordBiz extends BaseBiz<IntegralSignRecordMapper, Int
IntegralUserRecordDto
integralUserRecord
=
new
IntegralUserRecordDto
();
integralUserRecord
.
setUserId
(
appUserDTO
.
getUserid
());
integralUserRecord
.
setType
(
0
);
integralUserRecord
.
setChannelId
(
integralSignRecords
.
get
(
0
).
getId
());
integralUserRecord
.
setChannelId
(
integralSignRecords
.
get
(
0
).
getId
()
.
toString
()
);
integralUserRecord
.
setIntegralRuleCode
(
integralRule
.
getCode
());
integralUserRecord
.
setPoint
(
point
);
integralUserRecordBiz
.
add
(
integralUserRecord
);
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
a4de09fa
...
...
@@ -18,6 +18,8 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import
tk.mybatis.mapper.entity.Example
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Comparator
;
import
java.util.List
;
/**
...
...
@@ -109,15 +111,33 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
}
//获取我的优惠卷
public
ObjectRestResponse
getCouponList
(
Integer
userId
,
int
type
){
public
ObjectRestResponse
getCouponList
(
Integer
userId
,
int
type
,
Integer
channel
,
BigDecimal
amout
){
if
(
userId
==
null
||
userId
==
0
){
log
.
error
(
"----参数不能为空"
);
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数不能为空"
);
}
Long
time
=
System
.
currentTimeMillis
();
return
ObjectRestResponse
.
succ
(
mapper
.
getUserCouponsByType
(
userId
,
type
,
time
));
List
<
UserCouponVo
>
list
=
mapper
.
getUserCouponsByType
(
userId
,
type
,
time
,
channel
);
if
(
amout
.
compareTo
(
new
BigDecimal
(
"0.00"
))>
0
&&
list
.
size
()>
0
){
for
(
UserCouponVo
couponVo:
list
){
Integer
status
=
2
;
if
(
couponVo
.
getChannel
()==
1
){
if
(
amout
.
compareTo
(
couponVo
.
getWithAmount
())>=
0
){
status
=
1
;
}
}
else
if
(
couponVo
.
getChannel
()==
3
){
status
=
1
;
}
couponVo
.
setStatus
(
status
);
}
}
list
.
sort
(
Comparator
.
comparing
(
UserCouponVo:
:
getStatus
));
return
ObjectRestResponse
.
succ
(
list
);
}
//获取单个优惠卷
public
UserCouponVo
getUserCoupon
(
String
tickerNo
){
if
(
StringUtils
.
isBlank
(
tickerNo
)){
...
...
@@ -130,19 +150,26 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
//支付后更新优惠卷状态
public
BigDecimal
useTickerNo
(
Integer
userId
,
String
TickerNo
,
String
orderNo
,
Integer
channel
,
BigDecimal
amout
,
Integer
type
){
BigDecimal
couponAmout
=
new
BigDecimal
(
"0.00"
);
if
(
couponAmout
.
compareTo
(
amout
)
>=
0
)
{
return
BigDecimal
.
ZERO
;
}
if
(
userId
==
null
||
userId
==
0
||
StringUtils
.
isBlank
(
TickerNo
)){
log
.
error
(
"----参数不能为空"
);
return
couponAmout
;
}
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"
T
ickerNo"
,
TickerNo
).
andEqualTo
(
"isDel"
,
0
);
example
.
createCriteria
().
andEqualTo
(
"
t
ickerNo"
,
TickerNo
).
andEqualTo
(
"isDel"
,
0
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()==
0
){
log
.
error
(
userId
+
"----
已领优惠卷"
);
log
.
error
(
userId
+
"----
没有可用优惠卷--TickerNo==="
+
TickerNo
);
return
couponAmout
;
}
UserCoupon
userCoupon
=
list
.
get
(
0
);
if
(
userCoupon
!=
null
&&
userCoupon
.
getIsUse
()==
1
){
log
.
error
(
userId
+
"----该优惠卷已使用--TickerNo=="
+
TickerNo
);
return
couponAmout
;
}
if
(
type
==
1
){
userCoupon
.
setIsUse
(
1
);
userCoupon
.
setOrderNo
(
orderNo
);
...
...
@@ -161,9 +188,13 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
Integer
type
=
coupon
.
getType
();
if
(
type
!=
null
)
{
BigDecimal
useAmout
=
coupon
.
getUsedAmount
();
if
(
amout
.
compareTo
(
useAmout
)
>
0
)
{
if
(
type
==
3
||
(
type
==
1
&&
(
amout
.
compareTo
(
coupon
.
getWithAmount
())
>=
0
)))
{
couponAmout
=
amout
.
subtract
(
useAmout
);
if
(
type
==
3
||
(
type
==
1
&&
(
amout
.
compareTo
(
coupon
.
getWithAmount
())
>=
0
)))
{
//couponAmout = amout.subtract(useAmout);
if
(
amout
.
compareTo
(
useAmout
)
>
0
)
{
couponAmout
=
useAmout
;
}
else
{
couponAmout
=
amout
;
}
}
}
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/config/RabbitActivityConfig.java
View file @
a4de09fa
...
...
@@ -3,15 +3,13 @@ package com.xxfc.platform.activity.config;
import
com.github.wxiaoqi.security.common.config.RabbitCommonConfig
;
import
com.github.wxiaoqi.security.common.config.rabbit.BindDTO
;
import
com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant
;
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
com.xxfc.platform.universal.constant.MQconstant
;
import
org.springframework.context.annotation.Configuration
;
import
java.util.ArrayList
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.*;
/**
* rabbitmq配置类
* 包含: 不知道什么orderWater队列
...
...
@@ -22,44 +20,20 @@ import java.util.ArrayList;
public
class
RabbitActivityConfig
extends
RabbitCommonConfig
{
public
static
final
String
INTEGRAL_QUEUE
=
"integral_queue"
;
public
static
final
String
POPULARZIE_0101_QUEUE
=
"popularzie.0101.queue"
;
//新人注册有礼
public
static
final
String
ACTIVITY_NEW_QUEUE
=
"activity.new.queue"
;
public
static
final
String
INTEGRAL_HANDLE_QUEUE
=
"integral_handle_queue"
;
static
{
myQueue
=
new
ArrayList
<
BindDTO
>(){{
add
(
new
BindDTO
(
INTEGRAL_QUEUE
,
RabbitConstant
.
ADMIN_TOPIC
,
"order.#"
));
add
(
new
BindDTO
(
INTEGRAL_QUEUE
,
ORDER_TOPIC
,
"order.#"
));
add
(
new
BindDTO
(
POPULARZIE_0101_QUEUE
,
ADMIN_TOPIC
,
KEY_APPUSER_REGISTER
));
add
(
new
BindDTO
(
POPULARZIE_0101_QUEUE
,
ADMIN_TOPIC
,
KEY_APPUSER_AUTH
));
add
(
new
BindDTO
(
ACTIVITY_NEW_QUEUE
,
ADMIN_TOPIC
,
KEY_APPUSER_REGISTER
));
add
(
new
BindDTO
(
ACTIVITY_NEW_QUEUE
,
ADMIN_TOPIC
,
KEY_APPUSER_AUTH
));
add
(
new
BindDTO
(
INTEGRAL_HANDLE_QUEUE
,
MQconstant
.
INTEGRAL_EXCHANGE
,
MQconstant
.
INTEGRAL_ROUTING_KEY
));
}};
}
// public static final String BASE_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(BASE_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/config/RabbitIntegralConfig.java
deleted
100644 → 0
View file @
c3d9f31c
package
com
.
xxfc
.
platform
.
activity
.
config
;
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
RabbitIntegralConfig
{
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/handler/IntegralMQHandler.java
View file @
a4de09fa
...
...
@@ -4,6 +4,7 @@ package com.xxfc.platform.activity.handler;
import
com.alibaba.fastjson.JSONObject
;
import
com.rabbitmq.client.Channel
;
import
com.xxfc.platform.activity.biz.IntegralUserRecordBiz
;
import
com.xxfc.platform.activity.config.RabbitActivityConfig
;
import
com.xxfc.platform.activity.vo.IntegralUserRecordDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
...
...
@@ -26,7 +27,7 @@ public class IntegralMQHandler {
@Autowired
IntegralUserRecordBiz
integralUserRecordBiz
;
@RabbitListener
(
queues
=
"integral_queue"
)
@RabbitListener
(
queues
=
{
RabbitActivityConfig
.
INTEGRAL_HANDLE_QUEUE
}
)
public
void
integralHandler
(
Message
message
,
@Headers
Map
<
String
,
Object
>
headers
,
Channel
channel
)
{
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
executorService
.
execute
(
new
Runnable
()
{
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/handler/PopularizeMQHandler.java
0 → 100644
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
activity
.
handler
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO
;
import
com.rabbitmq.client.Channel
;
import
com.xxfc.platform.activity.biz.ActivityPopularizeBiz
;
import
com.xxfc.platform.activity.biz.ActivityUserJoinBiz
;
import
com.xxfc.platform.activity.biz.IntegralUserRecordBiz
;
import
com.xxfc.platform.activity.config.RabbitActivityConfig
;
import
com.xxfc.platform.activity.entity.ActivityPopularize
;
import
com.xxfc.platform.activity.vo.IntegralUserRecordDto
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.rabbit.annotation.RabbitListener
;
import
org.springframework.amqp.support.AmqpHeaders
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.messaging.handler.annotation.Headers
;
import
org.springframework.stereotype.Component
;
import
java.io.IOException
;
import
java.util.Map
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
@Component
@Slf4j
public
class
PopularizeMQHandler
{
@Autowired
ActivityPopularizeBiz
activityPopularizeBiz
;
@Autowired
ActivityUserJoinBiz
activityUserJoinBiz
;
//@RabbitListener(queues = {RabbitActivityConfig.POPULARZIE_REGISTER_QUEUE,RabbitActivityConfig.POPULARZIE_AUTH_QUEUE})
@RabbitListener
(
queues
=
{
RabbitActivityConfig
.
POPULARZIE_0101_QUEUE
})
public
void
popularizeHandler
(
Message
message
,
@Headers
Map
<
String
,
Object
>
headers
,
Channel
channel
)
{
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
executorService
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
String
messageId
=
message
.
getMessageProperties
().
getMessageId
();
String
msg
=
new
String
(
message
.
getBody
(),
"UTF-8"
);
log
.
info
(
"接收到的消息:msg = {}, 消息ID是:messageId = {} "
,
msg
,
messageId
);
if
(
StringUtils
.
isNotBlank
(
msg
))
{
RegisterQueueDTO
registerQueueDTO
=
JSONObject
.
parseObject
(
msg
,
RegisterQueueDTO
.
class
);
activityPopularizeBiz
.
handleRegister
(
registerQueueDTO
);
}
executorService
.
shutdown
();
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
// 手动签收
channel
.
basicAck
(
deliveryTag
,
false
);
}
catch
(
Exception
e
)
{
log
.
info
(
"接收到的消息失败"
);
try
{
channel
.
basicNack
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
,
false
);
}
catch
(
IOException
i
)
{
i
.
printStackTrace
();
}
e
.
printStackTrace
();
}
}
});
}
//新人注册有礼
@RabbitListener
(
queues
=
{
RabbitActivityConfig
.
ACTIVITY_NEW_QUEUE
})
public
void
activityNewHandler
(
Message
message
,
@Headers
Map
<
String
,
Object
>
headers
,
Channel
channel
)
{
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
executorService
.
execute
(
new
Runnable
()
{
@Override
public
void
run
()
{
try
{
String
messageId
=
message
.
getMessageProperties
().
getMessageId
();
String
msg
=
new
String
(
message
.
getBody
(),
"UTF-8"
);
log
.
info
(
"接收到的消息:msg = {}, 消息ID是:messageId = {} "
,
msg
,
messageId
);
if
(
StringUtils
.
isNotBlank
(
msg
))
{
RegisterQueueDTO
registerQueueDTO
=
JSONObject
.
parseObject
(
msg
,
RegisterQueueDTO
.
class
);
if
(
registerQueueDTO
!=
null
&&(
registerQueueDTO
.
getSign
()==
RegisterQueueDTO
.
SIGN_NEW
||
registerQueueDTO
.
getSign
()==
RegisterQueueDTO
.
SIGN_ACTIVATE
)){
activityUserJoinBiz
.
joinActivity
(
registerQueueDTO
.
getAppUserId
());
}
}
executorService
.
shutdown
();
Long
deliveryTag
=
(
Long
)
headers
.
get
(
AmqpHeaders
.
DELIVERY_TAG
);
// 手动签收
channel
.
basicAck
(
deliveryTag
,
false
);
}
catch
(
Exception
e
)
{
log
.
info
(
"接收到的消息失败"
);
try
{
channel
.
basicNack
(
message
.
getMessageProperties
().
getDeliveryTag
(),
false
,
false
);
}
catch
(
IOException
i
)
{
i
.
printStackTrace
();
}
e
.
printStackTrace
();
}
}
});
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/UserCouponMapper.java
View file @
a4de09fa
...
...
@@ -17,7 +17,7 @@ import java.util.List;
public
interface
UserCouponMapper
extends
Mapper
<
UserCoupon
>
{
//我的优惠卷
public
List
<
UserCouponVo
>
getUserCouponsByType
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"type"
)
int
type
,
@Param
(
"time"
)
Long
time
);
public
List
<
UserCouponVo
>
getUserCouponsByType
(
@Param
(
"userId"
)
Integer
userId
,
@Param
(
"type"
)
int
type
,
@Param
(
"time"
)
Long
time
,
@Param
(
"channel"
)
Integer
channel
);
//单个优惠卷
public
UserCouponVo
getUserCoupon
(
@Param
(
"tickerNo"
)
String
tickerNo
);
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/ActivityPopularizeController.java
View file @
a4de09fa
...
...
@@ -11,14 +11,18 @@ import com.github.wxiaoqi.security.common.msg.ObjectRestResponse;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.util.XxBizAssert
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.activity.biz.*
;
import
com.xxfc.platform.activity.dto.ItemAddDTO
;
import
com.xxfc.platform.activity.entity.*
;
import
com.xxfc.platform.activity.vo.popularize.FinishUserVO
;
import
com.xxfc.platform.activity.vo.popularize.ItemVO
;
import
com.xxfc.platform.activity.vo.popularize.PopularizeVO
;
import
com.xxfc.platform.activity.vo.popularize.UserVO
;
import
io.swagger.annotations.Api
;
import
io.swagger.annotations.ApiOperation
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
tk.mybatis.mapper.entity.Example
;
...
...
@@ -35,6 +39,7 @@ import static com.github.wxiaoqi.security.common.constant.CommonConstants.*;
@RestController
@RequestMapping
(
"activityPopularize"
)
@Api
(
value
=
"推广活动"
,
tags
=
"推广活动"
)
@Slf4j
public
class
ActivityPopularizeController
extends
BaseController
<
ActivityPopularizeBiz
,
ActivityPopularize
>
implements
UserRestInterface
{
@Autowired
...
...
@@ -72,10 +77,6 @@ public class ActivityPopularizeController extends BaseController<ActivityPopular
setType
(
type
);
}}).
stream
().
map
(
v
->
{
PopularizeVO
vo
=
BeanUtil
.
toBean
(
v
,
PopularizeVO
.
class
);
vo
.
setUserVOs
(
new
ArrayList
<
UserVO
>(){{
add
(
new
UserVO
(){{
setNickname
(
"小A"
);
setHeadimgurl
(
"https://xxtest.upyuns.com/image/app/default_%20avatar.png"
);}});
add
(
new
UserVO
(){{
setNickname
(
"小B"
);
setHeadimgurl
(
"https://xxtest.upyuns.com/image/app/default_%20avatar.png"
);}});
}});
ActivityPopularizeUser
[]
apu
=
new
ActivityPopularizeUser
[
1
];
Map
<
Integer
,
ActivityPopularizeLog
>[]
aplMap
=
new
HashMap
[
1
];
if
(
null
!=
appUserDTO
)
{
...
...
@@ -182,15 +183,27 @@ public class ActivityPopularizeController extends BaseController<ActivityPopular
@RequestMapping
(
value
=
"/app/unauth/relation-list"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
@ApiOperation
(
value
=
"查询该活动
邀请的好友
"
)
@ApiOperation
(
value
=
"查询该活动
参与成功的人
"
)
@IgnoreClientToken
@IgnoreUserToken
public
ObjectRestResponse
<
PopularizeVO
>
relationList
(
String
code
)
{
checkAppUser
();
// ActivityPopularize activityPopularize = popularizeBiz.selectOne(new ActivityPopularize(){{
// setCode(code);
// }});
// activityPopularize.get
return
ObjectRestResponse
.
succ
();
public
ObjectRestResponse
<
List
<
FinishUserVO
>>
relationList
(
String
code
)
{
ActivityPopularize
activityPopularize
=
popularizeBiz
.
selectOne
(
new
ActivityPopularize
(){{
setCode
(
code
);
}});
PageDataVO
<
ActivityPopularizeUser
>
pageDataVO
=
PageDataVO
.
pageInfo
(
1
,
20
,
()
->
popularizeUserBiz
.
selectByExample
(
new
Example
.
Builder
(
ActivityPopularizeUser
.
class
)
.
where
(
WeekendSqls
.<
ActivityPopularizeUser
>
custom
()
.
andEqualTo
(
ActivityPopularizeUser:
:
getPopularizeId
,
activityPopularize
.
getId
())
.
andEqualTo
(
ActivityPopularizeUser:
:
getStatus
,
SYS_TRUE
))
.
orderByDesc
(
"updTime"
).
build
()));
return
ObjectRestResponse
.
succ
(
pageDataVO
.
getData
().
stream
().
map
(
value
->
{
AppUserDTO
appUserDTO
=
userFeign
.
userDetailById
(
value
.
getUserId
()).
getData
();
FinishUserVO
finishUserVO
=
BeanUtil
.
toBean
(
appUserDTO
,
FinishUserVO
.
class
);
log
.
error
(
StringUtils
.
overlay
(
appUserDTO
.
getUsername
(),
"*****"
,
3
,
8
));
finishUserVO
.
setPhone
(
StringUtils
.
overlay
(
appUserDTO
.
getUsername
(),
"*****"
,
3
,
8
));
return
finishUserVO
;
}).
collect
(
Collectors
.
toList
()));
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/UserCouponController.java
View file @
a4de09fa
...
...
@@ -27,15 +27,23 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
return
baseBiz
.
authledCoupon
(
userId
);
}
/**
*
* @param type 0-未使用;1-已使用;3-已过期
* @param channel 1-租车;2-旅游;null-全部
* @return
*/
@ApiOperation
(
"我的优惠卷"
)
@RequestMapping
(
value
=
"/list/{type}"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
list
(
@PathVariable
Integer
type
)
{
@RequestMapping
(
value
=
"/coupon/list"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
list
(
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
value
=
"channel"
,
required
=
false
)
Integer
channel
,
@RequestParam
(
value
=
"amount"
,
defaultValue
=
"0.00"
)
BigDecimal
amount
)
{
AppUserDTO
userInfo
=
getUserInfo
();
Integer
userId
=
userInfo
.
getUserid
();
if
(
userId
==
null
){
return
ObjectRestResponse
.
createDefaultFail
();
}
return
baseBiz
.
getCouponList
(
userId
,
type
);
return
baseBiz
.
getCouponList
(
userId
,
type
,
channel
,
amount
);
}
@ApiOperation
(
"单个优惠卷信息"
)
...
...
@@ -49,13 +57,13 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
@RequestMapping
(
value
=
"/use"
,
method
=
RequestMethod
.
POST
)
public
BigDecimal
use
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
,
@RequestParam
(
value
=
"
TickerNo"
,
defaultValue
=
""
)
String
T
ickerNo
,
@RequestParam
(
value
=
"
tickerNo"
,
defaultValue
=
""
)
String
t
ickerNo
,
@RequestParam
(
value
=
"orderNo"
,
defaultValue
=
""
)
String
orderNo
,
@RequestParam
(
value
=
"channel"
,
defaultValue
=
"1"
)
Integer
channel
,
@RequestParam
(
value
=
"amou
t"
,
defaultValue
=
"0.00"
)
BigDecimal
amou
t
,
@RequestParam
(
value
=
"amou
nt"
,
defaultValue
=
"0.00"
)
BigDecimal
amoun
t
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"1"
)
Integer
type
)
{
return
baseBiz
.
useTickerNo
(
userId
,
TickerNo
,
orderNo
,
channel
,
amou
t
,
type
);
return
baseBiz
.
useTickerNo
(
userId
,
tickerNo
,
orderNo
,
channel
,
amoun
t
,
type
);
}
@ApiOperation
(
"优惠卷取消使用"
)
...
...
@@ -74,10 +82,11 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
if
(
userId
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
joinBiz
.
receiveCoupn
(
userId
);
return
ObjectRestResponse
.
succ
();
return
joinBiz
.
receiveCoupn
(
userId
);
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/IntegralUserRecordMapper.xml
View file @
a4de09fa
...
...
@@ -9,7 +9,7 @@
<result
column=
"user_id"
property=
"userId"
jdbcType=
"INTEGER"
/>
<result
column=
"type"
property=
"type"
jdbcType=
"INTEGER"
/>
<result
column=
"point"
property=
"point"
jdbcType=
"INTEGER"
/>
<result
column=
"integral_rule_code"
property=
"integralRuleCode"
jdbcType=
"
INTEGE
R"
/>
<result
column=
"integral_rule_code"
property=
"integralRuleCode"
jdbcType=
"
VARCHA
R"
/>
<result
column=
"crt_time"
property=
"crtTime"
jdbcType=
"BIGINT"
/>
<result
column=
"is_valid"
property=
"isValid"
jdbcType=
"BIT"
/>
<result
column=
"isdel"
property=
"isdel"
jdbcType=
"BIT"
/>
...
...
xx-activity/xx-activity-server/src/main/resources/mapper/UserCouponMapper.xml
View file @
a4de09fa
...
...
@@ -15,6 +15,7 @@
<result
property=
"expireTime"
column=
"expire_time"
/>
<result
property=
"useTime"
column=
"use_time"
/>
<result
property=
"title"
column=
"title"
/>
<result
property=
"subtitle"
column=
"subtitle"
/>
<result
property=
"icon"
column=
"icon"
/>
<result
property=
"used"
column=
"used"
/>
<result
property=
"channel"
column=
"channel"
/>
...
...
@@ -46,6 +47,9 @@
<if
test=
"type==2"
>
and u.is_use=0 and u.expire_time
<
#{time}
</if>
<if
test=
"channel!=null and channel!=''"
>
and (c.channel=#{channel} or c.channel=0 )
</if>
<choose>
<when
test=
"type==1"
>
ORDER BY u.use_time DESC
...
...
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/biz/BannerBiz.java
View file @
a4de09fa
...
...
@@ -38,7 +38,7 @@ public class BannerBiz extends BaseBiz<BannerMapper,Banner> {
banners
.
forEach
(
banner
->
{
BannerVo
bannerVo
=
new
BannerVo
();
bannerVo
.
setCover
(
banner
.
getCover
());
banner
.
setUrl
(
banner
.
getUrl
());
banner
Vo
.
setUrl
(
banner
.
getUrl
());
bannerVos
.
add
(
bannerVo
);
});
return
bannerVos
;
...
...
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/biz/CofigBiz.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
app
.
biz
;
import
com.alibaba.fastjson.JSON
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.util.EntityUtils
;
import
com.github.wxiaoqi.security.common.util.Query
;
import
com.github.wxiaoqi.security.common.vo.PageDataVO
;
import
com.xxfc.platform.app.entity.vo.WithDrawRuleVo
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.springframework.stereotype.Service
;
...
...
@@ -12,6 +15,7 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
import
java.util.Map
;
/**
* 系统配置表
...
...
@@ -35,7 +39,7 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
*/
public
int
updateConfig
(
Cofig
cofig
)
{
EntityUtils
.
setUpdatedInfo
(
cofig
);
return
mapper
.
update
Config
(
cofig
);
return
mapper
.
update
ByPrimaryKeySelective
(
cofig
);
}
public
WithDrawRuleVo
getWithDrawRule
(){
...
...
@@ -52,4 +56,22 @@ public class CofigBiz extends BaseBiz<CofigMapper,Cofig> {
withDrawRuleVo
.
setDescription
(
cofig
.
getValue
());
return
withDrawRuleVo
;
}
public
void
updateConfigStatus
(
int
id
)
{
Cofig
cofig
=
new
Cofig
();
cofig
.
setId
(
id
);
cofig
.
setIsDel
(
1
);
mapper
.
updateByPrimaryKeySelective
(
cofig
);
}
public
TableResultResponse
<
Cofig
>
listWithPage
(
Map
<
String
,
Object
>
params
)
{
Query
query
=
new
Query
(
params
);
Example
example
=
new
Example
(
Cofig
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"isDel"
,
0
);
PageDataVO
<
Cofig
>
cofigPage
=
PageDataVO
.
pageInfo
(
query
.
getPage
(),
query
.
getLimit
(),
()
->
mapper
.
selectByExample
(
example
));
return
new
TableResultResponse
<>(
cofigPage
.
getTotalCount
(),
cofigPage
.
getData
())
;
}
}
\ No newline at end of file
xx-app/xx-app-server/src/main/java/com/xxfc/platform/app/rest/admin/CofigAdminController.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
app
.
rest
.
admin
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.TableResultResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.app.biz.CofigBiz
;
import
com.xxfc.platform.app.entity.Cofig
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.Map
;
/**
* @author libin
* @version 1.0
...
...
@@ -20,6 +23,11 @@ import org.springframework.web.bind.annotation.RestController;
public
class
CofigAdminController
extends
BaseController
<
CofigBiz
,
Cofig
>
{
@Override
public
TableResultResponse
<
Cofig
>
list
(
@RequestParam
Map
<
String
,
Object
>
params
)
{
return
getBaseBiz
().
listWithPage
(
params
);
}
/**
* 修改通用配置
* @param cofig
...
...
@@ -33,4 +41,11 @@ public class CofigAdminController extends BaseController<CofigBiz,Cofig> {
}
return
ObjectRestResponse
.
createDefaultFail
();
}
@Override
public
ObjectRestResponse
<
Cofig
>
remove
(
@PathVariable
int
id
)
{
getBaseBiz
().
updateConfigStatus
(
id
);
return
ObjectRestResponse
.
succ
();
}
}
\ No newline at end of file
xx-im/xx-im-api/pom.xml
View file @
a4de09fa
...
...
@@ -23,7 +23,12 @@
<artifactId>
ace-auth-client
</artifactId>
<version>
2.0-SNAPSHOT
</version>
</dependency>
<dependency>
<groupId>
com.xxfc.platform
</groupId>
<artifactId>
xx-universal-api
</artifactId>
<version>
2.0-SNAPSHOT
</version>
<scope>
compile
</scope>
</dependency>
<!-- 自己项目 -->
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/ImCommentBiz.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
...
...
@@ -8,6 +9,8 @@ import com.xxfc.platform.im.dto.UpdateTypeEnum;
import
com.xxfc.platform.im.entity.ImComment
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.mapper.ImCommentMapper
;
import
com.xxfc.platform.universal.constant.MQconstant
;
import
com.xxfc.platform.universal.feign.MQSenderFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -20,7 +23,8 @@ public class ImCommentBiz extends BaseBiz<ImCommentMapper, ImComment> {
ImQuestionBiz
imQuestionBiz
;
@Autowired
UserBiz
userBiz
;
@Autowired
MQSenderFeign
mqSenderFeign
;
/**
* 添加评论
*
...
...
@@ -43,8 +47,15 @@ public class ImCommentBiz extends BaseBiz<ImCommentMapper, ImComment> {
return
ObjectRestResponse
.
createDefaultFail
();
}
insertSelective
(
imComment
);
ImQuestion
newValue
=
imQuestionBiz
.
selectById
(
imComment
.
getQuestionId
());
//修改评论数
imQuestionBiz
.
update
(
imComment
.
getQuestionId
(),
MsgTypeEnum
.
comment
,
UpdateTypeEnum
.
add
);
//评论添加积分
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"userId"
,
appUserDTO
.
getUserid
());
jsonObject
.
put
(
"channelId"
,
newValue
.
getId
());
jsonObject
.
put
(
"integralRuleCode"
,
"COMMENTPUBLISH"
);
mqSenderFeign
.
sendMessage
(
MQconstant
.
INTEGRAL_EXCHANGE
,
MQconstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
return
ObjectRestResponse
.
succ
();
}
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/ImQuestionBiz.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
im
.
biz
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
...
...
@@ -10,6 +11,8 @@ import com.xxfc.platform.im.dto.QuestionParamDto;
import
com.xxfc.platform.im.dto.UpdateTypeEnum
;
import
com.xxfc.platform.im.entity.ImQuestion
;
import
com.xxfc.platform.im.mapper.ImQuestionMapper
;
import
com.xxfc.platform.universal.constant.MQconstant
;
import
com.xxfc.platform.universal.feign.MQSenderFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
...
...
@@ -22,6 +25,9 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
@Autowired
UserBiz
userBiz
;
@Autowired
MQSenderFeign
mqSenderFeign
;
/**
* 获取列表
*
...
...
@@ -58,7 +64,13 @@ public class ImQuestionBiz extends BaseBiz<ImQuestionMapper, ImQuestion> {
if
(
imQuestion
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
insertSelective
(
imQuestion
);
insertSelective
(
imQuestion
);
ImQuestion
newValue
=
mapper
.
selectOne
(
imQuestion
);
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"userId"
,
appUserDTO
.
getUserid
());
jsonObject
.
put
(
"channelId"
,
newValue
.
getId
());
jsonObject
.
put
(
"integralRuleCode"
,
"PUBLISH"
);
mqSenderFeign
.
sendMessage
(
MQconstant
.
INTEGRAL_EXCHANGE
,
MQconstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
return
ObjectRestResponse
.
succ
();
}
...
...
xx-im/xx-im-server/src/main/java/com/xxfc/platform/im/biz/MsgBiz.java
View file @
a4de09fa
...
...
@@ -45,7 +45,10 @@ public class MsgBiz {
public
ObjectRestResponse
getMsgList
(
Integer
page
,
Integer
limit
,
Integer
type
)
throws
Exception
{
//获取所有朋友圈
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
Integer
userId
=
null
;
if
(
appUserDTO
!=
null
)
{
userId
=
appUserDTO
.
getImUserid
();
}
log
.
info
(
"获取消息列表: page = {}, limit = {}, type = {}"
,
page
,
limit
,
type
);
page
=
page
==
null
?
1
:
page
;
limit
=
limit
==
null
?
10
:
limit
;
...
...
@@ -54,12 +57,7 @@ public class MsgBiz {
List
<
Msg
>
msgList
=
null
;
if
(
type
!=
null
)
{
query
=
new
Query
(
Criteria
.
where
(
"body.type"
).
is
(
type
));
if
(
appUserDTO
!=
null
)
{
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
appUserDTO
.
getImUserid
());
PageInfo
<
MsgVo
>
goodPageInfo
=
new
PageInfo
<>(
replaceMsgResult
(
msgList
));
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
msgList
=
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
);
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
userId
);
PageInfo
<
MsgVo
>
goodPageInfo
=
new
PageInfo
<>(
replaceMsgResult
(
msgList
));
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
else
{
...
...
@@ -67,8 +65,7 @@ public class MsgBiz {
ids
.
add
(
2
);
ids
.
add
(
4
);
query
=
new
Query
(
Criteria
.
where
(
"body.type"
).
in
(
ids
));
List
<
Msg
>
list
=
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
);
msgList
=
fetchAndAttach
(
list
,
appUserDTO
.
getImUserid
());
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
userId
);
PageInfo
<
MsgVo
>
goodPageInfo
=
new
PageInfo
<>(
replaceMsgResult
(
msgList
));
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
...
...
@@ -93,21 +90,15 @@ public class MsgBiz {
public
ObjectRestResponse
get
(
String
id
){
//获取所有朋友圈
AppUserDTO
appUserDTO
=
userBiz
.
getUserInfo
();
if
(
appUserDTO
==
null
)
{
appUserDTO
=
new
AppUserDTO
();
Integer
userId
=
null
;
if
(
appUserDTO
!=
null
)
{
userId
=
appUserDTO
.
getImUserid
();
}
if
(
id
==
null
)
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
List
<
Msg
>
msgList
=
null
;
Query
query
=
new
Query
(
Criteria
.
where
(
"id"
).
is
(
new
ObjectId
(
id
)));
if
(
appUserDTO
!=
null
)
{
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
appUserDTO
.
getImUserid
());
PageInfo
<
MsgVo
>
goodPageInfo
=
new
PageInfo
<>(
replaceMsgResult
(
msgList
));
return
ObjectRestResponse
.
succ
(
goodPageInfo
);
}
msgList
=
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
);
List
<
Msg
>
msgList
=
fetchAndAttach
(
mongoTemplate
.
find
(
query
,
Msg
.
class
,
"s_msg"
),
userId
);
List
<
MsgVo
>
msgVoList
=
replaceMsgResult
(
msgList
);
if
(
msgVoList
.
size
()
>
0
)
{
return
ObjectRestResponse
.
succ
(
msgVoList
.
get
(
0
));
...
...
@@ -132,9 +123,13 @@ public class MsgBiz {
//添加点赞
List
<
Praise
>
praise
=
mongoTemplate
.
find
(
query
,
Praise
.
class
,
"s_praise"
);
msg
.
setPraises
(
replacePraiseResult
(
praise
));
msg
.
setIsPraise
(
this
.
exists
(
userId
,
msg
.
getId
())
?
1
:
0
);
msg
.
setIsCollect
(
this
.
existsCollect
(
userId
,
msg
.
getId
())
?
1
:
0
);
if
(
userId
!=
null
)
{
msg
.
setIsPraise
(
this
.
exists
(
userId
,
msg
.
getId
())
?
1
:
0
);
msg
.
setIsCollect
(
this
.
existsCollect
(
userId
,
msg
.
getId
())
?
1
:
0
);
}
else
{
msg
.
setIsPraise
(
0
);
msg
.
setIsCollect
(
0
);
}
}
return
list
;
}
...
...
xx-im/xx-im-server/src/main/resources/bootstrap.yml
View file @
a4de09fa
...
...
@@ -24,7 +24,8 @@ spring:
nacos
:
config
:
server-addr
:
127.0.0.1:8848
#共用配置,暂定一个
shared-dataids
:
common-dev.yaml,mongodb-log-dev.yaml
---
spring
:
profiles
:
pro
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/BaseOrder.java
View file @
a4de09fa
...
...
@@ -59,12 +59,12 @@ public class BaseOrder implements Serializable {
@Column
(
name
=
"status"
)
@ApiModelProperty
(
value
=
"订单状态"
+
"0--删除"
+
"1--创建订单"
+
"2--取消"
+
"3--待付款"
+
"4--待出行"
+
"5--出行中(进行中)"
+
"0--删除"
+
"1--创建订单"
+
"2--取消"
+
"3--待付款"
+
"4--待出行"
+
"5--出行中(进行中)"
+
"6--已完成"
)
private
Integer
status
;
...
...
@@ -228,4 +228,11 @@ public class BaseOrder implements Serializable {
@ApiModelProperty
(
value
=
"支付来源 1--app;2--小程序"
)
@Column
(
name
=
"pay_origin"
)
private
Integer
payOrigin
;
/**
* 优惠券优惠的价格
*/
@ApiModelProperty
(
value
=
"优惠券优惠的价格"
)
@Column
(
name
=
"coupon_amount"
)
private
BigDecimal
couponAmount
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/AddRentVehicleDTO.java
View file @
a4de09fa
...
...
@@ -94,6 +94,12 @@ public class AddRentVehicleDTO extends AddOrderCommonDTO{
@ApiModelProperty
(
value
=
"是否使用出租免费天数"
)
private
Integer
rentFreeDay
;
/**
* 优惠券*
*/
@ApiModelProperty
(
value
=
"优惠卷卷号"
)
private
String
tickerNos
;
public
void
setStartTime
(
Long
startTime
)
{
this
.
startTime
=
startTime
;
this
.
bookStartDate
=
DEFAULT_DATE_TIME_FORMATTER
.
format
(
LocalDateTime
.
ofInstant
(
Instant
.
ofEpochMilli
(
startTime
),
ZoneOffset
.
ofHours
(
8
)));
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/AddTourDTO.java
View file @
a4de09fa
...
...
@@ -70,8 +70,8 @@ public class AddTourDTO extends AddOrderCommonDTO{
Integer
hasInsure
;
/**
* 优惠券
ids
* 优惠券
*
*/
@ApiModelProperty
(
value
=
"优惠
券ids
"
)
private
String
couponId
s
;
@ApiModelProperty
(
value
=
"优惠
卷卷号
"
)
private
String
tickerNo
s
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/mq/OrderMQDTO.java
0 → 100644
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
order
.
pojo
.
mq
;
import
lombok.Data
;
@Data
public
class
OrderMQDTO
{
public
static
final
Integer
ORDER_CRT
=
1
;
public
static
final
Integer
ORDER_CANCEL
=
2
;
public
static
final
Integer
ORDER_PAY
=
4
;
public
static
final
Integer
ORDER_FINISH
=
6
;
Integer
orderId
;
/**
* 标记是什么操作
* 0--删除"
* 1--创建订单"
* 2--取消"
*
* 4--已支付"
*
* 6--已完成
*/
Integer
sign
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/order/MemberBO.java
View file @
a4de09fa
...
...
@@ -22,8 +22,9 @@ public class MemberBO extends OrderMemberDetail implements OrderDetail {
* 下单来源,1--app;2--小程序
*/
private
Integer
orderOrigin
;
/**
* 优惠券*
*/
private
List
<
Coupon
>
coupons
;
private
List
<
String
>
tickerNo
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/order/RentVehicleBO.java
View file @
a4de09fa
...
...
@@ -31,5 +31,5 @@ public class RentVehicleBO extends OrderRentVehicleDetail implements OrderDetail
/**
* 优惠券*
*/
private
List
<
Coupon
>
coupons
;
private
List
<
String
>
tickerNo
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/order/TourBO.java
View file @
a4de09fa
...
...
@@ -28,5 +28,5 @@ public class TourBO extends OrderTourDetail implements OrderDetail {
/**
* 优惠券*
*/
private
List
<
Coupon
>
coupons
;
private
List
<
String
>
tickerNo
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/price/RentVehiclePriceVO.java
View file @
a4de09fa
...
...
@@ -33,4 +33,6 @@ public class RentVehiclePriceVO extends OrderPriceVO{
BigDecimal
damageSafePrice
;
@ApiModelProperty
(
value
=
"费用详情"
)
private
String
costDetail
;
@ApiModelProperty
(
value
=
"优惠券扣除的费用"
)
private
BigDecimal
couponAmount
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/price/TourPriceVO.java
View file @
a4de09fa
...
...
@@ -53,4 +53,8 @@ public class TourPriceVO extends OrderPriceVO{
//总人数
@ApiModelProperty
(
value
=
"总人数"
)
private
Integer
totalNumber
;
//优惠券
@ApiModelProperty
(
value
=
"优惠券扣除的费用"
)
private
BigDecimal
couponAmount
;
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
order
.
biz
;
import
cn.hutool.core.util.StrUtil
;
import
cn.hutool.json.JSONUtil
;
import
com.github.wxiaoqi.security.admin.dto.RegisterParamDTO
;
import
com.github.wxiaoqi.security.admin.dto.RegisterQueueDTO
;
import
com.github.wxiaoqi.security.admin.dto.UserMemberDTO
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.config.rabbit.RabbitConstant
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.IntervalUtil
;
...
...
@@ -17,6 +21,7 @@ import com.xxfc.platform.order.contant.enumerate.RefundStatusEnum;
import
com.xxfc.platform.order.contant.enumerate.RefundTypeEnum
;
import
com.xxfc.platform.order.entity.*
;
import
com.xxfc.platform.order.mapper.BaseOrderMapper
;
import
com.xxfc.platform.order.pojo.mq.OrderMQDTO
;
import
com.xxfc.platform.order.pojo.order.OrderListVo
;
import
com.xxfc.platform.order.pojo.order.OrderPageVO
;
import
com.xxfc.platform.order.pojo.order.OrderVehicleCrosstownDto
;
...
...
@@ -38,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
import
java.math.BigDecimal
;
import
java.util.*
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
config
.
rabbit
.
RabbitConstant
.
KEY_REGISTER_SUCCESS
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.*;
...
...
@@ -512,4 +518,16 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
return
zero
;
}
private
void
sendQueue
(
Integer
orderId
,
Integer
sign
)
{
try
{
OrderMQDTO
orderMQDTO
=
new
OrderMQDTO
(){{
setOrderId
(
orderId
);
setSign
(
sign
);
}};
//mqSenderFeign.sendMessage(RabbitConstant.ADMIN_TOPIC, KEY_REGISTER_SUCCESS, JSONUtil.toJsonStr(orderMQDTO));
}
catch
(
Exception
e
){
log
.
error
(
e
.
getMessage
(),
e
);
}
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRentVehicleController.java
View file @
a4de09fa
...
...
@@ -27,6 +27,8 @@ import org.springframework.web.bind.annotation.*;
import
springfox.documentation.annotations.ApiIgnore
;
import
javax.persistence.Column
;
import
java.util.Arrays
;
import
java.util.List
;
@Controller
@RequestMapping
(
"orderRentVehicle"
)
...
...
@@ -56,6 +58,7 @@ public class OrderRentVehicleController extends CommonBaseController {
setBookEndDate
(
vo
.
getBookEndDate
());
}});
bo
.
setAppUserDTO
(
userFeign
.
userDetailByToken
(
BaseContextHandler
.
getToken
()).
getData
());
bo
.
setTickerNo
(
StrUtil
.
isNotBlank
(
vo
.
getTickerNos
())?
Arrays
.
asList
(
vo
.
getTickerNos
().
split
(
","
)):
null
);
orderRentVehicleService
.
createOrder
(
bo
);
return
ObjectRestResponse
.
succ
(
bo
.
getOrder
());
}
...
...
@@ -79,6 +82,7 @@ public class OrderRentVehicleController extends CommonBaseController {
setHasMemberRight
(
vo
.
getHasMemberRight
());
}});
bo
.
setAppUserDTO
(
userFeign
.
userDetailByToken
(
BaseContextHandler
.
getToken
()).
getData
());
bo
.
setTickerNo
(
StrUtil
.
isNotBlank
(
vo
.
getTickerNos
())?
Arrays
.
asList
(
vo
.
getTickerNos
().
split
(
","
)):
null
);
orderRentVehicleService
.
initDetailSecond
(
bo
);
return
ObjectRestResponse
.
succ
(
orderRentVehicleService
.
calculatePrice
(
bo
));
}
...
...
@@ -117,5 +121,11 @@ public class OrderRentVehicleController extends CommonBaseController {
*/
@ApiModelProperty
(
value
=
"是否使用出租免费天数"
)
private
Integer
rentFreeDay
;
/**
* 优惠券*
*/
@ApiModelProperty
(
value
=
"优惠卷卷号"
)
private
String
tickerNos
;
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderTourController.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
order
.
rest
;
import
cn.hutool.core.bean.BeanUtil
;
import
cn.hutool.core.util.StrUtil
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.auth.client.annotation.IgnoreClientToken
;
...
...
@@ -28,6 +29,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import
org.springframework.web.bind.annotation.RequestMethod
;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
java.util.Arrays
;
@Controller
@RequestMapping
(
"orderTour"
)
@IgnoreClientToken
...
...
@@ -55,6 +58,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ApiOperation
(
value
=
"确认旅游订单"
)
public
ObjectRestResponse
<
BaseOrder
>
add
(
@RequestBody
AddTourDTO
vo
){
TourBO
bo
=
BeanUtil
.
toBean
(
vo
,
TourBO
.
class
);
bo
.
setTickerNo
(
StrUtil
.
isNotBlank
(
vo
.
getTickerNos
())?
Arrays
.
asList
(
vo
.
getTickerNos
().
split
(
","
)):
null
);
orderTourService
.
createOrder
(
bo
);
return
ObjectRestResponse
.
succ
(
bo
.
getOrder
());
}
...
...
@@ -70,6 +74,7 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
bo
.
setChildNum
(
vo
.
getChildNumber
());
TourGood
tourGood
=
tourFeign
.
usableGet
(
bo
.
getGoodId
()).
getData
();
bo
.
setTourGood
(
tourGood
);
bo
.
setTickerNo
(
StrUtil
.
isNotBlank
(
vo
.
getTickerNos
())?
Arrays
.
asList
(
vo
.
getTickerNos
().
split
(
","
)):
null
);
return
ObjectRestResponse
.
succ
(
orderTourService
.
calculatePrice
(
bo
));
}
...
...
@@ -96,5 +101,11 @@ public class OrderTourController extends BaseController<OrderTourDetailBiz,Order
@ApiModelProperty
(
value
=
"是否保险标记 1--要保险;0--不需要"
)
Integer
hasInsure
;
/**
* 优惠券*
*/
@ApiModelProperty
(
value
=
"优惠卷卷号"
)
private
String
tickerNos
;
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/AbstractOrderHandle.java
View file @
a4de09fa
...
...
@@ -38,6 +38,8 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
protected
OrderTypeEnum
orderTypeEnum
;
protected
Integer
channel
;
/**
* 创建基础订单
* @return
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderRentVehicleService.java
View file @
a4de09fa
...
...
@@ -11,6 +11,7 @@ import com.github.wxiaoqi.security.common.context.BaseContextHandler;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
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.feign.ActivityFeign
;
import
com.xxfc.platform.order.biz.OrderCostDetailBiz
;
import
com.xxfc.platform.order.biz.OrderRentVehicleBiz
;
...
...
@@ -77,6 +78,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@PostConstruct
public
void
init
(){
this
.
channel
=
Coupon
.
CHANNEL_RENT
;
this
.
orderTypeEnum
=
OrderTypeEnum
.
RENT_VEHICLE
;
}
...
...
@@ -139,6 +141,11 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
}
}
//如果有使用优惠券,则扣减
if
(
BigDecimal
.
ZERO
.
compareTo
(
bo
.
getOrder
().
getCouponAmount
())
<
0
)
{
activityFeign
.
use
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getTickerNo
().
get
(
0
),
bo
.
getOrder
().
getNo
(),
channel
,
bo
.
getOrder
().
getGoodsAmount
(),
ActivityFeign
.
TYPE_USE
);
}
super
.
handleDetail
(
bo
);
//发送定时取消订单(数据字典设置--5分钟)
...
...
@@ -154,12 +161,14 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@Override
public
RentVehiclePriceVO
calculatePrice
(
RentVehicleBO
detail
)
{
BigDecimal
realAmount
=
BigDecimal
.
ZERO
;
BigDecimal
orderAmount
=
BigDecimal
.
ZERO
;
BigDecimal
goodsAmount
=
BigDecimal
.
ZERO
;
BigDecimal
vehicleAmount
=
BigDecimal
.
ZERO
;
BigDecimal
driverAmount
=
BigDecimal
.
ZERO
;
BigDecimal
damageSafeAmount
=
BigDecimal
.
ZERO
;
BigDecimal
modelAmount
=
BigDecimal
.
ZERO
;
BigDecimal
couponAmount
=
BigDecimal
.
ZERO
;
Integer
vehicleDayNum
=
0
;
Integer
freeDayNum
=
0
;
...
...
@@ -214,10 +223,6 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
}
vehicleAmount
=
vehicleAmount
.
add
(
modelAmount
.
multiply
(
BigDecimal
.
valueOf
(
vehicleDayNum
)));
//优惠券处理
//待完成
// activityFeign.use(dto.getUserid());
//如果有使用会员权益或者优惠券,则设置订单已优惠
if
(
SYS_TRUE
.
equals
(
detail
.
getOrder
().
getHasMemberRight
()))
{
detail
.
getOrder
().
setHasDiscount
(
SYS_TRUE
);
...
...
@@ -235,8 +240,16 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//商品价格
goodsAmount
=
goodsAmount
.
add
(
vehicleAmount
).
add
(
driverAmount
).
add
(
damageSafeAmount
);
//优惠券处理
//待完成
if
(
null
!=
detail
.
getTickerNo
()
&&
detail
.
getTickerNo
().
size
()
>
0
)
{
couponAmount
=
activityFeign
.
use
(
dto
.
getUserid
(),
detail
.
getTickerNo
().
get
(
0
),
detail
.
getOrder
().
getNo
(),
channel
,
goodsAmount
,
ActivityFeign
.
TYPE_NO_USE
);
}
//总价格(包含押金)
orderAmount
=
orderAmount
.
add
(
goodsAmount
).
add
(
vehicleModel
.
getDeposit
());
realAmount
=
orderAmount
.
subtract
(
couponAmount
);
//生成订单明细
RentVehiclePriceVO
rvp
=
new
RentVehiclePriceVO
(){{
...
...
@@ -248,9 +261,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
setVehicleNum
(
1
);
setDriverNum
(
1
);
}};
rvp
.
setCouponAmount
(
couponAmount
);
rvp
.
setOrderAmount
(
orderAmount
);
rvp
.
setGoodsAmount
(
goodsAmount
);
rvp
.
setRealAmount
(
order
Amount
);
rvp
.
setRealAmount
(
real
Amount
);
rvp
.
setDriverAmount
(
driverAmount
);
rvp
.
setVehicleAmount
(
vehicleAmount
);
rvp
.
setDamageSafeAmount
(
damageSafeAmount
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderTourService.java
View file @
a4de09fa
...
...
@@ -9,6 +9,8 @@ import com.github.wxiaoqi.security.auth.client.config.UserAuthConfig;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
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.feign.ActivityFeign
;
import
com.xxfc.platform.order.biz.OrderCostDetailBiz
;
import
com.xxfc.platform.order.biz.OrderTemplateBiz
;
import
com.xxfc.platform.order.biz.OrderTourDetailBiz
;
...
...
@@ -77,11 +79,15 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Autowired
ThirdFeign
thirdFeign
;
@Autowired
ActivityFeign
activityFeign
;
@Autowired
public
HttpServletRequest
request
;
@PostConstruct
public
void
init
(){
this
.
channel
=
Coupon
.
CHANNEL_TOUR
;
this
.
orderTypeEnum
=
OrderTypeEnum
.
TOUR
;
}
...
...
@@ -132,6 +138,11 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
//扣減庫存
tourFeign
.
stock
(
bo
.
getSpePriceId
(),
bo
.
getTotalNumber
(),
TourFeign
.
STOCK_SUBTRACT
);
//如果有使用优惠券,则扣减
if
(
BigDecimal
.
ZERO
.
compareTo
(
bo
.
getOrder
().
getCouponAmount
())
<
0
)
{
activityFeign
.
use
(
bo
.
getAppUserDTO
().
getUserid
(),
bo
.
getTickerNo
().
get
(
0
),
bo
.
getOrder
().
getNo
(),
channel
,
bo
.
getOrder
().
getGoodsAmount
(),
ActivityFeign
.
TYPE_USE
);
}
super
.
handleDetail
(
bo
);
//发送定时取消订单(30分钟)
...
...
@@ -147,12 +158,16 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Override
public
TourPriceVO
calculatePrice
(
TourBO
detail
)
{
BigDecimal
realAmount
=
BigDecimal
.
ZERO
;
BigDecimal
orderAmount
=
BigDecimal
.
ZERO
;
BigDecimal
goodsAmount
=
BigDecimal
.
ZERO
;
BigDecimal
tourAmount
=
BigDecimal
.
ZERO
;
BigDecimal
real
Amount
=
BigDecimal
.
ZERO
;
BigDecimal
coupon
Amount
=
BigDecimal
.
ZERO
;
BigDecimal
insureAmount
=
BigDecimal
.
ZERO
;
//当前用户
AppUserDTO
dto
=
detail
.
getAppUserDTO
();
if
(
StrUtil
.
isNotBlank
(
detail
.
getTourUserIds
()))
{
List
<
TourUser
>
users
=
new
ArrayList
<
TourUser
>();
if
(
StrUtil
.
isNotBlank
(
detail
.
getTourUserIds
()))
{
...
...
@@ -194,20 +209,27 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
insureAmount
=
insureAmount
.
add
(
INSURE_PRICE
.
multiply
(
new
BigDecimal
(
String
.
valueOf
(
detail
.
getTotalNumber
()
*
detail
.
getTourGood
().
getNumber
()))));
}
//优惠券处理
//待完成
//总价
tourAmount
=
tourAmount
.
add
(
tourSpePriceVo
.
getTotalPrice
()).
add
(
tourSpePriceVo
.
getTotalChildPrice
());
//商品价格
goodsAmount
=
goodsAmount
.
add
(
tourAmount
);
//优惠券处理
//待完成
if
(
null
!=
detail
.
getTickerNo
()
&&
detail
.
getTickerNo
().
size
()
>
0
)
{
couponAmount
=
activityFeign
.
use
(
dto
.
getUserid
(),
detail
.
getTickerNo
().
get
(
0
),
detail
.
getOrder
().
getNo
(),
channel
,
goodsAmount
,
ActivityFeign
.
TYPE_NO_USE
);
}
//总价格
orderAmount
=
orderAmount
.
add
(
goodsAmount
).
add
(
insureAmount
);
//真实价格
realAmount
=
realAmount
.
add
(
tourSpePriceVo
.
getRealPrice
()).
add
(
tourSpePriceVo
.
getRealChildPrice
()).
add
(
insureAmount
);
realAmount
=
realAmount
.
add
(
tourSpePriceVo
.
getRealPrice
()).
add
(
tourSpePriceVo
.
getRealChildPrice
()).
add
(
insureAmount
)
.
subtract
(
couponAmount
)
;
//生成订单明细
TourPriceVO
tpv
=
BeanUtil
.
toBean
(
tourSpePriceVo
,
TourPriceVO
.
class
);
tpv
.
setCouponAmount
(
couponAmount
);
tpv
.
setOrderAmount
(
orderAmount
);
tpv
.
setGoodsAmount
(
goodsAmount
);
tpv
.
setRealAmount
(
realAmount
);
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/MQconstant.java
0 → 100644
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
universal
.
constant
;
public
class
MQconstant
{
public
static
final
String
INTEGRAL_EXCHANGE
=
"integral_exchange"
;
public
static
final
String
INTEGRAL_ROUTING_KEY
=
"integral_routing_key"
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/MQSe
r
derFeign.java
→
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/MQSe
n
derFeign.java
View file @
a4de09fa
...
...
@@ -6,9 +6,9 @@ import org.springframework.web.bind.annotation.GetMapping;
import
org.springframework.web.bind.annotation.RequestParam
;
@FeignClient
(
value
=
"xx-universal"
,
contextId
=
"sendMessage"
)
public
interface
MQSe
r
derFeign
{
public
interface
MQSe
n
derFeign
{
@GetMapping
(
value
=
"/message/sendMessage"
)
public
ObjectRestResponse
sendMessage
(
@RequestParam
(
value
=
"exchange"
)
String
exchange
,
@RequestParam
(
value
=
"rout
ingKey"
)
String
routKey
,
@RequestParam
(
value
=
"jsonParam"
)
String
jsonParam
);
public
ObjectRestResponse
sendMessage
(
@RequestParam
(
value
=
"exchange"
)
String
exchange
,
@RequestParam
(
value
=
"rout
Key"
)
String
routKey
,
@RequestParam
(
value
=
"json"
)
String
json
);
}
xx-universal/xx-universal-api/src/main/lib/1.jar
deleted
100644 → 0
View file @
c3d9f31c
File deleted
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/MQServiceBiZ.java
View file @
a4de09fa
package
com
.
xxfc
.
platform
.
universal
.
biz
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
lombok.
AllArgsConstructor
;
import
lombok.
extern.slf4j.Slf4j
;
import
org.springframework.amqp.core.Message
;
import
org.springframework.amqp.core.MessageBuilder
;
import
org.springframework.amqp.core.MessageProperties
;
import
org.springframework.amqp.rabbit.core.RabbitTemplate
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.util.UUID
;
@Service
@
AllArgsConstructor
@
Slf4j
public
class
MQServiceBiZ
{
@Autowired
private
RabbitTemplate
rabbitTemplate
;
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
ObjectRestResponse
sendMessage
(
String
exchange
,
String
routKey
,
String
json
)
{
log
.
info
(
"发送消息到消息队列:exchange = {}, routingKey = {}, json = {}"
,
exchange
,
routKey
,
json
);
log
.
info
(
"开始发送消息。。。"
);
Message
message
=
MessageBuilder
.
withBody
(
json
.
getBytes
())
.
setContentType
(
MessageProperties
.
CONTENT_TYPE_JSON
).
setContentEncoding
(
"utf-8"
)
.
setMessageId
(
UUID
.
randomUUID
()
+
""
).
build
();
rabbitTemplate
.
convertAndSend
(
exchange
,
routKey
,
message
);
log
.
info
(
"发送成功。。。"
);
return
ObjectRestResponse
.
succ
();
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/OrderPayBiz.java
View file @
a4de09fa
...
...
@@ -17,6 +17,7 @@ import com.github.wxiaoqi.security.common.util.OrderUtil;
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.universal.constant.MQconstant
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.OrderPay
;
import
com.xxfc.platform.universal.mapper.OrderPayMapper
;
...
...
@@ -27,6 +28,7 @@ import lombok.extern.slf4j.Slf4j;
import
org.apache.commons.beanutils.BeanUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.stereotype.Service
;
import
tk.mybatis.mapper.entity.Example
;
...
...
@@ -57,6 +59,11 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
@Autowired
HttpServletRequest
request
;
@Autowired
MQServiceBiZ
mqServiceBiZ
;
@Value
(
"${universal.url}"
)
String
weixinHost
;
public
JSONObject
preparepay
(
OrderPayVo
orderPayVo
)
{
if
(
null
==
orderPayVo
)
{
log
.
error
(
"-----参数为空-----------"
);
...
...
@@ -69,23 +76,24 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
if
(
StringUtils
.
isBlank
(
orderPayVo
.
getOrderNo
()))
{
log
.
error
(
"-----订单不能为空-----------"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"订单不能为空"
);
}
String
trade_no
=
OrderUtil
.
GetOrderNumber
(
""
);
String
order_no
=
orderPayVo
.
getOrderNo
();
Integer
amount
=
orderPayVo
.
getAmount
();
}
String
trade_no
=
OrderUtil
.
GetOrderNumber
(
""
);
String
order_no
=
orderPayVo
.
getOrderNo
();
Integer
amount
=
orderPayVo
.
getAmount
();
log
.
error
(
"---下单---order_no====="
+
order_no
+
"--支付订单号--trade_no===="
+
trade_no
+
"--金额---amount===="
+
amount
);
//报名费回调路径
//报名费回调路径
//临时处理
Map
<
String
,
Dictionary
>
dictionaryMap
=
dictionaryBiz
.
getAll4Map
();
Integer
demotion
=
Integer
.
valueOf
(
dictionaryMap
.
get
(
UNIVERSAL_PAY
+
"_"
+
PAY_DEMOTION
).
getDetail
());
amount
=
amount
/
demotion
;
//临时处理
Map
<
String
,
Dictionary
>
dictionaryMap
=
dictionaryBiz
.
getAll4Map
();
Integer
demotion
=
Integer
.
valueOf
(
dictionaryMap
.
get
(
UNIVERSAL_PAY
+
"_"
+
PAY_DEMOTION
).
getDetail
());
amount
=
amount
/
demotion
;
if
(
amount
<=
0
)
{
amount
=
1
;
}
amount
=
1
;
}
Integer
type
=
orderPayVo
.
getType
();
String
jsParam
=
""
;
String
notify_url
=
"https://"
+
SystemConfig
.
weixinHost
+
"/api/universal/pay/app/unauth/notify"
;
String
notify_url
=
weixinHost
+
"/api/universal/pay/app/unauth/notify"
;
log
.
info
(
"报名费回调路径notify_url:"
+
notify_url
);
if
(
type
!=
null
&&
type
==
2
){
jsParam
=
WXPay
.
webPay
(
amount
+
""
,
orderPayVo
.
getBody
(),
notify_url
,
trade_no
,
orderPayVo
.
getBuyerIp
(),
orderPayVo
.
getBuyerAccount
());
}
else
{
...
...
@@ -129,9 +137,29 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
orderPay
.
setStatus
(
1
);
orderPay
.
setSerialNumber
(
serialNumber
);
int
num
=
mapper
.
updateByExampleSelective
(
orderPay
,
example
);
log
.
error
(
"---支付回调处理---num====="
+
num
+
"----orderNo======="
+
orderNo
);
if
(
num
>
0
){
//支付成功,添加积分
OrderPay
pay
=
list
.
get
(
0
);
OrderPay
newValue
=
mapper
.
selectOne
(
orderPay
);
log
.
info
(
"支付回调信息:newValue = {}"
,
newValue
);
if
(
newValue
.
getStatus
()
==
1
)
{
JSONObject
jsonObject
=
new
JSONObject
();
jsonObject
.
put
(
"userId"
,
newValue
.
getUserId
());
jsonObject
.
put
(
"amount"
,
newValue
.
getAmount
());
jsonObject
.
put
(
"channelId"
,
newValue
.
getOrderNo
());
if
(
newValue
.
getChannel
()
==
1
)
{
//租车
jsonObject
.
put
(
"integralRuleCode"
,
"RENTRV"
);
}
else
if
(
newValue
.
getChannel
()
==
2
)
{
//旅游
jsonObject
.
put
(
"integralRuleCode"
,
"BUYROUT"
);
}
else
if
(
newValue
.
getChannel
()
==
3
)
{
//会员
jsonObject
.
put
(
"integralRuleCode"
,
"BUYMEMBER"
);
}
log
.
info
(
"支付订单号:orderNo = {}, orderType = {}"
,
newValue
.
getOrderNo
(),
newValue
.
getChannel
());
log
.
info
(
"支付成功获取积分:发送消息 exchange = {}, routingKey = {}, json = {}"
,
MQconstant
.
INTEGRAL_EXCHANGE
,
MQconstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
mqServiceBiZ
.
sendMessage
(
MQconstant
.
INTEGRAL_EXCHANGE
,
MQconstant
.
INTEGRAL_ROUTING_KEY
,
jsonObject
.
toJSONString
());
}
if
(
StringUtils
.
isNotBlank
(
pay
.
getNotifyUrl
())){
String
url
=
pay
.
getNotifyUrl
();
Integer
type
=
pay
.
getType
()==
null
?
1
:
pay
.
getType
();
...
...
@@ -144,6 +172,7 @@ public class OrderPayBiz extends BaseBiz<OrderPayMapper,OrderPay> {
result
=
HTTPUtils
.
doGet
(
url
);
}
log
.
error
(
"---支付回调处理---orderNo======="
+
orderNo
+
"---result==="
+
result
);
}
}
}
...
...
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