Ver código fonte

添加二维码路径

yq 3 anos atrás
pai
commit
4d4820482b

+ 2 - 13
src/main/java/com/usky/dxtop/model/Dish.java

@@ -9,7 +9,6 @@ import lombok.experimental.Accessors;
 
 import java.io.Serializable;
 import java.math.BigDecimal;
-import java.time.LocalDateTime;
 import java.util.Date;
 
 /**
@@ -58,19 +57,9 @@ public class Dish implements Serializable {
 
     private String mob;
 
-    private Integer pId;
+    private String details;
 
-    private String pName;
-
-    private BigDecimal pPrice;
-
-    private BigDecimal pAmt;
-
-    private Integer paymentType;
-
-    private BigDecimal paymentAmt;
-
-    private BigDecimal paymentBalance;
+    private String payments;
 
 
 }

+ 2 - 2
src/main/java/com/usky/dxtop/service/impl/QrCodeServiceImpl.java

@@ -45,9 +45,9 @@ public class QrCodeServiceImpl extends ServiceImpl<QrCodeMapper, QrCode> impleme
     @Override
     public boolean add(QrCode qrCode) {
         try {
-            String appPayPath = sysConfigService.selectConfigByKey("app.pay.path");
+            String payPath = String.format("%s%s","http://wx.ewoogi.com/vuepay/#/amount?type=",qrCode.getTopChannelName());
             //生成二维码
-            BufferedImage image = QRCodeUtil.encode(appPayPath, null, true);
+            BufferedImage image = QRCodeUtil.encode(payPath, null, true);
             // 转换流信息写出
             FastByteArrayOutputStream os = new FastByteArrayOutputStream();
             try

+ 1 - 25
src/main/java/com/usky/dxtop/service/listener/DishTransMqListener.java

@@ -8,9 +8,7 @@ import org.springframework.amqp.core.Message;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Component;
 
-import java.math.BigDecimal;
 import java.nio.charset.StandardCharsets;
-import java.util.Optional;
 
 /**
  * @author yq
@@ -33,32 +31,10 @@ public class DishTransMqListener {
             //消息内容
             String s = new String(message.getBody(), StandardCharsets.UTF_8);
             log.info("dish_trade_produce获取到的消息"+s);
-            Dish dish = checkDate(s);
+            Dish dish = JSONObject.parseObject(s, Dish.class);;
             dishService.saveOrUpdate(dish);
         } catch (Exception e) {
             log.info("dish_trade_produce"+"异常信息:" + e.getMessage());
         }
     }
-
-
-    public Dish checkDate(String message){
-        JSONObject jsonObject = JSONObject.parseObject(message);
-        Dish dish = JSONObject.parseObject(message, Dish.class);
-        JSONObject details = jsonObject.getJSONObject("details");
-        Optional.ofNullable(details)
-                .ifPresent(de -> {
-                    Optional.ofNullable(de.get("pid")).ifPresent(pId -> dish.setPId(Integer.parseInt(pId.toString())));
-                    Optional.ofNullable(de.get("name")).ifPresent(pName -> dish.setPName(pName.toString()));
-                    Optional.ofNullable(de.get("price")).ifPresent(pPrice -> dish.setPPrice(new BigDecimal(pPrice.toString())));
-                    Optional.ofNullable(de.get("amt")).ifPresent(pAmt -> dish.setPAmt(new BigDecimal(pAmt.toString())));
-                });
-        JSONObject payments = jsonObject.getJSONObject("payments");
-        Optional.ofNullable(payments)
-                .ifPresent(de -> {
-                    Optional.ofNullable(de.get("type")).ifPresent(type -> dish.setPaymentType(Integer.parseInt(type.toString())));
-                    Optional.ofNullable(de.get("amt")).ifPresent(amt -> dish.setPaymentAmt(new BigDecimal(amt.toString())));
-                    Optional.ofNullable(de.get("balance")).ifPresent(balance -> dish.setPaymentBalance(new BigDecimal(balance.toString())));
-                });
-        return dish;
-    }
 }