Explorar el Código

轨迹的修改

dongxin hace 1 año
padre
commit
17592d6d73

+ 4 - 3
tenant/insurance/quotation-commons/src/main/java/com/jzg/quotation/commons/utils/SpElFieldExtractor.java

@@ -1,5 +1,6 @@
 package com.jzg.quotation.commons.utils;
 package com.jzg.quotation.commons.utils;
 
 
+import com.alibaba.fastjson2.JSON;
 import com.jzg.quotation.commons.constant.SpElMapping;
 import com.jzg.quotation.commons.constant.SpElMapping;
 import org.springframework.expression.EvaluationContext;
 import org.springframework.expression.EvaluationContext;
 import org.springframework.expression.ExpressionParser;
 import org.springframework.expression.ExpressionParser;
@@ -19,8 +20,8 @@ public class SpElFieldExtractor {
     /**
     /**
      * 从返回对象中提取多个字段(根据 SpElMapping 定义)
      * 从返回对象中提取多个字段(根据 SpElMapping 定义)
      */
      */
-    public Map<String, String> extractFields(Object returnValue, List<SpElMapping> mappings) {
-        Map<String, String> result = new HashMap<>();
+    public Map<String, Object> extractFields(Object returnValue, List<SpElMapping> mappings) {
+        Map<String, Object> result = new HashMap<>();
         if (returnValue == null || mappings == null || mappings.isEmpty()) {
         if (returnValue == null || mappings == null || mappings.isEmpty()) {
             return result;
             return result;
         }
         }
@@ -31,7 +32,7 @@ public class SpElFieldExtractor {
         for (SpElMapping mapping : mappings) {
         for (SpElMapping mapping : mappings) {
             try {
             try {
                 Object val = parser.parseExpression(mapping.getSpel()).getValue(context);
                 Object val = parser.parseExpression(mapping.getSpel()).getValue(context);
-                result.put(mapping.getFieldName(), val != null ? val.toString() : null);
+                result.put(mapping.getFieldName(), val != null ? val : null);
             } catch (Exception e) {
             } catch (Exception e) {
                 result.put(mapping.getFieldName(), "SpEL解析失败");
                 result.put(mapping.getFieldName(), "SpEL解析失败");
             }
             }

+ 7 - 7
tenant/insurance/quotation-summary/src/main/java/com/jzg/quotation/summary/aop/OrderOperationLogAspect.java

@@ -132,7 +132,7 @@ public class OrderOperationLogAspect {
                 new SpElMapping("data", "#ret.data")
                 new SpElMapping("data", "#ret.data")
         );
         );
         // 执行提取
         // 执行提取
-        Map<String, String> extracted = fieldExtractor.extractFields(result, mappings);
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(orderId);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(orderId);
         if(extracted.get("code").equals("200")){
         if(extracted.get("code").equals("200")){
             if(!before.getOrderStatus().equals(after.getOrderStatus())){
             if(!before.getOrderStatus().equals(after.getOrderStatus())){
@@ -168,7 +168,7 @@ public class OrderOperationLogAspect {
                 new SpElMapping("data", "#ret.data")
                 new SpElMapping("data", "#ret.data")
         );
         );
         // 执行提取
         // 执行提取
-        Map<String, String> extracted = fieldExtractor.extractFields(result, mappings);
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         InsOrdersTrack track = new InsOrdersTrack();
         InsOrdersTrack track = new InsOrdersTrack();
@@ -208,7 +208,7 @@ public class OrderOperationLogAspect {
                 new SpElMapping("data", "#ret.data")
                 new SpElMapping("data", "#ret.data")
         );
         );
         // 执行提取
         // 执行提取
-        Map<String, String> extracted = fieldExtractor.extractFields(result, mappings);
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         if(extracted.get("code").equals("200")){
         if(extracted.get("code").equals("200")){
@@ -239,8 +239,8 @@ public class OrderOperationLogAspect {
                 new SpElMapping("data", "#ret.data")
                 new SpElMapping("data", "#ret.data")
         );
         );
         // 执行提取
         // 执行提取
-        Map<String, String> extracted = fieldExtractor.extractFields(result, mappings);
-        UnderwritingResultsVo res = JSON.parseObject(extracted.get("data")).toJavaObject(UnderwritingResultsVo.class);
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
+        UnderwritingResultsVo res = JSON.parseObject(JSON.toJSONString(extracted.get("data"))).toJavaObject(UnderwritingResultsVo.class);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         InsOrdersTrack track = new InsOrdersTrack();
         InsOrdersTrack track = new InsOrdersTrack();
@@ -295,8 +295,8 @@ public class OrderOperationLogAspect {
                 new SpElMapping("data", "#ret.data")
                 new SpElMapping("data", "#ret.data")
         );
         );
         // 执行提取
         // 执行提取
-        Map<String, String> extracted = fieldExtractor.extractFields(result, mappings);
-        QuoteResultsVo res = JSON.parseObject(extracted.get("data")).toJavaObject(QuoteResultsVo.class);
+        Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
+        QuoteResultsVo res = JSON.parseObject(JSON.toJSONString(extracted.get("data"))).toJavaObject(QuoteResultsVo.class);
         String orderId = res.getOrdersNo();
         String orderId = res.getOrdersNo();
         InsOrders insOrders = orderService.getById(orderId);
         InsOrders insOrders = orderService.getById(orderId);
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
         InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());