浏览代码

恒隆停车支付

fllmoyu 5 年之前
父节点
当前提交
eb6b8c0b09

+ 16 - 0
web/src/main/java/com/jpsoft/smart/modules/pay/alipay/AlipayController.java

@@ -2,6 +2,7 @@ package com.jpsoft.smart.modules.pay.alipay;
 
 
 import cn.hutool.core.date.DateUtil;
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSONObject;
 import com.alipay.api.AlipayApiException;
 import com.alipay.api.AlipayClient;
@@ -311,8 +312,22 @@ public class AlipayController {
 
         MessageResult result = new MessageResult();
 
+        log.warn(map.toString());
         try {
+            if (StrUtil.isBlank(map.get("openId"))){
+                throw new Exception("openId不存在");
+            }
+
+            if (StrUtil.isBlank(map.get("id"))){
+                throw new Exception("订单不存在");
+            }
+
+
+
             ParkingRecord parkingRecord = parkingRecordService.get(map.get("id"));
+
+            parkingRecord.setOpenId(map.get("openId"));
+            parkingRecordService.update(parkingRecord);
             if (parkingRecord == null){
                 throw new Exception("订单不存在");
             }
@@ -379,6 +394,7 @@ public class AlipayController {
             e.printStackTrace();
             log.error(e.getMessage(), e);
             result.setResult(false);
+            result.setCode(400);
             result.setMessage(e.getMessage());
         }
         return result;

+ 11 - 3
web/src/main/java/com/jpsoft/smart/modules/pay/weixin/WxPayController.java

@@ -242,18 +242,25 @@ public class WxPayController {
     public MessageResult parkingWxPay(@RequestBody Map<String,Object> map) {
         MessageResult msgResult = new MessageResult<>();
         try {
+            log.warn(map.toString());
+            if (StrUtil.isBlank(map.get("openId").toString())){
+                throw new Exception("openId不存在");
+            }
+            if (StrUtil.isBlank(map.get("id").toString())){
+                throw new Exception("订单不存在");
+            }
+
             ParkingRecord parkingRecord = parkingRecordService.get(map.get("id").toString());
 
             parkingRecord.setUpdateTime(new Date());
+            parkingRecord.setOpenId(map.get("openId").toString());
 
             parkingRecordService.update(parkingRecord);
 
             if (parkingRecord == null) {
                 throw new Exception("订单不存在");
             }
-            if (StrUtil.isBlank(parkingRecord.getOpenId())) {
-                throw new Exception("openId不存在");
-            }
+
             if (parkingRecord.getPayAmount().compareTo(BigDecimal.ZERO) != 1) {
                 throw new Exception("金额有误");
             }
@@ -321,6 +328,7 @@ public class WxPayController {
             e.printStackTrace();
             logger.error(e.getMessage(), e);
             msgResult.setResult(false);
+            msgResult.setCode(400);
             msgResult.setMessage(e.getMessage());
         }
         return msgResult;

+ 9 - 0
web/src/main/java/com/jpsoft/smart/modules/wechat/controller/WxController.java

@@ -955,6 +955,11 @@ public class WxController {
         HashMap<String, Object> dataMap = new HashMap<>();
         try {
 
+            if (StringUtils.isBlank(openId)){
+                throw new Exception("获取用户信息失败");
+            }
+
+
 
             if (StringUtils.isBlank(companyInfoId)) {
                 return new MessageResult(false, "公司为空", "", 400);
@@ -1077,6 +1082,10 @@ public class WxController {
         boolean result = true;
 
         try {
+//            if (StringUtils.isBlank(openId)){
+//                throw new Exception("获取用户信息失败");
+//            }
+
 
             if (StringUtils.isBlank(deviceCode)) {
                 code = 400;