Toggle navigation
Toggle navigation
This project
Loading...
Sign in
zyn
/
cjs-site
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
bruce
2019-05-20 17:17:34 +0800
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
5c598b0edf704be1d1ba558a856708f447ca69b0
5c598b0e
1 parent
478555a8
仓管费
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
185 additions
and
75 deletions
src/main/java/com/cjs/site/action/user/fund/PickPayAction.java
src/main/java/com/cjs/site/action/user/pick/PickAction.java
src/main/java/com/cjs/site/biz/user/pick/PickBiz.java
src/main/java/com/cjs/site/biz/user/pick/PickPayBiz.java
src/main/java/com/cjs/site/dao/user/pick/OutpropApplyPayDao.java
src/main/java/com/cjs/site/model/union/CreateQrCode.java
src/main/java/com/cjs/site/model/user/pick/OutpropApplyPayInfo.java
src/main/java/com/cjs/site/util/lang/DateEnum.java
src/main/java/com/cjs/site/util/union/UnionConstants.java
src/main/java/com/cjs/site/util/union/UnionPayUtil.java
src/main/resources/mybatis/user/pick/out-prop-apply-pay-mapper.xml
src/main/webapp/view/user/pick/express.jsp
src/main/webapp/view/user/pick/payInfo.jsp
src/main/java/com/cjs/site/action/user/fund/PickPayAction.java
View file @
5c598b0
...
...
@@ -8,6 +8,8 @@ import org.springframework.web.bind.annotation.RequestMethod;
import
org.springframework.web.bind.annotation.ResponseBody
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
java.util.Map
;
/**
* Created by bruce on 2019-05-14 13:41
...
...
@@ -22,14 +24,14 @@ public class PickPayAction {
//创建订单
@RequestMapping
(
value
=
"/createOrder"
,
method
=
RequestMethod
.
GET
)
@ResponseBody
public
Object
createOrder
()
{
return
pickPayBiz
.
createOrder
();
public
Object
createOrder
(
HttpSession
session
)
{
return
pickPayBiz
.
createOrder
(
session
);
}
//支付通知
@RequestMapping
(
value
=
"notify"
,
method
=
RequestMethod
.
POST
)
public
String
notify
(
HttpServletRequest
request
)
{
pickPayBiz
.
isValidNotify
(
request
);
public
String
notify
(
Map
<
String
,
String
>
params
)
{
pickPayBiz
.
isValidNotify
(
params
);
return
"/jsp/payResult.jsp"
;
}
...
...
src/main/java/com/cjs/site/action/user/pick/PickAction.java
View file @
5c598b0
package
com
.
cjs
.
site
.
action
.
user
.
pick
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
javax.servlet.http.HttpSession
;
...
...
@@ -28,40 +29,43 @@ import com.cjs.site.util.web.ActionUtil;
/**
* 提货
*
* @author tongyufu
*
* @author tongyufu
*/
@Controller
@RequestMapping
(
"/user/pick"
)
public
class
PickAction
{
Logger
log
=
LogManager
.
getLogger
();
Logger
log
=
LogManager
.
getLogger
();
@Autowired
private
PickBiz
pickBiz
;
private
PickBiz
pickBiz
;
@Autowired
private
UserAddressDao
addressDao
;
@Autowired
private
PickPackageDao
pickPackageDao
;
@Autowired
private
WarehouseDao
warehouseDao
;
private
WarehouseDao
warehouseDao
;
@Autowired
private
WarehouseBiz
warehouseBiz
;
private
WarehouseBiz
warehouseBiz
;
/**提货方式选择*/
/**
* 提货方式选择
*/
@SuppressWarnings
(
"unchecked"
)
@RequestMapping
(
""
)
public
String
pickView
(
@RequestParam
String
applys
,
@RequestParam
String
pickType
,
@RequestParam
String
pack
,
Integer
packageId
,
HttpSession
session
)
{
applys
=
applys
.
replace
(
"\'"
,
"\""
);
session
.
setAttribute
(
"applyList"
,
JsonUtil
.
fromJson
(
applys
,
List
.
class
,
OutpropApplyInfo
.
class
));
JsonUtil
.
fromJson
(
applys
,
List
.
class
,
OutpropApplyInfo
.
class
));
session
.
setAttribute
(
"pack"
,
pack
);
session
.
setAttribute
(
"packageId"
,
packageId
);
return
"redirect:/user/pick/tab?pickType="
+
pickType
;
}
/**提货方式选择*/
/**
* 提货方式选择
*/
@SuppressWarnings
(
"unchecked"
)
@RequestMapping
(
"tab"
)
public
String
pickTab
(
@RequestParam
String
pickType
,
HttpSession
session
,
Model
model
)
{
...
...
@@ -79,7 +83,7 @@ public class PickAction {
return
"user/pick/self.jsp"
;
}
else
if
(
"2"
.
equals
(
pickType
))
{
//顺丰到付
List
<
OutpropApplyInfo
>
applyList
=
(
List
<
OutpropApplyInfo
>)
session
.
getAttribute
(
"applyList"
);
.
getAttribute
(
"applyList"
);
int
pickTotal
=
0
;
for
(
OutpropApplyInfo
apply
:
applyList
)
{
pickTotal
+=
apply
.
getOccurAmount
();
...
...
@@ -91,20 +95,24 @@ public class PickAction {
return
"user/pick/zhaoonline.jsp"
;
}
/**自提*/
/**
* 自提
*/
@RequestMapping
(
"self"
)
//todo 自提方式重定向页面应跳转到待支付页面
public
String
selfPick
(
OutpropApplyPickInfo
pickInfo
,
Model
model
,
RedirectAttributes
attributes
)
{
ResultInfo
resultInfo
=
pickBiz
.
selfPick
(
pickInfo
);
RedirectAttributes
attributes
,
HttpSession
session
)
{
ResultInfo
resultInfo
=
pickBiz
.
selfPick
New
(
pickInfo
);
session
.
setAttribute
(
"pickInfo"
,
pickInfo
);
this
.
putApplys
(
resultInfo
,
pickInfo
,
"2"
,
model
,
attributes
);
if
(
resultInfo
.
getCode
()
==
0
)
{
return
"user/pick/self.jsp"
;
}
return
"redirect:/user/pick/payInfo?pickType=
2
"
;
return
"redirect:/user/pick/payInfo?pickType=
1
"
;
}
/**网点自提*/
/**
* 网点自提
*/
@RequestMapping
(
"warehouse"
)
public
String
warehousePick
(
OutpropApplyPickInfo
pickInfo
,
Model
model
,
RedirectAttributes
attributes
)
{
...
...
@@ -114,16 +122,18 @@ public class PickAction {
return
"user/pick/warehouseDetail.jsp"
;
}
attributes
.
addFlashAttribute
(
"warehouse"
,
warehouseDao
.
queryByCode
(
pickInfo
.
getWarehouseCode
()));
return
"redirect:/user/pick/payInfo?pickType=
2
"
;
warehouseDao
.
queryByCode
(
pickInfo
.
getWarehouseCode
()));
return
"redirect:/user/pick/payInfo?pickType=
1
"
;
}
/**顺丰到付*/
/**
* 顺丰到付
*/
@RequestMapping
(
"express"
)
//todo 顺丰到付提货进入支付-提货详情页
public
String
expressPick
(
OutpropApplyPickInfo
pickInfo
,
Integer
addressId
,
Model
model
,
RedirectAttributes
attributes
)
{
RedirectAttributes
attributes
,
HttpSession
session
)
{
ResultInfo
resultInfo
=
pickBiz
.
expressPick
(
pickInfo
,
addressId
);
session
.
setAttribute
(
"pickInfo"
,
pickInfo
);
this
.
putApplys
(
resultInfo
,
pickInfo
,
"3"
,
model
,
attributes
);
if
(
resultInfo
.
getCode
()
==
0
)
{
model
.
addAttribute
(
"addresses"
,
addressDao
.
queryByUserId
(
ActionUtil
.
getUser
().
getClient_id
()));
...
...
@@ -133,20 +143,25 @@ public class PickAction {
return
"redirect:/user/pick/payInfo?pickType=2"
;
}
/**转赵涌在线拍卖*/
/**
* 转赵涌在线拍卖
*/
@RequestMapping
(
"zhaoonline"
)
//todo `转赵涌在线拍卖跳转
public
String
zhaoonlinePick
(
OutpropApplyPickInfo
pickInfo
,
Model
model
,
RedirectAttributes
attributes
)
{
ResultInfo
resultInfo
=
pickBiz
.
zhaoonlinePick
(
pickInfo
);
RedirectAttributes
attributes
,
HttpSession
session
)
{
session
.
setAttribute
(
"pickInfo"
,
pickInfo
);
ResultInfo
resultInfo
=
pickBiz
.
zhaoonlinePickNew
(
pickInfo
);
this
.
putApplys
(
resultInfo
,
pickInfo
,
"1"
,
model
,
attributes
);
if
(
resultInfo
.
getCode
()
==
0
)
{
return
"user/pick/zhaoonline.jsp"
;
}
return
"redirect:/user/pick/payInfo?pickType=
1
"
;
return
"redirect:/user/pick/payInfo?pickType=
3
"
;
}
/**网点自提*/
/**
* 网点自提
*/
@SuppressWarnings
(
"unchecked"
)
@RequestMapping
(
"warehouseDetail"
)
public
String
warehousePickView
(
@RequestParam
(
"warehouseCode"
)
String
warehouseCode
,
...
...
@@ -156,7 +171,7 @@ public class PickAction {
applys
=
applys
.
replace
(
"\'"
,
"\""
);
session
.
setAttribute
(
"applyList"
,
JsonUtil
.
fromJson
(
applys
,
List
.
class
,
OutpropApplyInfo
.
class
));
JsonUtil
.
fromJson
(
applys
,
List
.
class
,
OutpropApplyInfo
.
class
));
warehouse
=
warehouseBiz
.
parseWarehouseTime
(
warehouse
);
model
.
addAttribute
(
"warehouse"
,
warehouse
);
return
"user/pick/warehouseDetail.jsp"
;
...
...
@@ -170,22 +185,26 @@ public class PickAction {
@RequestMapping
(
"payInfo"
)
@SuppressWarnings
(
"unchecked"
)
//todo 计算托管费用
public
String
payInfo
(
HttpSession
session
,
Model
model
,
String
pickType
){
String
userId
=
ActionUtil
.
getUser
().
getUserId
();
public
String
payInfo
(
HttpSession
session
,
Model
model
,
String
pickType
,
OutpropApplyPickInfo
pickInfo
,
Integer
addressId
)
{
List
<
OutpropApplyInfo
>
applyList
=
(
List
<
OutpropApplyInfo
>)
session
.
getAttribute
(
"applyList"
);
int
pickTotal
=
0
;
Integer
trusteeshipCycle
=
DateUtil
.
getTrustCycle
();
for
(
OutpropApplyInfo
apply
:
applyList
)
{
apply
.
setTrusteeshipCycle
(
DateUtil
.
getTrustCycle
()
);
apply
.
setTrusteeshipCycle
(
trusteeshipCycle
);
apply
.
setWarehousingCharges
(
apply
.
getOccurAmount
()
*
apply
.
getTrusteeshipCycle
()
*
0.01
D
);
pickTotal
+=
apply
.
getOccurAmount
();
}
Double
totoalAmount
=
0.01
D
*
DateUtil
.
getTrustCycle
()
*
pickTotal
;
BigDecimal
totalAmount
=
new
BigDecimal
(
"0.01"
).
multiply
(
new
BigDecimal
(
trusteeshipCycle
)).
multiply
(
new
BigDecimal
(
pickTotal
));
if
(
addressId
!=
null
){
model
.
addAttribute
(
"pickName"
,
addressDao
.
queryById
(
addressId
).
getUserName
());
}
model
.
addAttribute
(
"pickDate"
,
pickInfo
.
getPickDate
());
model
.
addAttribute
(
"pickType"
,
pickType
);
model
.
addAttribute
(
"applyList"
,
applyList
);
model
.
addAttribute
(
"warehousingCharges"
,
totoalAmount
);
model
.
addAttribute
(
"totalAmount"
,
totoalAmount
+
6
D
);
model
.
addAttribute
(
"pickTotal"
,
pickTotal
);
model
.
addAttribute
(
"addresses"
,
JsonUtil
.
toJson
(
addressDao
.
queryByUserId
(
userId
)));
model
.
addAttribute
(
"warehousingCharges"
,
totalAmount
);
model
.
addAttribute
(
"totalAmount"
,
totalAmount
.
add
(
new
BigDecimal
(
"6"
)));
return
"user/pick/payInfo.jsp"
;
}
...
...
src/main/java/com/cjs/site/biz/user/pick/PickBiz.java
View file @
5c598b0
...
...
@@ -105,6 +105,23 @@ public class PickBiz {
return
amount
;
}
public
ResultInfo
selfPickNew
(
OutpropApplyPickInfo
pickInfo
){
String
pickType
=
StringUtils
.
isBlank
(
pickInfo
.
getDelegateName
())
?
"0"
:
"1"
;
if
(
"1"
.
equals
(
pickType
))
{
if
(
StringUtils
.
isBlank
(
pickInfo
.
getDelegateId
()))
{
return
new
ResultInfo
(
0
,
"委托人证件号码不能为空"
);
}
if
(
StringUtils
.
isBlank
(
pickInfo
.
getDelegateName
()))
{
return
new
ResultInfo
(
0
,
"委托人姓名不能为空"
);
}
}
String
pickDate
=
pickInfo
.
getPickDate
();
if
(
StringUtils
.
isBlank
(
pickDate
))
{
return
new
ResultInfo
(
0
,
"提货日期不能为空"
);
}
return
new
ResultInfo
(-
1
,
""
);
}
/**
* 自提
*/
...
...
@@ -241,6 +258,15 @@ public class PickBiz {
return
resultInfo
;
}
public
ResultInfo
zhaoonlinePickNew
(
OutpropApplyPickInfo
pickInfo
){
try
{
zhaoonlineBiz
.
checkZhaoonlineId
(
pickInfo
.
getZhaoonlineId
());
}
catch
(
ServiceException
e
)
{
return
new
ResultInfo
(
0
,
e
.
getMessage
());
}
return
new
ResultInfo
(-
1
,
""
);
}
/**转赵涌在线拍卖*/
public
ResultInfo
zhaoonlinePick
(
OutpropApplyPickInfo
pickInfo
)
{
//ResultInfo resultInfo = this.checkPickTime(9, 16);
...
...
src/main/java/com/cjs/site/biz/user/pick/PickPayBiz.java
View file @
5c598b0
...
...
@@ -5,6 +5,7 @@ import com.cjs.site.dao.user.pick.PickPackDao;
import
com.cjs.site.model.union.CreateQrCode
;
import
com.cjs.site.model.union.UnionResponse
;
import
com.cjs.site.model.user.pick.OutpropApplyPayInfo
;
import
com.cjs.site.model.user.pick.OutpropApplyPickInfo
;
import
com.cjs.site.model.user.pick.PickPackInfo
;
import
com.cjs.site.util.lang.DateEnum
;
import
com.cjs.site.util.lang.DateUtil
;
...
...
@@ -20,7 +21,8 @@ import org.springframework.transaction.TransactionDefinition;
import
org.springframework.transaction.TransactionStatus
;
import
org.springframework.transaction.support.DefaultTransactionDefinition
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpSession
;
import
java.math.BigDecimal
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -41,7 +43,11 @@ public class PickPayBiz {
@Qualifier
(
"transactionManagerOracle"
)
private
DataSourceTransactionManager
transactionManager
;
public
Map
<
String
,
Object
>
createOrder
()
{
public
Map
<
String
,
Object
>
createOrder
(
HttpSession
session
)
{
String
pickType
=
(
String
)
session
.
getAttribute
(
"pickType"
);
OutpropApplyPickInfo
pickInfo
=
(
OutpropApplyPickInfo
)
session
.
getAttribute
(
"pickInfo"
);
System
.
out
.
println
(
"---------------------------"
+
pickType
);
System
.
out
.
println
(
"---------------------------"
+
JsonUtil
.
toJson
(
pickInfo
));
Map
<
String
,
Object
>
result
=
new
HashMap
<
String
,
Object
>();
result
.
put
(
"code"
,
true
);
...
...
@@ -51,13 +57,16 @@ public class PickPayBiz {
for
(
PickPackInfo
apply
:
applyList
)
{
pickTotal
+=
apply
.
getCurrentAmount
();
}
Double
totalAmount
=
(
0.01
D
*
DateUtil
.
getTrustCycle
()
*
pickTotal
)
+
6
D
;
// BigDecimal totalAmount = new BigDecimal("0.01").multiply(new BigDecimal(DateUtil.getTrustCycle())).
// multiply(new BigDecimal(pickTotal)).add(new BigDecimal("6"));
BigDecimal
totalAmount
=
new
BigDecimal
(
"0.01"
);
//调试接口代码写死
result
.
put
(
"totalAmount"
,
totalAmount
);
String
pickNo
=
pickBiz
.
createPickNo
();
try
{
CreateQrCode
createQrCode
=
new
CreateQrCode
();
createQrCode
.
setBillNo
(
UnionPayUtil
.
getOrderNo
());
createQrCode
.
setTotalAmount
(
totalAmount
.
toString
());
createQrCode
.
setQrCodeId
(
UnionPayUtil
.
getQrCodeId
());
createQrCode
.
setBillNo
(
createQrCode
.
getQrCodeId
());
createQrCode
.
setTotalAmount
(
String
.
valueOf
(
totalAmount
.
multiply
(
BigDecimal
.
valueOf
(
100
)).
intValue
()));
createQrCode
.
setRequestTimestamp
(
DateUtil
.
getNow
());
createQrCode
.
setBillDate
(
DateUtil
.
getNow
(
DateEnum
.
DATE
));
createQrCode
.
setSrcReserve
(
pickNo
);
...
...
@@ -66,7 +75,7 @@ public class PickPayBiz {
String
json
=
UnionPayUtil
.
sendPost
(
UnionConstants
.
CREATE_ORDER
,
mapTypes
);
UnionResponse
response
=
JsonUtil
.
fromJson
(
json
,
UnionResponse
.
class
);
if
(
response
!=
null
&&
response
.
getErrCode
().
equals
(
UnionConstants
.
SUCCESS_CODE
))
{
result
.
put
(
"qrCode"
,
UnionPayUtil
.
createQrCode
(
createQrCode
.
get
BillNo
()));
result
.
put
(
"qrCode"
,
UnionPayUtil
.
createQrCode
(
createQrCode
.
get
QrCodeId
()));
insertPickPay
(
userId
,
createQrCode
.
getBillNo
(),
pickNo
);
}
else
{
result
.
put
(
"code"
,
false
);
...
...
@@ -79,8 +88,7 @@ public class PickPayBiz {
return
result
;
}
public
Boolean
isValidNotify
(
HttpServletRequest
request
)
{
Map
<
String
,
String
>
result
=
UnionPayUtil
.
getRequestParams
(
request
);
public
Boolean
isValidNotify
(
Map
<
String
,
String
>
result
)
{
if
(
UnionPayUtil
.
checkSign
(
result
))
{
DefaultTransactionDefinition
def
=
new
DefaultTransactionDefinition
();
def
.
setPropagationBehavior
(
TransactionDefinition
.
PROPAGATION_REQUIRED
);
...
...
@@ -94,6 +102,7 @@ public class PickPayBiz {
outpropApplyPayDao
.
update
(
update
);
//todo 更新库存,生成提货单<包含提货类型,提货人,提货日期,保价费>
}
transactionManager
.
commit
(
status
);
return
true
;
...
...
src/main/java/com/cjs/site/dao/user/pick/OutpropApplyPayDao.java
View file @
5c598b0
package
com
.
cjs
.
site
.
dao
.
user
.
pick
;
import
com.cjs.site.model.user.pick.OutpropApplyPayInfo
;
import
com.cjs.site.util.db.OracleDao
;
import
org.springframework.stereotype.Repository
;
/**
* Created by bruce on 2019-05-06 16:22
*/
@Repository
public
interface
OutpropApplyPayDao
{
public
interface
OutpropApplyPayDao
extends
OracleDao
{
void
insert
(
OutpropApplyPayInfo
entity
);
...
...
src/main/java/com/cjs/site/model/union/CreateQrCode.java
View file @
5c598b0
...
...
@@ -11,7 +11,7 @@ public class CreateQrCode implements Serializable {
private
static
final
long
serialVersionUID
=
4945657951041450816L
;
private
String
msgSrc
=
"
赵涌牛
"
;
private
String
msgSrc
=
"
WWW.TEST.COM
"
;
private
String
msgType
=
"bills.getQRCode"
;
private
String
requestTimestamp
;
private
String
srcReserve
;
...
...
@@ -21,6 +21,9 @@ public class CreateQrCode implements Serializable {
private
String
billNo
;
private
String
billDate
;
private
String
totalAmount
;
private
String
qrCodeId
;
private
String
returnUrl
=
"https://www.zhao.com/login"
;
private
String
notifyUrl
=
"http://192.168.10.106/notify.do"
;
public
String
getMsgSrc
()
{
return
msgSrc
;
...
...
@@ -101,4 +104,28 @@ public class CreateQrCode implements Serializable {
public
void
setTotalAmount
(
String
totalAmount
)
{
this
.
totalAmount
=
totalAmount
;
}
public
String
getQrCodeId
()
{
return
qrCodeId
;
}
public
void
setQrCodeId
(
String
qrCodeId
)
{
this
.
qrCodeId
=
qrCodeId
;
}
public
String
getReturnUrl
()
{
return
returnUrl
;
}
public
void
setReturnUrl
(
String
returnUrl
)
{
this
.
returnUrl
=
returnUrl
;
}
public
String
getNotifyUrl
()
{
return
notifyUrl
;
}
public
void
setNotifyUrl
(
String
notifyUrl
)
{
this
.
notifyUrl
=
notifyUrl
;
}
}
...
...
src/main/java/com/cjs/site/model/user/pick/OutpropApplyPayInfo.java
View file @
5c598b0
...
...
@@ -7,7 +7,7 @@ import com.cjs.site.model.BaseInfo;
*/
public
class
OutpropApplyPayInfo
extends
BaseInfo
{
private
static
final
long
serialVersionUID
=
6737890770319470632
L
;
private
static
final
long
serialVersionUID
=
1
L
;
private
String
tradeNo
;
private
String
clientId
;
...
...
src/main/java/com/cjs/site/util/lang/DateEnum.java
View file @
5c598b0
...
...
@@ -33,7 +33,7 @@ public enum DateEnum {
DATETIME2
(
"yyyy-MM-dd HH:mm"
),
//yyyyMMddmmHHssSSS
UNSIGNED_DATE_TIME_MILLS
(
"yyyyMMdd
mmHH
ssSSS"
);
UNSIGNED_DATE_TIME_MILLS
(
"yyyyMMdd
HHmm
ssSSS"
);
private
String
value
;
private
DateEnum
(
String
value
)
{
...
...
src/main/java/com/cjs/site/util/union/UnionConstants.java
View file @
5c598b0
...
...
@@ -20,22 +20,22 @@ public class UnionConstants {
/**
* 银联商务分配的来源编号
*/
public
static
final
String
MSG_ID
=
"
0001
"
;
public
static
final
String
MSG_ID
=
"
3194
"
;
/**
* 银联商务分配的商户号
*/
public
static
final
String
MID
=
"
98632165101
"
;
public
static
final
String
MID
=
"
898340149000005
"
;
/**
* 终端号,默认赋值
*/
public
static
final
String
TID
=
"
A0000
0001"
;
public
static
final
String
TID
=
"
8888
0001"
;
/**
* 银联商务分配的密钥
*/
public
static
final
String
MD5_KEY
=
"
SFASDGSDDFERQRSADFAYTJRGJGFH
"
;
public
static
final
String
MD5_KEY
=
"
fcAmtnx7MwismjWNhNKdHC44mNXtnEQeJkRrhKJwyrW2ysRR
"
;
/**
* 银联商务response返回正确的状态码
*/
public
static
final
String
SUCCESS_CODE
=
"
BAD_REQUEST
"
;
public
static
final
String
SUCCESS_CODE
=
"
SUCCESS
"
;
}
...
...
src/main/java/com/cjs/site/util/union/UnionPayUtil.java
View file @
5c598b0
...
...
@@ -5,19 +5,15 @@ import com.cjs.site.model.union.UnionResponse;
import
com.cjs.site.util.lang.DateEnum
;
import
com.cjs.site.util.lang.DateUtil
;
import
com.cjs.site.util.lang.JsonUtil
;
import
com.cjs.site.util.sand.SandPayUtil
;
import
org.apache.commons.codec.digest.DigestUtils
;
import
org.apache.commons.lang3.RandomStringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
javax.servlet.http.HttpServletRequest
;
import
java.io.*
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
java.net.URLDecoder
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.*
;
/**
* Created by bruce on 2019-05-14 10:07
...
...
@@ -29,11 +25,37 @@ public class UnionPayUtil {
}
private
static
String
makeSign
(
Map
<
String
,
String
>
params
)
{
String
preStr
=
SandPayUtil
.
map2
String
(
params
);
String
preStr
=
buildSign
String
(
params
);
String
text
=
preStr
+
UnionConstants
.
MD5_KEY
;
return
DigestUtils
.
md5Hex
(
getContentBytes
(
text
)).
toUpperCase
();
}
private
static
String
buildSignString
(
Map
<
String
,
String
>
params
)
{
if
(
params
==
null
||
params
.
size
()
==
0
)
{
return
""
;
}
List
<
String
>
keys
=
new
ArrayList
<
String
>(
params
.
size
());
for
(
String
key
:
params
.
keySet
())
{
if
(
"sign"
.
equals
(
key
))
continue
;
if
(
StringUtils
.
isEmpty
(
params
.
get
(
key
)))
continue
;
keys
.
add
(
key
);
}
Collections
.
sort
(
keys
);
StringBuilder
buf
=
new
StringBuilder
();
for
(
int
i
=
0
;
i
<
keys
.
size
();
i
++)
{
String
key
=
keys
.
get
(
i
);
String
value
=
params
.
get
(
key
);
if
(
i
==
keys
.
size
()
-
1
)
{
buf
.
append
(
key
).
append
(
"="
).
append
(
value
);
}
else
{
buf
.
append
(
key
).
append
(
"="
).
append
(
value
).
append
(
"&"
);
}
}
return
buf
.
toString
();
}
public
static
Boolean
checkSign
(
Map
<
String
,
String
>
params
)
{
String
sign
=
params
.
get
(
"sign"
);
if
(
StringUtils
.
isBlank
(
sign
))
{
...
...
@@ -43,7 +65,7 @@ public class UnionPayUtil {
return
StringUtils
.
equalsIgnoreCase
(
sign
,
signV
);
}
public
static
String
get
OrderNo
()
{
public
static
String
get
QrCodeId
()
{
String
date
=
DateUtil
.
parseDate
(
new
Date
(),
DateEnum
.
UNSIGNED_DATE_TIME_MILLS
);
String
rand
=
RandomStringUtils
.
randomNumeric
(
7
);
return
UnionConstants
.
MSG_ID
+
date
+
rand
;
...
...
@@ -57,7 +79,7 @@ public class UnionPayUtil {
}
}
public
static
Map
<
String
,
String
>
getRequestParams
(
HttpServletRequest
request
)
{
/*
public static Map<String, String> getRequestParams(HttpServletRequest request) {
Map<String, String[]> params = request.getParameterMap();
Map<String, String> params2 = new HashMap<String, String>();
for (String key : params.keySet()) {
...
...
@@ -67,19 +89,21 @@ public class UnionPayUtil {
}
}
return params2;
}
}
*/
@SuppressWarnings
(
"unchecked"
)
public
static
void
main
(
String
[]
args
)
{
CreateQrCode
createQrCode
=
new
CreateQrCode
();
createQrCode
.
setBillNo
(
getOrderNo
());
createQrCode
.
setTotalAmount
(
"1D"
);
createQrCode
.
setQrCodeId
(
getQrCodeId
());
createQrCode
.
setBillNo
(
createQrCode
.
getQrCodeId
());
createQrCode
.
setTotalAmount
(
"1"
);
createQrCode
.
setRequestTimestamp
(
DateUtil
.
getNow
());
createQrCode
.
setBillDate
(
DateUtil
.
getNow
(
DateEnum
.
DATE
));
createQrCode
.
setSrcReserve
(
"201905140001"
);
Map
<
String
,
String
>
mapTypes
=
JsonUtil
.
fromJson
(
JsonUtil
.
toJson
(
createQrCode
),
Map
.
class
);
String
json
=
sendPost
(
UnionConstants
.
CREATE_ORDER
,
mapTypes
);
UnionResponse
response
=
JsonUtil
.
fromJson
(
json
,
UnionResponse
.
class
);
System
.
out
.
println
(
createQrCode
.
getQrCodeId
());
System
.
out
.
println
(
JsonUtil
.
toJson
(
response
));
}
...
...
@@ -88,8 +112,7 @@ public class UnionPayUtil {
BufferedReader
in
=
null
;
StringBuilder
result
=
new
StringBuilder
();
Map
<
String
,
String
>
params
=
new
HashMap
<
String
,
String
>();
params
.
put
(
"sign"
,
makeSign
(
data
));
data
.
put
(
"sign"
,
makeSign
(
data
));
try
{
URL
realUrl
=
new
URL
(
url
);
...
...
@@ -100,7 +123,7 @@ public class UnionPayUtil {
conn
.
setDoOutput
(
true
);
conn
.
setDoInput
(
true
);
out
=
new
PrintWriter
(
conn
.
getOutputStream
());
out
.
print
(
SandPayUtil
.
map2String
(
params
));
out
.
write
(
JsonUtil
.
toJson
(
data
));
out
.
flush
();
in
=
new
BufferedReader
(
new
InputStreamReader
(
conn
.
getInputStream
()));
String
line
;
...
...
src/main/resources/mybatis/user/pick/out-prop-apply-pay-mapper.xml
View file @
5c598b0
...
...
@@ -18,7 +18,8 @@
<insert
id=
"insert"
parameterType=
"OutpropApplyPayInfo"
>
INSERT INTO HS_ASSET.OUTPROPAPPLY_PAY (TRADE_NO,CREATED_AT,UPDATED_AT,APPLY_NO,PAY_AT,STATUS)
VALUES (#{tradeNo}, #{createdAt}, #{updatedAt}, #{applyNo}, #{payAt}, #{status})
VALUES (#{tradeNo, jdbcType=VARCHAR}, #{createdAt, jdbcType=VARCHAR}, #{updatedAt, jdbcType=VARCHAR},
#{applyNo, jdbcType=VARCHAR}, #{payAt, jdbcType=VARCHAR}, #{status, jdbcType=VARCHAR})
</insert>
<select
id=
"selectByTradeNo"
parameterType=
"java.lang.String"
resultMap=
"BaseMap"
>
...
...
src/main/webapp/view/user/pick/express.jsp
View file @
5c598b0
...
...
@@ -34,7 +34,7 @@
<a
class=
"tab-seletced"
href=
"/user/pick/tab?pickType=2"
>
顺丰到付
</a>
</div>
<div
class=
"content zhaoonline"
>
<form
id=
"pickForm"
action=
"${ctx }/user/pick/payInfo"
method=
"post"
>
<form
id=
"pickForm"
action=
"${ctx }/user/pick/payInfo
?pickType=2
"
method=
"post"
>
<div
class=
"aBtn"
>
<h4
>
请选择收货地址
</h4>
<a
class=
"red-btn add-address"
href=
"${ctx }/user/address/search"
>
添加收货地址
</a>
...
...
src/main/webapp/view/user/pick/payInfo.jsp
View file @
5c598b0
...
...
@@ -100,7 +100,7 @@
提货方式:
</div>
<div
style=
"display: inline-block;vertical-align: top;width: 500px;"
>
<c:if
test=
"${pick
.pickType == '0
'}"
>
上门自提
</c:if>
<c:if
test=
"${pick
Type == '1
'}"
>
上门自提
</c:if>
<c:if
test=
"${pickType == '2' }"
>
顺丰到付
</c:if>
<c:if
test=
"${pickType == '3' }"
>
转赵涌在线
</c:if>
</div>
...
...
@@ -110,17 +110,19 @@
提货人:
</div>
<div
style=
"display: inline-block;vertical-align: top;width: 500px;"
>
陈鹏
${pickName }
</div>
</div>
<c:if
test=
"${pickType == '1'}"
>
<div
style=
"width: 100%;height: 30px;line-height: 30px;width: 620px;"
>
<div
style=
"display: inline-block;vertical-align: top;width: 100px;"
>
提货日期:
</div>
<div
style=
"display: inline-block;vertical-align: top;width: 500px;"
>
2019年4月25日
${pickDate }
</div>
</div>
</c:if>
</div>
<h4
style=
"margin-top: 60px;font-weight: bold;"
>
仓储明细
</h4>
<div
style=
"width: 760px;margin-top: 20px;"
>
...
...
Please
register
or
login
to post a comment