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
bf1936ab
Commit
bf1936ab
authored
Jul 17, 2019
by
jiaorz
Browse files
Options
Browse Files
Download
Plain Diff
Merge remote-tracking branch 'origin/base-modify' into base-modify
parents
a6be3c86
503ff148
Changes
56
Show whitespace changes
Inline
Side-by-side
Showing
56 changed files
with
1110 additions
and
64 deletions
+1110
-64
AuthController.java
...thub/wxiaoqi/security/auth/controller/AuthController.java
+5
-0
IUserService.java
.../com/github/wxiaoqi/security/auth/feign/IUserService.java
+4
-0
ClientTokenInterceptor.java
...oqi/security/auth/interceptor/ClientTokenInterceptor.java
+5
-0
AuthService.java
...com/github/wxiaoqi/security/auth/service/AuthService.java
+2
-0
AppAuthServiceImpl.java
...xiaoqi/security/auth/service/impl/AppAuthServiceImpl.java
+5
-0
AuthServiceImpl.java
...b/wxiaoqi/security/auth/service/impl/AuthServiceImpl.java
+5
-0
CommonLogServiceImpl.java
...xiaoqi/security/common/log/Impl/CommonLogServiceImpl.java
+1
-1
BaseUserMemberVO.java
...m/github/wxiaoqi/security/admin/dto/BaseUserMemberVO.java
+0
-5
AppUserDetail.java
...m/github/wxiaoqi/security/admin/entity/AppUserDetail.java
+1
-1
UserFeign.java
...va/com/github/wxiaoqi/security/admin/feign/UserFeign.java
+5
-0
AppUserManageVo.java
...com/github/wxiaoqi/security/admin/vo/AppUserManageVo.java
+8
-8
ImiVo.java
...main/java/com/github/wxiaoqi/security/admin/vo/ImiVo.java
+15
-0
SellingWalletVo.java
...com/github/wxiaoqi/security/admin/vo/SellingWalletVo.java
+8
-2
WalletDetailPageVo.java
.../github/wxiaoqi/security/admin/vo/WalletDetailPageVo.java
+5
-0
AppUserDetailBiz.java
...m/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
+16
-0
AppUserLoginBiz.java
...om/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
+11
-0
AppUserRelationBiz.java
...github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
+5
-5
BaseUserMemberBiz.java
.../github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
+5
-2
MyWalletCathBiz.java
...om/github/wxiaoqi/security/admin/biz/MyWalletCathBiz.java
+6
-0
MyWalletDetailBiz.java
.../github/wxiaoqi/security/admin/biz/MyWalletDetailBiz.java
+3
-3
MyWaterBiz.java
...ava/com/github/wxiaoqi/security/admin/biz/MyWaterBiz.java
+11
-1
AppUsersManageController.java
...wxiaoqi/security/admin/rest/AppUsersManageController.java
+1
-0
BaseUserMemberController.java
...wxiaoqi/security/admin/rest/BaseUserMemberController.java
+3
-3
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+35
-4
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+62
-11
AppUserDetailMapper.xml
...e-admin/src/main/resources/mapper/AppUserDetailMapper.xml
+13
-5
ActivityRule.java
.../java/com/xxfc/platform/activity/entity/ActivityRule.java
+94
-0
ActivityUserJoin.java
...a/com/xxfc/platform/activity/entity/ActivityUserJoin.java
+66
-0
ActivityFeign.java
.../java/com/xxfc/platform/activity/feign/ActivityFeign.java
+4
-0
ActivityRuleBiz.java
.../java/com/xxfc/platform/activity/biz/ActivityRuleBiz.java
+34
-0
ActivityUserJoinBiz.java
...a/com/xxfc/platform/activity/biz/ActivityUserJoinBiz.java
+90
-0
UserCouponBiz.java
...in/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
+34
-4
ActivityRuleMapper.java
...com/xxfc/platform/activity/mapper/ActivityRuleMapper.java
+15
-0
ActivityUserJoinMapper.java
...xxfc/platform/activity/mapper/ActivityUserJoinMapper.java
+15
-0
ActivityUserJoinController.java
...fc/platform/activity/rest/ActivityUserJoinController.java
+26
-0
CouponController.java
...ava/com/xxfc/platform/activity/rest/CouponController.java
+2
-0
UserCouponController.java
...com/xxfc/platform/activity/rest/UserCouponController.java
+18
-0
ActivityRuleMapper.xml
...y-server/src/main/resources/mapper/ActivityRuleMapper.xml
+20
-0
ActivityUserJoinMapper.xml
...rver/src/main/resources/mapper/ActivityUserJoinMapper.xml
+16
-0
OrderRentVehicleDetail.java
...om/xxfc/platform/order/entity/OrderRentVehicleDetail.java
+7
-0
OrderViolation.java
...n/java/com/xxfc/platform/order/entity/OrderViolation.java
+96
-0
QueryOrderDTO.java
...ava/com/xxfc/platform/order/pojo/order/QueryOrderDTO.java
+3
-0
OrderTourVerificationBiz.java
...com/xxfc/platform/order/biz/OrderTourVerificationBiz.java
+19
-0
OrderViolationBiz.java
...n/java/com/xxfc/platform/order/biz/OrderViolationBiz.java
+110
-0
OrderViolationMapper.java
.../com/xxfc/platform/order/mapper/OrderViolationMapper.java
+7
-0
BaseOrderController.java
...ava/com/xxfc/platform/order/rest/BaseOrderController.java
+1
-0
OrderTourVerificationController.java
.../platform/order/rest/OrderTourVerificationController.java
+0
-7
OrderViolationController.java
...om/xxfc/platform/order/rest/OrderViolationController.java
+127
-0
orderViolationMapper.xml
...server/src/main/resources/mapper/orderViolationMapper.xml
+5
-0
TourFeign.java
...src/main/java/com/xxfc/platform/tour/feign/TourFeign.java
+6
-0
TourGoodSiteBiz.java
...main/java/com/xxfc/platform/tour/biz/TourGoodSiteBiz.java
+8
-0
TourGoodVerificationBiz.java
...a/com/xxfc/platform/tour/biz/TourGoodVerificationBiz.java
+7
-2
TourGoodSiteController.java
...a/com/xxfc/platform/tour/rest/TourGoodSiteController.java
+8
-0
TourGoodVerificationController.java
...fc/platform/tour/rest/TourGoodVerificationController.java
+5
-0
VehicleFeign.java
...in/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
+8
-0
SysRegionController.java
...a/com/xxfc/platform/vehicle/rest/SysRegionController.java
+19
-0
No files found.
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/controller/AuthController.java
View file @
bf1936ab
...
@@ -214,4 +214,9 @@ public class AuthController {
...
@@ -214,4 +214,9 @@ public class AuthController {
return
data
;
return
data
;
}
}
@PostMapping
(
"/imi/login"
)
public
String
loginImiWithToken
(){
return
authService
.
loginImiWithToken
();
}
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/feign/IUserService.java
View file @
bf1936ab
...
@@ -67,4 +67,8 @@ public interface IUserService {
...
@@ -67,4 +67,8 @@ public interface IUserService {
@PostMapping
(
"/api/app/applet/registry"
)
@PostMapping
(
"/api/app/applet/registry"
)
public
JSONObject
appletRegistry
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"nickname"
)
String
nickname
,
public
JSONObject
appletRegistry
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"nickname"
)
String
nickname
,
@RequestParam
(
value
=
"headimgurl"
)
String
headimgurl
,
@RequestParam
(
value
=
"userid"
,
defaultValue
=
"0"
)
Integer
userid
);
@RequestParam
(
value
=
"headimgurl"
)
String
headimgurl
,
@RequestParam
(
value
=
"userid"
,
defaultValue
=
"0"
)
Integer
userid
);
@PostMapping
(
"/api/app/imi/login"
)
String
loginImiWithToken
();
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/interceptor/ClientTokenInterceptor.java
View file @
bf1936ab
...
@@ -8,6 +8,7 @@ import feign.RequestTemplate;
...
@@ -8,6 +8,7 @@ import feign.RequestTemplate;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestAttributes
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
...
@@ -22,12 +23,16 @@ public class ClientTokenInterceptor implements RequestInterceptor {
...
@@ -22,12 +23,16 @@ public class ClientTokenInterceptor implements RequestInterceptor {
@Autowired
@Autowired
private
AuthClientService
authClientService
;
private
AuthClientService
authClientService
;
@Value
(
"${auth.user.token-header:Authorization}"
)
private
String
tokenHeader
;
@Override
@Override
public
void
apply
(
RequestTemplate
requestTemplate
)
{
public
void
apply
(
RequestTemplate
requestTemplate
)
{
try
{
try
{
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
ServletRequestAttributes
requestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
requestTemplate
.
header
(
clientConfiguration
.
getClientTokenHeader
(),
authClientService
.
apply
(
clientConfiguration
.
getClientId
(),
clientConfiguration
.
getClientSecret
()));
requestTemplate
.
header
(
clientConfiguration
.
getClientTokenHeader
(),
authClientService
.
apply
(
clientConfiguration
.
getClientId
(),
clientConfiguration
.
getClientSecret
()));
requestTemplate
.
header
(
"userHost"
,
ClientUtil
.
getClientIp
(
requestAttributes
.
getRequest
()));
requestTemplate
.
header
(
"userHost"
,
ClientUtil
.
getClientIp
(
requestAttributes
.
getRequest
()));
requestTemplate
.
header
(
tokenHeader
,
requestAttributes
.
getRequest
().
getHeader
(
tokenHeader
));
}
catch
(
Exception
e
)
{
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
...
...
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/AuthService.java
View file @
bf1936ab
...
@@ -33,4 +33,6 @@ public interface AuthService {
...
@@ -33,4 +33,6 @@ public interface AuthService {
* @return
* @return
*/
*/
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
,
Integer
userid
);
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
,
Integer
userid
);
String
loginImiWithToken
();
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/impl/AppAuthServiceImpl.java
View file @
bf1936ab
...
@@ -96,4 +96,9 @@ public class AppAuthServiceImpl implements AuthService {
...
@@ -96,4 +96,9 @@ public class AppAuthServiceImpl implements AuthService {
return
userService
.
appletRegistry
(
username
,
headimgurl
,
nickname
,
userid
);
return
userService
.
appletRegistry
(
username
,
headimgurl
,
nickname
,
userid
);
}
}
@Override
public
String
loginImiWithToken
()
{
return
userService
.
loginImiWithToken
();
}
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/impl/AuthServiceImpl.java
View file @
bf1936ab
...
@@ -93,4 +93,9 @@ public class AuthServiceImpl implements AuthService {
...
@@ -93,4 +93,9 @@ public class AuthServiceImpl implements AuthService {
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
,
Integer
userid
)
{
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
,
Integer
userid
)
{
return
userService
.
appletRegistry
(
username
,
headimgurl
,
nickname
,
userid
);
return
userService
.
appletRegistry
(
username
,
headimgurl
,
nickname
,
userid
);
}
}
@Override
public
String
loginImiWithToken
()
{
return
userService
.
loginImiWithToken
();
}
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/log/Impl/CommonLogServiceImpl.java
View file @
bf1936ab
...
@@ -86,7 +86,7 @@ public class CommonLogServiceImpl implements CommonLogService {
...
@@ -86,7 +86,7 @@ public class CommonLogServiceImpl implements CommonLogService {
}
}
@Override
@Override
public
void
run
()
{
public
void
run
()
{
mongoTemplate
.
insert
(
xxLogEntity
,
xxLogEntity
.
getMongoKey
());
//
mongoTemplate.insert(xxLogEntity, xxLogEntity.getMongoKey());
}
}
}
}
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/dto/BaseUserMemberVO.java
View file @
bf1936ab
...
@@ -74,9 +74,4 @@ public class BaseUserMemberVO implements Serializable {
...
@@ -74,9 +74,4 @@ public class BaseUserMemberVO implements Serializable {
@Column
(
name
=
"name"
)
@Column
(
name
=
"name"
)
private
String
name
;
private
String
name
;
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/entity/AppUserDetail.java
View file @
bf1936ab
...
@@ -73,5 +73,5 @@ public class AppUserDetail {
...
@@ -73,5 +73,5 @@ public class AppUserDetail {
@ApiModelProperty
(
value
=
"邀请人账号:"
)
@ApiModelProperty
(
value
=
"邀请人账号:"
)
@Column
(
name
=
"inviter_account"
)
@Column
(
name
=
"inviter_account"
)
private
String
inviterAccount
;
private
Integer
inviterAccount
;
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/feign/UserFeign.java
View file @
bf1936ab
...
@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
...
@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.admin.entity.BaseUserMemberLevel;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.ImiVo
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
...
@@ -111,4 +112,8 @@ public interface UserFeign {
...
@@ -111,4 +112,8 @@ public interface UserFeign {
@GetMapping
(
"/app/user/one"
)
@GetMapping
(
"/app/user/one"
)
public
AppUserLogin
one
(
@RequestParam
(
value
=
"username"
)
String
username
);
public
AppUserLogin
one
(
@RequestParam
(
value
=
"username"
)
String
username
);
@GetMapping
(
"/api/app/imi/{imiId}"
)
public
ImiVo
findUserInfoByImiId
(
@PathVariable
(
value
=
"imiId"
)
Integer
imiId
);
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/AppUserManageVo.java
View file @
bf1936ab
...
@@ -51,22 +51,17 @@ public class AppUserManageVo {
...
@@ -51,22 +51,17 @@ public class AppUserManageVo {
@Column
(
name
=
"source"
)
@Column
(
name
=
"source"
)
private
Integer
source
;
private
Integer
source
;
/**
* 邀请人id
*/
@Column
(
name
=
"inviter_account"
)
private
String
inviterAccount
;
/**
/**
* 省代码
* 省代码
*/
*/
@Column
(
name
=
"province_code"
)
@Column
(
name
=
"province_code"
)
private
String
provinceCode
;
private
Integer
provinceCode
;
/**
/**
* 市代码
* 市代码
*/
*/
@Column
(
name
=
"city_code"
)
@Column
(
name
=
"city_code"
)
private
String
cityCode
;
private
Integer
cityCode
;
/**
/**
* 用户性别
* 用户性别
...
@@ -108,7 +103,7 @@ public class AppUserManageVo {
...
@@ -108,7 +103,7 @@ public class AppUserManageVo {
* 有效期;0代表永久
* 有效期;0代表永久
*/
*/
@Column
(
name
=
"valid_time"
)
@Column
(
name
=
"valid_time"
)
private
Integer
validTime
;
private
Long
validTime
;
/**
/**
* 创建时间
* 创建时间
...
@@ -160,4 +155,9 @@ public class AppUserManageVo {
...
@@ -160,4 +155,9 @@ public class AppUserManageVo {
* 头像
* 头像
*/
*/
private
String
headimgurl
;
private
String
headimgurl
;
/**
* 邀请人用户名
*/
private
String
inviter
;
}
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/ImiVo.java
0 → 100644
View file @
bf1936ab
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
;
import
lombok.Data
;
/**
* @author libin
* @version 1.0
* @description
* @data 2019/7/15 16:35
*/
@Data
public
class
ImiVo
{
private
String
nickname
;
private
String
headimgurl
;
}
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/SellingWalletVo.java
View file @
bf1936ab
...
@@ -4,6 +4,10 @@ import io.swagger.annotations.ApiModelProperty;
...
@@ -4,6 +4,10 @@ import io.swagger.annotations.ApiModelProperty;
import
lombok.Data
;
import
lombok.Data
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.Instant
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.Set
;
/**
/**
* @author libin
* @author libin
...
@@ -42,14 +46,16 @@ public class SellingWalletVo {
...
@@ -42,14 +46,16 @@ public class SellingWalletVo {
@ApiModelProperty
(
value
=
"售价"
)
@ApiModelProperty
(
value
=
"售价"
)
private
BigDecimal
price
;
private
BigDecimal
price
;
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
private
Long
crtTime
;
private
Long
crtTime
;
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
private
Long
updTime
;
@ApiModelProperty
(
"是否入账:0-未入账;1-已入账"
)
private
Integer
waiting
;
private
Integer
waiting
;
@ApiModelProperty
(
"'类别:0-正;1-负(退款时)"
)
private
Integer
status
;
private
Integer
status
;
/**
/**
* 所获佣金
* 所获佣金
...
...
ace-modules/ace-admin-api/src/main/java/com/github/wxiaoqi/security/admin/vo/WalletDetailPageVo.java
View file @
bf1936ab
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
;
package
com
.
github
.
wxiaoqi
.
security
.
admin
.
vo
;
import
com.alibaba.fastjson.JSON
;
import
io.swagger.annotations.ApiModelProperty
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
import
lombok.Data
;
import
org.springframework.beans.BeanUtils
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.time.Instant
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
/**
* @author libin
* @author libin
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserDetailBiz.java
View file @
bf1936ab
...
@@ -53,6 +53,22 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
...
@@ -53,6 +53,22 @@ public class AppUserDetailBiz extends BaseBiz<AppUserDetailMapper, AppUserDetail
return
null
;
return
null
;
}
}
/**
* 根据用户id获取父id
*
* @param code
* @return
*/
public
Integer
getUserByCode
(
String
code
)
{
Example
example
=
new
Example
(
AppUserDetail
.
class
);
example
.
createCriteria
().
andEqualTo
(
"code"
,
code
).
andEqualTo
(
"isdel"
,
0
);
List
<
AppUserDetail
>
list
=
mapper
.
selectByExample
(
example
);
if
(
list
!=
null
&&
list
.
size
()
!=
0
)
{
return
list
.
get
(
0
).
getUserid
();
}
return
0
;
}
/**
/**
* 获取用户信息
* 获取用户信息
*
*
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserLoginBiz.java
View file @
bf1936ab
...
@@ -179,4 +179,15 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
...
@@ -179,4 +179,15 @@ public class AppUserLoginBiz extends BaseBiz<AppUserLoginMapper, AppUserLogin> {
}
}
return
userIdAndAppUserLoginMap
;
return
userIdAndAppUserLoginMap
;
}
}
public
AppUserLogin
findUserByImiId
(
Integer
imiId
)
{
Example
example
=
new
Example
(
AppUserLogin
.
class
);
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"imUserid"
,
imiId
);
List
<
AppUserLogin
>
appUserLogins
=
mapper
.
selectByExample
(
example
);
if
(
CollectionUtils
.
isNotEmpty
(
appUserLogins
)){
return
appUserLogins
.
get
(
0
);
}
return
null
;
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/AppUserRelationBiz.java
View file @
bf1936ab
...
@@ -37,7 +37,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -37,7 +37,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
* @param userId
* @param userId
* @param parentId
* @param parentId
*/
*/
public
void
bindRelation
(
Integer
userId
,
Integer
parentId
){
public
void
bindRelation
(
Integer
userId
,
Integer
parentId
,
Integer
type
){
AppUserRelation
relation
=
getMyBiz
().
getRelationByUserId
(
parentId
);
AppUserRelation
relation
=
getMyBiz
().
getRelationByUserId
(
parentId
);
if
(
relation
==
null
){
if
(
relation
==
null
){
relation
=
new
AppUserRelation
();
relation
=
new
AppUserRelation
();
...
@@ -50,13 +50,13 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -50,13 +50,13 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
relation
=
new
AppUserRelation
();
relation
=
new
AppUserRelation
();
relation
.
setUserId
(
userId
);
relation
.
setUserId
(
userId
);
relation
.
setParentId
(
parentId
);
relation
.
setParentId
(
parentId
);
relation
.
setBindType
(
2
);
relation
.
setBindType
(
type
);
relation
.
setBindTime
(
time
);
relation
.
setBindTime
(
time
);
insertSelective
(
relation
);
insertSelective
(
relation
);
}
else
{
}
else
{
if
(
relation
.
getParentId
()==
null
||
relation
.
getParentId
()==
0
||(
relation
.
getIsForever
()!=
1
&&(
time
-
relation
.
getBindTime
())>
3600
)){
if
(
relation
.
getParentId
()==
null
||
relation
.
getParentId
()==
0
||(
relation
.
getIsForever
()!=
1
&&(
time
-
relation
.
getBindTime
())>
3600
)){
relation
.
setParentId
(
parentId
);
relation
.
setParentId
(
parentId
);
relation
.
setBindType
(
2
);
relation
.
setBindType
(
type
);
relation
.
setBindTime
(
time
);
relation
.
setBindTime
(
time
);
getMyBiz
().
updRelation
(
relation
);
getMyBiz
().
updRelation
(
relation
);
}
}
...
@@ -80,7 +80,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -80,7 +80,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
if
(
userVo
==
null
){
if
(
userVo
==
null
){
upRelationTemp
(
pid
,
userid
);
upRelationTemp
(
pid
,
userid
);
}
else
{
}
else
{
bindRelation
(
platform_userid
,
pid
);
bindRelation
(
platform_userid
,
pid
,
2
);
}
}
}
}
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
...
@@ -125,7 +125,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
...
@@ -125,7 +125,7 @@ public class AppUserRelationBiz extends BaseBiz<AppUserRelationMapper,AppUserRel
return
;
return
;
}
}
Integer
parentId
=
relationTemp
.
getUserId
();
Integer
parentId
=
relationTemp
.
getUserId
();
bindRelation
(
platform_userid
,
parentId
);
bindRelation
(
platform_userid
,
parentId
,
2
);
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
View file @
bf1936ab
...
@@ -207,7 +207,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
...
@@ -207,7 +207,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
* @param baseUserMemberVO
* @param baseUserMemberVO
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
set
UserMember
(
BaseUserMemberVO
baseUserMemberVO
)
throws
InvocationTargetException
,
IllegalAccessException
{
public
void
Update
UserMember
(
BaseUserMemberVO
baseUserMemberVO
)
throws
InvocationTargetException
,
IllegalAccessException
{
Example
exa
=
Example
.
builder
(
BaseUserMember
.
class
).
where
(
Example
exa
=
Example
.
builder
(
BaseUserMember
.
class
).
where
(
WeekendSqls
.<
BaseUserMember
>
custom
()
WeekendSqls
.<
BaseUserMember
>
custom
()
...
@@ -219,11 +219,14 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
...
@@ -219,11 +219,14 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
BaseUserMember
baseUserMember
=
new
BaseUserMember
();
BaseUserMember
baseUserMember
=
new
BaseUserMember
();
BeanUtilsBean
.
getInstance
().
copyProperties
(
baseUserMember
,
baseUserMemberVO
);
BeanUtilsBean
.
getInstance
().
copyProperties
(
baseUserMember
,
baseUserMemberVO
);
if
(
baseUserMembers
==
null
||
baseUserMembers
.
size
()==
0
)
{
if
(
baseUserMembers
==
null
||
baseUserMembers
.
size
()==
0
)
{
if
(
baseUserMemberVO
.
getMemberLevel
()==
null
||
baseUserMember
.
getValidTime
()==
null
)
return
;
baseUserMember
.
setCrtTime
(
System
.
currentTimeMillis
());
baseUserMember
.
setCrtTime
(
System
.
currentTimeMillis
());
baseUserMember
.
setIsDel
(
0
);
baseUserMember
.
setIsDel
(
0
);
baseUserMember
.
setPayCount
(
0
);
baseUserMember
.
setPayCount
(
0
);
baseUserMember
.
setCardLeave
(
0
);
baseUserMember
.
setCardLeave
(
1
);
baseUserMember
.
setRecentRecharge
(
System
.
currentTimeMillis
());
baseUserMember
.
setRecentRecharge
(
System
.
currentTimeMillis
());
Integer
buyCount
=
baseUserMember
.
getBuyCount
()==
null
?
0
:
baseUserMember
.
getBuyCount
();
baseUserMember
.
setBuyCount
(
buyCount
+
1
);
insertSelective
(
baseUserMember
);
insertSelective
(
baseUserMember
);
return
;
return
;
}
else
if
(
baseUserMembers
.
size
()==
1
){
}
else
if
(
baseUserMembers
.
size
()==
1
){
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletCathBiz.java
View file @
bf1936ab
...
@@ -15,6 +15,7 @@ import tk.mybatis.mapper.entity.Example;
...
@@ -15,6 +15,7 @@ import tk.mybatis.mapper.entity.Example;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.Collections
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Optional
;
import
java.util.Optional
;
...
@@ -40,6 +41,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
...
@@ -40,6 +41,11 @@ public class MyWalletCathBiz extends BaseBiz<MyWalletCathMapper, MyWalletCath> {
List
<
MyWalletCath
>
walletCaths
=
walletCathPage
.
getData
();
List
<
MyWalletCath
>
walletCaths
=
walletCathPage
.
getData
();
if
(
CollectionUtils
.
isEmpty
(
walletCaths
)){
if
(
CollectionUtils
.
isEmpty
(
walletCaths
)){
walletCathPageVo
.
setPageNum
(
pageNo
);
walletCathPageVo
.
setPageSize
(
pageSize
);
walletCathPageVo
.
setTotalCount
(
0
);
walletCathPageVo
.
setTotalPage
(
0
);
walletCathPageVo
.
setWalletCaths
(
Collections
.
EMPTY_LIST
);
return
walletCathPageVo
;
return
walletCathPageVo
;
}
}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWalletDetailBiz.java
View file @
bf1936ab
...
@@ -33,14 +33,14 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
...
@@ -33,14 +33,14 @@ public class MyWalletDetailBiz extends BaseBiz<MyWalletDetailMapper, MyWalletDet
Example
.
Criteria
criteria
=
example
.
createCriteria
();
Example
.
Criteria
criteria
=
example
.
createCriteria
();
criteria
.
andEqualTo
(
"userId"
,
userId
);
criteria
.
andEqualTo
(
"userId"
,
userId
);
PageDataVO
<
WalletDetailPageVo
>
walletDetailPageVoPageDataVO
=
PageDataVO
.
pageInfo
(
pageNo
,
pageSize
,
()
->
mapper
.
selectByExample
(
example
));
PageDataVO
<
MyWalletDetail
>
walletDetailPageVoPageDataVO
=
PageDataVO
.
pageInfo
(
pageNo
,
pageSize
,
()
->
mapper
.
selectByExample
(
example
));
List
<
WalletDetailPageVo
>
walletDetails
=
walletDetailPageVoPageDataVO
.
getData
();
List
<
MyWalletDetail
>
walletDetails
=
walletDetailPageVoPageDataVO
.
getData
();
if
(
CollectionUtils
.
isEmpty
(
walletDetails
)){
if
(
CollectionUtils
.
isEmpty
(
walletDetails
)){
return
walletDetailPageVo
;
return
walletDetailPageVo
;
}
}
List
<
WalletDetailPageVo
>
walletDetailPageVoList
=
new
ArrayList
<>();
List
<
WalletDetailPageVo
>
walletDetailPageVoList
=
new
ArrayList
<>();
WalletDetailPageVo
walletDetail
;
WalletDetailPageVo
walletDetail
;
for
(
WalletDetailPageVo
walletDetailPage
:
walletDetails
)
{
for
(
MyWalletDetail
walletDetailPage
:
walletDetails
)
{
walletDetail
=
new
WalletDetailPageVo
();
walletDetail
=
new
WalletDetailPageVo
();
BeanUtils
.
copyProperties
(
walletDetailPage
,
walletDetail
);
BeanUtils
.
copyProperties
(
walletDetailPage
,
walletDetail
);
walletDetailPageVoList
.
add
(
walletDetail
);
walletDetailPageVoList
.
add
(
walletDetail
);
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/MyWaterBiz.java
View file @
bf1936ab
...
@@ -9,10 +9,13 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
...
@@ -9,10 +9,13 @@ import com.github.wxiaoqi.security.common.biz.BaseBiz;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Propagation
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.math.BigDecimal
;
import
java.text.ParseException
;
import
java.text.ParseException
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.Instant
;
import
java.util.Date
;
import
java.util.Date
;
/**
/**
...
@@ -107,5 +110,12 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
...
@@ -107,5 +110,12 @@ public class MyWaterBiz extends BaseBiz<MyWalletMapper, MyWallet>{
return
isToday
;
return
isToday
;
}
}
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
int
createWalletByUserId
(
Integer
userId
){
MyWallet
myWallet
=
new
MyWallet
();
myWallet
.
setUserId
(
userId
);
myWallet
.
setCrtTime
(
Instant
.
now
().
toEpochMilli
());
myWallet
.
setUpdTime
(
Instant
.
now
().
toEpochMilli
());
return
mapper
.
insertSelective
(
myWallet
);
}
}
}
\ No newline at end of file
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/AppUsersManageController.java
View file @
bf1936ab
...
@@ -63,4 +63,5 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
...
@@ -63,4 +63,5 @@ public class AppUsersManageController extends BaseController<AppUserManageBiz,Ap
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rest/BaseUserMemberController.java
View file @
bf1936ab
...
@@ -36,10 +36,10 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz,
...
@@ -36,10 +36,10 @@ public class BaseUserMemberController extends BaseController<BaseUserMemberBiz,
* @param baseUserMemberVO
* @param baseUserMemberVO
* @return
* @return
*/
*/
@P
os
tMapping
(
"/setUserMember"
)
@P
u
tMapping
(
"/setUserMember"
)
public
ObjectRestResponse
set
UserMember
(
@RequestBody
BaseUserMemberVO
baseUserMemberVO
)
public
ObjectRestResponse
Update
UserMember
(
@RequestBody
BaseUserMemberVO
baseUserMemberVO
)
throws
InvocationTargetException
,
IllegalAccessException
{
throws
InvocationTargetException
,
IllegalAccessException
{
baseBiz
.
set
UserMember
(
baseUserMemberVO
);
baseBiz
.
Update
UserMember
(
baseUserMemberVO
);
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
bf1936ab
...
@@ -4,9 +4,14 @@ import com.ace.cache.annotation.Cache;
...
@@ -4,9 +4,14 @@ import com.ace.cache.annotation.Cache;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService
;
import
com.github.wxiaoqi.security.admin.rpc.service.AppPermissionService
;
import
com.github.wxiaoqi.security.admin.rpc.service.PermissionService
;
import
com.github.wxiaoqi.security.admin.rpc.service.PermissionService
;
import
com.github.wxiaoqi.security.admin.vo.ImiVo
;
import
com.github.wxiaoqi.security.api.vo.authority.PermissionInfo
;
import
com.github.wxiaoqi.security.api.vo.authority.PermissionInfo
;
import
com.github.wxiaoqi.security.api.vo.user.AppUserInfo
;
import
com.github.wxiaoqi.security.api.vo.user.AppUserInfo
;
import
com.github.wxiaoqi.security.api.vo.user.UserInfo
;
import
com.github.wxiaoqi.security.api.vo.user.UserInfo
;
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.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
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.process.SystemConfig
;
...
@@ -14,7 +19,10 @@ import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
...
@@ -14,7 +19,10 @@ import com.github.wxiaoqi.security.common.util.result.JsonResultUtil;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.context.request.RequestContextHolder
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.List
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.Map
;
...
@@ -27,6 +35,12 @@ public class AppUserRest {
...
@@ -27,6 +35,12 @@ public class AppUserRest {
@Autowired
@Autowired
private
AppPermissionService
appPermissionService
;
private
AppPermissionService
appPermissionService
;
@Autowired
private
UserAuthUtil
authUtil
;
@Autowired
private
UserAuthConfig
userAuthConfig
;
// @Cache(key="permission")
// @Cache(key="permission")
// @RequestMapping(value = "/permissions", method = RequestMethod.GET)
// @RequestMapping(value = "/permissions", method = RequestMethod.GET)
// public @ResponseBody
// public @ResponseBody
...
@@ -70,12 +84,13 @@ public class AppUserRest {
...
@@ -70,12 +84,13 @@ public class AppUserRest {
JSONObject
register
(
JSONObject
register
(
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"mobilecode"
,
defaultValue
=
""
)
String
mobilecode
,
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
@RequestParam
(
value
=
"password"
,
defaultValue
=
""
)
String
password
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
){
){
//默认昵称
//默认昵称
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
String
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
return
appPermissionService
.
register
(
username
,
password
,
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
,
return
appPermissionService
.
register
(
username
,
password
,
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
nickname
,
mobilecode
,
null
,
null
,
0
);
mobilecode
,
null
,
null
,
0
,
code
);
}
}
...
@@ -102,7 +117,8 @@ public class AppUserRest {
...
@@ -102,7 +117,8 @@ public class AppUserRest {
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"openid"
,
defaultValue
=
""
)
String
openid
,
@RequestParam
(
value
=
"unionid"
,
defaultValue
=
""
)
String
unionid
,
@RequestParam
(
value
=
"unionid"
,
defaultValue
=
""
)
String
unionid
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
value
=
"type"
,
defaultValue
=
"0"
)
Integer
type
,
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
@RequestParam
(
value
=
"isQQ"
,
defaultValue
=
"0"
)
Integer
isQQ
,
@RequestParam
(
value
=
"code"
,
defaultValue
=
""
)
String
code
){
){
if
(
StringUtils
.
isBlank
(
headimgurl
)){
if
(
StringUtils
.
isBlank
(
headimgurl
)){
headimgurl
=
SystemConfig
.
USER_HEADER_URL_DEFAULT
;
headimgurl
=
SystemConfig
.
USER_HEADER_URL_DEFAULT
;
...
@@ -110,7 +126,7 @@ public class AppUserRest {
...
@@ -110,7 +126,7 @@ public class AppUserRest {
if
(
StringUtils
.
isBlank
(
nickname
)){
if
(
StringUtils
.
isBlank
(
nickname
)){
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
}
}
return
appPermissionService
.
weCahtRegister
(
username
,
password
,
openid
,
unionid
,
nickname
,
headimgurl
,
type
,
mobilecode
,
isQQ
);
return
appPermissionService
.
weCahtRegister
(
username
,
password
,
openid
,
unionid
,
nickname
,
headimgurl
,
type
,
mobilecode
,
isQQ
,
code
);
}
}
/**
/**
* 手机号码检测是否已绑定
* 手机号码检测是否已绑定
...
@@ -199,5 +215,20 @@ public class AppUserRest {
...
@@ -199,5 +215,20 @@ public class AppUserRest {
return
appPermissionService
.
appletRegistry
(
username
,
headimgurl
,
nickname
,
userid
);
return
appPermissionService
.
appletRegistry
(
username
,
headimgurl
,
nickname
,
userid
);
}
}
@PostMapping
(
"/imi/login"
)
public
String
loginImiWithToken
(){
ServletRequestAttributes
servletRequestAttributes
=
(
ServletRequestAttributes
)
RequestContextHolder
.
getRequestAttributes
();
HttpServletRequest
request
=
servletRequestAttributes
.
getRequest
();
try
{
IJWTInfo
infoFromToken
=
authUtil
.
getInfoFromToken
(
userAuthConfig
.
getToken
(
request
));
return
appPermissionService
.
loginImiWithUserId
(
Integer
.
valueOf
(
infoFromToken
.
getId
()));
}
catch
(
Exception
e
)
{
throw
new
BaseException
(
e
);
}
}
@GetMapping
(
"/imi/{imiId}"
)
public
ImiVo
findUserInfoByImiId
(
@PathVariable
(
value
=
"imiId"
)
Integer
imiId
){
return
appPermissionService
.
findUserInoByImiId
(
imiId
);
}
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
bf1936ab
...
@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.dto.BaseUserMemberExportDTO;
...
@@ -12,6 +12,7 @@ import com.github.wxiaoqi.security.admin.dto.BaseUserMemberExportDTO;
import
com.github.wxiaoqi.security.admin.dto.UserMemberDTO
;
import
com.github.wxiaoqi.security.admin.dto.UserMemberDTO
;
import
com.github.wxiaoqi.security.admin.entity.*
;
import
com.github.wxiaoqi.security.admin.entity.*
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.AppUserVo
;
import
com.github.wxiaoqi.security.admin.vo.ImiVo
;
import
com.github.wxiaoqi.security.api.vo.authority.PermissionInfo
;
import
com.github.wxiaoqi.security.api.vo.authority.PermissionInfo
;
import
com.github.wxiaoqi.security.api.vo.user.AppUserInfo
;
import
com.github.wxiaoqi.security.api.vo.user.AppUserInfo
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
import
com.github.wxiaoqi.security.common.msg.BaseResponse
;
...
@@ -41,10 +42,7 @@ import org.springframework.web.context.request.RequestContextHolder;
...
@@ -41,10 +42,7 @@ import org.springframework.web.context.request.RequestContextHolder;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
org.springframework.web.context.request.ServletRequestAttributes
;
import
javax.annotation.Resource
;
import
javax.annotation.Resource
;
import
java.util.ArrayList
;
import
java.util.*
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.concurrent.TimeUnit
;
import
java.util.concurrent.TimeUnit
;
/**
/**
...
@@ -76,6 +74,9 @@ public class AppPermissionService {
...
@@ -76,6 +74,9 @@ public class AppPermissionService {
@Resource
@Resource
private
RegionFeign
regionFeign
;
private
RegionFeign
regionFeign
;
@Autowired
private
MyWaterBiz
walletBiz
;
private
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
(
12
);
private
BCryptPasswordEncoder
encoder
=
new
BCryptPasswordEncoder
(
12
);
@Autowired
@Autowired
private
RedisTemplate
userRedisTemplate
;
private
RedisTemplate
userRedisTemplate
;
...
@@ -203,7 +204,7 @@ public class AppPermissionService {
...
@@ -203,7 +204,7 @@ public class AppPermissionService {
*/
*/
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
public
JSONObject
register
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
)
{
String
nickname
,
String
mobilecode
,
String
openId
,
String
unionid
,
Integer
type
,
String
code
)
{
// 判断参数和验证码
// 判断参数和验证码
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
...
@@ -256,14 +257,28 @@ public class AppPermissionService {
...
@@ -256,14 +257,28 @@ public class AppPermissionService {
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setIsdel
(
0
);
rsUserDetail
.
setCrtHost
(
getIp
());
rsUserDetail
.
setCrtHost
(
getIp
());
setCreateIPInfo
(
rsUserDetail
);
setCreateIPInfo
(
rsUserDetail
);
//邀请人id关系绑定
Integer
parentId
=
0
;
if
(
StringUtils
.
isNotBlank
(
code
)){
parentId
=
appUserDetailBiz
.
getUserByCode
(
code
);
}
if
(
parentId
!=
null
&&
parentId
>
0
){
rsUserDetail
.
setInviterAccount
(
parentId
);
}
//生成邀请码 长度改为8 不然重复率太高
//生成邀请码 长度改为8 不然重复率太高
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
rsUserDetail
.
setCode
(
UUIDUtils
.
genCodes
(
8
));
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//绑定上下线关系
if
(
parentId
!=
null
&&
parentId
>
0
){
relationBiz
.
bindRelation
(
userid
,
parentId
,
1
);
}
//临时会员绑定
//临时会员绑定
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
//自动登录获取优惠卷
//参加新人活动
authCoupn
(
userid
);
jionActivity
(
userid
);
//创建钱包
walletBiz
.
createWalletByUserId
(
appUserLogin
.
getId
());
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
// 到im注册,获取返回结果
...
@@ -321,6 +336,7 @@ public class AppPermissionService {
...
@@ -321,6 +336,7 @@ public class AppPermissionService {
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)
?
username
:
userVo
.
getUsername
());
data
.
put
(
"username"
,
StringUtils
.
isNotEmpty
(
username
)
?
username
:
userVo
.
getUsername
());
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"userId"
,
userid
);
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
data
.
put
(
"imUserId"
,
userVo
.
getImUserid
());
data
.
put
(
"code"
,
userVo
.
getCode
());
//更新登录时间 和 ip
//更新登录时间 和 ip
String
clientIp
=
getIp
();
String
clientIp
=
getIp
();
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
appUserLoginBiz
.
updateLoginInfo
(
userid
,
clientIp
);
...
@@ -350,7 +366,7 @@ public class AppPermissionService {
...
@@ -350,7 +366,7 @@ public class AppPermissionService {
*/
*/
@Transactional
@Transactional
public
JSONObject
weCahtRegister
(
String
username
,
String
password
,
String
openId
,
public
JSONObject
weCahtRegister
(
String
username
,
String
password
,
String
openId
,
String
unionid
,
String
nickname
,
String
headimgurl
,
int
type
,
String
mobilecode
,
Integer
isQQ
)
{
String
unionid
,
String
nickname
,
String
headimgurl
,
int
type
,
String
mobilecode
,
Integer
isQQ
,
String
code
)
{
// 校验参数和验证码
// 校验参数和验证码
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
mobilecode
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
...
@@ -432,7 +448,7 @@ public class AppPermissionService {
...
@@ -432,7 +448,7 @@ public class AppPermissionService {
}
}
}
else
if
(
type
==
2
)
{
// 新增
}
else
if
(
type
==
2
)
{
// 新增
JSONObject
register
=
register
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
JSONObject
register
=
register
(
username
,
password
,
headimgurl
,
nickname
,
mobilecode
,
openId
,
unionid
,
isQQ
);
openId
,
unionid
,
isQQ
,
code
);
if
(
register
.
getInteger
(
"status"
)
!=
ResultCode
.
SUCCESS_CODE
)
{
if
(
register
.
getInteger
(
"status"
)
!=
ResultCode
.
SUCCESS_CODE
)
{
if
(
register
.
getInteger
(
"status"
)
==
ResultCode
.
EXIST_CODE
)
{
if
(
register
.
getInteger
(
"status"
)
==
ResultCode
.
EXIST_CODE
)
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXIST_CODE
,
"用户已存在"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXIST_CODE
,
"用户已存在"
);
...
@@ -681,6 +697,12 @@ public class AppPermissionService {
...
@@ -681,6 +697,12 @@ public class AppPermissionService {
}
}
public
String
loginImiWithUserId
(
Integer
userId
){
AppUserLogin
appUserLogin
=
appUserLoginBiz
.
getUserById
(
userId
);
String
token
=
loginIm
(
appUserLogin
.
getUsername
(),
appUserLogin
.
getImPassword
(),
userId
);
return
token
;
}
//登录im
//登录im
public
String
loginIm
(
String
username
,
String
password
,
Integer
userId
)
{
public
String
loginIm
(
String
username
,
String
password
,
Integer
userId
)
{
...
@@ -718,6 +740,16 @@ public class AppPermissionService {
...
@@ -718,6 +740,16 @@ public class AppPermissionService {
}
}
}
}
//注册参与活动
public
void
jionActivity
(
Integer
userId
)
{
try
{
activityFeign
.
join
(
userId
);
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
;
}
}
/**
/**
* 通过用户id登录*** Unbelievable! ! !
* 通过用户id登录*** Unbelievable! ! !
...
@@ -782,12 +814,16 @@ public class AppPermissionService {
...
@@ -782,12 +814,16 @@ public class AppPermissionService {
setCreateIPInfo
(
rsUserDetail
);
setCreateIPInfo
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//创建钱包
walletBiz
.
createWalletByUserId
(
appUserLogin
.
getId
());
//临时会员绑定
//临时会员绑定
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
insertUserMemberByUserIdAndPhone
(
userid
,
username
);
//上线绑定
//上线绑定
relationBiz
.
bindByUserId
(
userid
,
small_id
);
relationBiz
.
bindByUserId
(
userid
,
small_id
);
//发送短信通知用户
//发送短信通知用户
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
//参加新人活动
jionActivity
(
userid
);
// 登录结果要做做统一处理
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
// 到im注册,获取返回结果
...
@@ -834,7 +870,8 @@ public class AppPermissionService {
...
@@ -834,7 +870,8 @@ public class AppPermissionService {
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
JSONObject
data
=
new
JSONObject
();
JSONObject
data
=
new
JSONObject
();
if
(
null
==
user
)
{
if
(
null
==
user
)
{
String
password
=
"12345678"
;
//随机生成密码
String
password
=
UUIDUtils
.
genCodes
(
8
);
data
=
applyRegister
(
username
,
password
,
headimgurl
,
nickname
,
small_id
);
data
=
applyRegister
(
username
,
password
,
headimgurl
,
nickname
,
small_id
);
}
else
{
}
else
{
Integer
userid
=
user
.
getId
();
Integer
userid
=
user
.
getId
();
...
@@ -850,6 +887,20 @@ public class AppPermissionService {
...
@@ -850,6 +887,20 @@ public class AppPermissionService {
}
}
}
}
public
ImiVo
findUserInoByImiId
(
Integer
imiId
)
{
ImiVo
imiVo
=
new
ImiVo
();
AppUserLogin
appUserLogin
=
appUserLoginBiz
.
findUserByImiId
(
imiId
);
if
(
appUserLogin
==
null
){
return
imiVo
;
}
Map
<
Integer
,
AppUserDetail
>
userIdAndAppUserDetail
=
appUserDetailBiz
.
findUserIdAndUserDetailMapByMemberIds
(
Arrays
.
asList
(
appUserLogin
.
getId
()));
AppUserDetail
appUserDetail
=
userIdAndAppUserDetail
.
get
(
appUserLogin
.
getId
());
imiVo
.
setNickname
(
appUserDetail
.
getNickname
());
imiVo
.
setHeadimgurl
(
appUserDetail
.
getHeadimgurl
());
return
imiVo
;
}
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
@Transactional
(
rollbackFor
=
Exception
.
class
,
propagation
=
Propagation
.
REQUIRED
)
public
void
insertUserMemberByUserIdAndPhone
(
Integer
userId
,
String
phone
)
throws
Exception
{
public
void
insertUserMemberByUserIdAndPhone
(
Integer
userId
,
String
phone
)
throws
Exception
{
List
<
BaseUserMemberExportDTO
>
memberExportDTOS
=
baseUserMemberExportBiz
.
findUserMemberExportDataByPhoneAndHashEffective
(
phone
);
List
<
BaseUserMemberExportDTO
>
memberExportDTOS
=
baseUserMemberExportBiz
.
findUserMemberExportDataByPhoneAndHashEffective
(
phone
);
...
@@ -910,7 +961,6 @@ public class AppPermissionService {
...
@@ -910,7 +961,6 @@ public class AppPermissionService {
}
}
}
}
/**
/**
* @author libin
* @author libin
* @version 1.0.0
* @version 1.0.0
...
@@ -922,4 +972,5 @@ public class AppPermissionService {
...
@@ -922,4 +972,5 @@ public class AppPermissionService {
public
static
final
String
BASE_DATA
=
"data"
;
public
static
final
String
BASE_DATA
=
"data"
;
public
static
final
String
CITY_NAME
=
"city"
;
public
static
final
String
CITY_NAME
=
"city"
;
}
}
}
}
ace-modules/ace-admin/src/main/resources/mapper/AppUserDetailMapper.xml
View file @
bf1936ab
...
@@ -56,7 +56,6 @@
...
@@ -56,7 +56,6 @@
d.isdel,
d.isdel,
d.nickname,
d.nickname,
d.source,
d.source,
d.Inviter_account as inviterAccount,
d.province_code as provinceCode,
d.province_code as provinceCode,
d.city_code as cityCode,
d.city_code as cityCode,
d.sex,
d.sex,
...
@@ -69,12 +68,18 @@
...
@@ -69,12 +68,18 @@
m.rent_free_days as rentFreeDays,
m.rent_free_days as rentFreeDays,
m.crt_time as timeOfMembership,
m.crt_time as timeOfMembership,
m.recent_recharge as recentRecharge,
m.recent_recharge as recentRecharge,
m.name as memberName
m.name as memberName,
ul.username as inviter
from
from
app_user_login l
app_user_login l
left join
left join
app_user_detail d
app_user_detail d
on d.userid = l.id
on
d.userid = l.id
left join
app_user_login ul
on
ul.id=d.inviter_account
left join
left join
(
(
select
select
...
@@ -89,10 +94,13 @@
...
@@ -89,10 +94,13 @@
) m
) m
on
on
l.id = m.user_id
l.id = m.user_id
where 1=1
where 1=1
<if
test=
"mobile !=null"
>
<if
test=
"mobile !=null"
>
and l.username
=#{mobile}
and l.username
like CONCAT('%',#{mobile},'%')
</if>
</if>
<if
test=
"channel !=null"
>
<if
test=
"channel !=null"
>
and d.channel=#{channel}
and d.channel=#{channel}
...
@@ -107,7 +115,7 @@
...
@@ -107,7 +115,7 @@
and l.createtime
<
= #{registrationTimeEnd}
and l.createtime
<
= #{registrationTimeEnd}
</if>
</if>
<if
test=
"source !=null"
>
<if
test=
"source !=null"
>
and d.source
<
= #{source}
and d.source = #{source}
</if>
</if>
order by l.id ASC
order by l.id ASC
...
...
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/ActivityRule.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Data
@Table
(
name
=
"activity_rule"
)
public
class
ActivityRule
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 活动名称
*/
@Column
(
name
=
"name"
)
@ApiModelProperty
(
value
=
"活动名称"
)
private
String
name
;
/**
* 活动描述
*/
@Column
(
name
=
"descr"
)
@ApiModelProperty
(
value
=
"活动描述"
)
private
String
descr
;
/**
* 活动人数限制
*/
@Column
(
name
=
"number"
)
@ApiModelProperty
(
value
=
"活动人数限制"
)
private
Integer
number
;
/**
* 参加活动人数
*/
@Column
(
name
=
"join_number"
)
@ApiModelProperty
(
value
=
"参加活动人数"
)
private
Integer
joinNumber
;
/**
* 活动是否开启:0-未开启;1-已开启;2-已关闭
*/
@Column
(
name
=
"status"
)
@ApiModelProperty
(
value
=
"活动是否开启:0-未开启;1-已开启;2-已关闭"
)
private
Integer
status
;
/**
* 活动奖励规则,json数组格式 [{"type":1, "detail":{...}},...] //// type分类 1--现金;
*/
@Column
(
name
=
"value"
)
@ApiModelProperty
(
value
=
"活动奖励规则,json数组格式 [{type:1, detail:{...}},...] //// type分类 1--现金;"
)
private
String
value
;
/**
* 创建时间
*/
@Column
(
name
=
"crt_time"
)
@ApiModelProperty
(
value
=
"创建时间"
,
hidden
=
true
)
private
Long
crtTime
;
/**
* 更新时间
*/
@Column
(
name
=
"upd_time"
)
@ApiModelProperty
(
value
=
"更新时间"
,
hidden
=
true
)
private
Long
updTime
;
/**
* 是否删除:0-正常;1-删除
*/
@Column
(
name
=
"is_del"
)
@ApiModelProperty
(
value
=
"是否删除:0-正常;1-删除"
)
private
Integer
isDel
;
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/entity/ActivityUserJoin.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
entity
;
import
java.io.Serializable
;
import
java.util.Date
;
import
javax.persistence.*
;
import
io.swagger.annotations.ApiModelProperty
;
import
lombok.Data
;
/**
* 用户活动参与表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Data
@Table
(
name
=
"activity_user_join"
)
public
class
ActivityUserJoin
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
* 主键id
*/
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
@ApiModelProperty
(
"主键id"
)
private
Integer
id
;
/**
* 用户id
*/
@Column
(
name
=
"user_id"
)
@ApiModelProperty
(
value
=
"用户id"
)
private
Integer
userId
;
/**
* 活动规则id
*/
@Column
(
name
=
"activity_id"
)
@ApiModelProperty
(
value
=
"活动规则id"
)
private
Integer
activityId
;
/**
* 状态:0-已参与;1-已领取
*/
@Column
(
name
=
"status"
)
@ApiModelProperty
(
value
=
"状态:0-已参与;1-已领取"
)
private
Integer
status
;
/**
* 参与时间
*/
@Column
(
name
=
"crt_time"
)
@ApiModelProperty
(
value
=
"参与时间"
,
hidden
=
true
)
private
Long
crtTime
;
/**
* 领取时间
*/
@Column
(
name
=
"upd_time"
)
@ApiModelProperty
(
value
=
"领取时间"
,
hidden
=
true
)
private
Long
updTime
;
}
xx-activity/xx-activity-api/src/main/java/com/xxfc/platform/activity/feign/ActivityFeign.java
View file @
bf1936ab
...
@@ -36,4 +36,8 @@ public interface ActivityFeign {
...
@@ -36,4 +36,8 @@ public interface ActivityFeign {
@RequestMapping
(
value
=
"/user/cancelUse"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/user/cancelUse"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
cancelUse
(
@RequestParam
(
value
=
"TickerNo"
,
defaultValue
=
""
)
String
TickerNo
);
public
ObjectRestResponse
cancelUse
(
@RequestParam
(
value
=
"TickerNo"
,
defaultValue
=
""
)
String
TickerNo
);
@ApiOperation
(
"新人有礼参加活动"
)
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
join
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
);
}
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityRuleBiz.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.entity.ActivityRule
;
import
com.xxfc.platform.activity.mapper.ActivityRuleMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
tk.mybatis.mapper.entity.Example
;
import
java.util.List
;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Service
public
class
ActivityRuleBiz
extends
BaseBiz
<
ActivityRuleMapper
,
ActivityRule
>
{
//获取最新的生效的活动
public
ActivityRule
getActity
(){
Example
example
=
new
Example
(
ActivityRule
.
class
);
example
.
createCriteria
().
andEqualTo
(
"status"
,
1
).
andEqualTo
(
"isDel"
,
0
);
example
.
orderBy
(
"id desc"
);
List
<
ActivityRule
>
list
=
mapper
.
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
return
list
.
get
(
0
);
}
return
null
;
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/ActivityUserJoinBiz.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
biz
;
import
com.alibaba.fastjson.JSONArray
;
import
com.alibaba.fastjson.JSONObject
;
import
com.xxfc.platform.activity.entity.ActivityRule
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.xxfc.platform.activity.entity.ActivityUserJoin
;
import
com.xxfc.platform.activity.mapper.ActivityUserJoinMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
/**
* 用户活动参与表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
@Service
@Slf4j
public
class
ActivityUserJoinBiz
extends
BaseBiz
<
ActivityUserJoinMapper
,
ActivityUserJoin
>
{
@Autowired
ActivityRuleBiz
ruleBiz
;
@Autowired
UserCouponBiz
userCouponBiz
;
//注册参与活动
public
void
joinActivity
(
Integer
userId
){
ActivityRule
rule
=
ruleBiz
.
getActity
();
if
(
rule
==
null
){
log
.
error
(
"----没有开启的活动----"
);
return
;
}
Integer
joinNumber
=
rule
.
getJoinNumber
()==
null
?
0
:
rule
.
getJoinNumber
();
Integer
number
=
rule
.
getNumber
()==
null
?
0
:
rule
.
getNumber
();
if
(
joinNumber
>=
number
){
log
.
error
(
"----活动已超过参与人数----number==="
+
number
);
return
;
}
Integer
activityId
=
rule
.
getId
();
ActivityUserJoin
userJoin
=
new
ActivityUserJoin
();
userJoin
.
setActivityId
(
activityId
);
userJoin
.
setUserId
(
userId
);
Long
num
=
selectCount
(
userJoin
);
if
(
num
!=
null
||
num
>
0
){
log
.
error
(
"----用户已经参与活动----userId===="
+
userId
);
return
;
}
insertSelective
(
userJoin
);
}
//领取优惠卷
public
void
receiveCoupn
(
Integer
userId
)
{
ActivityRule
rule
=
ruleBiz
.
getActity
();
if
(
rule
==
null
)
{
log
.
error
(
"----没有开启的活动----"
);
return
;
}
Integer
activityId
=
rule
.
getId
();
ActivityUserJoin
userJoin
=
new
ActivityUserJoin
();
userJoin
.
setActivityId
(
activityId
);
userJoin
.
setUserId
(
userId
);
Long
num
=
selectCount
(
userJoin
);
if
(
num
==
null
||
num
==
0
)
{
log
.
error
(
"----用户没有此参与活动----userId===="
+
userId
);
return
;
}
String
value
=
rule
.
getValue
();
JSONObject
json
=
JSONObject
.
parseObject
(
value
);
if
(
json
!=
null
){
Integer
type
=
json
.
getInteger
(
"type"
);
if
(
type
==
1
){
JSONArray
array
=
json
.
getJSONArray
(
"value"
);
if
(
array
.
size
()>
0
){
for
(
int
i
=
0
;
i
<
array
.
size
();
i
++){
Integer
id
=
array
.
getJSONObject
(
i
).
getInteger
(
"id"
);
userCouponBiz
.
userLedCoupon
(
userId
,
id
);
}
}
}
}
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/biz/UserCouponBiz.java
View file @
bf1936ab
...
@@ -48,14 +48,33 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
...
@@ -48,14 +48,33 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
return
null
;
return
null
;
}
}
Integer
couponId
=
coupon
.
getId
();
Integer
couponId
=
coupon
.
getId
();
Example
example
=
new
Example
(
UserCoupon
.
class
);
boolean
falg
=
checkUserLed
(
userId
,
couponId
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
couponId
);
if
(
falg
){
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
log
.
error
(
userId
+
"----已领优惠卷"
);
if
(
list
.
size
()>
0
){
return
null
;
}
return
led
(
coupon
,
userId
);
}
//用户领劵
public
String
userLedCoupon
(
Integer
userId
,
Integer
couponId
){
Coupon
coupon
=
couponBiz
.
selectById
(
couponId
);
if
(
coupon
==
null
||
coupon
.
getIsDel
()!=
0
||
coupon
.
getStatus
()!=
1
){
log
.
error
(
userId
+
"----无可领取优惠卷"
);
return
null
;
}
boolean
falg
=
checkUserLed
(
userId
,
couponId
);
if
(
falg
){
log
.
error
(
userId
+
"----已领优惠卷"
);
log
.
error
(
userId
+
"----已领优惠卷"
);
return
null
;
return
null
;
}
}
return
led
(
coupon
,
userId
);
}
//领取动作
public
String
led
(
Coupon
coupon
,
Integer
userId
){
int
type
=
coupon
.
getValidType
();
int
type
=
coupon
.
getValidType
();
Integer
couponId
=
coupon
.
getId
();
Long
expireTime
=
System
.
currentTimeMillis
();
Long
expireTime
=
System
.
currentTimeMillis
();
Long
startTime
=
0L
;
Long
startTime
=
0L
;
if
(
type
==
1
){
if
(
type
==
1
){
...
@@ -74,7 +93,18 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
...
@@ -74,7 +93,18 @@ public class UserCouponBiz extends BaseBiz<UserCouponMapper, UserCoupon> {
userCoupon
.
setExpireTime
(
expireTime
);
userCoupon
.
setExpireTime
(
expireTime
);
insertSelective
(
userCoupon
);
insertSelective
(
userCoupon
);
return
ticker_no
;
return
ticker_no
;
}
//检查用户是否领卷
public
boolean
checkUserLed
(
Integer
userId
,
Integer
id
){
Example
example
=
new
Example
(
UserCoupon
.
class
);
example
.
createCriteria
().
andEqualTo
(
"userId"
,
userId
).
andEqualTo
(
"couponId"
,
id
);
List
<
UserCoupon
>
list
=
selectByExample
(
example
);
if
(
list
.
size
()>
0
){
log
.
error
(
userId
+
"----已领优惠卷"
);
return
true
;
}
return
false
;
}
}
//获取我的优惠卷
//获取我的优惠卷
...
...
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/ActivityRuleMapper.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
mapper
;
import
com.xxfc.platform.activity.entity.ActivityRule
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* 通用活动规则表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
public
interface
ActivityRuleMapper
extends
Mapper
<
ActivityRule
>
{
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/mapper/ActivityUserJoinMapper.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
mapper
;
import
com.xxfc.platform.activity.entity.ActivityUserJoin
;
import
tk.mybatis.mapper.common.Mapper
;
/**
* 用户活动参与表
*
* @author zjw
* @email 18178966185@163.com
* @date 2019-07-16 14:04:22
*/
public
interface
ActivityUserJoinMapper
extends
Mapper
<
ActivityUserJoin
>
{
}
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/ActivityUserJoinController.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
activity
.
rest
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.activity.biz.ActivityUserJoinBiz
;
import
com.xxfc.platform.activity.entity.ActivityUserJoin
;
import
io.swagger.annotations.ApiOperation
;
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
;
@RestController
@RequestMapping
(
"join"
)
public
class
ActivityUserJoinController
extends
BaseController
<
ActivityUserJoinBiz
,
ActivityUserJoin
>
{
@ApiOperation
(
"新人有礼参加活动"
)
@RequestMapping
(
value
=
"/user"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
join
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
){
baseBiz
.
joinActivity
(
userId
);
return
ObjectRestResponse
.
succ
();
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/CouponController.java
View file @
bf1936ab
...
@@ -10,4 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
...
@@ -10,4 +10,6 @@ import org.springframework.web.bind.annotation.RestController;
@RequestMapping
(
"coupon"
)
@RequestMapping
(
"coupon"
)
public
class
CouponController
extends
BaseController
<
CouponBiz
,
Coupon
>
{
public
class
CouponController
extends
BaseController
<
CouponBiz
,
Coupon
>
{
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/java/com/xxfc/platform/activity/rest/UserCouponController.java
View file @
bf1936ab
...
@@ -3,9 +3,11 @@ package com.xxfc.platform.activity.rest;
...
@@ -3,9 +3,11 @@ package com.xxfc.platform.activity.rest;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.activity.biz.ActivityUserJoinBiz
;
import
com.xxfc.platform.activity.biz.UserCouponBiz
;
import
com.xxfc.platform.activity.biz.UserCouponBiz
;
import
com.xxfc.platform.activity.vo.UserCouponVo
;
import
com.xxfc.platform.activity.vo.UserCouponVo
;
import
io.swagger.annotations.ApiOperation
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.bind.annotation.*
;
@RestController
@RestController
...
@@ -13,6 +15,10 @@ import org.springframework.web.bind.annotation.*;
...
@@ -13,6 +15,10 @@ import org.springframework.web.bind.annotation.*;
public
class
UserCouponController
extends
ActivityBaseController
<
UserCouponBiz
>
{
public
class
UserCouponController
extends
ActivityBaseController
<
UserCouponBiz
>
{
@Autowired
ActivityUserJoinBiz
joinBiz
;
@ApiOperation
(
"用户自动领取新人卷"
)
@ApiOperation
(
"用户自动领取新人卷"
)
@RequestMapping
(
value
=
"/auth/led"
,
method
=
RequestMethod
.
POST
)
@RequestMapping
(
value
=
"/auth/led"
,
method
=
RequestMethod
.
POST
)
public
String
led
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
)
{
public
String
led
(
@RequestParam
(
value
=
"userId"
,
defaultValue
=
"0"
)
Integer
userId
)
{
...
@@ -56,6 +62,18 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
...
@@ -56,6 +62,18 @@ public class UserCouponController extends ActivityBaseController<UserCouponBiz>
return
ObjectRestResponse
.
succ
();
return
ObjectRestResponse
.
succ
();
}
}
@ApiOperation
(
"领取优惠卷"
)
@RequestMapping
(
value
=
"/coupon/led"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
led
()
{
AppUserDTO
userInfo
=
getUserInfo
();
Integer
userId
=
userInfo
.
getId
();
if
(
userId
==
null
)
{
return
ObjectRestResponse
.
createDefaultFail
();
}
joinBiz
.
receiveCoupn
(
userId
);
return
ObjectRestResponse
.
succ
();
}
}
}
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/ActivityRuleMapper.xml
0 → 100644
View file @
bf1936ab
<?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.xxfc.platform.activity.mapper.ActivityRuleMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.activity.entity.ActivityRule"
id=
"activityRuleMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"name"
column=
"name"
/>
<result
property=
"descr"
column=
"descr"
/>
<result
property=
"number"
column=
"number"
/>
<result
property=
"joinNumber"
column=
"join_number"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"value"
column=
"value"
/>
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
<result
property=
"isDel"
column=
"is_del"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-activity/xx-activity-server/src/main/resources/mapper/ActivityUserJoinMapper.xml
0 → 100644
View file @
bf1936ab
<?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.xxfc.platform.activity.mapper.ActivityUserJoinMapper"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.xxfc.platform.activity.entity.ActivityUserJoin"
id=
"activityUserJoinMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"userId"
column=
"user_id"
/>
<result
property=
"activityId"
column=
"activity_id"
/>
<result
property=
"status"
column=
"status"
/>
<result
property=
"crtTime"
column=
"crt_time"
/>
<result
property=
"updTime"
column=
"upd_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/OrderRentVehicleDetail.java
View file @
bf1936ab
...
@@ -294,4 +294,11 @@ public class OrderRentVehicleDetail implements Serializable {
...
@@ -294,4 +294,11 @@ public class OrderRentVehicleDetail implements Serializable {
@ApiModelProperty
(
value
=
"是否购买免赔"
)
@ApiModelProperty
(
value
=
"是否购买免赔"
)
private
Integer
damageSafe
;
private
Integer
damageSafe
;
/**
* 是否处理违章 0--未处理;1--已处理
*/
@ApiModelProperty
(
value
=
"是否购买免赔"
)
@Column
(
name
=
"handel_violation"
)
private
Integer
handelViolation
;
}
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/entity/OrderViolation.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
order
.
entity
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
lombok.Data
;
import
org.springframework.format.annotation.DateTimeFormat
;
import
javax.persistence.Column
;
import
javax.persistence.GeneratedValue
;
import
javax.persistence.Id
;
import
java.util.Date
;
@Data
public
class
OrderViolation
{
@Id
@GeneratedValue
(
generator
=
"JDBC"
)
private
Integer
id
;
/**
* 违章总金额
*/
@Column
(
name
=
"price"
)
private
Double
price
;
/**
* 租车订单id
*/
@Column
(
name
=
"detail_id"
)
private
Integer
detailId
;
/**
* 违章截图
*/
@Column
(
name
=
"picture"
)
private
String
picture
;
/**
* 创建人id
*/
@Column
(
name
=
"crt_user_id"
)
private
Integer
crtUserId
;
/**
* 创建人姓名
*/
@Column
(
name
=
"crt_name"
)
private
String
crtName
;
/**
* 创建人host
*/
@Column
(
name
=
"crt_host"
)
private
String
crtHost
;
/**
* 创建时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd:HH:mm:ss"
,
timezone
=
"GMT+8"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd:HH:mm:ss"
)
@Column
(
name
=
"crt_time"
)
private
Date
crtTime
;
/**
* 修改时间
*/
@JsonFormat
(
pattern
=
"yyyy-MM-dd:HH:mm:ss"
,
timezone
=
"GMT+8"
)
@DateTimeFormat
(
pattern
=
"yyyy-MM-dd:HH:mm:ss"
)
@Column
(
name
=
"upd_time"
)
private
Date
updTime
;
/**
* 修改人id
*/
@Column
(
name
=
"upd_user_id"
)
private
Integer
updUserId
;
/**
* 修改人姓名
*/
@Column
(
name
=
"upd_name"
)
private
String
updName
;
/**
* 修改人host
*/
@Column
(
name
=
"upd_host"
)
private
String
updHost
;
/**
* 是否已删除:0-否,1-是
*/
@Column
(
name
=
"is_del"
)
private
Integer
isDel
;
}
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/pojo/order/QueryOrderDTO.java
View file @
bf1936ab
...
@@ -12,6 +12,9 @@ public class QueryOrderDTO extends PageParam {
...
@@ -12,6 +12,9 @@ public class QueryOrderDTO extends PageParam {
@ApiModelProperty
(
hidden
=
false
)
@ApiModelProperty
(
hidden
=
false
)
private
Integer
crtUser
;
private
Integer
crtUser
;
@ApiModelProperty
(
hidden
=
false
)
private
Integer
userId
;
@ApiModelProperty
(
hidden
=
false
)
@ApiModelProperty
(
hidden
=
false
)
private
Integer
crtCompanyId
;
private
Integer
crtCompanyId
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderTourVerificationBiz.java
View file @
bf1936ab
...
@@ -16,6 +16,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
...
@@ -16,6 +16,7 @@ import com.xxfc.platform.vehicle.entity.BranchCompany;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
import
java.time.Instant
;
import
java.util.List
;
import
java.util.List
;
/**
/**
...
@@ -49,6 +50,13 @@ public class OrderTourVerificationBiz{
...
@@ -49,6 +50,13 @@ public class OrderTourVerificationBiz{
return
PageDataVO
.
pageInfo
(
page
,
limit
,()->
verificationMapper
.
pageByParm
(
verificationId
));
return
PageDataVO
.
pageInfo
(
page
,
limit
,()->
verificationMapper
.
pageByParm
(
verificationId
));
}
}
/**
*
* @param no 订单号
* @param list 分公司列表
* @param userDTO
* @return
*/
//核销
//核销
public
ObjectRestResponse
VerificationByOrder
(
String
no
,
List
<
BranchCompany
>
list
,
UserDTO
userDTO
){
public
ObjectRestResponse
VerificationByOrder
(
String
no
,
List
<
BranchCompany
>
list
,
UserDTO
userDTO
){
BaseOrder
baseOrder
=
new
BaseOrder
();
BaseOrder
baseOrder
=
new
BaseOrder
();
...
@@ -79,6 +87,17 @@ public class OrderTourVerificationBiz{
...
@@ -79,6 +87,17 @@ public class OrderTourVerificationBiz{
}
}
}
}
}
}
// 出发时间 是否已经发车
Long
departureTime
=
tourFeign
.
selectDepartureTimeByStartCompanyIdAndRouteId
(
tourDetail
.
getStartCompanyId
(),
tourDetail
.
getGoodId
());
if
(
Instant
.
now
().
toEpochMilli
()<
departureTime
){
return
ObjectRestResponse
.
createFailedResultWithObj
(
400
,
"还未到发车时间"
,
0
);
}
Integer
departureStatus
=
tourFeign
.
selectDepartureStatusByVerificationId
(
verificationId
);
if
(
departureStatus
==
1
){
return
ObjectRestResponse
.
createFailedResultWithObj
(
400
,
"已经发车"
,
1
);
}
baseOrder
=
new
BaseOrder
();
baseOrder
=
new
BaseOrder
();
baseOrder
.
setId
(
orderId
);
baseOrder
.
setId
(
orderId
);
baseOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_FINISH
.
getCode
());
baseOrder
.
setStatus
(
OrderStatusEnum
.
ORDER_FINISH
.
getCode
());
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/OrderViolationBiz.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
order
.
biz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.order.entity.OrderRentVehicleDetail
;
import
com.xxfc.platform.order.entity.OrderViolation
;
import
com.xxfc.platform.order.mapper.OrderRentVehicleDetailMapper
;
import
com.xxfc.platform.order.mapper.OrderViolationMapper
;
import
com.xxfc.platform.vehicle.common.RestResponse
;
import
com.xxfc.platform.vehicle.constant.RedisKey
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.io.FileUtils
;
import
org.joda.time.DateTime
;
import
org.joda.time.format.DateTimeFormat
;
import
org.joda.time.format.DateTimeFormatter
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpStatus
;
import
org.springframework.http.MediaType
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.IOException
;
import
java.util.concurrent.TimeUnit
;
/**订单违章记录biz
* @author Administrator
*/
@Service
@Slf4j
public
class
OrderViolationBiz
extends
BaseBiz
<
OrderViolationMapper
,
OrderViolation
>
{
@Autowired
private
OrderRentVehicleDetailMapper
detailMapper
;
@Value
(
"order.violation.upload"
)
private
String
ovUpload
;
public
static
final
DateTimeFormatter
DEFAULT_DATE_TIME_FORMATTER
=
DateTimeFormat
.
forPattern
(
"yyyy-MM-dd"
);
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 保存违章记录
* @param orderViolation
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
insertOrderViolation
(
OrderViolation
orderViolation
)
{
OrderRentVehicleDetail
orderRentVehicleDetail
=
new
OrderRentVehicleDetail
();
orderRentVehicleDetail
.
setId
(
orderViolation
.
getDetailId
());
orderRentVehicleDetail
.
setHandelViolation
(
0
);
mapper
.
insertSelective
(
orderViolation
);
detailMapper
.
updateByPrimaryKeySelective
(
orderRentVehicleDetail
);
}
/**
* 修改违章记录
* @param orderViolation
*/
@Transactional
(
rollbackFor
=
Exception
.
class
)
public
void
updateOrderViolation
(
OrderViolation
orderViolation
)
{
OrderRentVehicleDetail
orderRentVehicleDetail
=
detailMapper
.
selectByPrimaryKey
(
orderViolation
.
getDetailId
());
if
(
orderRentVehicleDetail
.
getHandelViolation
()==
0
)
{
mapper
.
updateByPrimaryKeySelective
(
orderViolation
);
}
else
{
throw
new
BaseException
(
"The violation has been dealt with and cannot be modified"
);
}
}
public
ObjectRestResponse
uploadViolation
(
MultipartFile
file
)
throws
IOException
{
DateTime
now
=
DateTime
.
now
();
String
dirPathToday
=
File
.
separator
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
String
redisNoKey
=
RedisKey
.
UPLOAD_FILE_NO_PREFIX
+
now
.
toString
(
DEFAULT_DATE_TIME_FORMATTER
);
Long
no
=
redisTemplate
.
opsForValue
().
increment
(
redisNoKey
);
if
(
no
.
equals
(
1L
)){
redisTemplate
.
expire
(
redisNoKey
,
1
,
TimeUnit
.
DAYS
);
}
String
fileName
=
file
.
getOriginalFilename
();
String
realFileRelPath
=
dirPathToday
+
File
.
separator
+
no
+
fileName
.
substring
(
fileName
.
lastIndexOf
(
"."
));
String
filePath
=
ovUpload
+
realFileRelPath
;
FileUtils
.
copyInputStreamToFile
(
file
.
getInputStream
(),
new
File
(
filePath
));
return
ObjectRestResponse
.
succ
(
filePath
);
}
/**
* 下载行驶证图片
* @param realFileRelPath
* @return
* @throws Exception
*/
public
ResponseEntity
<
byte
[]>
downloadViolation
(
String
realFileRelPath
)
throws
Exception
{
String
filePath
=
ovUpload
+
realFileRelPath
;
File
file
=
new
File
(
filePath
);
//新建一个文件
HttpHeaders
headers
=
new
HttpHeaders
();
//http头信息
String
downloadFileName
=
new
String
(
file
.
getName
());
//设置编码
headers
.
setContentDispositionFormData
(
"attachment"
,
downloadFileName
);
headers
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM
);
return
new
ResponseEntity
<
byte
[]>(
FileUtils
.
readFileToByteArray
(
file
),
headers
,
HttpStatus
.
CREATED
);
}
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/mapper/OrderViolationMapper.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
order
.
mapper
;
import
com.xxfc.platform.order.entity.OrderViolation
;
import
tk.mybatis.mapper.common.Mapper
;
public
interface
OrderViolationMapper
extends
Mapper
<
OrderViolation
>
{
}
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/BaseOrderController.java
View file @
bf1936ab
...
@@ -186,6 +186,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes
...
@@ -186,6 +186,7 @@ public class BaseOrderController extends CommonBaseController implements UserRes
if
(
startResponse
.
getData
()
!=
null
)
{
if
(
startResponse
.
getData
()
!=
null
)
{
orderPageVO
.
setStartCompanyName
(
startResponse
.
getData
().
getName
());
orderPageVO
.
setStartCompanyName
(
startResponse
.
getData
().
getName
());
}
}
ObjectRestResponse
<
CompanyDetail
>
restResponse
=
vehicleFeign
.
getCompanyDetail
(
orderPageVO
.
getOrderRentVehicleDetail
().
getEndCompanyId
());
ObjectRestResponse
<
CompanyDetail
>
restResponse
=
vehicleFeign
.
getCompanyDetail
(
orderPageVO
.
getOrderRentVehicleDetail
().
getEndCompanyId
());
if
(
restResponse
.
getData
()
!=
null
)
{
if
(
restResponse
.
getData
()
!=
null
)
{
orderPageVO
.
setEndCompanyName
(
restResponse
.
getData
().
getName
());
orderPageVO
.
setEndCompanyName
(
restResponse
.
getData
().
getName
());
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderTourVerificationController.java
View file @
bf1936ab
...
@@ -79,11 +79,4 @@ public class OrderTourVerificationController extends CommonBaseController {
...
@@ -79,11 +79,4 @@ public class OrderTourVerificationController extends CommonBaseController {
public
ObjectRestResponse
list
(
@RequestBody
TourGoodOrderFindVo
tourGoodOrderFindVo
)
{
public
ObjectRestResponse
list
(
@RequestBody
TourGoodOrderFindVo
tourGoodOrderFindVo
)
{
return
verificationBiz
.
getVerifications
(
tourGoodOrderFindVo
);
return
verificationBiz
.
getVerifications
(
tourGoodOrderFindVo
);
}
}
}
}
\ No newline at end of file
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderViolationController.java
0 → 100644
View file @
bf1936ab
package
com
.
xxfc
.
platform
.
order
.
rest
;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.UserDTO
;
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.common.util.process.ResultCode
;
import
com.xxfc.platform.order.biz.OrderViolationBiz
;
import
com.xxfc.platform.order.entity.OrderViolation
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.Assert
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
javax.servlet.http.HttpServletRequest
;
import
java.util.Date
;
import
java.util.List
;
/**
* 订单违章表
*
* @author Administrator
*/
@RestController
@RequestMapping
(
"orderViolation"
)
public
class
OrderViolationController
extends
BaseController
<
OrderViolationBiz
,
OrderViolation
>
{
@Autowired
private
UserFeign
userFeign
;
private
Long
MAX_DRIVING_LICENSE_SIZE
=
1024
*
1024
*
50L
;
private
final
String
FILE_TYPE
=
"JPG"
;
/**
* 获取操作用户信息
*/
private
UserDTO
getUserDTO
()
{
ObjectRestResponse
<
UserDTO
>
orrUserDTO
=
userFeign
.
userinfoByToken
(
request
.
getHeader
(
"Authorization"
));
if
(
orrUserDTO
==
null
||
orrUserDTO
.
getData
()
==
null
||
orrUserDTO
.
getData
().
getId
()
==
null
)
{
throw
new
BaseException
(
"This user does not exist"
);
}
UserDTO
userDTOD
=
orrUserDTO
.
getData
();
return
userDTOD
;
}
/**
* 保存违章记录
*
* @param orderViolation
* @param request
* @return
*/
@PostMapping
(
"/saveOrderViolation"
)
public
ObjectRestResponse
saveOrderViolation
(
@RequestBody
OrderViolation
orderViolation
,
HttpServletRequest
request
)
{
UserDTO
userDTOD
=
getUserDTO
();
orderViolation
.
setCrtHost
(
request
.
getRemoteHost
());
orderViolation
.
setCrtName
(
userDTOD
.
getName
());
orderViolation
.
setCrtUserId
(
userDTOD
.
getId
());
orderViolation
.
setCrtTime
(
new
Date
());
getBaseBiz
().
insertOrderViolation
(
orderViolation
);
return
ObjectRestResponse
.
succ
();
}
/**
* 通过订单id查询违章记录
*
* @param detailId
* @return
*/
@GetMapping
(
"/getOne/{detailId}"
)
public
ObjectRestResponse
<
OrderViolation
>
getOne
(
@PathVariable
Integer
detailId
)
{
Example
exa
=
Example
.
builder
(
OrderViolation
.
class
)
.
where
(
WeekendSqls
.<
OrderViolation
>
custom
().
andEqualTo
(
OrderViolation:
:
getDetailId
,
detailId
)
.
andEqualTo
(
OrderViolation:
:
getIsDel
,
0
)).
build
();
List
<
OrderViolation
>
orderViolations
=
getBaseBiz
().
selectByExample
(
exa
);
if
(
orderViolations
.
size
()
>
1
)
{
throw
new
BaseException
(
"The database has multiple records"
);
}
OrderViolation
orderViolation
=
new
OrderViolation
();
orderViolation
=(
orderViolations
.
size
()==
0
)?
null
:
orderViolations
.
get
(
0
);
return
ObjectRestResponse
.
succ
(
orderViolation
);
}
/**
* 保存修改违章记录
*
* @param orderViolation
* @param request
* @return
*/
@PutMapping
(
"/updateOrderViolation"
)
public
ObjectRestResponse
updateOrderViolation
(
@RequestBody
OrderViolation
orderViolation
,
HttpServletRequest
request
)
{
UserDTO
userDTOD
=
getUserDTO
();
orderViolation
.
setUpdHost
(
request
.
getRemoteHost
());
orderViolation
.
setUpdName
(
userDTOD
.
getName
());
orderViolation
.
setUpdUserId
(
userDTOD
.
getId
());
orderViolation
.
setUpdTime
(
new
Date
());
getBaseBiz
().
updateOrderViolation
(
orderViolation
);
return
ObjectRestResponse
.
succ
();
}
@PostMapping
(
value
=
"/upload/violation"
)
public
ObjectRestResponse
uploadViolation
(
@RequestParam
(
"file"
)
MultipartFile
file
)
throws
Exception
{
Assert
.
notNull
(
file
);
//文件类型
String
contentType
=
file
.
getContentType
();
if
(!
FILE_TYPE
.
equalsIgnoreCase
(
contentType
)||
"png"
.
equalsIgnoreCase
(
contentType
))
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"Picture format error"
);
}
if
(
file
.
getSize
()
>
MAX_DRIVING_LICENSE_SIZE
)
{
return
ObjectRestResponse
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
"Picture is too large"
);
}
return
baseBiz
.
uploadViolation
(
file
);
}
@GetMapping
(
value
=
"/download/Violation/{realFileRelPath}"
)
//匹配的是href中的download请求
public
ResponseEntity
<
byte
[]>
downloadViolation
(
@RequestParam
(
"realFileRelPath"
)
String
realFileRelPath
)
throws
Exception
{
return
baseBiz
.
downloadViolation
(
realFileRelPath
);
}
}
xx-order/xx-order-server/src/main/resources/mapper/orderViolationMapper.xml
0 → 100644
View file @
bf1936ab
<?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.xxfc.platform.order.mapper.OrderViolationMapper"
>
</mapper>
\ No newline at end of file
xx-tour/xx-tour-api/src/main/java/com/xxfc/platform/tour/feign/TourFeign.java
View file @
bf1936ab
...
@@ -94,4 +94,10 @@ public interface TourFeign {
...
@@ -94,4 +94,10 @@ public interface TourFeign {
//获取商品信息
//获取商品信息
@RequestMapping
(
value
=
"/good/app/unauth/one"
,
method
=
RequestMethod
.
GET
)
@RequestMapping
(
value
=
"/good/app/unauth/one"
,
method
=
RequestMethod
.
GET
)
public
TourGood
one
(
@RequestParam
(
value
=
"goodId"
,
defaultValue
=
"0"
)
Integer
goodId
);
public
TourGood
one
(
@RequestParam
(
value
=
"goodId"
,
defaultValue
=
"0"
)
Integer
goodId
);
@GetMapping
(
"/tourGoodSite/departure_time"
)
Long
selectDepartureTimeByStartCompanyIdAndRouteId
(
@RequestParam
(
value
=
"companyId"
)
Integer
companyId
,
@RequestParam
(
value
=
"goodId"
)
Integer
routeId
);
@GetMapping
(
"/tourGood/verfication/departure_status"
)
Integer
selectDepartureStatusByVerificationId
(
@RequestParam
(
value
=
"verificationId"
)
Integer
verificationId
);
}
}
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodSiteBiz.java
View file @
bf1936ab
...
@@ -21,4 +21,12 @@ public class TourGoodSiteBiz extends BaseBiz<TourGoodSiteMapper,TourGoodSite> {
...
@@ -21,4 +21,12 @@ public class TourGoodSiteBiz extends BaseBiz<TourGoodSiteMapper,TourGoodSite> {
//删除站点
//删除站点
public
void
delGoodSite
(
Integer
goodId
,
List
<
Integer
>
ids
){
mapper
.
delSite
(
goodId
,
ids
);}
public
void
delGoodSite
(
Integer
goodId
,
List
<
Integer
>
ids
){
mapper
.
delSite
(
goodId
,
ids
);}
public
Long
selectDepartureTimeByStartCompanyIdAndRouteId
(
Integer
companyId
,
Integer
routeId
)
{
TourGoodSite
tourGoodSite
=
new
TourGoodSite
();
tourGoodSite
.
setCompanyId
(
companyId
);
tourGoodSite
.
setGoodId
(
routeId
);
TourGoodSite
site
=
mapper
.
selectOne
(
tourGoodSite
);
return
site
.
getDepartTime
();
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodVerificationBiz.java
View file @
bf1936ab
...
@@ -9,9 +9,7 @@ import com.xxfc.platform.tour.entity.TourGoodVerification;
...
@@ -9,9 +9,7 @@ import com.xxfc.platform.tour.entity.TourGoodVerification;
import
com.xxfc.platform.tour.mapper.TourGoodVerificationMapper
;
import
com.xxfc.platform.tour.mapper.TourGoodVerificationMapper
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
com.github.wxiaoqi.security.common.biz.BaseBiz
;
import
java.text.DateFormat
;
import
java.text.SimpleDateFormat
;
import
java.text.SimpleDateFormat
;
import
java.time.LocalTime
;
import
java.util.*
;
import
java.util.*
;
/**
/**
...
@@ -85,4 +83,11 @@ public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,
...
@@ -85,4 +83,11 @@ public class TourGoodVerificationBiz extends BaseBiz<TourGoodVerificationMapper,
return
mapper
.
updateTourGoodPerNumbs
(
verficationId
,
properties
,
number
);
return
mapper
.
updateTourGoodPerNumbs
(
verficationId
,
properties
,
number
);
}
}
public
Integer
selectDepartureStatusByVerificationId
(
Integer
verificationId
)
{
TourGoodVerification
tourGoodVerification
=
new
TourGoodVerification
();
tourGoodVerification
.
setId
(
verificationId
);
TourGoodVerification
verfication
=
mapper
.
selectByPrimaryKey
(
tourGoodVerification
);
return
verfication
.
getStatus
();
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodSiteController.java
View file @
bf1936ab
...
@@ -3,11 +3,19 @@ package com.xxfc.platform.tour.rest;
...
@@ -3,11 +3,19 @@ package com.xxfc.platform.tour.rest;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.github.wxiaoqi.security.common.rest.BaseController
;
import
com.xxfc.platform.tour.biz.TourGoodSiteBiz
;
import
com.xxfc.platform.tour.biz.TourGoodSiteBiz
;
import
com.xxfc.platform.tour.entity.TourGoodSite
;
import
com.xxfc.platform.tour.entity.TourGoodSite
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RequestParam
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.RestController
;
@RestController
@RestController
@RequestMapping
(
"tourGoodSite"
)
@RequestMapping
(
"tourGoodSite"
)
public
class
TourGoodSiteController
extends
BaseController
<
TourGoodSiteBiz
,
TourGoodSite
>
{
public
class
TourGoodSiteController
extends
BaseController
<
TourGoodSiteBiz
,
TourGoodSite
>
{
@GetMapping
(
"/departure_time"
)
public
Long
selectDepartureTimeByStartCompanyIdAndRouteId
(
@RequestParam
(
value
=
"companyId"
)
Integer
companyId
,
@RequestParam
(
value
=
"goodId"
)
Integer
routeId
){
return
baseBiz
.
selectDepartureTimeByStartCompanyIdAndRouteId
(
companyId
,
routeId
);
}
}
}
\ No newline at end of file
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodVerificationController.java
View file @
bf1936ab
...
@@ -62,4 +62,9 @@ public class TourGoodVerificationController extends BaseController<TourGoodVerif
...
@@ -62,4 +62,9 @@ public class TourGoodVerificationController extends BaseController<TourGoodVerif
}
}
return
ObjectRestResponse
.
createDefaultFail
();
return
ObjectRestResponse
.
createDefaultFail
();
}
}
@GetMapping
(
"/departure_status"
)
public
Integer
selectDepartureStatusByVerificationId
(
@RequestParam
(
value
=
"verificationId"
)
Integer
verificationId
){
return
baseBiz
.
selectDepartureStatusByVerificationId
(
verificationId
);
}
}
}
\ No newline at end of file
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
View file @
bf1936ab
...
@@ -73,4 +73,12 @@ public interface VehicleFeign {
...
@@ -73,4 +73,12 @@ public interface VehicleFeign {
*/
*/
@GetMapping
(
value
=
"/vehicleModel/goodList"
)
@GetMapping
(
value
=
"/vehicleModel/goodList"
)
List
<
GoodDataVO
>
goodList
(
@RequestParam
(
value
=
"page"
)
Integer
page
,
@RequestParam
(
"limit"
)
Integer
limit
);
List
<
GoodDataVO
>
goodList
(
@RequestParam
(
value
=
"page"
)
Integer
page
,
@RequestParam
(
"limit"
)
Integer
limit
);
/**
* 根据一个id获取城市
* @param id
* @return
*/
@GetMapping
(
"/sysRegion/getSysRegionById/{id}"
)
RestResponse
getSysRegionById
(
@PathVariable
Integer
id
);
}
}
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/SysRegionController.java
View file @
bf1936ab
...
@@ -75,4 +75,23 @@ public class SysRegionController extends BaseController<SysRegionBiz> {
...
@@ -75,4 +75,23 @@ public class SysRegionController extends BaseController<SysRegionBiz> {
}
}
/**
* 根据一个id获取城市
* @param id
* @return
*/
@GetMapping
(
"/getSysRegionById/{id}"
)
public
RestResponse
getSysRegionById
(
@PathVariable
Integer
id
){
Example
exam
=
Example
.
builder
(
SysRegion
.
class
)
.
where
(
WeekendSqls
.<
SysRegion
>
custom
()
.
andEqualTo
(
SysRegion:
:
getId
,
id
)).
build
();
List
<
SysRegion
>
sysRegions
=
baseBiz
.
selectByExample
(
exam
);
if
(
sysRegions
==
null
||
sysRegions
.
size
()!=
1
)
{
RestResponse
.
suc
();
}
return
RestResponse
.
suc
(
sysRegions
.
get
(
0
));
}
}
}
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