Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
customer-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
customer-service
Commits
fe32c604
Commit
fe32c604
authored
Jun 16, 2020
by
huangcb
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
增加银联获取对账单、更新公钥定时任务
parent
eb656d8d
Changes
19
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
629 additions
and
8 deletions
+629
-8
SDKUtil.java
...ava/com/esv/freight/customer/common/unionpay/SDKUtil.java
+8
-5
UnionPayComponent.java
...v/freight/customer/common/unionpay/UnionPayComponent.java
+1
-1
ScheduleConfig.java
.../java/com/esv/freight/customer/config/ScheduleConfig.java
+18
-0
DataPermHandler.java
.../esv/freight/customer/config/mybatis/DataPermHandler.java
+1
-1
PdfService.java
.../freight/customer/module/contract/service/PdfService.java
+1
-1
PdfServiceImpl.java
...customer/module/contract/service/impl/PdfServiceImpl.java
+2
-0
UnionpayPublicCertUpdateDao.java
.../customer/module/pay/dao/UnionpayPublicCertUpdateDao.java
+17
-0
UnionpayStatementDao.java
...freight/customer/module/pay/dao/UnionpayStatementDao.java
+17
-0
UnionpayPublicCertUpdateEntity.java
...mer/module/pay/entity/UnionpayPublicCertUpdateEntity.java
+44
-0
UnionpayStatementEntity.java
...t/customer/module/pay/entity/UnionpayStatementEntity.java
+67
-0
UnionpayPublicCertUpdateService.java
...r/module/pay/service/UnionpayPublicCertUpdateService.java
+25
-0
UnionpayStatementService.java
...customer/module/pay/service/UnionpayStatementService.java
+25
-0
UnionpayPublicCertUpdateServiceImpl.java
...pay/service/impl/UnionpayPublicCertUpdateServiceImpl.java
+26
-0
UnionpayStatementServiceImpl.java
...module/pay/service/impl/UnionpayStatementServiceImpl.java
+20
-0
UnionpayTask.java
.../java/com/esv/freight/customer/schedule/UnionpayTask.java
+258
-0
UnionpayPublicCertUpdateDao.xml
...main/resources/mapper/pay/UnionpayPublicCertUpdateDao.xml
+16
-0
UnionpayStatementDao.xml
src/main/resources/mapper/pay/UnionpayStatementDao.xml
+21
-0
BaseTestController.java
...est/java/com/esv/freight/customer/BaseTestController.java
+13
-0
UnionpayTaskTest.java
...a/com/esv/freight/customer/schedule/UnionpayTaskTest.java
+49
-0
No files found.
src/main/java/com/esv/freight/customer/common/unionpay/SDKUtil.java
View file @
fe32c604
...
@@ -2,6 +2,7 @@ package com.esv.freight.customer.common.unionpay;
...
@@ -2,6 +2,7 @@ package com.esv.freight.customer.common.unionpay;
import
com.esv.freight.customer.common.constants.SDKConstants
;
import
com.esv.freight.customer.common.constants.SDKConstants
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.joda.time.DateTime
;
import
java.io.*
;
import
java.io.*
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteBuffer
;
...
@@ -516,8 +517,7 @@ public class SDKUtil {
...
@@ -516,8 +517,7 @@ public class SDKUtil {
* @param encoding
* @param encoding
* @return
* @return
*/
*/
public
static
int
getEncryptCert
(
Map
<
String
,
String
>
resData
,
public
static
int
getEncryptCert
(
Map
<
String
,
String
>
resData
,
String
encoding
)
{
String
encoding
)
{
String
strCert
=
resData
.
get
(
SDKConstants
.
param_encryptPubKeyCert
);
String
strCert
=
resData
.
get
(
SDKConstants
.
param_encryptPubKeyCert
);
String
certType
=
resData
.
get
(
SDKConstants
.
param_certType
);
String
certType
=
resData
.
get
(
SDKConstants
.
param_certType
);
if
(
isEmpty
(
strCert
)
||
isEmpty
(
certType
))
{
if
(
isEmpty
(
strCert
)
||
isEmpty
(
certType
))
{
...
@@ -526,8 +526,7 @@ public class SDKUtil {
...
@@ -526,8 +526,7 @@ public class SDKUtil {
X509Certificate
x509Cert
=
CertUtil
.
genCertificateByStr
(
strCert
);
X509Certificate
x509Cert
=
CertUtil
.
genCertificateByStr
(
strCert
);
if
(
SDKConstants
.
CERTTYPE_01
.
equals
(
certType
))
{
if
(
SDKConstants
.
CERTTYPE_01
.
equals
(
certType
))
{
// 更新敏感信息加密公钥
// 更新敏感信息加密公钥
if
(!
CertUtil
.
getEncryptCertId
().
equals
(
if
(!
CertUtil
.
getEncryptCertId
().
equals
(
x509Cert
.
getSerialNumber
().
toString
()))
{
x509Cert
.
getSerialNumber
().
toString
()))
{
// ID不同时进行本地证书更新操作
// ID不同时进行本地证书更新操作
String
localCertPath
=
SDKConfig
.
getConfig
().
getEncryptCertPath
();
String
localCertPath
=
SDKConfig
.
getConfig
().
getEncryptCertPath
();
String
newLocalCertPath
=
genBackupName
(
localCertPath
);
String
newLocalCertPath
=
genBackupName
(
localCertPath
);
...
@@ -695,10 +694,14 @@ public class SDKUtil {
...
@@ -695,10 +694,14 @@ public class SDKUtil {
int
i
=
fileName
.
lastIndexOf
(
SDKConstants
.
POINT
);
int
i
=
fileName
.
lastIndexOf
(
SDKConstants
.
POINT
);
String
leftFileName
=
fileName
.
substring
(
0
,
i
);
String
leftFileName
=
fileName
.
substring
(
0
,
i
);
String
rightFileName
=
fileName
.
substring
(
i
+
1
);
String
rightFileName
=
fileName
.
substring
(
i
+
1
);
String
newFileName
=
leftFileName
+
"_backup
"
+
SDKConstants
.
POINT
+
rightFileName
;
String
newFileName
=
leftFileName
+
"_backup
_"
+
getTodayStr
()
+
SDKConstants
.
POINT
+
rightFileName
;
return
newFileName
;
return
newFileName
;
}
}
public
static
String
getTodayStr
()
{
DateTime
dateTime
=
new
DateTime
(
new
Date
());
return
dateTime
.
toString
(
"yyyyMMdd"
);
}
public
static
byte
[]
readFileByNIO
(
String
filePath
)
{
public
static
byte
[]
readFileByNIO
(
String
filePath
)
{
FileInputStream
in
=
null
;
FileInputStream
in
=
null
;
...
...
src/main/java/com/esv/freight/customer/common/unionpay/UnionPayComponent.java
View file @
fe32c604
...
@@ -121,7 +121,7 @@ public class UnionPayComponent {
...
@@ -121,7 +121,7 @@ public class UnionPayComponent {
throw
new
EException
(
ECode
.
THIRD_PARTY_ERROR
.
code
(),
"未定义异常"
);
throw
new
EException
(
ECode
.
THIRD_PARTY_ERROR
.
code
(),
"未定义异常"
);
}
}
}
else
{
}
else
{
log
.
error
(
"验证签名失败"
);
log
.
error
(
"
[银联开放平台]
验证签名失败"
);
throw
new
EException
(
ECode
.
THIRD_PARTY_ERROR
.
code
(),
"创建银联受理订单号失败"
);
throw
new
EException
(
ECode
.
THIRD_PARTY_ERROR
.
code
(),
"创建银联受理订单号失败"
);
}
}
}
else
{
}
else
{
...
...
src/main/java/com/esv/freight/customer/config/ScheduleConfig.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
config
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.scheduling.annotation.EnableScheduling
;
/**
* @description: 定时任务配置
* @project: freight-customer-service
* @name: com.esv.freight.customer.config.ScheduleConfig
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/06/12 15:42
* @version:1.0
*/
@Configuration
@EnableScheduling
public
class
ScheduleConfig
{
}
src/main/java/com/esv/freight/customer/config/mybatis/DataPermHandler.java
View file @
fe32c604
...
@@ -30,7 +30,7 @@ public class DataPermHandler implements TenantHandler {
...
@@ -30,7 +30,7 @@ public class DataPermHandler implements TenantHandler {
**/
**/
private
final
List
<
String
>
filterTableNames
=
Arrays
.
asList
(
private
final
List
<
String
>
filterTableNames
=
Arrays
.
asList
(
"goods_owner_info"
,
"goods_owner_audit_history"
,
"goods_owner_delivery_address"
,
"goods_owner_receive_address"
,
"goods_owner_regularly_route"
,
"goods_owner_info"
,
"goods_owner_audit_history"
,
"goods_owner_delivery_address"
,
"goods_owner_receive_address"
,
"goods_owner_regularly_route"
,
"vehicle_audit_history"
,
"vehicle_attachment"
,
"driver_info"
,
"driver_audit_history"
"vehicle_audit_history"
,
"vehicle_attachment"
,
"driver_info"
,
"driver_audit_history"
,
"unionpay_statement"
,
"unionpay_public_cert_update"
);
);
@Override
@Override
...
...
src/main/java/com/esv/freight/customer/module/contract/service/PdfService.java
View file @
fe32c604
...
@@ -20,5 +20,5 @@ public interface PdfService {
...
@@ -20,5 +20,5 @@ public interface PdfService {
* author HuangChaobin
* author HuangChaobin
* createTime 2020/05/28 20:17
* createTime 2020/05/28 20:17
**/
**/
public
void
asyncSaveTargetFileInfo
(
String
traceId
,
ContractOnlineRecordEntity
entity
,
byte
[]
fileBytes
);
void
asyncSaveTargetFileInfo
(
String
traceId
,
ContractOnlineRecordEntity
entity
,
byte
[]
fileBytes
);
}
}
src/main/java/com/esv/freight/customer/module/contract/service/impl/PdfServiceImpl.java
View file @
fe32c604
...
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
...
@@ -17,6 +17,7 @@ import org.apache.commons.lang3.StringUtils;
import
org.slf4j.MDC
;
import
org.slf4j.MDC
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Lazy
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.scheduling.annotation.Async
;
import
org.springframework.stereotype.Service
;
import
org.springframework.stereotype.Service
;
...
@@ -42,6 +43,7 @@ public class PdfServiceImpl implements PdfService {
...
@@ -42,6 +43,7 @@ public class PdfServiceImpl implements PdfService {
private
FeignFileService
feignFileService
;
private
FeignFileService
feignFileService
;
@Autowired
@Autowired
@Lazy
private
ContractOnlineRecordService
contractOnlineRecordService
;
private
ContractOnlineRecordService
contractOnlineRecordService
;
@Value
(
"${font.windows.dir}"
)
@Value
(
"${font.windows.dir}"
)
...
...
src/main/java/com/esv/freight/customer/module/pay/dao/UnionpayPublicCertUpdateDao.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
dao
;
import
com.esv.freight.customer.module.pay.entity.UnionpayPublicCertUpdateEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 银联加密公钥更新记录表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-06-15 13:14:21
*/
@Mapper
public
interface
UnionpayPublicCertUpdateDao
extends
BaseMapper
<
UnionpayPublicCertUpdateEntity
>
{
}
src/main/java/com/esv/freight/customer/module/pay/dao/UnionpayStatementDao.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
dao
;
import
com.esv.freight.customer.module.pay.entity.UnionpayStatementEntity
;
import
com.baomidou.mybatisplus.core.mapper.BaseMapper
;
import
org.apache.ibatis.annotations.Mapper
;
/**
* 银联对账单表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-06-12 15:34:12
*/
@Mapper
public
interface
UnionpayStatementDao
extends
BaseMapper
<
UnionpayStatementEntity
>
{
}
src/main/java/com/esv/freight/customer/module/pay/entity/UnionpayPublicCertUpdateEntity.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
entity
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 银联加密公钥更新记录表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-06-15 13:14:21
*/
@Data
@TableName
(
"unionpay_public_cert_update"
)
public
class
UnionpayPublicCertUpdateEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 更新日期(yyyyMMdd)
*/
private
String
updateDate
;
/**
* 更新结果:0-成功、1-无更新、2-更新失败、3-更新异常
*/
private
Integer
updateResult
;
/**
* 创建时间
*/
private
Date
createTime
;
/**
* 修改时间
*/
private
Date
updateTime
;
}
src/main/java/com/esv/freight/customer/module/pay/entity/UnionpayStatementEntity.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
entity
;
import
com.baomidou.mybatisplus.annotation.FieldFill
;
import
com.baomidou.mybatisplus.annotation.TableField
;
import
com.baomidou.mybatisplus.annotation.TableId
;
import
com.baomidou.mybatisplus.annotation.TableName
;
import
java.io.Serializable
;
import
java.util.Date
;
import
lombok.Data
;
/**
* 银联对账单表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-06-12 15:34:12
*/
@Data
@TableName
(
"unionpay_statement"
)
public
class
UnionpayStatementEntity
implements
Serializable
{
private
static
final
long
serialVersionUID
=
1L
;
/**
*
*/
@TableId
private
Long
id
;
/**
* 账单类型:1-手机支付控件、2-在线网关支付
*/
private
Integer
statementCategory
;
/**
* 对账单日期(yyyyMMdd)
*/
private
String
statementDate
;
/**
* 对账单压缩包文件ID
*/
private
Long
zipId
;
/**
* 对账单压缩包文件URL
*/
private
String
zipUrl
;
/**
* 对账单明细文件ID
*/
private
Long
detailId
;
/**
* 对账单明细文件URL
*/
private
String
detailUrl
;
/**
* 对账单汇总文件ID
*/
private
Long
summaryId
;
/**
* 对账单汇总文件URL
*/
private
String
summaryUrl
;
/**
* 创建时间
*/
@TableField
(
fill
=
FieldFill
.
INSERT
)
private
Date
createTime
;
}
src/main/java/com/esv/freight/customer/module/pay/service/UnionpayPublicCertUpdateService.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.pay.entity.UnionpayPublicCertUpdateEntity
;
/**
* 银联加密公钥更新记录表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-06-15 13:14:21
*/
public
interface
UnionpayPublicCertUpdateService
extends
IService
<
UnionpayPublicCertUpdateEntity
>
{
/**
* description 保存记录
* param []
* return java.lang.Integer
* author HuangChaobin
* createTime 2020/06/15 13:19
**/
Integer
saveRecord
(
UnionpayPublicCertUpdateEntity
entity
);
}
src/main/java/com/esv/freight/customer/module/pay/service/UnionpayStatementService.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
service
;
import
com.baomidou.mybatisplus.extension.service.IService
;
import
com.esv.freight.customer.module.pay.entity.UnionpayStatementEntity
;
/**
* 银联对账单表
*
* @author 黄朝斌
* @email huangchaobin@esvtek.com
* @date 2020-06-12 15:34:12
*/
public
interface
UnionpayStatementService
extends
IService
<
UnionpayStatementEntity
>
{
/**
* description 通过对账单日期查询记录
* param [date]
* return com.esv.freight.customer.module.pay.entity.UnionpayStatementEntity
* author HuangChaobin
* createTime 2020/06/12 16:09
**/
UnionpayStatementEntity
getRecordByDate
(
String
date
);
}
src/main/java/com/esv/freight/customer/module/pay/service/impl/UnionpayPublicCertUpdateServiceImpl.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.pay.dao.UnionpayPublicCertUpdateDao
;
import
com.esv.freight.customer.module.pay.entity.UnionpayPublicCertUpdateEntity
;
import
com.esv.freight.customer.module.pay.service.UnionpayPublicCertUpdateService
;
import
org.springframework.stereotype.Service
;
@Service
(
"unionpayPublicCertUpdateService"
)
public
class
UnionpayPublicCertUpdateServiceImpl
extends
ServiceImpl
<
UnionpayPublicCertUpdateDao
,
UnionpayPublicCertUpdateEntity
>
implements
UnionpayPublicCertUpdateService
{
@Override
public
Integer
saveRecord
(
UnionpayPublicCertUpdateEntity
entity
)
{
UnionpayPublicCertUpdateEntity
dbEntity
=
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
UnionpayPublicCertUpdateEntity
>()
.
eq
(
UnionpayPublicCertUpdateEntity:
:
getUpdateDate
,
entity
.
getUpdateDate
()));
if
(
null
==
dbEntity
)
{
return
this
.
baseMapper
.
insert
(
entity
);
}
else
{
entity
.
setId
(
dbEntity
.
getId
());
return
this
.
baseMapper
.
updateById
(
entity
);
}
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/module/pay/service/impl/UnionpayStatementServiceImpl.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
module
.
pay
.
service
.
impl
;
import
com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper
;
import
com.baomidou.mybatisplus.extension.service.impl.ServiceImpl
;
import
com.esv.freight.customer.module.pay.dao.UnionpayStatementDao
;
import
com.esv.freight.customer.module.pay.entity.UnionpayStatementEntity
;
import
com.esv.freight.customer.module.pay.service.UnionpayStatementService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.stereotype.Service
;
@Slf4j
@Service
(
"unionpayStatementService"
)
public
class
UnionpayStatementServiceImpl
extends
ServiceImpl
<
UnionpayStatementDao
,
UnionpayStatementEntity
>
implements
UnionpayStatementService
{
@Override
public
UnionpayStatementEntity
getRecordByDate
(
String
date
)
{
return
this
.
baseMapper
.
selectOne
(
new
LambdaQueryWrapper
<
UnionpayStatementEntity
>().
eq
(
UnionpayStatementEntity:
:
getStatementDate
,
date
));
}
}
\ No newline at end of file
src/main/java/com/esv/freight/customer/schedule/UnionpayTask.java
0 → 100644
View file @
fe32c604
This diff is collapsed.
Click to expand it.
src/main/resources/mapper/pay/UnionpayPublicCertUpdateDao.xml
0 → 100644
View file @
fe32c604
<?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.esv.freight.customer.module.pay.dao.UnionpayPublicCertUpdateDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.pay.entity.UnionpayPublicCertUpdateEntity"
id=
"unionpayPublicCertUpdateMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"updateDate"
column=
"update_date"
/>
<result
property=
"updateResult"
column=
"update_result"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/main/resources/mapper/pay/UnionpayStatementDao.xml
0 → 100644
View file @
fe32c604
<?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.esv.freight.customer.module.pay.dao.UnionpayStatementDao"
>
<!-- 可根据自己的需求,是否要使用 -->
<resultMap
type=
"com.esv.freight.customer.module.pay.entity.UnionpayStatementEntity"
id=
"unionpayStatementMap"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"statementCategory"
column=
"statement_category"
/>
<result
property=
"statementDate"
column=
"statement_date"
/>
<result
property=
"zipId"
column=
"zip_id"
/>
<result
property=
"zipUrl"
column=
"zip_url"
/>
<result
property=
"detailId"
column=
"detail_id"
/>
<result
property=
"detailUrl"
column=
"detail_url"
/>
<result
property=
"summaryId"
column=
"summary_id"
/>
<result
property=
"summaryUrl"
column=
"summary_url"
/>
<result
property=
"createTime"
column=
"create_time"
/>
</resultMap>
</mapper>
\ No newline at end of file
src/test/java/com/esv/freight/customer/BaseTestController.java
View file @
fe32c604
...
@@ -3,14 +3,18 @@ package com.esv.freight.customer;
...
@@ -3,14 +3,18 @@ package com.esv.freight.customer;
import
com.esv.freight.customer.common.constants.CommonConstants
;
import
com.esv.freight.customer.common.constants.CommonConstants
;
import
lombok.Data
;
import
lombok.Data
;
import
lombok.extern.slf4j.Slf4j
;
import
lombok.extern.slf4j.Slf4j
;
import
org.apache.commons.lang3.StringUtils
;
import
org.junit.After
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Before
;
import
org.slf4j.MDC
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.http.HttpHeaders
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.MockMvc
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.test.web.servlet.setup.MockMvcBuilders
;
import
org.springframework.web.context.WebApplicationContext
;
import
org.springframework.web.context.WebApplicationContext
;
import
java.util.UUID
;
/**
/**
* @description:
* @description:
* @project: freight-file-service
* @project: freight-file-service
...
@@ -34,6 +38,7 @@ public class BaseTestController {
...
@@ -34,6 +38,7 @@ public class BaseTestController {
@Before
@Before
public
void
before
()
{
public
void
before
()
{
this
.
initLogTraceId
();
log
.
info
(
"=================================== Test Start ==================================="
);
log
.
info
(
"=================================== Test Start ==================================="
);
mockMvc
=
MockMvcBuilders
.
webAppContextSetup
(
webApplicationContext
).
build
();
mockMvc
=
MockMvcBuilders
.
webAppContextSetup
(
webApplicationContext
).
build
();
TEST_START_TIME
=
System
.
currentTimeMillis
();
TEST_START_TIME
=
System
.
currentTimeMillis
();
...
@@ -61,4 +66,12 @@ public class BaseTestController {
...
@@ -61,4 +66,12 @@ public class BaseTestController {
return
httpHeaders
;
return
httpHeaders
;
}
}
private
void
initLogTraceId
()
{
String
traceId
=
MDC
.
get
(
"traceId"
);
if
(
StringUtils
.
isBlank
(
traceId
))
{
traceId
=
UUID
.
randomUUID
().
toString
().
replace
(
"-"
,
""
);
MDC
.
put
(
"traceId"
,
traceId
);
}
}
}
}
src/test/java/com/esv/freight/customer/schedule/UnionpayTaskTest.java
0 → 100644
View file @
fe32c604
package
com
.
esv
.
freight
.
customer
.
schedule
;
import
lombok.extern.slf4j.Slf4j
;
import
org.junit.FixMethodOrder
;
import
org.junit.Test
;
import
org.junit.runner.RunWith
;
import
org.junit.runners.MethodSorters
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.boot.test.context.SpringBootTest
;
import
org.springframework.test.annotation.Rollback
;
import
org.springframework.test.context.junit4.SpringRunner
;
import
org.springframework.transaction.annotation.Transactional
;
/**
* @description:
* @project: freight-customer-service
* @name: com.esv.freight.customer.schedule.UnionpayTaskTest
* @author: 黄朝斌
* @email: huangchaobin@esvtek.com
* @createTime: 2020/06/12 17:01
* @version:1.0
*/
@RunWith
(
SpringRunner
.
class
)
@SpringBootTest
@Slf4j
@FixMethodOrder
(
MethodSorters
.
NAME_ASCENDING
)
@Transactional
@Rollback
(
false
)
public
class
UnionpayTaskTest
{
@Autowired
private
UnionpayTask
unionpayTask
;
/**
* 对账单定时任务触发器
**/
@Test
public
void
a1_getStatementTaskTrigger_test
()
throws
Exception
{
unionpayTask
.
getStatementTaskTrigger
();
}
/**
* 银联加密公钥更新
**/
@Test
public
void
b1_updateCertTaskTrigger_test
()
throws
Exception
{
unionpayTask
.
updateCertTaskTrigger
();
}
}
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