Browse Source

feat:“收钱吧数币支付v1.2“

soobin 1 năm trước cách đây
mục cha
commit
49633f4430

+ 6 - 10
src/main/java/com/szwl/service/impl/TEquipmentServiceImpl.java

@@ -1,13 +1,10 @@
 package com.szwl.service.impl;
 
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.szwl.feign.bean.SzwlFeign;
 import com.szwl.mapper.TEquipmentMapper;
 import com.szwl.model.bo.R;
 import com.szwl.model.entity.TEquipment;
-import com.szwl.model.query.StatisticsParam;
 import com.szwl.model.utils.PushUtils;
 import com.szwl.service.TEquipmentService;
 import org.apache.commons.lang.StringUtils;
@@ -16,8 +13,6 @@ import org.springframework.amqp.core.MessageProperties;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
-import java.util.List;
-
 /**
  * <p>
  * 设备表 服务实现类
@@ -33,6 +28,7 @@ public class TEquipmentServiceImpl extends ServiceImpl<TEquipmentMapper, TEquipm
 
     @Autowired
     SzwlFeign szwlFeign;
+
     @Override
     public String sentMessage(String clientId, String json) {
 
@@ -41,20 +37,20 @@ public class TEquipmentServiceImpl extends ServiceImpl<TEquipmentMapper, TEquipm
             return "该设备不存在";
         }
         String channel = equipment.getChannel();
-        String equimentType = equipment.getEquimentType();
-        if(StringUtils.isEmpty(channel)||channel.equals("1")||StringUtils.isEmpty(equimentType)){
+        String equipmentType = equipment.getEquimentType();
+        if (StringUtils.isEmpty(channel) || "1".equals(channel) || StringUtils.isEmpty(equipmentType)) {
             //用个推
             PushUtils.push(equipment.getGtClientId(), "", "", json);
             return "success";
         }
-        if(StringUtils.isNotEmpty(channel)&&channel.equals("2")&&StringUtils.isNotEmpty(equimentType)){
+        if (StringUtils.isNotEmpty(channel) && "2".equals(channel) && StringUtils.isNotEmpty(equipmentType)) {
             //用Mq
             //1 创建消息
             MessageProperties messageProperties = new MessageProperties();
             messageProperties.setContentType("text/plain");
             org.springframework.amqp.core.Message message = new org.springframework.amqp.core.Message(json.getBytes(), messageProperties);
-            amqpTemplate.send(equimentType, clientId, message);
-            System.out.println("mq发送成功,clientId="+clientId+"&json="+json);
+            amqpTemplate.send(equipmentType, clientId, message);
+            System.out.println("mq发送成功,clientId=" + clientId + "&json=" + json);
 
             return "success";
         }

+ 12 - 3
src/main/java/com/szwl/service/impl/TOrderServiceImpl.java

@@ -617,11 +617,16 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
                         sqbConfig.getTerminalSn(), sqbConfig.getNewTerminalKey(), orderNo);
                 log.info("查询结果:{}", query);
                 JSONObject queryJsonObject = JSON.parseObject(query);
-                orderStatus = queryJsonObject.getJSONObject("biz_response").getJSONObject("data")
+                JSONObject bizResponse = queryJsonObject.getJSONObject("biz_response");
+                String resultCode = bizResponse.getString("result_code");
+                if (resultCode.equals(ShouQianBaConstant.FAIL)) {
+                    break;
+                }
+                orderStatus = bizResponse.getJSONObject("data")
                         .getString("order_status");
                 if (orderStatus.equals(ShouQianBaConstant.PAID)) {
                     log.info("订单支付成功:{}", orderNo);
-                    JSONObject bizResponse = queryJsonObject.getJSONObject("biz_response");
+//                    JSONObject bizResponse = queryJsonObject.getJSONObject("biz_response");
                     // 付款时间
                     String channelFinishTime = bizResponse.getJSONObject("data").getString("channel_finish_time");
                     // 收钱吧订单号
@@ -705,6 +710,9 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
         if (StringUtils.isEmpty(ip)) {
             return JsonMessage.error("ip不能为空");
         }
+        if (!authCode.startsWith("0100")) {
+            return JsonMessage.error("请使用数币钱包支付");
+        }
         StringBuilder note = new StringBuilder();
         StringBuilder productName = new StringBuilder();
         String productNo = "";
@@ -883,6 +891,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
                 return JsonMessage.error("签到失败");
             }
             String newTerminalKey = terminal.getString("terminal_key");
+            sqbConfig.setTerminalKey(newTerminalKey);
             sqbConfig.setNewTerminalKey(newTerminalKey);
             sqbConfig.setCheckin("1");
             sqbConfigService.updateById(sqbConfig);
@@ -959,7 +968,7 @@ public class TOrderServiceImpl extends ServiceImpl<TOrderMapper, TOrder> impleme
             kindData.put("sn", sn);
             return JsonMessage.success(kindData.toString());
         } else {
-            return JsonMessage.error(result);
+            return JsonMessage.error("支付失败");
         }
     }
 

+ 1 - 1
src/main/java/com/szwl/utils/shouqianba/HttpProxy.java

@@ -623,7 +623,7 @@ public class HttpProxy {
             params.put("terminal_sn", terminalSn);           //终端号
             params.put("client_sn", clientSn);  //商户系统订单号,必须在商户系统内唯一;且长度不超过64字节
             params.put("total_amount",amount);               //交易总金额,以分为单位
-//            params.put("payway","23");	                     //支付方式,1:支付宝 3:微信 4:百付宝 5:京东钱包
+            params.put("payway","23");	                     //支付方式,1:支付宝 3:微信 4:百付宝 5:京东钱包
             params.put("dynamic_id", dynamicId);	 //条码内容
             params.put("subject", productName);	                 //交易简介
             params.put("operator", userName);	                 //门店操作员