|
|
@@ -48,17 +48,17 @@ import java.util.*;
|
|
|
*/
|
|
|
@MINComponent
|
|
|
public class ShouhuoPay implements IMINAction{
|
|
|
-
|
|
|
+
|
|
|
/** 通用支付 */
|
|
|
public final static String MIN_COMMMON_PAY = "minCommmonPay";
|
|
|
-
|
|
|
+
|
|
|
/** PersonalPay支付回调 */
|
|
|
public final static String PERSONALPAY_CALL_BACK = "personalPayCallBack";
|
|
|
-
|
|
|
+
|
|
|
/** 查询PersonalPay的订单状态 */
|
|
|
public final static String QUERY_PERSONALPAY_ORDERSTT = "queryPersonalpayOrderstt";
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 通用支付
|
|
|
* @param payAmt 支付总金额
|
|
|
@@ -67,7 +67,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
* @param session
|
|
|
* @param fapRequest
|
|
|
* @return
|
|
|
- * @throws Exception
|
|
|
+ * @throws Exception
|
|
|
*/
|
|
|
@MINAction(value = MIN_COMMMON_PAY, transaction = IMINTransactionEnum.CMT)
|
|
|
public MINActionResult minCommmonPay(
|
|
|
@@ -93,7 +93,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
// 如果已经支付过一次
|
|
|
if(paymenList.size() > 0) {
|
|
|
// 0 初始状态,1成功,2失败,3在途,4待审核,5已审核
|
|
|
- if(!"0".equals(paymenList.get(0).getStatus())
|
|
|
+ if(!"0".equals(paymenList.get(0).getStatus())
|
|
|
&& !"3".equals(paymenList.get(0).getStatus())) {
|
|
|
throw new MINBusinessException("订单已经在支付中!");
|
|
|
}
|
|
|
@@ -105,7 +105,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
VmOrderInfExample orderExp = new VmOrderInfExample();
|
|
|
orderExp.createCriteria().andIdEqualTo(oldID);
|
|
|
Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).updateByExampleSelective(ordInf, orderExp);
|
|
|
-
|
|
|
+
|
|
|
// 产生新的订单号
|
|
|
orderId = DateUtil.getDifferentTimeByFormat("MMddHHmmss").concat(StringUtils.substring(orderId, 10));
|
|
|
ordInf.setId(orderId);
|
|
|
@@ -154,7 +154,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
payMentInf.setStatus("3");
|
|
|
Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).insert(payMentInf);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|
|
|
else {
|
|
|
//修改支付方式
|
|
|
@@ -341,11 +341,11 @@ public class ShouhuoPay implements IMINAction{
|
|
|
}
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
/**
|
|
|
* personalPay支付回调
|
|
|
* @return
|
|
|
- * @throws Exception
|
|
|
+ * @throws Exception
|
|
|
*/
|
|
|
@MINAction(value = PERSONALPAY_CALL_BACK, session = false)
|
|
|
public MINActionResult personalPayCallBack(
|
|
|
@@ -354,7 +354,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
) throws Exception {
|
|
|
|
|
|
MINActionResult res = new MINActionResult();
|
|
|
- /*StringBuffer sb = new StringBuffer() ;
|
|
|
+ StringBuffer sb = new StringBuffer() ;
|
|
|
InputStream is = request.getInputStream();
|
|
|
InputStreamReader isr = new InputStreamReader(is, "UTF-8");
|
|
|
BufferedReader br = new BufferedReader(isr, 1024*1024);
|
|
|
@@ -383,20 +383,13 @@ public class ShouhuoPay implements IMINAction{
|
|
|
amt = CommonUtil.divide(amt,"100");
|
|
|
//第三方订单号 OrderNo
|
|
|
String sysorderno = resMap.get("OrderNo").toString();
|
|
|
- //查询订单如果已支付状态表示已经回调过*/
|
|
|
- String payOrderno = "123";
|
|
|
- String orderno = "1000000543";
|
|
|
- //实付金额 BuyerPayAmount TotalAmount
|
|
|
- String amt = "0.02";
|
|
|
- amt = CommonUtil.divide(amt,"100");
|
|
|
- //第三方订单号 OrderNo
|
|
|
- String sysorderno = "1233";
|
|
|
+ //查询订单如果已支付状态表示已经回调过
|
|
|
//调用真实回调
|
|
|
IDrawService drawService = new DrawServiceImpl();
|
|
|
drawService.backEx(orderno, sysorderno, "TRADE_SUCCESS", amt,payOrderno, "", "");
|
|
|
return res;
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
|
|
|
/**
|
|
|
* 回调真实执行方法
|
|
|
@@ -406,7 +399,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
* @param amt 交易金额
|
|
|
* @param failReason 失败原因
|
|
|
* @param payChannel 支付通道(04快捷支付 91微信支付92支付宝支付 93钱包支付)
|
|
|
- * @throws Exception
|
|
|
+ * @throws Exception
|
|
|
*/
|
|
|
private void backEx(
|
|
|
String orderno,
|
|
|
@@ -416,7 +409,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
String payOrderno,
|
|
|
String failReason,
|
|
|
String payChannel) throws Exception {
|
|
|
-
|
|
|
+
|
|
|
// 交易流水号
|
|
|
VmPaymentInfExample paymentExp = new VmPaymentInfExample();
|
|
|
paymentExp.createCriteria().andTranflownoEqualTo(orderno);
|
|
|
@@ -436,14 +429,14 @@ public class ShouhuoPay implements IMINAction{
|
|
|
if(CommonUtil.isNotEmpty(payChannel)) {
|
|
|
payMentInf.setPaytype(payChannel);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
+
|
|
|
VmOrderInf orderInf = Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmOrderInfMapper.class).selectByPrimaryKey(orderno);
|
|
|
orderInf.setState("92"); // 92:支付中
|
|
|
// TRADE_SUCCESS:交易成功,用户付款成功
|
|
|
// TRADE_FINISHED:交易结束,付款金额已结算给商户
|
|
|
// TRADE_CLOSED:交易关闭,交易失败
|
|
|
- if("TRADE_SUCCESS".equals(status)
|
|
|
+ if("TRADE_SUCCESS".equals(status)
|
|
|
|| "TRADE_FINISHED".equals(status)) {
|
|
|
// 交易状态(0 初始状态,1成功,2失败,3在途,4待审核,5已审核)
|
|
|
payMentInf.setStatus("1");
|
|
|
@@ -462,7 +455,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
if(!CommonUtil.isEmpty(failReason)) {
|
|
|
payMentInf.setRemarktwo(failReason);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
Service.lookup(IMINDataBaseService.class).getMybatisMapper(VmPaymentInfMapper.class).updateByExampleSelective(payMentInf, paymentExp);
|
|
|
// 变更待结算账户
|
|
|
IAccountService service = Service.lookup(IAccountService.class);
|
|
|
@@ -507,7 +500,7 @@ public class ShouhuoPay implements IMINAction{
|
|
|
//组装推送接口
|
|
|
String sendUrl = url.concat("/VendingMachineAction/pushGoods").concat("?MINView=JSON");
|
|
|
String returnUrl = retUrl.concat("/DeliveryAction/backDeliveryForMachine");
|
|
|
-
|
|
|
+
|
|
|
//组装传送参数
|
|
|
//初始化查询条件
|
|
|
Map<String,String> map = new HashMap<String,String>();
|
|
|
@@ -564,5 +557,5 @@ public class ShouhuoPay implements IMINAction{
|
|
|
throw new MINBusinessException("没有提货信息!");
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
}
|