Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
R
rs-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
周健威
rs-cloud-platform
Commits
72ff7357
Commit
72ff7357
authored
Jul 16, 2021
by
周健威
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
抽取支付配置
parent
4b7209a3
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
0 additions
and
576 deletions
+0
-576
SystemConfig.java
...ub/wxiaoqi/security/common/util/process/SystemConfig.java
+0
-34
ThirdFeign.java
...va/com/upyuns/platform/rs/universal/feign/ThirdFeign.java
+0
-2
WXPay.java
...va/com/upyuns/platform/rs/universal/weixin/api/WXPay.java
+0
-71
OrderRefundBiz.java
.../com/upyuns/platform/rs/universal/biz/OrderRefundBiz.java
+0
-114
OrderRefundController.java
...atform/rs/universal/controller/OrderRefundController.java
+0
-10
TrafficViolationsController.java
.../rs/universal/controller/TrafficViolationsController.java
+0
-66
TrafficViolationsService.java
...atform/rs/universal/service/TrafficViolationsService.java
+0
-230
application.properties
...niversal-server/src/main/resources/application.properties
+0
-49
No files found.
ace-common/src/main/java/com/github/wxiaoqi/security/common/util/process/SystemConfig.java
View file @
72ff7357
...
...
@@ -46,33 +46,6 @@ public class SystemConfig {
public
static
String
APP_ID
=
SystemProperty
.
getConfig
(
"APP_ID"
);
// 财付通商户号(OK)
public
static
String
APP_PARTNER
=
SystemProperty
.
getConfig
(
"APP_PARTNER"
);
// 商户号对应的密钥//(OK)
public
static
String
APP_PARTNER_KEY
=
SystemProperty
.
getConfig
(
"APP_PARTNER_KEY"
);
public
static
String
APP_TRADE_TYPE
=
SystemProperty
.
getConfig
(
"APP_TRADE_TYPE"
);
/**
* (IOS)企业版配置
*/
public
static
String
APP_ID_IOS
=
SystemProperty
.
getConfig
(
"APP_ID_IOS"
);
// 微信开发平台应用id(OK)
public
static
String
APP_PARTNER_IOS
=
SystemProperty
.
getConfig
(
"APP_PARTNER_IOS"
);
// 财付通商户号(OK)
public
static
String
APP_PARTNER_KEY_IOS
=
SystemProperty
.
getConfig
(
"APP_PARTNER_KEY_IOS"
);
// 商户号对应的密钥//(OK)
public
static
String
APP_TRADE_TYPE_IOS
=
SystemProperty
.
getConfig
(
"APP_TRADE_TYPE"
);
// 平台所有微信的回调地址的域名
public
static
final
String
weixinHost
=
SystemProperty
.
getConfig
(
"weixinHost"
);
// 存放退款证书目录
public
static
String
APICLIENT_CERT
=
SystemProperty
.
getConfig
(
"APICLIENT_CERT"
);
/**
* 支付宝支付相关配置
*/
public
static
final
String
ALIPAY_APPID
=
SystemProperty
.
getConfig
(
"ALIPAY_APPID"
);
public
static
final
String
ALIPAY_PID
=
SystemProperty
.
getConfig
(
"ALIPAY_PID"
);
public
static
final
String
ALIPAY_PUBLIC_KEY
=
SystemProperty
.
getConfig
(
"ALIPAY_PUBLIC_KEY"
);
public
static
final
String
ALIPAY_ACOUNT
=
SystemProperty
.
getConfig
(
"ALIPAY_ACOUNT"
);
public
static
final
String
ALIPAY_PRIVATE_KEY
=
SystemProperty
.
getConfig
(
"ALIPAY_PRIVATE_KEY"
);
/**
* 交易创建,等待买家付款
...
...
@@ -91,13 +64,6 @@ public class SystemConfig {
*/
public
static
final
String
ALIPAY_TRADE_FINISHED
=
"TRADE_FINISHED"
;
public
static
final
String
ALIPAY_PAY_BASE_URL
=
"https://openapi.alipay.com"
;
//public static final String ALIPAY_PAY_BASE_URL = "https://openapi.alipaydev.com";
public
static
final
String
ALIPAY
=
"alipay"
;
public
static
final
String
WXPAY
=
"wxpay"
;
/**
* 邮件服务配置
*/
...
...
rs-universal/rs-universal-api/src/main/java/com/upyuns/platform/rs/universal/feign/ThirdFeign.java
View file @
72ff7357
...
...
@@ -36,8 +36,6 @@ public interface ThirdFeign {
public
JSONObject
uploadFiles
(
@RequestParam
(
value
=
"files"
)
MultipartFile
[]
files
);
@RequestMapping
(
value
=
"/pay/app/wx"
,
method
=
RequestMethod
.
POST
)
public
JSONObject
wx
(
@RequestBody
OrderPayVo
orderPayVo
);
@RequestMapping
(
value
=
"/refund/app/pay/refund"
,
method
=
RequestMethod
.
POST
)
public
ObjectRestResponse
<
String
>
refund
(
@RequestBody
OrderRefundVo
orderRefundVo
);
@PostMapping
(
value
=
"pay/app/unauth/updateStatus"
)
public
ObjectRestResponse
updateStatus
(
@RequestBody
OrderPay
orderPay
);
...
...
rs-universal/rs-universal-api/src/main/java/com/upyuns/platform/rs/universal/weixin/api/WXPay.java
View file @
72ff7357
...
...
@@ -120,77 +120,6 @@ public class WXPay {
return
sign
;
}
/**
* app 生成签名
* @param appid
* @param appKey
* @param prepay_id
* @return
*/
public
static
String
createPackageValue
(
String
appid
,
String
appKey
,
String
prepay_id
,
int
version
)
{
JSONObject
res
=
new
JSONObject
();
res
.
put
(
"appid"
,
appid
);
Random
random
=
new
Random
();
String
randomStr
=
MD5
.
GetMD5String
(
String
.
valueOf
(
random
.
nextInt
(
10000
)));
res
.
put
(
"noncestr"
,
MD5Util
.
MD5Encode
(
randomStr
,
"utf-8"
).
toLowerCase
());
//
res
.
put
(
"package"
,
"Sign=WXPay"
);
//"prepay_id=" + prepay_id
res
.
put
(
"partnerid"
,
appKey
);
res
.
put
(
"prepayid"
,
prepay_id
);
String
timeStamp
=
OrderUtil
.
GetTimestamp
();
res
.
put
(
"timestamp"
,
timeStamp
);
//参考以下两个方法
//https://pay.weixin.qq.com/wiki/tools/signverify/
//https://pay.weixin.qq.com/wiki/doc/api/app/app.php?chapter=9_12&index=2
SortedMap
<
Object
,
Object
>
nativeObj
=
new
TreeMap
<
Object
,
Object
>();
nativeObj
.
put
(
"appid"
,
appid
);
nativeObj
.
put
(
"package"
,
"Sign=WXPay"
);
nativeObj
.
put
(
"partnerid"
,
appKey
);
nativeObj
.
put
(
"prepayid"
,
prepay_id
);
nativeObj
.
put
(
"noncestr"
,
MD5Util
.
MD5Encode
(
randomStr
,
"utf-8"
).
toLowerCase
());
//MD5Util.MD5Encode(randomStr, "utf-8").toLowerCase()
nativeObj
.
put
(
"timestamp"
,
timeStamp
);
res
.
put
(
"sign"
,
createSign
(
"UTF-8"
,
nativeObj
,
version
));
return
res
.
toString
();
}
/**
* app微信支付签名算法sign
* @param characterEncoding
* @param parameters
* @return
*/
public
static
String
createSign
(
String
characterEncoding
,
SortedMap
<
Object
,
Object
>
parameters
,
int
version
){
StringBuffer
sb
=
new
StringBuffer
();
Set
es
=
parameters
.
entrySet
();
//所有参与传参的参数按照accsii排序(升序)
Iterator
it
=
es
.
iterator
();
while
(
it
.
hasNext
())
{
Map
.
Entry
entry
=
(
Map
.
Entry
)
it
.
next
();
String
k
=
(
String
)
entry
.
getKey
();
Object
v
=
entry
.
getValue
();
if
(
null
!=
v
&&
!
""
.
equals
(
v
)
&&
!
"sign"
.
equals
(
k
)
&&
!
"key"
.
equals
(
k
))
{
sb
.
append
(
k
+
"="
+
v
+
"&"
);
}
}
// app store 微信支付
if
(
0
==
version
)
{
sb
.
append
(
"key="
+
SystemConfig
.
APP_PARTNER_KEY
);
}
else
{
sb
.
append
(
"key="
+
SystemConfig
.
APP_PARTNER_KEY_IOS
);
}
log
.
error
(
"version:"
+
version
);
log
.
error
(
"SystemConfig.APP_PARTNER_KEY_IOS="
+
SystemConfig
.
APP_PARTNER_KEY_IOS
);
log
.
error
(
"签名前是:"
+
sb
.
toString
());
String
sign
=
MD5Util
.
MD5Encode
(
sb
.
toString
(),
characterEncoding
).
toUpperCase
();
return
sign
;
}
/*public static void main(String[] args) {
String Key = "cnitr89201000cnitr89201000CNITR5";
...
...
rs-universal/rs-universal-server/src/main/java/com/upyuns/platform/rs/universal/biz/OrderRefundBiz.java
View file @
72ff7357
...
...
@@ -42,120 +42,6 @@ public class OrderRefundBiz extends BaseBiz<OrderRefundMapper, OrderRefund> {
@Autowired
DictionaryBiz
dictionaryBiz
;
//申请退款
public
JSONObject
refund
(
OrderRefundVo
orderRefundVo
)
throws
Exception
{
if
(
orderRefundVo
==
null
)
{
log
.
error
(
"-----参数为空-----------"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
String
order_no
=
orderRefundVo
.
getOrderNo
();
String
appid
=
SystemConfig
.
APP_ID
;
String
mchId
=
SystemConfig
.
APP_PARTNER
;
String
partnerKey
=
SystemConfig
.
APP_PARTNER_KEY
;
Integer
payAmount
=
orderRefundVo
.
getAmount
();
Integer
refundAmount
=
orderRefundVo
.
getRefundAmount
();
//临时处理
// Map<String, Dictionary> dictionaryMap = dictionaryBiz.getAll4Map();
// Integer demotion = Integer.valueOf(dictionaryMap.get(UNIVERSAL_PAY + "_" + PAY_DEMOTION).getDetail());
// payAmount = payAmount / demotion;
// if (payAmount <= 0) {
// payAmount = 1;
// }
//
// refundAmount = refundAmount / demotion;
// if (refundAmount <= 0) {
// refundAmount = 1;
// }
String
refundDesc
=
StringUtils
.
isNotBlank
(
orderRefundVo
.
getRefundDesc
())
?
orderRefundVo
.
getRefundDesc
()
:
"审核通过,退款"
;
String
out_refund_no
=
Snowflake
.
build
()
+
""
;
if
(
StringUtils
.
isBlank
(
order_no
)
||
StringUtils
.
isBlank
(
appid
)
||
StringUtils
.
isBlank
(
mchId
)
||
StringUtils
.
isBlank
(
partnerKey
)
||
payAmount
==
null
||
payAmount
==
0
||
(
refundAmount
==
null
&&
orderRefundVo
.
getFreeze2PayAmount
()
==
null
)
||
(
refundAmount
==
0
&&
orderRefundVo
.
getFreeze2PayAmount
()
==
0
))
{
log
.
error
(
"-----参数为空-----------"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
NULL_CODE
,
"参数为空"
);
}
log
.
error
(
"-----payAmoun======="
+
payAmount
+
"------refundAmount======"
+
refundAmount
);
Example
example
=
new
Example
(
OrderPay
.
class
);
example
.
createCriteria
().
andEqualTo
(
"orderNo"
,
order_no
).
andEqualTo
(
"isDel"
,
0
).
andEqualTo
(
"status"
,
1
);
List
<
OrderPay
>
list
=
payBiz
.
selectByExample
(
example
);
if
(
list
.
size
()
==
0
)
{
log
.
error
(
"---支付回调---trade_no====="
+
order_no
+
"----订单不存在或未支付"
);
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
FAILED_CODE
,
order_no
+
"订单不存在或未支付"
);
}
OrderPay
orderPay
=
list
.
get
(
0
);
String
out_trade_no
=
orderPay
.
getTradeNo
();
boolean
flag
=
false
;
boolean
isFreeze2PayComplete
=
false
;
if
(
orderPay
.
getPayWay
()
==
2
&&
orderPay
.
getPayType
()
==
1
)
{
log
.
info
(
"======支付宝APP支付退款中==========="
);
flag
=
payBiz
.
alipayOrderRefund
(
out_trade_no
,
orderPay
.
getSerialNumber
(),
refundAmount
,
refundDesc
,
out_trade_no
+
System
.
currentTimeMillis
());
}
else
if
(
orderPay
.
getPayWay
()
==
2
&&
orderPay
.
getPayType
()
==
2
)
{
log
.
info
(
"======支付宝预授权支付退款中==========="
);
//需要根据实际传过来的参数类型来进行解冻或者预授权转支付
if
(
orderRefundVo
.
getRefundAmount
()
!=
0
)
{
//解冻金额
flag
=
payBiz
.
fundAuthOrderUnFreeze
(
out_refund_no
,
orderPay
.
getSerialNumber
(),
orderRefundVo
.
getRefundAmount
(),
orderRefundVo
.
getRefundDesc
());
}
//预授权转支付
if
(
orderRefundVo
.
getFreeze2PayAmount
()
!=
null
&&
orderRefundVo
.
getFreeze2PayAmount
()
!=
0
)
{
log
.
info
(
"======预授权转支付==========="
);
String
refundTradeNo
=
Snowflake
.
build
()
+
""
;
isFreeze2PayComplete
=
payBiz
.
tradePay
(
refundTradeNo
,
orderPay
.
getSerialNumber
(),
orderRefundVo
.
getFreeze2PayAmount
(),
orderRefundVo
.
getFreeze2PayDesc
(),
orderRefundVo
.
getFreeze2PayDesc
());
if
(
isFreeze2PayComplete
)
{
OrderRefund
orderRefund
=
new
OrderRefund
();
BeanUtils
.
copyProperties
(
orderRefund
,
orderRefundVo
);
if
(
StringUtils
.
isNotBlank
(
orderRefundVo
.
getFreeze2PayDesc
()))
{
orderRefund
.
setRefundDesc
(
"预授权转支付:"
+
orderRefundVo
.
getFreeze2PayDesc
());
}
else
{
orderRefund
.
setRefundDesc
(
"预授权转支付"
);
}
orderRefund
.
setRefundAmount
(
orderRefundVo
.
getFreeze2PayAmount
());
orderRefund
.
setUserId
(
orderPay
.
getUserId
());
orderRefund
.
setStatus
(
2
);
orderRefund
.
setFinishTime
(
System
.
currentTimeMillis
());
orderRefund
.
setRefundTradeNo
(
refundTradeNo
);
orderRefund
.
setOutRefundNo
(
out_trade_no
);
orderRefund
.
setSerialNumber
(
orderPay
.
getSerialNumber
());
insertSelective
(
orderRefund
);
//如果退款是不成功的,则out_refund_no = refundTradeNo
if
(!
flag
)
{
out_refund_no
=
refundTradeNo
;
}
}
}
}
else
if
(
orderPay
.
getPayWay
()
==
1
){
log
.
info
(
"======微信退款中==========="
);
flag
=
WxPayRefundUtils
.
refund
(
appid
,
mchId
,
partnerKey
,
out_trade_no
,
out_refund_no
,
payAmount
+
""
,
refundAmount
+
""
,
refundDesc
,
APICLIENT_CERT
);
}
if
(
flag
)
{
OrderRefund
orderRefund
=
new
OrderRefund
();
BeanUtils
.
copyProperties
(
orderRefund
,
orderRefundVo
);
if
(
StringUtils
.
isNotBlank
(
orderRefund
.
getRefundDesc
()))
{
orderRefund
.
setRefundDesc
(
refundDesc
);
}
orderRefund
.
setUserId
(
orderPay
.
getUserId
());
orderRefund
.
setStatus
(
2
);
orderRefund
.
setFinishTime
(
System
.
currentTimeMillis
());
orderRefund
.
setRefundTradeNo
(
out_refund_no
);
orderRefund
.
setOutRefundNo
(
out_trade_no
);
orderRefund
.
setSerialNumber
(
orderPay
.
getSerialNumber
());
insertSelective
(
orderRefund
);
return
JsonResultUtil
.
createSuccessResultWithObj
(
out_refund_no
);
}
if
(
flag
||
isFreeze2PayComplete
)
{
return
JsonResultUtil
.
createSuccessResultWithObj
(
out_refund_no
);
}
else
{
return
JsonResultUtil
.
createFailedResult
(
40004
,
"退款失败!"
);
}
}
public
ObjectRestResponse
tradeRefund
(
String
tradNo
,
Integer
refundAmount
,
String
refundReason
,
String
outRequestNo
)
{
AlipayTradeRefundResponse
refundResponse
=
payBiz
.
testTradeRefund
(
tradNo
,
refundAmount
,
refundReason
,
outRequestNo
);
log
.
info
(
"预授权转支付退款: {}"
,
refundResponse
.
getBody
());
...
...
rs-universal/rs-universal-server/src/main/java/com/upyuns/platform/rs/universal/controller/OrderRefundController.java
View file @
72ff7357
...
...
@@ -15,16 +15,6 @@ import org.springframework.web.bind.annotation.*;
@RequestMapping
(
"refund"
)
public
class
OrderRefundController
extends
BaseController
<
OrderRefundBiz
,
OrderRefund
>
{
@RequestMapping
(
value
=
"/app/pay/refund"
,
method
=
RequestMethod
.
POST
)
//匹配的是href中的download请求
public
JSONObject
refund
(
@RequestBody
OrderRefundVo
orderRefundVo
)
{
try
{
return
baseBiz
.
refund
(
orderRefundVo
);
}
catch
(
Exception
e
){
e
.
getMessage
();
return
JsonResultUtil
.
createFailedResult
(
ResultCode
.
EXCEPTION_CODE
,
"出现异常"
);
}
}
@GetMapping
(
value
=
"/app/unauth/tradRefund"
)
@ApiOperation
(
"预授权转支付接口"
)
public
ObjectRestResponse
tradRefund
(
String
tradNo
,
Integer
refundAmount
,
String
refundReason
,
String
outRequestNo
)
{
...
...
rs-universal/rs-universal-server/src/main/java/com/upyuns/platform/rs/universal/controller/TrafficViolationsController.java
deleted
100644 → 0
View file @
4b7209a3
package
com
.
upyuns
.
platform
.
rs
.
universal
.
controller
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.msg.ObjectRestResponse
;
import
com.github.wxiaoqi.security.common.util.process.ResultCode
;
import
com.upyuns.platform.rs.universal.service.TrafficViolationsService
;
import
com.upyuns.platform.rs.universal.vo.RentViolationDTO
;
import
com.upyuns.platform.rs.universal.vo.TrafficViolations
;
import
com.upyuns.platform.rs.universal.vo.ViolationVO
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.*
;
import
java.util.List
;
@RestController
@RequestMapping
(
"3p/tv"
)
@Slf4j
public
class
TrafficViolationsController
{
@Autowired
TrafficViolationsService
tvService
;
/**
* 获取支持的城市
* @return
*/
@GetMapping
(
"/city"
)
public
ObjectRestResponse
getCityInfo
()
{
try
{
return
ObjectRestResponse
.
succ
(
JSONObject
.
parse
(
tvService
.
getCity
()));
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);;
return
ObjectRestResponse
.
createDefaultFail
();
}
}
/**
* 违章车辆查询
* @return
*/
@PostMapping
(
"/trafficViolations"
)
public
ObjectRestResponse
queryTrafficViolations
(
@RequestBody
TrafficViolations
trafficViolations
)
{
try
{
return
ObjectRestResponse
.
succ
(
JSONObject
.
parse
(
tvService
.
queryViolations
(
trafficViolations
)));
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);;
return
ObjectRestResponse
.
createDefaultFail
();
}
}
/**
* 车辆类型查询
* @return
*/
@GetMapping
(
"/LicensePlateType"
)
public
ObjectRestResponse
getLicensePlateType
()
{
try
{
return
ObjectRestResponse
.
succ
(
tvService
.
getLicensePlateType
());
}
catch
(
Exception
e
)
{
log
.
error
(
e
.
getMessage
(),
e
);;
return
ObjectRestResponse
.
createDefaultFail
();
}
}
}
rs-universal/rs-universal-server/src/main/java/com/upyuns/platform/rs/universal/service/TrafficViolationsService.java
deleted
100644 → 0
View file @
4b7209a3
package
com
.
upyuns
.
platform
.
rs
.
universal
.
service
;
import
com.alibaba.fastjson.JSONObject
;
import
com.github.wxiaoqi.security.common.exception.BaseException
;
import
com.upyuns.platform.rs.universal.biz.LicensePlateTypeBiz
;
import
com.upyuns.platform.rs.universal.constant.RedisKey
;
import
com.upyuns.platform.rs.universal.entity.LicensePlateType
;
import
com.upyuns.platform.rs.universal.utils.CertifHttpUtils
;
import
com.upyuns.platform.rs.universal.vo.RentViolationDTO
;
import
com.upyuns.platform.rs.universal.vo.TrafficViolations
;
import
org.apache.commons.collections.CollectionUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.http.HttpEntity
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.util.EntityUtils
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.data.redis.core.RedisTemplate
;
import
org.springframework.stereotype.Service
;
import
java.sql.SQLException
;
import
java.util.*
;
import
java.util.concurrent.CompletableFuture
;
import
java.util.concurrent.Executor
;
import
java.util.concurrent.ExecutorService
;
import
java.util.concurrent.Executors
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 违章查询
* 注意:调用"北京库斯曼科技有限公司"的接口,返回参是Unicode编码
*/
@Service
public
class
TrafficViolationsService
{
@Autowired
private
LicensePlateTypeBiz
licensePlateTypeBiz
;
@Value
(
"${ALIYUN.CODE}"
)
private
String
CODE
;
@Value
(
"${RETURN.TYPE}"
)
private
String
TYPE
;
private
ExecutorService
executorService
=
Executors
.
newCachedThreadPool
();
/**
* 下列参数,根据使用不同的公司的接口进行修改
*/
private
static
final
String
CITY_HOST
=
"https://weizhang.market.alicloudapi.com"
;
private
static
final
String
CITY_PATH
=
"/wz/province"
;
private
static
final
String
CITY_METHOD
=
"GET"
;
private
static
final
String
VIOLATIONS_HOST
=
"https://weizhang.market.alicloudapi.com"
;
private
static
final
String
VIOLATIONS_PATH
=
"/wz/query"
;
private
static
final
String
VIOLATIONS_METHOD
=
"GET"
;
private
static
final
String
GET_LICENSE_PLATE_TYPE_HOST
=
"https://weizhang.market.alicloudapi.com"
;
private
static
final
String
GET_LICENSE_PLATE_TYPE_PATH
=
"/wz/type"
;
private
static
final
String
GET_LICENSE_PLATE_TYPE_METHOD
=
"GET"
;
private
static
final
String
TYPE_NAME
=
"type"
;
private
static
final
String
PLATENO_NAME
=
"plateno"
;
private
static
final
String
ENGINENO_NAME
=
"engineno"
;
private
static
final
String
FRAMENO_NAME
=
"frameno"
;
private
static
final
String
AUTHORIZATION
=
"Authorization"
;
@Autowired
private
RedisTemplate
redisTemplate
;
/**
* 支持查询的城市
* @return
* @throws Exception
*/
public
String
getCity
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>();
querys
.
put
(
TYPE_NAME
,
TYPE
);
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
CITY_HOST
,
CITY_PATH
,
CITY_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
// String result = EntityUtils.toString(entity);
// ArrayList<SearchableCity> searchableCities = JSONObject.parseObject(result, ArrayList.class);
// searchableCities.forEach(searchableCity ->searchableCity.setCreateDate(new Date()) );
// searchableCityBiz.insertSearchableCities(searchableCities);
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
/**s
* 违章车辆查询
* @param trafficViolations
* @return
*/
public
String
queryViolations
(
TrafficViolations
trafficViolations
)
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
Map
<
String
,
String
>
querys
=
new
HashMap
<
String
,
String
>();
querys
.
put
(
TYPE_NAME
,
trafficViolations
.
getType
());
querys
.
put
(
PLATENO_NAME
,
trafficViolations
.
getPlateno
());
querys
.
put
(
ENGINENO_NAME
,
trafficViolations
.
getEngineno
());
querys
.
put
(
FRAMENO_NAME
,
trafficViolations
.
getFrameno
());
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
VIOLATIONS_HOST
,
VIOLATIONS_PATH
,
VIOLATIONS_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
/**
* 放入bean中
* @throws Exception
* @return
*/
public
ArrayList
<
LicensePlateType
>
saveLicensePlateType
()
throws
Exception
{
String
result
=
searchaLicensePlateType
();
if
(
StringUtils
.
isBlank
(
result
))
{
throw
new
BaseException
(
"错误! 查询不到车辆类型"
);
}
Map
<
String
,
Object
>
resultMap
=
JSONObject
.
parseObject
(
result
,
Map
.
class
);
Integer
status
=
(
Integer
)
resultMap
.
get
(
"status"
);
Map
<
String
,
String
>
licensePlateTypeMap
=
(
Map
<
String
,
String
>)
resultMap
.
get
(
"result"
);
if
(
status
!=
200
||
licensePlateTypeMap
==
null
)
{
throw
new
BaseException
(
"错误! 查询不到车辆类型"
);
}
ArrayList
<
LicensePlateType
>
licensePlateTypes
=
new
ArrayList
<>();
for
(
Map
.
Entry
<
String
,
String
>
licensePlateTypeEntry
:
licensePlateTypeMap
.
entrySet
())
{
licensePlateTypes
.
add
(
new
LicensePlateType
(
licensePlateTypeEntry
.
getKey
(),
licensePlateTypeEntry
.
getValue
()));
}
return
licensePlateTypes
;
}
/**
* Unicode转汉字字符串(根据接口返回编码的类型使用)
* @param str
* @return
*/
private
String
unicodeToString
(
String
str
)
{
Pattern
pattern
=
Pattern
.
compile
(
"(\\\\u(\\p{XDigit}{4}))"
);
Matcher
matcher
=
pattern
.
matcher
(
str
);
char
ch
;
while
(
matcher
.
find
())
{
String
group
=
matcher
.
group
(
2
);
ch
=
(
char
)
Integer
.
parseInt
(
group
,
16
);
String
group1
=
matcher
.
group
(
1
);
str
=
str
.
replace
(
group1
,
ch
+
""
);
}
return
str
;
}
/**
* 调用接口获取车辆车牌和代码
* @return
* @throws Exception
*/
public
String
searchaLicensePlateType
()
throws
Exception
{
Map
<
String
,
String
>
headers
=
new
HashMap
<
String
,
String
>();
headers
.
put
(
AUTHORIZATION
,
"APPCODE "
+
CODE
);
HashMap
<
String
,
String
>
querys
=
new
HashMap
<>();
HttpResponse
httpResponse
=
CertifHttpUtils
.
doGet
(
GET_LICENSE_PLATE_TYPE_HOST
,
GET_LICENSE_PLATE_TYPE_PATH
,
GET_LICENSE_PLATE_TYPE_METHOD
,
headers
,
querys
);
HttpEntity
entity
=
httpResponse
.
getEntity
();
return
unicodeToString
(
EntityUtils
.
toString
(
entity
));
}
/**
* 查询对应的车牌和车牌代码
* @return
* @throws Exception
*/
public
List
<
LicensePlateType
>
getLicensePlateType
()
throws
Exception
{
List
<
LicensePlateType
>
licensePlateTypes
=
licensePlateTypeBiz
.
selectListAll
();
if
(
CollectionUtils
.
isEmpty
(
licensePlateTypes
))
{
licensePlateTypes
=
saveLicensePlateType
();
List
<
LicensePlateType
>
finalLicensePlateTypes
=
licensePlateTypes
;
CompletableFuture
.
supplyAsync
(()->{
insertLicensePlateType
(
finalLicensePlateTypes
);
return
null
;
},
executorService
);
Thread
thread
=
new
Thread
(
new
Runnable
()
{
@Override
public
void
run
()
{
insertLicensePlateType
(
finalLicensePlateTypes
);
}
}
);
thread
.
start
();
}
return
licensePlateTypes
;
}
/**
* 定时修改车牌类型
* @throws SQLException
*/
// @Scheduled(cron = "0 0 0 0/7 * ?")
private
void
updateLicensePlateType
()
throws
SQLException
{
List
<
LicensePlateType
>
licensePlateTypes
=
licensePlateTypeBiz
.
selectListAll
();
licensePlateTypeBiz
.
updateLicensePlateType
(
licensePlateTypes
);
}
private
void
insertLicensePlateType
(
List
<
LicensePlateType
>
finalLicensePlateTypes
){
licensePlateTypeBiz
.
insertLicensePlateType
(
finalLicensePlateTypes
);
}
}
rs-universal/rs-universal-server/src/main/resources/application.properties
deleted
100644 → 0
View file @
4b7209a3
#\u8BA4\u8BC1\u63A5\u53E3\u9700\u8981\u643A\u5E26\u7684\u53C2\u6570
#A-\u8BA4\u8BC1
certif.cHost
=
https://idcert.market.alicloudapi.com
certif.cPath
=
/idcard
certif.cMethod
=
GET
certif.cAppcode
=
acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u8EAB\u4EFD\u8BC1\u53F7\u5B57\u6BB5\u540D\u79F0
certif.idCardName
=
idCard
#\u59D3\u540D\u5B57\u6BB5\u540D\u79F0
certif.cName
=
name
#2.\u54CD\u5E94
#\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.certifRet
=
status
#\u8BA4\u8BC1\u6210\u529F\u7801
certif.certifResultCode
=
01
#B-\u56FE\u7247\u89E3\u6790
certif.iHost
=
https://ocridcard.market.alicloudapi.com
certif.iPath
=
/idimages
certif.iMethod
=
POST
certif.iAppcode
=
acea1c8811f748b3a65815f11db357c4
#1.\u8BF7\u6C42
#\u56FE\u7247url\u5B57\u6BB5\u540D
certif.picName
=
image
#\u65B9\u5411\u5B57\u6BB5\u540D
certif.typeName
=
idCardSide
#\u56FE\u7247\u6B63\u9762\u6807\u8BC6\u53C2\u6570
certif.frontParameter
=
front
#\u56FE\u7247\u80CC\u9762\u6807\u8BC6\u53C2\u6570
certif.backParameter
=
back
#2.\u54CD\u5E94
#\u56FE\u7247\u89E3\u6790\u54CD\u5E94\u643A\u5E26\u9519\u8BEF\u7801\u5B57\u6BB5\u540D
certif.imageRet
=
code
#\u56FE\u7247\u89E3\u6790\u6210\u529F\u7801
certif.imageResultCode
=
1
#\u5185\u5BB9\u5B57\u6BB5\u540D
certif.dataNam
=
result
#\u8EAB\u4EFD\u8BC1\u53F7\u5B57\u6BB5\u540D
certif.numberName
=
code
#\u7528\u6237\u59D3\u540D\u5B57\u6BB5\u540D
certif.iName
=
name
#\u8EAB\u4EFD\u8BC1\u5230\u671F\u65F6\u95F4\u5B57\u6BB5\u540D
certif.expirationDateName
=
expiryDate
#C-\u8FDD\u7AE0\u8F66\u8F86\u67E5\u8BE2
#\u63A5\u53E3appcode
ALIYUN.CODE
=
acea1c8811f748b3a65815f11db357c4
#\u8FD4\u56DE\u53C2\u6570\u7C7B\u578B(HTML/JSON/JSONP/XML)
RETURN.TYPE
=
JSON
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