lyhzzz hace 2 años
padre
commit
8a96e75e3c

+ 3 - 1
src/main/java/com/fdkankan/ucenter/common/utils/AuthLicenseUtil.java

@@ -29,10 +29,12 @@ public class AuthLicenseUtil {
 
      public static JSONObject readLicense(){
          try {
-             createLicense();
+
              if (FileUtil.exist(licensePath + File.separator + "results" + File.separator + "encryption_info.xml")) {
                  String xml = FileUtils.readFile((licensePath + File.separator + "results" + File.separator + "encryption_info.xml"));
                  return XML.toJSONObject(xml);
+             }else {
+                 createLicense();
              }
          }catch (Exception e){
             log.error("readLicense-error:",e);

+ 20 - 0
src/main/java/com/fdkankan/ucenter/httpClient/address/PayAddressSource.java

@@ -0,0 +1,20 @@
+package com.fdkankan.ucenter.httpClient.address;
+
+import com.dtflys.forest.callback.AddressSource;
+import com.dtflys.forest.http.ForestAddress;
+import com.dtflys.forest.http.ForestRequest;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+
+@Component
+public class PayAddressSource implements AddressSource {
+
+    @Value("${4dkk.payService.basePath}")
+    private String basePath;
+
+
+    @Override
+    public ForestAddress getAddress(ForestRequest forestRequest) {
+        return new ForestAddress("","",null,basePath);
+    }
+}

+ 33 - 0
src/main/java/com/fdkankan/ucenter/httpClient/client/PayClient.java

@@ -0,0 +1,33 @@
+package com.fdkankan.ucenter.httpClient.client;
+
+import com.dtflys.forest.annotation.*;
+import com.fdkankan.ucenter.common.Result;
+import com.fdkankan.ucenter.common.ResultData;
+import com.fdkankan.ucenter.httpClient.address.LaserAddressSource;
+import com.fdkankan.ucenter.httpClient.param.PayOrderParam;
+import com.fdkankan.ucenter.httpClient.param.SSDownSceneParam;
+import com.fdkankan.ucenter.httpClient.param.SsBindParam;
+
+import java.util.List;
+import java.util.Map;
+
+/**
+ * 获取,调用激光服务
+ */
+@Address(source = LaserAddressSource.class)
+public interface PayClient {
+
+    /**
+     * 下单
+     */
+    @Post("/service/pay/order/down")
+    ResultData downOrder(@JSONBody PayOrderParam param);
+
+
+    /**
+     * 查询订单状态
+     */
+    @Get("/service/pay/order/info/{orderSn}")
+    ResultData queryOrder(@Var("orderSn")String orderSn);
+
+}

+ 12 - 0
src/main/java/com/fdkankan/ucenter/httpClient/param/PayOrderParam.java

@@ -0,0 +1,12 @@
+package com.fdkankan.ucenter.httpClient.param;
+
+import lombok.Data;
+
+import java.math.BigDecimal;
+
+@Data
+public class PayOrderParam {
+    private String serveName = "ucenter";
+    private BigDecimal orderMoney;
+    private String orderType;
+}

+ 63 - 0
src/main/java/com/fdkankan/ucenter/httpClient/vo/PayOrderVo.java

@@ -0,0 +1,63 @@
+package com.fdkankan.ucenter.httpClient.vo;
+
+import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
+import com.baomidou.mybatisplus.annotation.TableId;
+import lombok.Data;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+@Data
+public class PayOrderVo {
+
+    /**
+     * 订单表
+     */
+    private Integer orderId;
+
+    /**
+     * 服务名称
+     */
+    private String serveName;
+    /**
+     * 服务名称
+     */
+    private Integer serveId;
+
+    /**
+     * 订单编号
+     */
+    private String orderSn;
+
+    /**
+     * 订单类型
+     */
+    private String orderType;
+
+    /**
+     * 订单金额
+     */
+    private BigDecimal orderMoney;
+
+    /**
+     * 0微信h5,1微信jsapi,2,微信扫码支付,3支付宝扫码,4支付宝h5
+     */
+    private Integer payType;
+
+    /**
+     * 支付状态,0未支付,1支付成功,2支付失败
+     */
+    private Integer payStatus;
+
+    private String openId;
+
+    private String tradeNo;
+
+    private Date createTime;
+
+    private Date updateTime;
+
+    private Date payTime;
+
+}

+ 49 - 0
src/main/java/com/fdkankan/ucenter/mq/consumer/OrderDownConsumer.java

@@ -0,0 +1,49 @@
+package com.fdkankan.ucenter.mq.consumer;
+
+import com.alibaba.fastjson.JSONObject;
+import com.fdkankan.rabbitmq.util.RabbitMqProducer;
+import com.fdkankan.ucenter.httpClient.vo.PayOrderVo;
+import com.rabbitmq.client.Channel;
+import lombok.extern.slf4j.Slf4j;
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.amqp.core.ExchangeTypes;
+import org.springframework.amqp.core.Message;
+import org.springframework.amqp.rabbit.annotation.Exchange;
+import org.springframework.amqp.rabbit.annotation.Queue;
+import org.springframework.amqp.rabbit.annotation.QueueBinding;
+import org.springframework.amqp.rabbit.annotation.RabbitListener;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
+import sun.rmi.runtime.Log;
+
+import java.nio.charset.StandardCharsets;
+
+@Slf4j
+@Component
+public class OrderDownConsumer {
+
+    @Value("${queue.orderPay.order-down:order-down}")
+    private String orderDownQueue;
+    @Value("${queue.orderPay.down-payResult:down-payResult}")
+    private String orderPayResultQueue;
+
+    @Autowired
+    RabbitMqProducer rabbitMqProducer;
+
+
+    @RabbitListener(
+            queuesToDeclare = @Queue("${queue.orderPay.down-payResult:down-payResult}")
+    )
+    public void consumerQueue(Channel channel, Message message) throws Exception {
+        String messageId = message.getMessageProperties().getMessageId();
+        String msg = new String(message.getBody(), StandardCharsets.UTF_8);
+        log.info("接受下单结果mq消息:messageId:{},msg:{}",messageId,msg);
+        channel.basicAck(message.getMessageProperties().getDeliveryTag(), false);
+
+        msg = StringEscapeUtils.unescapeJava(msg);
+        PayOrderVo order = JSONObject.parseObject(msg, PayOrderVo.class);
+
+    }
+}