Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
app-service
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SuperHive
back-end
app-service
Commits
5ecb76d4
Commit
5ecb76d4
authored
Jun 04, 2020
by
zhangzc
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改refreshTime没有生成的bug
添加支付接口
parent
ff59b294
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
164 additions
and
17 deletions
+164
-17
TokenComponent.java
.../com/esv/freight/app/common/component/TokenComponent.java
+33
-1
PayInterface.java
src/main/java/com/esv/freight/app/feign/PayInterface.java
+26
-0
AppLoginServiceImpl.java
.../app/module/account/service/impl/AppLoginServiceImpl.java
+4
-14
OwnerBillController.java
...eight/app/module/bill/controller/OwnerBillController.java
+37
-2
OwnerPayForm.java
...va/com/esv/freight/app/module/bill/form/OwnerPayForm.java
+43
-0
PayVO.java
src/main/java/com/esv/freight/app/module/bill/vo/PayVO.java
+21
-0
No files found.
src/main/java/com/esv/freight/app/common/component/TokenComponent.java
View file @
5ecb76d4
...
@@ -62,7 +62,7 @@ public class TokenComponent {
...
@@ -62,7 +62,7 @@ public class TokenComponent {
private
AppLoginService
appLoginService
;
private
AppLoginService
appLoginService
;
/**
/**
* description 创建
司机
Token信息
* description 创建Token信息
* param [tokenInfoPojo, driverAccountInfoPojo]
* param [tokenInfoPojo, driverAccountInfoPojo]
* return void
* return void
* author Administrator
* author Administrator
...
@@ -93,6 +93,38 @@ public class TokenComponent {
...
@@ -93,6 +93,38 @@ public class TokenComponent {
redisComponent
.
set
(
cacheKey
,
tokenInfoPojo
.
toString
(),
this
.
accessTokenValidTime
*
TOKEN_TIME
);
redisComponent
.
set
(
cacheKey
,
tokenInfoPojo
.
toString
(),
this
.
accessTokenValidTime
*
TOKEN_TIME
);
}
}
/**
* description 刷新Token信息
* param [tokenInfoPojo, driverAccountInfoPojo]
* return void
* author Administrator
* createTime 2020/06/04 09:52
**/
public
void
refreshTokenInfo
(
TokenInfoPojo
tokenInfoPojo
)
{
// 构建Token信息
tokenInfoPojo
.
setIp
(
ReqUtils
.
getHttpClientIp
());
tokenInfoPojo
.
setSn
(
ReqUtils
.
getRequestHeader
(
"mobileId"
));
tokenInfoPojo
.
setDeviceType
(
Integer
.
parseInt
(
ReqUtils
.
getRequestHeader
(
"requestSource"
)));
tokenInfoPojo
.
setOsType
(
ReqUtils
.
getRequestHeader
(
"osType"
));
tokenInfoPojo
.
setOsVersion
(
ReqUtils
.
getRequestHeader
(
"osVer"
));
tokenInfoPojo
.
setAppVersion
(
ReqUtils
.
getRequestHeader
(
"cVer"
));
tokenInfoPojo
.
setAccountType
(
Integer
.
parseInt
(
ReqUtils
.
getRequestHeader
(
"accountType"
)));
String
accessToken
=
AesUtils
.
aesEncrypt
(
this
.
getAccessTokenOriginalContent
(
tokenInfoPojo
),
AES_KEY
);
tokenInfoPojo
.
setAccessToken
(
accessToken
);
String
refreshToken
=
AesUtils
.
aesEncrypt
(
this
.
getRefreshTokenOriginalContent
(
tokenInfoPojo
),
AES_KEY
);
tokenInfoPojo
.
setRefreshToken
(
refreshToken
);
Date
refreshTime
=
new
Date
();
tokenInfoPojo
.
setRefreshTime
(
refreshTime
.
getTime
());
Date
accessTokenValidTime
=
DateUtils
.
plusDays
(
refreshTime
,
this
.
accessTokenValidTime
);
Date
refreshTokenValidTime
=
DateUtils
.
plusDays
(
refreshTime
,
this
.
refreshTokenValidTime
);
tokenInfoPojo
.
setAccessTokenValidTime
(
accessTokenValidTime
.
getTime
());
tokenInfoPojo
.
setRefreshTokenValidTime
(
refreshTokenValidTime
.
getTime
());
// 缓存Token信息
String
cacheKey
=
this
.
getTokenInfoCacheKey
(
tokenInfoPojo
.
getAccount
(),
tokenInfoPojo
.
getAccountType
());
redisComponent
.
set
(
cacheKey
,
tokenInfoPojo
.
toString
(),
this
.
accessTokenValidTime
*
TOKEN_TIME
);
}
/**
/**
* description 校验Token是否过期
* description 校验Token是否过期
* param [accessToken]
* param [accessToken]
...
...
src/main/java/com/esv/freight/app/feign/PayInterface.java
0 → 100644
View file @
5ecb76d4
package
com
.
esv
.
freight
.
app
.
feign
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.cloud.openfeign.FeignClient
;
import
org.springframework.web.bind.annotation.PostMapping
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.feign.PayInterface
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/03 16:50
* @version:1.0
*/
@FeignClient
(
value
=
"freight-customer-service"
)
public
interface
PayInterface
{
/**
* 创建支付订单
* @param bodyJson
* @return
*/
@PostMapping
(
value
=
"customer/goodsowner/pay/createPayOrder"
)
JSONObject
createPayOrder
(
JSONObject
bodyJson
);
}
src/main/java/com/esv/freight/app/module/account/service/impl/AppLoginServiceImpl.java
View file @
5ecb76d4
...
@@ -30,18 +30,6 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
...
@@ -30,18 +30,6 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
@Autowired
@Autowired
private
TokenComponent
tokenComponent
;
private
TokenComponent
tokenComponent
;
@Autowired
private
RedisComponent
redisComponent
;
private
void
createToken
(
AppLoginEntity
entity
)
{
if
(
entity
==
null
)
{
return
;
}
entity
.
setAccessToken
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
entity
.
setRefreshToken
(
UUID
.
randomUUID
().
toString
().
replaceAll
(
"-"
,
""
));
}
@Override
@Override
public
LoginVO
driverLogin
(
DriverAccountInfoPojo
driverAccountInfoPojo
)
{
public
LoginVO
driverLogin
(
DriverAccountInfoPojo
driverAccountInfoPojo
)
{
// 1:初始化Token
// 1:初始化Token
...
@@ -59,6 +47,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
...
@@ -59,6 +47,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
appLoginEntity
.
setLoginStatus
(
AccountConstants
.
ACCOUNT_STATUS_LOGIN
);
appLoginEntity
.
setLoginStatus
(
AccountConstants
.
ACCOUNT_STATUS_LOGIN
);
appLoginEntity
.
setPhone
(
tokenInfoPojo
.
getAccount
());
appLoginEntity
.
setPhone
(
tokenInfoPojo
.
getAccount
());
appLoginEntity
.
setLoginTime
(
new
Date
(
tokenInfoPojo
.
getLoginTime
()));
appLoginEntity
.
setLoginTime
(
new
Date
(
tokenInfoPojo
.
getLoginTime
()));
appLoginEntity
.
setRefreshTime
(
appLoginEntity
.
getLoginTime
());
appLoginEntity
.
setAccessTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getAccessTokenValidTime
()));
appLoginEntity
.
setAccessTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getAccessTokenValidTime
()));
appLoginEntity
.
setRefreshTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getRefreshTokenValidTime
()));
appLoginEntity
.
setRefreshTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getRefreshTokenValidTime
()));
...
@@ -92,6 +81,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
...
@@ -92,6 +81,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
appLoginEntity
.
setLoginStatus
(
AccountConstants
.
ACCOUNT_STATUS_LOGIN
);
appLoginEntity
.
setLoginStatus
(
AccountConstants
.
ACCOUNT_STATUS_LOGIN
);
appLoginEntity
.
setPhone
(
tokenInfoPojo
.
getAccount
());
appLoginEntity
.
setPhone
(
tokenInfoPojo
.
getAccount
());
appLoginEntity
.
setLoginTime
(
new
Date
(
tokenInfoPojo
.
getLoginTime
()));
appLoginEntity
.
setLoginTime
(
new
Date
(
tokenInfoPojo
.
getLoginTime
()));
appLoginEntity
.
setRefreshTime
(
appLoginEntity
.
getLoginTime
());
appLoginEntity
.
setAccessTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getAccessTokenValidTime
()));
appLoginEntity
.
setAccessTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getAccessTokenValidTime
()));
appLoginEntity
.
setRefreshTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getRefreshTokenValidTime
()));
appLoginEntity
.
setRefreshTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getRefreshTokenValidTime
()));
...
@@ -147,7 +137,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
...
@@ -147,7 +137,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
TokenInfoPojo
tokenInfoPojo
=
new
TokenInfoPojo
();
TokenInfoPojo
tokenInfoPojo
=
new
TokenInfoPojo
();
BeanUtils
.
copyProperties
(
pojo
,
tokenInfoPojo
);
BeanUtils
.
copyProperties
(
pojo
,
tokenInfoPojo
);
this
.
tokenComponent
.
generate
TokenInfo
(
tokenInfoPojo
);
this
.
tokenComponent
.
refresh
TokenInfo
(
tokenInfoPojo
);
AppLoginEntity
record
=
this
.
baseMapper
.
selectOne
(
new
QueryWrapper
<
AppLoginEntity
>().
lambda
()
AppLoginEntity
record
=
this
.
baseMapper
.
selectOne
(
new
QueryWrapper
<
AppLoginEntity
>().
lambda
()
.
eq
(
AppLoginEntity:
:
getAccountType
,
tokenInfoPojo
.
getAccountType
())
.
eq
(
AppLoginEntity:
:
getAccountType
,
tokenInfoPojo
.
getAccountType
())
...
@@ -157,7 +147,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
...
@@ -157,7 +147,7 @@ public class AppLoginServiceImpl extends ServiceImpl<AppLoginDao, AppLoginEntity
BeanUtils
.
copyProperties
(
tokenInfoPojo
,
appLoginEntity
);
BeanUtils
.
copyProperties
(
tokenInfoPojo
,
appLoginEntity
);
appLoginEntity
.
setLoginStatus
(
AccountConstants
.
ACCOUNT_STATUS_LOGIN
);
appLoginEntity
.
setLoginStatus
(
AccountConstants
.
ACCOUNT_STATUS_LOGIN
);
appLoginEntity
.
setPhone
(
tokenInfoPojo
.
getAccount
());
appLoginEntity
.
setPhone
(
tokenInfoPojo
.
getAccount
());
appLoginEntity
.
set
LoginTime
(
new
Date
(
tokenInfoPojo
.
getLogin
Time
()));
appLoginEntity
.
set
RefreshTime
(
new
Date
(
tokenInfoPojo
.
getRefresh
Time
()));
appLoginEntity
.
setAccessTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getAccessTokenValidTime
()));
appLoginEntity
.
setAccessTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getAccessTokenValidTime
()));
appLoginEntity
.
setRefreshTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getRefreshTokenValidTime
()));
appLoginEntity
.
setRefreshTokenValidTime
(
new
Date
(
tokenInfoPojo
.
getRefreshTokenValidTime
()));
appLoginEntity
.
setId
(
record
.
getId
());
appLoginEntity
.
setId
(
record
.
getId
());
...
...
src/main/java/com/esv/freight/app/module/bill/controller/OwnerBillController.java
View file @
5ecb76d4
...
@@ -5,14 +5,18 @@ import com.alibaba.fastjson.JSONObject;
...
@@ -5,14 +5,18 @@ import com.alibaba.fastjson.JSONObject;
import
com.esv.freight.app.common.response.EResponse
;
import
com.esv.freight.app.common.response.EResponse
;
import
com.esv.freight.app.common.util.FeignUtils
;
import
com.esv.freight.app.common.util.FeignUtils
;
import
com.esv.freight.app.common.validator.groups.ValidatorDetail
;
import
com.esv.freight.app.common.validator.groups.ValidatorDetail
;
import
com.esv.freight.app.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.app.common.validator.groups.ValidatorList
;
import
com.esv.freight.app.common.validator.groups.ValidatorList
;
import
com.esv.freight.app.feign.OwnerBillInterface
;
import
com.esv.freight.app.feign.OwnerBillInterface
;
import
com.esv.freight.app.feign.PayInterface
;
import
com.esv.freight.app.module.account.pojo.DriverAccountInfoPojo
;
import
com.esv.freight.app.module.account.pojo.DriverAccountInfoPojo
;
import
com.esv.freight.app.module.bill.form.BillQueryForm
;
import
com.esv.freight.app.module.bill.form.BillQueryForm
;
import
com.esv.freight.app.module.bill.form.OwnerPayForm
;
import
com.esv.freight.app.module.bill.pojo.OwnerBillDetailPojo
;
import
com.esv.freight.app.module.bill.pojo.OwnerBillDetailPojo
;
import
com.esv.freight.app.module.bill.vo.BillDetailVO
;
import
com.esv.freight.app.module.bill.vo.BillDetailVO
;
import
com.esv.freight.app.module.bill.vo.BillListItemVO
;
import
com.esv.freight.app.module.bill.vo.BillListItemVO
;
import
com.esv.freight.app.module.bill.vo.BillListVO
;
import
com.esv.freight.app.module.bill.vo.BillListVO
;
import
com.esv.freight.app.module.bill.vo.PayVO
;
import
com.esv.freight.app.module.evaluate.form.OwnerEvaluateForm
;
import
com.esv.freight.app.module.evaluate.form.OwnerEvaluateForm
;
import
com.esv.freight.app.module.evaluate.vo.EvaluateListItemVO
;
import
com.esv.freight.app.module.evaluate.vo.EvaluateListItemVO
;
import
com.esv.freight.app.module.evaluate.vo.EvaluateListVO
;
import
com.esv.freight.app.module.evaluate.vo.EvaluateListVO
;
...
@@ -44,14 +48,45 @@ import java.util.List;
...
@@ -44,14 +48,45 @@ import java.util.List;
public
class
OwnerBillController
{
public
class
OwnerBillController
{
private
OwnerBillInterface
ownerBillInterface
;
private
OwnerBillInterface
ownerBillInterface
;
private
PayInterface
payInterface
;
@Autowired
@Autowired
public
OwnerBillController
(
OwnerBillInterface
ownerBillInterface
)
{
public
OwnerBillController
(
OwnerBillInterface
ownerBillInterface
,
PayInterface
payInterface
)
{
this
.
ownerBillInterface
=
ownerBillInterface
;
this
.
ownerBillInterface
=
ownerBillInterface
;
this
.
payInterface
=
payInterface
;
}
}
/**
/**
* description 获取对账详情
* description 创建支付订单
* param complaintForm
* return com.esv.freight.common.response.EResponse
* author 张志臣
* createTime 2020/06/03 17:00
**/
@PostMapping
(
"/createPayOrder"
)
public
EResponse
createPayOrder
(
@RequestBody
(
required
=
false
)
@Validated
(
ValidatorInsert
.
class
)
OwnerPayForm
ownerPayForm
)
{
// 调用确认账单接口
JSONObject
reqJson
=
new
JSONObject
();
reqJson
.
put
(
"customerId"
,
ownerPayForm
.
getCustomerId
());
reqJson
.
put
(
"billId"
,
ownerPayForm
.
getBillNo
());
reqJson
.
put
(
"billDesc"
,
"应付账单"
);
reqJson
.
put
(
"txnAmt"
,
ownerPayForm
.
getTxnAmt
());
log
.
info
(
reqJson
.
toJSONString
());
JSONObject
result
=
payInterface
.
createPayOrder
(
reqJson
);
log
.
info
(
result
.
toJSONString
());
if
(!
FeignUtils
.
isFeignSuccess
(
result
))
{
return
FeignUtils
.
getFeignEResponse
(
result
);
}
PayVO
payVO
=
new
PayVO
();
payVO
.
setTn
(
result
.
getJSONObject
(
"data"
).
getString
(
"tn"
));
return
EResponse
.
ok
(
payVO
);
}
/**
* description 确认对账
* param complaintForm
* param complaintForm
* return com.esv.freight.common.response.EResponse
* return com.esv.freight.common.response.EResponse
* author 张志臣
* author 张志臣
...
...
src/main/java/com/esv/freight/app/module/bill/form/OwnerPayForm.java
0 → 100644
View file @
5ecb76d4
package
com
.
esv
.
freight
.
app
.
module
.
bill
.
form
;
import
com.esv.freight.app.common.validator.groups.ValidatorInsert
;
import
com.esv.freight.app.common.validator.groups.ValidatorList
;
import
lombok.Data
;
import
javax.validation.constraints.NotBlank
;
import
javax.validation.constraints.NotNull
;
import
javax.validation.constraints.Positive
;
import
java.math.BigDecimal
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.bill.form.OwnerPayForm
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/03 16:50
* @version:1.0
*/
@Data
public
class
OwnerPayForm
{
/**
* 账号ID
*/
@Positive
(
message
=
"参数userId不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数userId不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
Long
customerId
;
/**
* 账单号
*/
@NotBlank
(
message
=
"参数billNo不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
String
billNo
;
/**
* 交易金额
*/
@Positive
(
message
=
"参数txnAmt不合法"
,
groups
=
{
ValidatorInsert
.
class
})
@NotNull
(
message
=
"参数txnAmt不能为空"
,
groups
=
{
ValidatorInsert
.
class
})
private
BigDecimal
txnAmt
;
}
src/main/java/com/esv/freight/app/module/bill/vo/PayVO.java
0 → 100644
View file @
5ecb76d4
package
com
.
esv
.
freight
.
app
.
module
.
bill
.
vo
;
import
lombok.Data
;
/**
* @description:
* @project: freight-app-service
* @name: com.esv.freight.app.module.bill.vo.PayVO
* @author: 张志臣
* @email: zhangzhichen@esvtek.com
* @createTime: 2020/06/03 17:00
* @version:1.0
*/
@Data
public
class
PayVO
{
/**
* 流水号
**/
private
String
tn
;
}
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