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
7c4029ad
Commit
7c4029ad
authored
Jul 02, 2019
by
hanfeng
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'base-modify' of
http://10.5.52.3/youjj/cloud-platform
into base-modify
parents
d6baf64d
22a69e1d
Changes
36
Hide whitespace changes
Inline
Side-by-side
Showing
36 changed files
with
640 additions
and
120 deletions
+640
-120
AuthController.java
...thub/wxiaoqi/security/auth/controller/AuthController.java
+6
-2
IUserService.java
.../com/github/wxiaoqi/security/auth/feign/IUserService.java
+6
-6
AuthService.java
...com/github/wxiaoqi/security/auth/service/AuthService.java
+4
-4
AppAuthServiceImpl.java
...xiaoqi/security/auth/service/impl/AppAuthServiceImpl.java
+2
-2
AuthServiceImpl.java
...b/wxiaoqi/security/auth/service/impl/AuthServiceImpl.java
+2
-2
BaseException.java
...thub/wxiaoqi/security/common/exception/BaseException.java
+6
-0
IntervalUtil.java
...com/github/wxiaoqi/security/common/util/IntervalUtil.java
+146
-0
ResultCode.java
...thub/wxiaoqi/security/common/util/process/ResultCode.java
+2
-0
BaseUserMemberBiz.java
.../github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
+1
-1
AppUserRest.java
...va/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
+11
-2
AppPermissionService.java
...aoqi/security/admin/rpc/service/AppPermissionService.java
+84
-6
BaseUserMemberMapper.xml
...-admin/src/main/resources/mapper/BaseUserMemberMapper.xml
+2
-0
AppVersion.java
...rc/main/java/com/xxfc/platform/app/entity/AppVersion.java
+7
-0
OrderStatusEnum.java
...xfc/platform/order/contant/enumerate/OrderStatusEnum.java
+1
-1
BaseOrderBiz.java
...c/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
+77
-15
OrderRentVehicleController.java
.../xxfc/platform/order/rest/OrderRentVehicleController.java
+1
-0
AbstractOrderHandle.java
.../com/xxfc/platform/order/service/AbstractOrderHandle.java
+4
-0
OrderMemberService.java
...a/com/xxfc/platform/order/service/OrderMemberService.java
+3
-2
OrderRentVehicleService.java
.../xxfc/platform/order/service/OrderRentVehicleService.java
+34
-31
OrderTourService.java
...ava/com/xxfc/platform/order/service/OrderTourService.java
+26
-7
TourGoodBiz.java
...src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
+7
-1
TourGoodMapper.java
...in/java/com/xxfc/platform/tour/mapper/TourGoodMapper.java
+2
-0
TourGoodController.java
.../java/com/xxfc/platform/tour/rest/TourGoodController.java
+1
-1
TourGoodMapper.xml
...-tour-server/src/main/resources/mapper/TourGoodMapper.xml
+20
-16
DictionaryKey.java
...a/com/xxfc/platform/universal/constant/DictionaryKey.java
+31
-0
ThirdFeign.java
...in/java/com/xxfc/platform/universal/feign/ThirdFeign.java
+12
-3
RentViolationDTO.java
...java/com/xxfc/platform/universal/vo/RentViolationDTO.java
+12
-0
ViolationVO.java
...main/java/com/xxfc/platform/universal/vo/ViolationVO.java
+10
-0
DictionaryBiz.java
...n/java/com/xxfc/platform/universal/biz/DictionaryBiz.java
+19
-6
DictionaryController.java
...c/platform/universal/controller/DictionaryController.java
+7
-0
SmsController.java
...com/xxfc/platform/universal/controller/SmsController.java
+7
-0
TrafficViolationsController.java
...orm/universal/controller/TrafficViolationsController.java
+13
-1
SmsService.java
.../java/com/xxfc/platform/universal/service/SmsService.java
+57
-2
VehicleFeign.java
...in/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
+8
-2
VehicleBiz.java
...c/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
+6
-1
VehicleController.java
...ava/com/xxfc/platform/vehicle/rest/VehicleController.java
+3
-6
No files found.
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/controller/AuthController.java
View file @
7c4029ad
...
...
@@ -174,6 +174,7 @@ public class AuthController {
*/
@PostMapping
(
value
=
"/applet/uid/login"
)
public
JSONObject
appletLoginByUserId
(
@RequestParam
(
"userId"
)
Integer
userId
)
throws
Exception
{
log
.
info
(
userId
+
"----require appletLoginByUserId..."
);
JSONObject
data
=
appAuthService
.
appletLoginByUserId
(
userId
);
if
(
data
!=
null
&&
data
.
getInteger
(
"status"
)==
ResultCode
.
SUCCESS_CODE
){
JSONObject
result
=
data
.
getJSONObject
(
"data"
);
...
...
@@ -188,8 +189,11 @@ public class AuthController {
}
@PostMapping
(
value
=
"/applet/registry"
)
public
JSONObject
registryWithApplet
(
@RequestParam
(
"username"
)
String
phone
,
@RequestParam
(
"password"
)
String
pwd
,
@RequestParam
(
"mobilecode"
)
String
code
)
throws
Exception
{
JSONObject
data
=
appAuthService
.
appletRegistry
(
phone
,
pwd
,
code
);
public
JSONObject
registryWithApplet
(
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"nickname"
,
defaultValue
=
""
)
String
nickname
,
@RequestParam
(
value
=
"headimgurl"
,
defaultValue
=
""
)
String
headimgurl
)
throws
Exception
{
JSONObject
data
=
appAuthService
.
appletRegistry
(
username
,
nickname
,
headimgurl
);
if
(
data
!=
null
&&
data
.
getInteger
(
"status"
)==
ResultCode
.
SUCCESS_CODE
){
JSONObject
result
=
data
.
getJSONObject
(
"data"
);
if
(
result
==
null
){
...
...
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/feign/IUserService.java
View file @
7c4029ad
...
...
@@ -54,16 +54,16 @@ public interface IUserService {
* @param userid
* @return
*/
@
PostMapping
(
"/api/app/applet/uid/login"
)
JSONObject
appletLogin
(
@RequestParam
(
value
=
"userid"
)
Integer
userid
);
@
RequestMapping
(
value
=
"/api/app/applet/uid/login"
,
method
=
RequestMethod
.
POST
)
public
JSONObject
appletLogin
(
@RequestParam
(
value
=
"userid"
)
Integer
userid
);
/**
* 小程序注册
* @param
phon
e
* @param
pwd
* @param
code
* @param
usernam
e
* @param
nickname
* @param
headimgurl
* @return
*/
@PostMapping
(
"/api/app/applet/registry"
)
JSONObject
appletRegistry
(
@RequestParam
(
value
=
"phone"
)
String
phone
,
@RequestParam
(
"pwd"
)
String
pwd
,
@RequestParam
(
"code"
)
String
code
);
public
JSONObject
appletRegistry
(
@RequestParam
(
value
=
"username"
)
String
username
,
@RequestParam
(
value
=
"nickname"
)
String
nickname
,
@RequestParam
(
value
=
"headimgurl"
)
String
headimgurl
);
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/AuthService.java
View file @
7c4029ad
...
...
@@ -27,10 +27,10 @@ public interface AuthService {
/**
* 通过小程序注册
* @param
phon
e
* @param
pwd
* @param
cod
e
* @param
usernam
e
* @param
headimgurl
* @param
nicknam
e
* @return
*/
JSONObject
appletRegistry
(
String
phone
,
String
pwd
,
String
cod
e
);
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nicknam
e
);
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/impl/AppAuthServiceImpl.java
View file @
7c4029ad
...
...
@@ -92,8 +92,8 @@ public class AppAuthServiceImpl implements AuthService {
}
@Override
public
JSONObject
appletRegistry
(
String
phone
,
String
pwd
,
String
cod
e
)
{
return
userService
.
appletRegistry
(
phone
,
pwd
,
cod
e
);
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nicknam
e
)
{
return
userService
.
appletRegistry
(
username
,
headimgurl
,
nicknam
e
);
}
}
ace-auth/ace-auth-server/src/main/java/com/github/wxiaoqi/security/auth/service/impl/AuthServiceImpl.java
View file @
7c4029ad
...
...
@@ -90,7 +90,7 @@ public class AuthServiceImpl implements AuthService {
}
@Override
public
JSONObject
appletRegistry
(
String
phone
,
String
pwd
,
String
cod
e
)
{
return
userService
.
appletRegistry
(
phone
,
pwd
,
cod
e
);
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nicknam
e
)
{
return
userService
.
appletRegistry
(
username
,
headimgurl
,
nicknam
e
);
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/exception/BaseException.java
View file @
7c4029ad
...
...
@@ -4,6 +4,7 @@ import com.github.wxiaoqi.security.common.constant.RestCode;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
java.util.Map
;
import
java.util.Set
;
/**
* Created by ace on 2017/9/8.
...
...
@@ -57,4 +58,9 @@ public class BaseException extends RuntimeException {
super
(
ResultCode
.
getMsg
(
code
)
+
(
map
==
null
?
""
:
map
.
toString
()));
this
.
status
=
code
;
}
public
BaseException
(
int
code
,
Set
<
String
>
set
)
{
super
(
ResultCode
.
getMsg
(
code
)+
(
set
==
null
?
""
:
set
.
toString
()));
this
.
status
=
code
;
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/IntervalUtil.java
0 → 100644
View file @
7c4029ad
package
com
.
github
.
wxiaoqi
.
security
.
common
.
util
;
import
org.apache.commons.jexl2.Expression
;
import
org.apache.commons.jexl2.JexlContext
;
import
org.apache.commons.jexl2.JexlEngine
;
import
org.apache.commons.jexl2.MapContext
;
import
javax.script.ScriptEngine
;
import
javax.script.ScriptEngineManager
;
import
java.util.Map
;
/**
*
* @ClassName: IntervalUtil
* @author: kangyl17909
* @date: 2018年7月3日
*/
public
class
IntervalUtil
{
/**
* 判断data_value是否在interval区间范围内
* @author: kangyl17909
* @date: 2018年7月3日
* @param data_value 数值类型的
* @param interval 正常的数学区间,包括无穷大等,如:(1,3)、>5%、(-∞,6]、(125%,135%)U(70%,80%)
* @return true:表示data_value在区间interval范围内,false:表示data_value不在区间interval范围内
*/
public
boolean
isInTheInterval
(
String
data_value
,
String
interval
)
{
//将区间和data_value转化为可计算的表达式
String
formula
=
getFormulaByAllInterval
(
data_value
,
interval
,
"||"
);
ScriptEngine
jse
=
new
ScriptEngineManager
().
getEngineByName
(
"JavaScript"
);
try
{
//计算表达式
return
(
Boolean
)
jse
.
eval
(
formula
);
}
catch
(
Exception
t
)
{
return
false
;
}
}
/**
* 将所有阀值区间转化为公式:如
* [75,80) =》 date_value < 80 && date_value >= 75
* (125%,135%)U(70%,80%) =》 (date_value < 1.35 && date_value > 1.25) || (date_value < 0.8 && date_value > 0.7)
* @param date_value
* @param interval 形式如:(125%,135%)U(70%,80%)
* @param connector 连接符 如:") || ("
*/
private
String
getFormulaByAllInterval
(
String
date_value
,
String
interval
,
String
connector
)
{
StringBuffer
buff
=
new
StringBuffer
();
for
(
String
limit:
interval
.
split
(
"U"
)){
//如:(125%,135%)U (70%,80%)
buff
.
append
(
"("
).
append
(
getFormulaByInterval
(
date_value
,
limit
,
" && "
)).
append
(
")"
).
append
(
connector
);
}
String
allLimitInvel
=
buff
.
toString
();
int
index
=
allLimitInvel
.
lastIndexOf
(
connector
);
allLimitInvel
=
allLimitInvel
.
substring
(
0
,
index
);
return
allLimitInvel
;
}
/**
* 将整个阀值区间转化为公式:如
* 145) =》 date_value < 145
* [75,80) =》 date_value < 80 && date_value >= 75
* @param date_value
* @param interval 形式如:145)、[75,80)
* @param connector 连接符 如:&&
*/
private
String
getFormulaByInterval
(
String
date_value
,
String
interval
,
String
connector
)
{
StringBuffer
buff
=
new
StringBuffer
();
for
(
String
halfInterval:
interval
.
split
(
","
)){
//如:[75,80)、≥80
buff
.
append
(
getFormulaByHalfInterval
(
halfInterval
,
date_value
)).
append
(
connector
);
}
String
limitInvel
=
buff
.
toString
();
int
index
=
limitInvel
.
lastIndexOf
(
connector
);
limitInvel
=
limitInvel
.
substring
(
0
,
index
);
return
limitInvel
;
}
/**
* 将半个阀值区间转化为公式:如
* 145) =》 date_value < 145
* ≥80% =》 date_value >= 0.8
* [130 =》 date_value >= 130
* <80% =》 date_value < 0.8
* @param halfInterval 形式如:145)、≥80%、[130、<80%
* @param date_value
* @return date_value < 145
*/
private
String
getFormulaByHalfInterval
(
String
halfInterval
,
String
date_value
)
{
halfInterval
=
halfInterval
.
trim
();
if
(
halfInterval
.
contains
(
"∞"
)){
//包含无穷大则不需要公式
return
"1 == 1"
;
}
StringBuffer
formula
=
new
StringBuffer
();
String
data
=
""
;
String
opera
=
""
;
if
(
halfInterval
.
matches
(
"^([<>≤≥\\[\\(]{1}(-?\\d+.?\\d*\\%?))$"
)){
//表示判断方向(如>)在前面 如:≥80%
opera
=
halfInterval
.
substring
(
0
,
1
);
data
=
halfInterval
.
substring
(
1
);
}
else
{
//[130、145)
opera
=
halfInterval
.
substring
(
halfInterval
.
length
()-
1
);
data
=
halfInterval
.
substring
(
0
,
halfInterval
.
length
()-
1
);
}
double
value
=
dealPercent
(
data
);
formula
.
append
(
date_value
).
append
(
" "
).
append
(
opera
).
append
(
" "
).
append
(
value
);
String
a
=
formula
.
toString
();
//转化特定字符
return
a
.
replace
(
"["
,
">="
).
replace
(
"("
,
">"
).
replace
(
"]"
,
"<="
).
replace
(
")"
,
"<"
).
replace
(
"≤"
,
"<="
).
replace
(
"≥"
,
">="
);
}
/**
* 去除百分号,转为小数
* @param str 可能含百分号的数字
* @return
*/
private
double
dealPercent
(
String
str
){
double
d
=
0.0
;
if
(
str
.
contains
(
"%"
)){
str
=
str
.
substring
(
0
,
str
.
length
()-
1
);
d
=
Double
.
parseDouble
(
str
)/
100
;
}
else
{
d
=
Double
.
parseDouble
(
str
);
}
return
d
;
}
public
static
boolean
staticIsInTheInterval
(
String
data_value
,
String
interval
)
{
return
new
IntervalUtil
().
isInTheInterval
(
data_value
,
interval
);
}
public
static
Object
evaluate
(
String
expression
,
JexlContext
jexlContext
)
{
Expression
e
=
new
JexlEngine
().
createExpression
(
expression
);
return
e
.
evaluate
(
jexlContext
);
}
public
static
Object
evaluate
(
String
expression
,
Map
<
String
,
Object
>
jexlContextMap
)
{
Expression
e
=
new
JexlEngine
().
createExpression
(
expression
);
JexlContext
jexlContext
=
new
MapContext
();
jexlContextMap
.
forEach
((
k
,
v
)
->
jexlContext
.
set
(
k
,
v
));
return
e
.
evaluate
(
jexlContext
);
}
public
static
void
main
(
String
[]
args
)
{
IntervalUtil
a
=
new
IntervalUtil
();
System
.
out
.
println
(
a
.
isInTheInterval
(
"6"
,
"(-∞,6]"
));
}
}
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/ResultCode.java
View file @
7c4029ad
...
...
@@ -6,7 +6,9 @@ import com.github.wxiaoqi.security.common.util.SystemProperty;
public
class
ResultCode
{
////////////////////////////参数相关///////////////////////////
//参数非法,请修改
public
static
int
PARAM_ILLEGAL_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"PARAM_ILLEGAL_CODE"
));
//参数时效已过时,不能使用
public
static
int
PARAM_EXPIRE_CODE
=
Integer
.
valueOf
(
SystemProperty
.
getResultConfig
(
"PARAM_EXPIRE_CODE"
));
// 操作成功
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/biz/BaseUserMemberBiz.java
View file @
7c4029ad
...
...
@@ -37,7 +37,7 @@ public class BaseUserMemberBiz extends BaseBiz<BaseUserMemberMapper,BaseUserMemb
//更新会员信息
@Override
@CacheClear
(
key
=
"user:member{1.user
i
d}"
)
@CacheClear
(
key
=
"user:member{1.user
I
d}"
)
public
void
updateSelectiveById
(
BaseUserMember
userMember
){
super
.
updateSelectiveById
(
userMember
);}
...
...
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/AppUserRest.java
View file @
7c4029ad
...
...
@@ -183,8 +183,17 @@ public class AppUserRest {
@PostMapping
(
"/applet/registry"
)
public
JSONObject
appletRegistry
(
@RequestParam
(
value
=
"phone"
)
String
phone
,
@RequestParam
(
"pwd"
)
String
pwd
,
@RequestParam
(
"code"
)
String
code
){
return
appPermissionService
.
appletRegistry
(
phone
,
pwd
,
code
);
public
JSONObject
appletRegistry
(
@RequestParam
(
value
=
"username"
,
defaultValue
=
""
)
String
username
,
@RequestParam
(
value
=
"nickname"
,
defaultValue
=
""
)
String
nickname
,
@RequestParam
(
value
=
"headimgurl"
,
defaultValue
=
""
)
String
headimgurl
){
if
(
StringUtils
.
isBlank
(
headimgurl
)){
headimgurl
=
SystemConfig
.
USER_HEADER_URL_DEFAULT
;
}
if
(
StringUtils
.
isBlank
(
nickname
)){
nickname
=
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
);
}
return
appPermissionService
.
appletRegistry
(
username
,
headimgurl
,
nickname
);
}
}
ace-modules/ace-admin/src/main/java/com/github/wxiaoqi/security/admin/rpc/service/AppPermissionService.java
View file @
7c4029ad
...
...
@@ -245,7 +245,6 @@ public class AppPermissionService {
data
.
put
(
"imToken"
,
access_token
);
data
.
put
(
"imUserId"
,
imUserId
);
}
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
else
{
...
...
@@ -672,22 +671,101 @@ public class AppPermissionService {
/**
*通过小程序注册
* 小程序注册用户
*
* @param username
* @param password
* @param mobilecode
* @param headimgurl
* @param nickname
*/
@Transactional
public
JSONObject
applyRegister
(
String
username
,
String
password
,
String
headimgurl
,
String
nickname
)
{
// 判断参数
if
(
StringUtils
.
isBlank
(
username
)
||
StringUtils
.
isBlank
(
password
))
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
// 是否已存在
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
if
(
null
!=
user
)
{
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXIST_CODE
,
"用户已存在"
);
}
// 新增用户登录信息
try
{
Long
now
=
System
.
currentTimeMillis
()
/
1000
;
AppUserLogin
appUserLogin
=
new
AppUserLogin
();
appUserLogin
.
setUsername
(
username
);
appUserLogin
.
setPassword
(
password
);
appUserLogin
.
setIsdel
(
0
);
appUserLogin
.
setStatus
(
0
);
appUserLogin
.
setCreatetime
(
now
);
appUserLogin
.
setUpdatetime
(
now
);
appUserLoginBiz
.
insertSelective
(
appUserLogin
);
Integer
userid
=
appUserLogin
.
getId
();
log
.
error
(
"注册:新增登陆用户信息: "
+
userid
);
// 新增用户详情
AppUserDetail
rsUserDetail
=
new
AppUserDetail
();
rsUserDetail
.
setUserid
(
userid
);
rsUserDetail
.
setNickname
(
nickname
);
rsUserDetail
.
setHeadimgurl
(
headimgurl
);
// 默认路径,待写
rsUserDetail
.
setCreatetime
(
now
);
rsUserDetail
.
setUpdatetime
(
now
);
rsUserDetail
.
setIsdel
(
0
);
appUserDetailBiz
.
insertSelective
(
rsUserDetail
);
log
.
error
(
"注册:新增用户详情: "
+
userid
);
//自动登录获取优惠卷
authCoupn
(
userid
);
//发送短信通知用户
thirdFeign
.
sendCode
(
username
,
password
,
SystemConfig
.
TEMPLATECODE
);
// 登录结果要做做统一处理
JSONObject
data
=
autoLogin
(
userid
,
username
,
headimgurl
,
nickname
);
// 到im注册,获取返回结果
Map
<
String
,
Object
>
map
=
registerIm
(
username
,
appUserLogin
.
getPassword
(),
nickname
);
if
(
map
!=
null
){
Integer
imUserId
=
Integer
.
parseInt
(
map
.
get
(
"userId"
).
toString
());
String
access_token
=
map
.
get
(
"access_token"
).
toString
();
String
imPassword
=
map
.
get
(
"password"
).
toString
();
if
(
imUserId
!=
null
&&
imUserId
>
0
&&
StringUtils
.
isNotBlank
(
imPassword
)){
AppUserLogin
userLogin
=
new
AppUserLogin
();
userLogin
.
setId
(
userid
);
userLogin
.
setImPassword
(
imPassword
);
userLogin
.
setImUserid
(
imUserId
);
userLogin
.
setUsername
(
username
);
appUserLoginBiz
.
updateSelectiveById
(
userLogin
);
log
.
info
(
username
+
"----userLogin updateSelectiveById---username====="
+
username
+
"----imPassword===="
+
imPassword
);
}
data
.
put
(
"imToken"
,
access_token
);
data
.
put
(
"imUserId"
,
imUserId
);
}
if
(
data
!=
null
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
data
);
}
else
{
return
JsonResultUtil
.
createDefaultFail
();
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXCEPTION_CODE
,
"出现异常"
);
}
}
/**
*通过小程序注册
* @param username
* @return
*/
public
JSONObject
appletRegistry
(
String
username
,
String
password
,
String
mobilecode
){
public
JSONObject
appletRegistry
(
String
username
,
String
headimgurl
,
String
nickname
){
try
{
// 是否已存在
AppUserLogin
user
=
appUserLoginBiz
.
checkeUserLogin
(
username
);
JSONObject
data
=
new
JSONObject
();
if
(
null
==
user
)
{
data
=
register
(
username
,
password
,
SystemConfig
.
USER_HEADER_URL_DEFAULT
,
SystemConfig
.
USER_NIKENAME_DEFAULT
+(
int
)((
Math
.
random
()*
9
+
1
)*
100000
),
mobilecode
,
null
,
null
,
0
);
String
password
=
"12345678"
;
data
=
applyRegister
(
username
,
password
,
headimgurl
,
nickname
);
}
else
{
data
=
login
(
username
,
null
,
mobilecode
,
2
);
data
=
appletLoginByUserId
(
user
.
getId
()
);
}
return
data
;
}
catch
(
Exception
e
)
{
...
...
ace-modules/ace-admin/src/main/resources/mapper/BaseUserMemberMapper.xml
View file @
7c4029ad
...
...
@@ -11,6 +11,8 @@
<result
property=
"memberLevel"
column=
"member_level"
/>
<result
property=
"cardLeave"
column=
"card_leave"
/>
<result
property=
"isBind"
column=
"is_bind"
/>
<result
property=
"payCount"
column=
"pay_count"
/>
<result
property=
"buyCount"
column=
"buy_count"
/>
<result
property=
"totalNumber"
column=
"total_number"
/>
<result
property=
"rentFreeDays"
column=
"rent_free_days"
/>
<result
property=
"validTime"
column=
"valid_time"
/>
...
...
xx-app/xx-app-api/src/main/java/com/xxfc/platform/app/entity/AppVersion.java
View file @
7c4029ad
...
...
@@ -74,6 +74,13 @@ public class AppVersion implements Serializable {
@Column
(
name
=
"download_switch"
)
@ApiModelProperty
(
value
=
"下载开关(0:可下载,1:不可下载)"
)
private
Integer
downloadSwitch
;
/**
* 下载开关(0:可下载,1:不可下载)
*/
@Column
(
name
=
"is_compel"
)
@ApiModelProperty
(
value
=
"是否强制:0-否;1-是"
)
private
Integer
isCompel
;
/**
* 权重
...
...
xx-order/xx-order-api/src/main/java/com/xxfc/platform/order/contant/enumerate/OrderStatusEnum.java
View file @
7c4029ad
...
...
@@ -8,7 +8,7 @@ public enum OrderStatusEnum {
ORDER_CRT
(
1
,
"创建订单"
),
ORDER_CANCEL
(
2
,
"取消订单"
),
ORDER_UNPAY
(
3
,
"待支付"
),
ORDER_TOSTART
(
4
,
"待进行(待出行)"
),
ORDER_TOSTART
(
4
,
"待进行(待出行
/租车已支付
)"
),
ORDER_WAIT
(
5
,
"出行中(进行中)"
),
ORDER_FINISH
(
6
,
"已完成"
),
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/biz/BaseOrderBiz.java
View file @
7c4029ad
...
...
@@ -6,6 +6,7 @@ import com.github.wxiaoqi.security.admin.feign.UserFeign;
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.github.wxiaoqi.security.common.util.IntervalUtil
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.google.common.collect.Lists
;
import
com.xxfc.platform.order.contant.enumerate.OrderStatusEnum
;
...
...
@@ -22,18 +23,19 @@ import com.xxfc.platform.vehicle.common.RestResponse;
import
com.xxfc.platform.vehicle.entity.VehicleUserLicense
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.jexl2.MapContext
;
import
org.apache.commons.lang3.StringUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.LinkedList
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
APP_ORDER
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
RENT_REFUND
;
/**
*
...
...
@@ -165,6 +167,7 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
* 取消订单
* @param baseOrder
*/
@Transactional
public
void
cancel
(
BaseOrder
baseOrder
)
{
if
(
cancelAble
.
get
(
baseOrder
.
getType
()).
contains
(
baseOrder
.
getStatus
()))
{
BaseOrder
updateOrder
=
new
BaseOrder
(){{
...
...
@@ -190,10 +193,14 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
}});
//退款流程
re
fundProcess
(
baseOrder
,
orvd
);
re
ntRefundProcess
(
baseOrder
,
orvd
.
getDeposit
(),
orvd
.
getStartTime
(),
APP_ORDER
+
"_"
+
RENT_REFUND
);
}
else
if
(
OrderTypeEnum
.
TOUR
.
getCode
().
equals
(
baseOrder
.
getType
()))
{
OrderTourDetail
otd
=
orderTourDetailBiz
.
selectOne
(
new
OrderTourDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
//退款流程
rentRefundProcess
(
baseOrder
,
otd
.
getStartTime
(),
APP_ORDER
+
"_"
+
RENT_REFUND
);
}
}
...
...
@@ -202,7 +209,15 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
OrderRentVehicleDetail
orvd
=
orderRentVehicleBiz
.
selectOne
(
new
OrderRentVehicleDetail
(){{
setOrderId
(
baseOrder
.
getId
());
}});
//取消租车预定
//已支付,并且是待出行状态,取消预约
if
(
OrderStatusEnum
.
ORDER_TOSTART
.
equals
(
baseOrder
.
getType
())
&&
SYS_TRUE
.
equals
(
baseOrder
.
getHasPay
())){
vehicleFeign
.
unbookVehicle
(
orvd
.
getBookRecordId
());
}
else
{
//未支付,拒绝之前的预约
vehicleFeign
.
rejectVehicleBooking
(
orvd
.
getBookRecordId
());
}
//取消租车免费天数使用
if
(
null
!=
orvd
.
getFreeDays
()
&&
orvd
.
getFreeDays
()
>
0
)
{
...
...
@@ -225,17 +240,64 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
}
}
private
void
refundProcess
(
BaseOrder
baseOrder
,
OrderRentVehicleDetail
orvd
)
{
private
void
rentRefundProcess
(
BaseOrder
baseOrder
,
Long
startTime
,
String
dicParentKey
){
rentRefundProcess
(
baseOrder
,
BigDecimal
.
ZERO
,
startTime
,
dicParentKey
);
}
private
void
rentRefundProcess
(
BaseOrder
baseOrder
,
BigDecimal
depositAmont
,
Long
startTime
,
String
dicParentKey
)
{
//计算退款金额
// 1、押金 + 租金(规则扣除)
BigDecimal
refundAmont
=
orvd
.
getDeposit
().
add
(
baseOrder
.
getGoodsAmount
());
String
refundTradeNo
=
thirdFeign
.
refund
(
new
OrderRefundVo
(){{
BigDecimal
refundGoodsAmount
=
baseOrder
.
getGoodsAmount
();
String
refundDesc
=
"取消订单退款:"
;
BigDecimal
refundGoodsAmont
=
baseOrder
.
getGoodsAmount
();
BigDecimal
refundAmont
=
BigDecimal
.
ZERO
;
if
(
null
==
depositAmont
)
{
depositAmont
=
BigDecimal
.
ZERO
;
}
//根据时间处理goodsAmount
//获取出发时间 到现在 距离时间
//LocalDateTime StartDay = LocalDateTime.ofInstant(Instant.ofEpochMilli(orvd.getStartTime()), ZoneOffset.ofHours(8));
Long
timeLag
=
startTime
-
System
.
currentTimeMillis
();
Integer
hourLag
=
Long
.
valueOf
(
timeLag
/(
1000L
*
60L
*
60L
)).
intValue
();
Map
<
String
,
com
.
xxfc
.
platform
.
universal
.
entity
.
Dictionary
>
dictionaryMap
=
thirdFeign
.
dictionaryGetAll4Map
().
getData
();
//APP_ORDER+ "_"+ RENT_REFUND
Set
<
com
.
xxfc
.
platform
.
universal
.
entity
.
Dictionary
>
rentRefunds
=
dictionaryMap
.
get
(
dicParentKey
).
getChildrens
();
for
(
com
.
xxfc
.
platform
.
universal
.
entity
.
Dictionary
dic
:
rentRefunds
)
{
if
(
StrUtil
.
isBlank
(
dic
.
getName
()))
{
continue
;
}
String
[]
names
=
dic
.
getName
().
split
(
"\\|"
);
if
(
names
.
length
<
2
)
{
continue
;
}
//符合范围
if
(
IntervalUtil
.
staticIsInTheInterval
(
hourLag
.
toString
(),
names
[
0
])){
refundGoodsAmont
=
new
BigDecimal
(((
Double
)
IntervalUtil
.
evaluate
(
dic
.
getDetail
(),
new
MapContext
(){{
set
(
"ga"
,
baseOrder
.
getGoodsAmount
());
}})).
toString
());
refundDesc
=
names
[
1
]+
","
+
refundDesc
;
break
;
}
}
refundAmont
=
depositAmont
.
add
(
refundGoodsAmont
);
OrderRefundVo
orv
=
new
OrderRefundVo
(){{
setAmount
(
baseOrder
.
getRealAmount
().
multiply
(
new
BigDecimal
(
"100"
)).
intValue
());
setRefundAmount
(
refundAmont
.
multiply
(
new
BigDecimal
(
"100"
)).
intValue
());
setOrderNo
(
baseOrder
.
getNo
());
setRefundDesc
(
"取消订单退款:"
+
refundAmont
.
toString
());
}}).
getData
();
}};
orv
.
setRefundDesc
(
refundDesc
+
refundAmont
.
toString
());
orv
.
setRefundAmount
(
refundAmont
.
multiply
(
new
BigDecimal
(
"100"
)).
intValue
());
String
refundTradeNo
=
thirdFeign
.
refund
(
orv
).
getData
();
//记录订单退款记录
addOrderRefund
(
baseOrder
.
getId
(),
refundDesc
,
refundAmont
,
refundTradeNo
);
}
private
void
addOrderRefund
(
Integer
orderId
,
String
refundDesc
,
BigDecimal
refundAmont
,
String
refundTradeNo
)
{
//如果返回的流水为空,则当做失败
Integer
refundStatus
=
SYS_TRUE
;
if
(
StrUtil
.
isBlank
(
refundTradeNo
))
{
...
...
@@ -244,13 +306,13 @@ public class BaseOrderBiz extends BaseBiz<BaseOrderMapper,BaseOrder> {
//创建订单退款记录
OrderRefund
orderRefund
=
new
OrderRefund
(){{
setOrderId
(
baseOrder
.
getId
());
setRefundAmount
(
refundAmont
);
setOrderId
(
orderId
);
setRefundTime
(
System
.
currentTimeMillis
());
setRefundDesc
(
"取消订单退款:"
+
refundAmont
.
toString
());
setTradeNo
(
refundTradeNo
);
setRefundType
(
RefundTypeEnum
.
RentVehicle
.
getCode
());
}};
orderRefund
.
setRefundAmount
(
refundAmont
);
orderRefund
.
setRefundDesc
(
refundDesc
);
orderRefund
.
setRefundStatus
(
refundStatus
);
orderRefundBiz
.
insertSelective
(
orderRefund
);
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/rest/OrderRentVehicleController.java
View file @
7c4029ad
...
...
@@ -74,6 +74,7 @@ public class OrderRentVehicleController extends CommonBaseController {
if
(
StrUtil
.
isNotBlank
(
BaseContextHandler
.
getToken
()))
{
bo
.
setAppUserDTO
(
userFeign
.
userDetailByToken
(
BaseContextHandler
.
getToken
()).
getData
());
}
orderRentVehicleService
.
initDetailSecond
(
bo
);
return
ObjectRestResponse
.
succ
(
orderRentVehicleService
.
calculatePrice
(
bo
));
}
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/AbstractOrderHandle.java
View file @
7c4029ad
...
...
@@ -13,10 +13,12 @@ import com.xxfc.platform.order.entity.BaseOrder;
import
com.xxfc.platform.order.entity.inter.OrderDetail
;
import
com.xxfc.platform.order.mqhandler.RabbitProduct
;
import
com.xxfc.platform.order.pojo.price.OrderPriceVO
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
java.math.BigDecimal
;
import
java.util.Map
;
@Transactional
public
abstract
class
AbstractOrderHandle
<
Biz
extends
BaseBiz
,
Detail
extends
OrderDetail
>{
...
...
@@ -26,6 +28,8 @@ public abstract class AbstractOrderHandle<Biz extends BaseBiz, Detail extends Or
@Autowired
protected
Biz
detailBiz
;
protected
Map
<
String
,
Dictionary
>
dictionaryMap
;
@Autowired
RabbitProduct
rabbitProduct
;
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderMemberService.java
View file @
7c4029ad
...
...
@@ -24,6 +24,7 @@ import javax.annotation.PostConstruct;
import
javax.servlet.http.HttpServletRequest
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.HashSet
;
@Service
@Log4j
...
...
@@ -69,8 +70,8 @@ public class OrderMemberService extends AbstractOrderHandle<OrderMemberDetailBiz
super
.
initDetail
(
bo
);
BaseUserMemberLevel
buml
=
userFeign
.
level
(
bo
.
getMemberLevel
());
if
(!
bo
.
getMemberLevelId
().
equals
(
buml
.
getId
()))
{
throw
new
BaseException
(
ResultCode
.
PARAM_ILLEGAL_CODE
,
new
Hash
Map
<
String
,
Object
>(){{
put
(
"MemberLevelId 和 MemberLevel"
,
"
不对称"
);
throw
new
BaseException
(
ResultCode
.
PARAM_ILLEGAL_CODE
,
new
Hash
Set
<
String
>(){{
add
(
"MemberLevelId 和 MemberLevel
不对称"
);
}});
}
bo
.
setBaseUserMemberLevel
(
buml
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderRentVehicleService.java
View file @
7c4029ad
...
...
@@ -20,7 +20,7 @@ import com.xxfc.platform.order.contant.enumerate.OrderTypeEnum;
import
com.xxfc.platform.order.entity.OrderTemplate
;
import
com.xxfc.platform.order.pojo.order.RentVehicleBO
;
import
com.xxfc.platform.order.pojo.price.RentVehiclePriceVO
;
import
com.xxfc.platform.universal.
entity.Dictionar
y
;
import
com.xxfc.platform.universal.
constant.DictionaryKe
y
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.vehicle.entity.VehicleBookRecord
;
import
com.xxfc.platform.vehicle.entity.VehicleModel
;
...
...
@@ -33,8 +33,10 @@ import org.springframework.stereotype.Service;
import
javax.annotation.PostConstruct
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
static
com
.
github
.
wxiaoqi
.
security
.
admin
.
constant
.
enumerate
.
MemberEnum
.*;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
APP_ORDER
;
@Service
@Log4j
...
...
@@ -47,6 +49,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
private
static
Integer
DISCOUNT_STATUS_NONE
=
0
;
private
static
Integer
DISCOUNT_STATUS_MEMBER
=
1
;
private
static
Integer
DISCOUNT_STATUS_FIXED
=
2
;
private
static
Long
autoCancelTime
;
@Autowired
VehicleFeign
vehicleFeign
;
...
...
@@ -72,23 +75,21 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
@Override
public
void
initDetail
(
RentVehicleBO
bo
)
{
super
.
initDetail
(
bo
);
initDetailSecond
(
bo
);
}
public
void
initDetailSecond
(
RentVehicleBO
bo
)
{
initDictionary
();
VehicleModel
vehicleModel
=
vehicleFeign
.
get
(
bo
.
getModelId
()).
getData
();
bo
.
setVehicleModel
(
vehicleModel
);
}
private
void
initDictionary
()
{
Dictionary
driverPriceDic
=
thirdFeign
.
dictionaryGet
(
BeanUtil
.
beanToMap
(
new
Dictionary
(){{
setType
(
"APP_ORDER"
);
setCode
(
"DRIVER_PRICE"
);
}},
false
,
true
)).
getData
().
get
(
0
);
Dictionary
damageSafeDic
=
thirdFeign
.
dictionaryGet
(
BeanUtil
.
beanToMap
(
new
Dictionary
(){{
setType
(
"APP_ORDER"
);
setCode
(
"DAMAGE_SAFE"
);
}},
false
,
true
)).
getData
().
get
(
0
);
this
.
DRIVER_PRICE
=
new
BigDecimal
(
driverPriceDic
.
getDetail
());
this
.
DAMAGE_SAFE
=
new
BigDecimal
(
damageSafeDic
.
getDetail
());
public
void
initDictionary
()
{
dictionaryMap
=
thirdFeign
.
dictionaryGetAll4Map
().
getData
();
this
.
autoCancelTime
=
Long
.
valueOf
(
dictionaryMap
.
get
(
APP_ORDER
+
"_"
+
DictionaryKey
.
ACT_RENT
).
getDetail
());
this
.
DRIVER_PRICE
=
new
BigDecimal
(
dictionaryMap
.
get
(
APP_ORDER
+
"_"
+
DictionaryKey
.
DRIVER_PRICE
).
getDetail
());
this
.
DAMAGE_SAFE
=
new
BigDecimal
(
dictionaryMap
.
get
(
APP_ORDER
+
"_"
+
DictionaryKey
.
DAMAGE_SAFE
).
getDetail
());
}
@Override
...
...
@@ -112,9 +113,8 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
super
.
handleDetail
(
bo
);
//发送定时取消订单(30分钟)
//rabbitProduct.sendDelayMessage(bo.getOrder(), 1000L * 60 * 30);
rabbitProduct
.
sendDelayMessage
(
bo
.
getOrder
(),
1000L
*
60
*
5
);
//发送定时取消订单(数据字典设置--5分钟)
rabbitProduct
.
sendDelayMessage
(
bo
.
getOrder
(),
autoCancelTime
);
}
@Override
...
...
@@ -139,8 +139,10 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
//如果用户存在,并且为会员,并且车辆有优惠价
if
(
null
!=
dto
&&
null
!=
detail
.
getRentFreeDay
()
&&
detail
.
getRentFreeDay
()
>
0
)
{
if
(
dto
.
getRentFreeDays
()
<=
0
)
{
throw
new
BaseException
(
ResultCode
.
PARAM_EXPIRE_CODE
);
if
(
null
==
dto
.
getRentFreeDays
()
||
dto
.
getRentFreeDays
()
<=
0
)
{
throw
new
BaseException
(
ResultCode
.
PARAM_EXPIRE_CODE
,
new
HashSet
<
String
>()
{{
add
(
"免费租车天数不存在或为0"
);
}});
}
if
(
detail
.
getDayNum
()
>
dto
.
getRentFreeDays
())
{
freeDayNum
=
dto
.
getRentFreeDays
();
...
...
@@ -194,25 +196,26 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
orderAmount
=
orderAmount
.
add
(
goodsAmount
).
add
(
vehicleModel
.
getDeposit
());
//生成订单明细
RentVehiclePriceVO
rvp
=
new
RentVehiclePriceVO
();
rvp
.
setOrderAmount
(
orderAmount
);
rvp
.
setGoodsAmount
(
goodsAmount
);
RentVehiclePriceVO
rvp
=
new
RentVehiclePriceVO
(){{
setOrderAmount
(
orderAmount
);
setGoodsAmount
(
goodsAmount
);
setRealAmount
(
orderAmount
);
setDeposit
(
vehicleModel
.
getDeposit
());
setDriverPrice
(
DRIVER_PRICE
);
setDamageSafePrice
(
DAMAGE_SAFE
);
setModelName
(
vehicleModel
.
getName
());
setDayNum
(
detail
.
getDayNum
());
setVehicleNum
(
1
);
setDriverNum
(
1
);
}};
rvp
.
setDriverAmount
(
driverAmount
);
rvp
.
setVehicleAmount
(
vehicleAmount
);
rvp
.
setDamageSafeAmount
(
damageSafeAmount
);
rvp
.
setRealAmount
(
orderAmount
);
rvp
.
setDeposit
(
vehicleModel
.
getDeposit
());
rvp
.
setModelAmount
(
modelAmount
);
rvp
.
setDriverPrice
(
DRIVER_PRICE
);
rvp
.
setDamageSafePrice
(
DAMAGE_SAFE
);
rvp
.
setModelName
(
vehicleModel
.
getName
());
rvp
.
setDayNum
(
detail
.
getDayNum
());
rvp
.
setVehicleDayNum
(
vehicleDayNum
);
rvp
.
setVehicleNum
(
1
);
rvp
.
setDriverNum
(
1
);
//设置收费明细
costDetail
(
rvp
,
handle
c
hildren
(
detail
,
vehicleDayNum
));
costDetail
(
rvp
,
handle
C
hildren
(
detail
,
vehicleDayNum
));
return
rvp
;
}
...
...
@@ -234,7 +237,7 @@ public class OrderRentVehicleService extends AbstractOrderHandle<OrderRentVehicl
return
modelAmount
;
}
private
String
handle
c
hildren
(
RentVehicleBO
detail
,
Integer
vehicleDayNum
)
{
private
String
handle
C
hildren
(
RentVehicleBO
detail
,
Integer
vehicleDayNum
)
{
StringBuffer
childrenStr
=
new
StringBuffer
(
""
);
if
(
vehicleDayNum
>
0
)
{
childrenStr
.
append
(
",${tem_0101}"
);
...
...
xx-order/xx-order-server/src/main/java/com/xxfc/platform/order/service/OrderTourService.java
View file @
7c4029ad
...
...
@@ -6,7 +6,9 @@ import cn.hutool.core.util.StrUtil;
import
com.github.wxiaoqi.security.admin.feign.UserFeign
;
import
com.github.wxiaoqi.security.admin.feign.dto.AppUserDTO
;
import
com.github.wxiaoqi.security.auth.client.config.UserAuthConfig
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.xxfc.platform.order.biz.OrderCostDetailBiz
;
import
com.xxfc.platform.order.biz.OrderTemplateBiz
;
import
com.xxfc.platform.order.biz.OrderTourDetailBiz
;
...
...
@@ -22,6 +24,8 @@ import com.xxfc.platform.tour.entity.TourGoodVerification;
import
com.xxfc.platform.tour.entity.TourUser
;
import
com.xxfc.platform.tour.feign.TourFeign
;
import
com.xxfc.platform.tour.vo.TourSpePriceVo
;
import
com.xxfc.platform.universal.constant.DictionaryKey
;
import
com.xxfc.platform.universal.feign.ThirdFeign
;
import
com.xxfc.platform.vehicle.entity.SysRegion
;
import
com.xxfc.platform.vehicle.feign.VehicleFeign
;
import
com.xxfc.platform.vehicle.pojo.CompanyDetail
;
...
...
@@ -34,11 +38,12 @@ import javax.servlet.http.HttpServletRequest;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.stream.Collectors
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_FALSE
;
import
static
com
.
github
.
wxiaoqi
.
security
.
common
.
constant
.
CommonConstants
.
SYS_TRUE
;
import
static
com
.
xxfc
.
platform
.
universal
.
constant
.
DictionaryKey
.
APP_ORDER
;
@Service
@Log4j
...
...
@@ -49,13 +54,13 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Autowired
VehicleFeign
vehicleFeign
;
private
static
Integer
IS_CHILD
=
1
;
private
static
Integer
LEVEL_DEFAULT
=
0
;
private
static
Integer
NUMBER_ZERO
=
0
;
private
static
BigDecimal
INSURE_PRICE
=
new
BigDecimal
(
"5.00"
);
//保险
private
static
BigDecimal
INSURE_PRICE
;
private
static
Long
autoCancelTime
;
//= new BigDecimal("5.00"); //保险
@Autowired
OrderCostDetailBiz
orderCostDetailBiz
;
...
...
@@ -69,6 +74,9 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Autowired
UserFeign
userFeign
;
@Autowired
ThirdFeign
thirdFeign
;
@Autowired
public
HttpServletRequest
request
;
...
...
@@ -84,11 +92,18 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
@Override
public
void
initDetail
(
TourBO
bo
)
{
super
.
initDetail
(
bo
);
initDictionary
();
TourGood
tourGood
=
tourFeign
.
usableGet
(
bo
.
getGoodId
()).
getData
();
bo
.
setTourGood
(
tourGood
);
bo
.
setAppUserDTO
(
getUserInfo
());
}
public
void
initDictionary
()
{
dictionaryMap
=
thirdFeign
.
dictionaryGetAll4Map
().
getData
();
this
.
INSURE_PRICE
=
new
BigDecimal
(
dictionaryMap
.
get
(
APP_ORDER
+
"_"
+
DictionaryKey
.
INSURE_PRICE
).
getDetail
());
this
.
autoCancelTime
=
Long
.
valueOf
(
dictionaryMap
.
get
(
APP_ORDER
+
"_"
+
DictionaryKey
.
ACT_TOUR
).
getDetail
());
}
@Override
public
void
handleDetail
(
TourBO
bo
)
{
//设置订单状态为3
...
...
@@ -117,7 +132,7 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
super
.
handleDetail
(
bo
);
//发送定时取消订单(30分钟)
rabbitProduct
.
sendDelayMessage
(
bo
.
getOrder
(),
1000L
*
60
*
30
);
rabbitProduct
.
sendDelayMessage
(
bo
.
getOrder
(),
autoCancelTime
);
}
@Override
...
...
@@ -156,6 +171,10 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
detail
.
setTotalNumber
(
detail
.
getAdultNum
()
+
detail
.
getChildNum
());
}
if
(
detail
.
getAdultNum
()
<=
0
)
{
throw
new
BaseException
(
ResultCode
.
PARAM_ILLEGAL_CODE
,
new
HashSet
<
String
>(){{
add
(
"最少一个成人"
);}});
}
//计算旅游价格
ObjectRestResponse
<
TourSpePriceVo
>
objectRestResponse
=
tourFeign
.
refund
(
new
TourSpePriceDTO
(){{
setChildNumber
(
detail
.
getChildNum
());
...
...
@@ -193,11 +212,11 @@ public class OrderTourService extends AbstractOrderHandle<OrderTourDetailBiz, To
tpv
.
setTotalNumber
(
detail
.
getTotalNumber
());
//设置收费明细
costDetail
(
tpv
,
handle
c
hildren
(
detail
));
costDetail
(
tpv
,
handle
C
hildren
(
detail
));
return
tpv
;
}
private
String
handle
c
hildren
(
TourBO
detail
)
{
private
String
handle
C
hildren
(
TourBO
detail
)
{
StringBuffer
childrenStr
=
new
StringBuffer
(
""
);
if
(
NUMBER_ZERO
<
detail
.
getAdultNum
())
{
childrenStr
.
append
(
",${tem_0201}"
);
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/biz/TourGoodBiz.java
View file @
7c4029ad
...
...
@@ -66,7 +66,13 @@ public class TourGoodBiz extends BaseBiz<TourGoodMapper, TourGood> {
*/
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
){
Map
<
String
,
Object
>
params
=
initParam
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
return
new
ObjectRestResponse
().
status
(
RestCode
.
SUCCESS
.
getStatus
()).
msg
(
RestCode
.
SUCCESS
.
getMsg
()).
data
(
PageDataVO
.
pageInfo
(
page
,
limit
,
()
->
mapper
.
getGoodList
(
params
)));
PageDataVO
<
TourGood
>
dataVO
=
null
;
if
(
latitude
!=
null
&&
latitude
>
0
&&
longitude
!=
null
&&
longitude
>
0
){
dataVO
=
PageDataVO
.
pageInfo
(
page
,
limit
,
()->
mapper
.
getCoordinateList
(
params
));
}
else
{
dataVO
=
PageDataVO
.
pageInfo
(
page
,
limit
,
()->
mapper
.
getGoodList
(
params
));
}
return
new
ObjectRestResponse
().
status
(
RestCode
.
SUCCESS
.
getStatus
()).
msg
(
RestCode
.
SUCCESS
.
getMsg
()).
data
(
dataVO
);
}
private
Map
<
String
,
Object
>
initParam
(
int
page
,
int
limit
,
String
query
,
Double
latitude
,
Double
longitude
,
Integer
tagId
,
Double
distance
)
{
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/mapper/TourGoodMapper.java
View file @
7c4029ad
...
...
@@ -23,6 +23,8 @@ public interface TourGoodMapper extends Mapper<TourGood> {
//查询旅游路线列表
public
List
<
TourGood
>
getGoodList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
//根据经纬度查询旅游路线列表
public
List
<
TourGood
>
getCoordinateList
(
@Param
(
"params"
)
Map
<
String
,
Object
>
map
);
//获取商品列表
public
List
<
TourGoodVo
>
findGoodList
(
@Param
(
"params"
)
GoodSearchDTO
tourGoodDTO
);
...
...
xx-tour/xx-tour-server/src/main/java/com/xxfc/platform/tour/rest/TourGoodController.java
View file @
7c4029ad
...
...
@@ -36,7 +36,7 @@ public class TourGoodController extends BaseController<TourGoodBiz, TourGood> {
public
ObjectRestResponse
<
TourGood
>
getGoodList
(
@RequestParam
(
value
=
"page"
,
required
=
true
)
Integer
page
,
@RequestParam
(
value
=
"limit"
,
required
=
true
)
Integer
limit
,
@RequestParam
(
value
=
"query"
,
required
=
false
)
String
query
,
@RequestParam
(
value
=
"latitude"
,
required
=
false
)
Double
latitude
,
@RequestParam
(
value
=
"longitude"
,
required
=
false
)
Double
longitude
,
@RequestParam
(
value
=
"tagId"
,
required
=
false
)
Integer
tagId
,
@RequestParam
(
value
=
"distance"
,
defaultValue
=
"10.00"
)
Double
distance
)
{
@RequestParam
(
value
=
"distance"
,
defaultValue
=
"10
0
.00"
)
Double
distance
)
{
return
baseBiz
.
getGoodList
(
page
,
limit
,
query
,
latitude
,
longitude
,
tagId
,
distance
);
}
...
...
xx-tour/xx-tour-server/src/main/resources/mapper/TourGoodMapper.xml
View file @
7c4029ad
...
...
@@ -51,6 +51,21 @@
<result
property=
"isOutside"
column=
"is_outside"
/>
</resultMap>
<!--查询旅游路线列表-->
<select
id=
"getCoordinateList"
parameterType=
"java.util.Map"
resultMap=
"tourGoodMap"
>
SELECT t.* from tour_good t
left join (
select good_id,
IFNULL(ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS( #{params.longitude} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 ,0 ) AS distance
FROM tour_good_site WHERE type=2 ) gs ON t.id=gs.good_id
where t.is_del=0 AND t.status=1 and gs.distance
<
#{params.distance}
<if
test=
"params.query != null and params.query != ''"
>
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
</if>
order by gs.distance
</select>
<!--查询旅游路线列表-->
<select
id=
"getGoodList"
parameterType=
"java.util.Map"
resultMap=
"tourGoodMap"
>
SELECT * from tour_good t
...
...
@@ -58,22 +73,11 @@
<if
test=
"params.query != null and params.query != ''"
>
and (t.`name` like CONCAT('%',#{params.query},'%') or t.introduce like CONCAT('%',#{params.query},'%'))
</if>
<if
test=
"params.latitude != null and params.latitude != '' and params.longitude != null and params.longitude != ''"
>
and t.id in (SELECT s.good_id from (
select good_id,
if(ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS( #{params.longitude} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 is null ,0,ROUND(( (2 * ASIN( SQRT( POW( SIN((latitude * PI() / 180.0- #{params.latitude}* PI() / 180.0)/2), 2)+COS( latitude * PI() / 180.0)*COS(#{params.longitude} * PI() / 180.0)
*POW(SIN((longitude * PI() / 180.0 - #{params.longitude}* PI() /180.0)/2),2))))*6378.137)*10000)/10000 ) AS distance
FROM tour_good_site
order by distance
) s
where s.distance
<
#{params.distance})
</if>
<if
test=
"params.tagId != null and params.tagId != '' "
>
and t.id in (SELECT tg.good_id from tour_good_tag tg
where tg.tag_id = #{params.tagId}) and t.recommend = 1
ORDER BY t.recommend
</if>
<if
test=
"params.tagId != null and params.tagId != '' "
>
and t.id in (SELECT tg.good_id from tour_good_tag tg
where tg.tag_id = #{params.tagId}) and t.recommend = 1
ORDER BY t.recommend
</if>
</select>
...
...
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/constant/DictionaryKey.java
0 → 100644
View file @
7c4029ad
package
com
.
xxfc
.
platform
.
universal
.
constant
;
public
class
DictionaryKey
{
/**
* 订单类型
*/
public
static
final
String
APP_ORDER
=
"APP_ORDER"
;
/**
* 租车,旅游退款
*/
public
static
final
String
RENT_REFUND
=
"RENT_REFUND"
;
public
static
final
String
TOUR_REFUND
=
"TOUR_REFUND"
;
/**
* 租车:公司司机租金、免赔费用
*/
public
static
final
String
DRIVER_PRICE
=
"DRIVER_PRICE"
;
public
static
final
String
DAMAGE_SAFE
=
"DAMAGE_SAFE"
;
/**
* 旅游:保险费用
*/
public
static
final
String
INSURE_PRICE
=
"INSURE_PRICE"
;
/**
* 自动取消订单时间:租车、旅游
*/
public
static
final
String
ACT_RENT
=
"ACT_RENT"
;
public
static
final
String
ACT_TOUR
=
"ACT_TOUR"
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/feign/ThirdFeign.java
View file @
7c4029ad
...
...
@@ -4,9 +4,7 @@ import com.alibaba.fastjson.JSONObject;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.universal.entity.Dictionary
;
import
com.xxfc.platform.universal.entity.OrderRefund
;
import
com.xxfc.platform.universal.vo.OrderPayVo
;
import
com.xxfc.platform.universal.vo.OrderRefundVo
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
com.xxfc.platform.universal.vo.*
;
import
feign.Param
;
import
io.swagger.annotations.ApiOperation
;
import
org.springframework.cloud.openfeign.FeignClient
;
...
...
@@ -27,6 +25,9 @@ import java.util.Map;
public
interface
ThirdFeign
{
@RequestMapping
(
value
=
"/sms/app/unauth/send"
,
method
=
RequestMethod
.
GET
)
public
JSONObject
send
(
@RequestParam
(
value
=
"phone"
)
String
phone
);
@RequestMapping
(
value
=
"/sms/app/unauth/sendCode"
,
method
=
RequestMethod
.
GET
)
//发送短信模板消息
public
JSONObject
sendCode
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"templateCode"
)
String
templateCode
);
@RequestMapping
(
value
=
"/file/app/unauth/uploadFiles"
,
method
=
RequestMethod
.
POST
)
public
JSONObject
uploadFiles
(
@RequestParam
(
value
=
"files"
)
MultipartFile
[]
files
);
@RequestMapping
(
value
=
"/pay/app/wx"
,
method
=
RequestMethod
.
POST
)
...
...
@@ -66,4 +67,12 @@ public interface ThirdFeign {
// @GetMapping(value = "/dictionary/get")
@RequestMapping
(
value
=
"/dictionary/get"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
List
<
Dictionary
>>
dictionaryGet
(
@RequestParam
(
value
=
"dictionary"
)
Map
<
String
,
Object
>
dictionary
);
@RequestMapping
(
value
=
"/dictionary/getAll4Map"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
Map
<
String
,
Dictionary
>>
dictionaryGetAll4Map
();
/***************************************** 违章 ********************************************/
@GetMapping
(
"/getRentViolation"
)
public
ObjectRestResponse
<
List
<
ViolationVO
>>
getRentViolation
(
@RequestParam
(
value
=
"rentViolationDTO"
)
Map
<
String
,
Object
>
rentViolationDTO
);
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/RentViolationDTO.java
0 → 100644
View file @
7c4029ad
package
com
.
xxfc
.
platform
.
universal
.
vo
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
public
class
RentViolationDTO
{
String
vehicleId
;
Long
startTime
;
Long
endTime
;
}
xx-universal/xx-universal-api/src/main/java/com/xxfc/platform/universal/vo/ViolationVO.java
0 → 100644
View file @
7c4029ad
package
com
.
xxfc
.
platform
.
universal
.
vo
;
import
lombok.Data
;
import
java.math.BigDecimal
;
@Data
public
class
ViolationVO
{
BigDecimal
price
;
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/biz/DictionaryBiz.java
View file @
7c4029ad
...
...
@@ -12,10 +12,9 @@ import lombok.extern.slf4j.Slf4j;
import
org.springframework.stereotype.Service
;
import
org.springframework.util.StringUtils
;
import
java.util.ArrayList
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Set
;
import
java.util.*
;
import
java.util.function.Function
;
import
java.util.stream.Collectors
;
@Service
@Slf4j
...
...
@@ -83,6 +82,11 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
if
(
StringUtils
.
isEmpty
(
type
))
{
return
ObjectRestResponse
.
paramIsEmpty
();
}
List
<
Dictionary
>
dictionaryList
=
getParentCommon
(
type
);
return
ObjectRestResponse
.
succ
(
dictionaryList
);
}
private
List
<
Dictionary
>
getParentCommon
(
String
type
)
{
Dictionary
dictionary
=
new
Dictionary
();
dictionary
.
setType
(
type
);
dictionary
.
setPid
(
0
);
...
...
@@ -91,10 +95,19 @@ public class DictionaryBiz extends BaseBiz<DictionaryMapper, Dictionary> {
Set
<
Dictionary
>
dictionaryVoList
=
buildTree
(
parent
.
getId
());
parent
.
setChildrens
(
dictionaryVoList
);
}
return
ObjectRestResponse
.
succ
(
dictionaryList
)
;
return
dictionaryList
;
}
public
Map
<
String
,
Dictionary
>
getAll4Map
(){
// List<Dictionary> dictionaries = this.getParentCommon(null);
List
<
Dictionary
>
dictionaries
=
selectListAll
();
Map
<
String
,
Dictionary
>
dictionaryMap
=
dictionaries
.
parallelStream
().
collect
(
Collectors
.
toMap
(
dic
->
dic
.
getType
()+
"_"
+
dic
.
getCode
()
,
Function
.
identity
(),
(
oldValue
,
newValue
)
->
newValue
));
dictionaryMap
.
forEach
((
k
,
v
)
->
{
v
.
setChildrens
(
buildTree
(
v
.
getId
()));
});
return
dictionaryMap
;
}
public
DictionaryVo
buidTree
(
Dictionary
dictionary
)
{
DictionaryVo
dictionaryVo
=
new
DictionaryVo
();
...
...
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/DictionaryController.java
View file @
7c4029ad
...
...
@@ -9,6 +9,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
import
java.util.Map
;
@RestController
@RequestMapping
(
value
=
"dictionary"
)
...
...
@@ -47,4 +48,10 @@ public class DictionaryController {
public
ObjectRestResponse
<
List
<
Dictionary
>>
getParent
(
String
type
)
{
return
dictionaryBiz
.
getParent
(
type
);
}
@GetMapping
(
value
=
"/getAll4Map"
)
@ApiOperation
(
value
=
"获取所有的内容, key为 <type>_<code>"
)
public
ObjectRestResponse
<
Map
<
String
,
Dictionary
>>
getAll4Map
()
{
return
ObjectRestResponse
.
succ
(
dictionaryBiz
.
getAll4Map
());
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/SmsController.java
View file @
7c4029ad
...
...
@@ -33,5 +33,12 @@ public class SmsController {
public
JSONObject
sendSms
(
@RequestParam
(
"phone"
)
String
phone
)
throws
Exception
{
return
smsService
.
smsCode
(
phone
);
}
@RequestMapping
(
value
=
"/app/unauth/sendCode"
,
method
=
RequestMethod
.
GET
)
public
JSONObject
sendCode
(
@RequestParam
(
"phone"
)
String
phone
,
@RequestParam
(
"code"
)
String
code
,
@RequestParam
(
"templateCode"
)
String
templateCode
)
throws
Exception
{
return
smsService
.
smsByCode
(
phone
,
code
,
templateCode
);
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/controller/TrafficViolationsController.java
View file @
7c4029ad
...
...
@@ -3,10 +3,16 @@ package com.xxfc.platform.universal.controller;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.xxfc.platform.universal.service.TrafficViolationsService
;
import
com.xxfc.platform.universal.vo.RentViolationDTO
;
import
com.xxfc.platform.universal.vo.TrafficViolations
;
import
com.xxfc.platform.universal.vo.ViolationVO
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.List
;
@RestController
@RequestMapping
(
"3p/tv"
)
public
class
TrafficViolationsController
{
...
...
@@ -56,7 +62,13 @@ public class TrafficViolationsController {
}
}
@GetMapping
(
"/getRentViolation"
)
public
ObjectRestResponse
<
List
<
ViolationVO
>>
getRentViolation
(
RentViolationDTO
rentViolationDTO
)
{
return
ObjectRestResponse
.
succ
(
new
ArrayList
<
ViolationVO
>(){{
add
(
new
ViolationVO
(){{
setPrice
(
new
BigDecimal
(
"100.00"
));}});
add
(
new
ViolationVO
(){{
setPrice
(
new
BigDecimal
(
"200.00"
));}});
}});
}
}
xx-universal/xx-universal-server/src/main/java/com/xxfc/platform/universal/service/SmsService.java
View file @
7c4029ad
...
...
@@ -57,6 +57,18 @@ public class SmsService {
}
}
public
JSONObject
smsByCode
(
String
mobile
,
String
pwd
,
String
templateCode
){
try
{
if
(
StringUtils
.
isNotBlank
(
mobile
)){
mobile
=
mobile
.
replace
(
" "
,
""
);
}
sendSmsByStr
(
mobile
,
pwd
,
templateCode
);
return
JsonResultUtil
.
createSuccessResult
();
}
catch
(
ClientException
e
)
{
e
.
printStackTrace
();
return
JsonResultUtil
.
createDefaultFail
();
}
}
public
String
sendSms
(
String
mobile
,
String
code
)
throws
ClientException
{
//可自助调整超时时间
...
...
@@ -93,13 +105,56 @@ public class SmsService {
log
.
info
(
"RequestId="
+
sendSmsResponse
.
getRequestId
());
log
.
info
(
"BizId="
+
sendSmsResponse
.
getBizId
());
if
(
sendSmsResponse
.
getCode
()
!=
null
&&
sendSmsResponse
.
getCode
().
equals
(
"OK"
))
{
//请求成功
return
code
;
//请求成功
return
code
;
}
return
null
;
}
public
boolean
sendSmsByStr
(
String
mobile
,
String
str
,
String
templateCode
)
throws
ClientException
{
//可自助调整超时时间
System
.
setProperty
(
"sun.net.client.defaultConnectTimeout"
,
"10000"
);
System
.
setProperty
(
"sun.net.client.defaultReadTimeout"
,
"10000"
);
//初始化acsClient,暂不支持region化
IClientProfile
profile
=
DefaultProfile
.
getProfile
(
"cn-hangzhou"
,
accessKeyId
,
accessKeySecret
);
DefaultProfile
.
addEndpoint
(
"cn-hangzhou"
,
"cn-hangzhou"
,
product
,
domain
);
IAcsClient
acsClient
=
new
DefaultAcsClient
(
profile
);
//组装请求对象-具体描述见控制台-文档部分内容
SendSmsRequest
request
=
new
SendSmsRequest
();
//必填:待发送手机号
request
.
setPhoneNumbers
(
mobile
);
//必填:短信签名-可在短信控制台中找到
request
.
setSignName
(
SignName
);
//必填:短信模板-可在短信控制台中找到
request
.
setTemplateCode
(
templateCode
);
//可选:模板中的变量替换JSON串,如模板内容为"亲爱的${name},您的验证码为${code}"时,此处的值为
request
.
setTemplateParam
(
TemplateParam
.
replace
(
"str"
,
str
));
//\"name\":\"Tom\",
//选填-上行短信扩展码(无特殊需求用户请忽略此字段)
//request.setSmsUpExtendCode("90997");
//可选:outId为提供给业务方扩展字段,最终在短信回执消息中将此值带回给调用者
//request.setOutId("yourOutId");
//hint 此处可能会抛出异常,注意catch
SendSmsResponse
sendSmsResponse
=
acsClient
.
getAcsResponse
(
request
);
log
.
info
(
"短信接口返回的数据----------------mobile======"
+
mobile
+
"----str===="
+
str
);
log
.
info
(
"Code="
+
sendSmsResponse
.
getCode
());
log
.
info
(
"Message="
+
sendSmsResponse
.
getMessage
());
log
.
info
(
"RequestId="
+
sendSmsResponse
.
getRequestId
());
log
.
info
(
"BizId="
+
sendSmsResponse
.
getBizId
());
if
(
sendSmsResponse
.
getCode
()
!=
null
&&
sendSmsResponse
.
getCode
().
equals
(
"OK"
))
{
//请求成功
return
true
;
}
return
false
;
}
/* public static QuerySendDetailsResponse querySendDetails(String bizId) throws ClientException {
...
...
xx-vehicle/xx-vehicle-api/src/main/java/com/xxfc/platform/vehicle/feign/VehicleFeign.java
View file @
7c4029ad
...
...
@@ -37,10 +37,16 @@ public interface VehicleFeign {
@RequestMapping
(
value
=
"/branchCompany/app/unauth/detail/{id}"
,
method
=
RequestMethod
.
GET
)
public
ObjectRestResponse
<
CompanyDetail
>
getCompanyDetail
(
@PathVariable
Integer
id
);
@RequestMapping
(
value
=
"/unbook/4employee/{bookRecordId}"
,
method
=
RequestMethod
.
DELETE
)
//拒绝预约
@RequestMapping
(
value
=
"/vehicleInfo/book/4employee/reject/{bookRecordId}"
,
method
=
RequestMethod
.
PUT
)
public
RestResponse
<
Integer
>
rejectVehicleBooking
(
@PathVariable
Long
bookRecordId
);
//取消预约
@RequestMapping
(
value
=
"/vehicleInfo/unbook/4employee/{bookRecordId}"
,
method
=
RequestMethod
.
DELETE
)
public
RestResponse
<
Integer
>
unbookVehicle
(
@PathVariable
Long
bookRecordId
);
@RequestMapping
(
value
=
"/book/4employee/prove/{bookRecordId}"
,
method
=
RequestMethod
.
PUT
)
//通过预约
@RequestMapping
(
value
=
"/vehicleInfo/book/4employee/prove/{bookRecordId}"
,
method
=
RequestMethod
.
PUT
)
public
RestResponse
<
Integer
>
proveVehicleBooking
(
@PathVariable
Long
bookRecordId
);
//获取分公司列表
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/biz/VehicleBiz.java
View file @
7c4029ad
...
...
@@ -450,6 +450,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
if
(
effected
==
0
){
//修改失败,手动回滚
TransactionAspectSupport
.
currentTransactionStatus
().
setRollbackOnly
();
//手动回滚
return
RestResponse
.
code
(
ResCode
.
VEHICLE_BOOKED_RECORD_ALREADY_CHANGED
.
getCode
());
}
else
if
(
VehicleBookRecordStatus
.
REJECTED
.
getCode
().
equals
(
rsStatus
)){
//拒绝,则释放bookinfo
bookVehicleVo
.
setUnbookStartDate
(
bookVehicleVo
.
getBookStartDate
());
bookVehicleVo
.
setUnbookEndDate
(
bookVehicleVo
.
getBookEndDate
());
Boolean
hasSuc
=
unbookVehicle
(
bookVehicleVo
);
}
return
RestResponse
.
suc
();
}
...
...
@@ -646,7 +651,7 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> {
}
/**
* 取消预定
* 取消预定
(释放bookinfo)
* @return
*/
@Transactional
...
...
xx-vehicle/xx-vehicle-server/src/main/java/com/xxfc/platform/vehicle/rest/VehicleController.java
View file @
7c4029ad
...
...
@@ -42,10 +42,7 @@ import org.springframework.web.multipart.MultipartFile;
import
tk.mybatis.mapper.entity.Example
;
import
tk.mybatis.mapper.weekend.WeekendSqls
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.*
;
import
java.util.regex.Pattern
;
import
java.util.stream.Collectors
;
...
...
@@ -401,8 +398,8 @@ public class VehicleController extends BaseController<VehicleBiz> {
//查询可车辆信息
PageDataVO
<
Vehicle
>
pageDataVO
=
vehicleBiz
.
searchUsableVehicle
(
dto
);
if
(
pageDataVO
.
getData
().
size
()
<=
0
)
{
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
,
new
Hash
Map
<
String
,
Object
>(){{
put
(
"可用车辆"
,
"
不存在"
);
throw
new
BaseException
(
ResultCode
.
NOTEXIST_CODE
,
new
Hash
Set
<
String
>(){{
add
(
"可用车辆
不存在"
);
}});
}
bookVehicleVo
.
setVehicleId
(
pageDataVO
.
getData
().
get
(
0
).
getId
());
...
...
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