Parcourir la source

BUG修正 客户查询订单完成

秦国才 il y a 4 ans
Parent
commit
519569eb02

+ 3 - 1
modules/get-order/src/main/java/com/fire/getorder/GetOrderApplication.java

@@ -1,16 +1,18 @@
 package com.fire.getorder;
 
 import com.spring4all.swagger.EnableSwagger2Doc;
+import org.mybatis.spring.annotation.MapperScan;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
 import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
 import org.springframework.scheduling.annotation.EnableScheduling;
 
-@SpringBootApplication(scanBasePackages = {"com.fire.getorder", "com.fire.common.redis"}, exclude = {DataSourceAutoConfiguration.class})
+@SpringBootApplication(scanBasePackages = {"com.fire.getorder", "com.fire.common.redis"})
 @EnableDiscoveryClient
 @EnableSwagger2Doc
 @EnableScheduling
+@MapperScan({"com.fire.getorder.mapper"})
 public class GetOrderApplication {
 
     public static void main(String[] args) {

+ 0 - 1
modules/get-order/src/main/java/com/fire/getorder/service/impl/CacheServiceImpl.java

@@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 
 import java.util.List;
-import java.util.Map;
 
 import java.util.stream.Collectors;
 

+ 8 - 4
modules/get-order/src/main/java/com/fire/getorder/service/impl/GetOrderServiceImpl.java

@@ -3,11 +3,9 @@ package com.fire.getorder.service.impl;
 
 
 import com.alibaba.nacos.api.utils.StringUtils;
-import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.ObjectMapper;
 import com.fire.dto.FlowAppInfo;
 import com.fire.dto.FlowOrderInfo;
-import com.fire.es.OrderEsDto;
 import com.fire.getorder.data.DataPool;
 import com.fire.getorder.request.GetOrderContent;
 import com.fire.getorder.request.GetOrderMsgBody;
@@ -49,6 +47,7 @@ public class GetOrderServiceImpl implements GetOrderService {
     @Resource
     private JedisCluster jedisCluster;
 
+
     public String timeSwap(Date time,String format) {
         //"yyyy-MM-dd hh:mm:ss"
         DateFormat df = new SimpleDateFormat(format);
@@ -162,7 +161,7 @@ public class GetOrderServiceImpl implements GetOrderService {
         //CP订单号
         String extensionId = content.getExtensionId();
         //sign校验
-        String signStr =  header.getSecretKey() + orderId + extensionId;
+        String signStr =  flowAppInfo.getAppKey() + orderId + extensionId;
         String sign = DigestUtils.md5DigestAsHex(signStr.getBytes(StandardCharsets.UTF_8));
         //sign校验
         if (!sign.equals(content.getSign())) {
@@ -171,7 +170,7 @@ public class GetOrderServiceImpl implements GetOrderService {
             return responseDto;
         }
 
-        if (StringUtils.isEmpty(orderId) && StringUtils.isEmpty(extensionId)) {
+        if (StringUtils.isBlank(orderId) && StringUtils.isBlank(extensionId)) {
             orderResp.setRCode(ORDER_NOT_EXISTS.status());
             orderResp.setRMsg(ORDER_NOT_EXISTS.message());
             return responseDto;
@@ -185,6 +184,11 @@ public class GetOrderServiceImpl implements GetOrderService {
             String redisIndex = "{down.order." + num + "}";
             //redis查询orderId
             String resOrderId = jedisCluster.hget(redisIndex, redisIndex + searchString);
+            if (resOrderId==null){
+                orderResp.setRCode(ORDER_NOT_EXISTS.status());
+                orderResp.setRMsg(ORDER_NOT_EXISTS.message());
+                return responseDto;
+            }
             if (!StringUtils.isBlank(orderId)) {
                 if (!resOrderId.equals(orderId)) {
                     orderResp.setRCode(ORDER_NOT_EXISTS.status());

+ 22 - 0
modules/get-order/src/main/resources/bootstrap.yml

@@ -3,6 +3,13 @@ server:
 spring:
   application:
     name: get-order
+  profiles:
+    active: dev
+---
+spring:
+  config:
+    activate:
+      on-profile: dev
   cloud:
     nacos:
       config:
@@ -12,4 +19,19 @@ spring:
       discovery:
         server-addr: 47.106.133.48:8848
         namespace: fire
+        service: get-order
+---
+spring:
+  config:
+    activate:
+      on-profile: test
+  cloud:
+    nacos:
+      config:
+        server-addr: 139.155.226.217:8848
+        file-extension: yaml
+        namespace: fire
+      discovery:
+        server-addr: 139.155.226.217:8848
+        namespace: fire
         service: get-order

+ 1 - 1
modules/get-order/src/main/resources/mapper/FlowAppInfoMapper.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
-<mapper namespace="com.fire.order.mapper.FlowAppInfoMapper">
+<mapper namespace="com.fire.getorder.mapper.FlowAppInfoMapper">
 
     <resultMap type="com.fire.dto.FlowAppInfo" id="FlowAppInfoMap">
         <result property="flowAppId" column="flow_app_id" jdbcType="INTEGER"/>