|
@@ -1,8 +1,9 @@
|
|
|
package com.jzg.quotation.summary.aop;
|
|
package com.jzg.quotation.summary.aop;
|
|
|
|
|
|
|
|
|
|
+import cn.hutool.json.JSONUtil;
|
|
|
import com.alibaba.fastjson2.JSON;
|
|
import com.alibaba.fastjson2.JSON;
|
|
|
-import com.fasterxml.jackson.databind.ObjectMapper;
|
|
|
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
import com.jzg.commons.constants.dict.InsOrderStatusEnum;
|
|
|
|
|
+import com.jzg.commons.core.page.HttpResult;
|
|
|
import com.jzg.commons.entity.dto.VerifyAdjustParam;
|
|
import com.jzg.commons.entity.dto.VerifyAdjustParam;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrderAdjust;
|
|
import com.jzg.commons.entity.orders.po.InsOrderAdjust;
|
|
|
import com.jzg.commons.entity.orders.po.InsOrders;
|
|
import com.jzg.commons.entity.orders.po.InsOrders;
|
|
@@ -11,7 +12,6 @@ import com.jzg.commons.entity.orders.po.InsOrdersTrack;
|
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
import com.jzg.commons.entity.quote.vo.QuoteVo;
|
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
import com.jzg.commons.entity.quote.vo.aggregated.*;
|
|
|
import com.jzg.commons.entity.vo.AdjustAllRefundVo;
|
|
import com.jzg.commons.entity.vo.AdjustAllRefundVo;
|
|
|
-import com.jzg.commons.exception.SystemException;
|
|
|
|
|
import com.jzg.quotation.commons.constant.SpElMapping;
|
|
import com.jzg.quotation.commons.constant.SpElMapping;
|
|
|
import com.jzg.quotation.commons.utils.SpElFieldExtractor;
|
|
import com.jzg.quotation.commons.utils.SpElFieldExtractor;
|
|
|
import com.jzg.quotation.summary.constants.QuoteNumberConstant;
|
|
import com.jzg.quotation.summary.constants.QuoteNumberConstant;
|
|
@@ -24,6 +24,8 @@ import org.aspectj.lang.annotation.Around;
|
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
import org.aspectj.lang.annotation.Aspect;
|
|
|
import org.aspectj.lang.reflect.MethodSignature;
|
|
import org.aspectj.lang.reflect.MethodSignature;
|
|
|
import org.hibernate.validator.internal.util.stereotypes.Lazy;
|
|
import org.hibernate.validator.internal.util.stereotypes.Lazy;
|
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.expression.EvaluationContext;
|
|
import org.springframework.expression.EvaluationContext;
|
|
|
import org.springframework.expression.ExpressionParser;
|
|
import org.springframework.expression.ExpressionParser;
|
|
@@ -31,7 +33,6 @@ import org.springframework.expression.spel.standard.SpelExpressionParser;
|
|
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
|
import org.springframework.expression.spel.support.StandardEvaluationContext;
|
|
|
import org.springframework.stereotype.Component;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
-import java.lang.reflect.Method;
|
|
|
|
|
import java.util.List;
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
import java.util.Objects;
|
|
import java.util.Objects;
|
|
@@ -40,6 +41,8 @@ import java.util.Objects;
|
|
|
@Component
|
|
@Component
|
|
|
public class OrderOperationLogAspect {
|
|
public class OrderOperationLogAspect {
|
|
|
|
|
|
|
|
|
|
+ private static final Logger logger = LoggerFactory.getLogger(OrderOperationLogAspect.class);
|
|
|
|
|
+
|
|
|
@Autowired
|
|
@Autowired
|
|
|
@Lazy
|
|
@Lazy
|
|
|
private InsOrdersService orderService;
|
|
private InsOrdersService orderService;
|
|
@@ -141,10 +144,59 @@ public class OrderOperationLogAspect {
|
|
|
result = joinPoint.proceed();
|
|
result = joinPoint.proceed();
|
|
|
this.adjustSubmitLog(orderNo,result,log);
|
|
this.adjustSubmitLog(orderNo,result,log);
|
|
|
break;
|
|
break;
|
|
|
|
|
+ // 订单审核
|
|
|
|
|
+ case 14:
|
|
|
|
|
+ // 通过 SpEL 提取 入参
|
|
|
|
|
+ //orderNo = parser.parseExpression(log.orderSpEl()).getValue(context, String.class);
|
|
|
|
|
+ result = joinPoint.proceed();
|
|
|
|
|
+ HttpResult<String> res = (HttpResult)result;
|
|
|
|
|
+ this.dealApproveOrders(res.getData(),res,log);
|
|
|
|
|
+ break;
|
|
|
}
|
|
}
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 订单审核(通过/驳回)
|
|
|
|
|
+ *
|
|
|
|
|
+ * @author lipf
|
|
|
|
|
+ * @date 2026/6/13 14:27
|
|
|
|
|
+ */
|
|
|
|
|
+ void dealApproveOrders(String orderNo, HttpResult<String> result, OrderOperationLog log){
|
|
|
|
|
+ logger.info("订单审核通过或驳回时记录。orderNo=[{}],result=[{}]", orderNo, JSONUtil.toJsonStr(result));
|
|
|
|
|
+ // 定义要提取的字段
|
|
|
|
|
+ List<SpElMapping> mappings = List.of(
|
|
|
|
|
+ new SpElMapping("msg", "#ret.msg"),
|
|
|
|
|
+ new SpElMapping("code", "#ret.code"),
|
|
|
|
|
+ new SpElMapping("data", "#ret.data")
|
|
|
|
|
+ );
|
|
|
|
|
+ // 执行提取
|
|
|
|
|
+ Map<String, Object> extracted = fieldExtractor.extractFields(result, mappings);
|
|
|
|
|
+ logger.info("extracted=[{}]", JSONUtil.toJsonStr(extracted));
|
|
|
|
|
+ InsOrdersTrack track = new InsOrdersTrack();
|
|
|
|
|
+ InsOrders insOrders = orderService.getById(orderNo);
|
|
|
|
|
+ if(insOrders != null){
|
|
|
|
|
+ InsOrdersCarInfo carInfo = carInfoService.getByOrderId(insOrders.getId());
|
|
|
|
|
+ track.setLicenseNo(carInfo.getLicenseNo());
|
|
|
|
|
+ track.setCompanyId(insOrders.getCompanyId());
|
|
|
|
|
+ track.setResult(result.getMsg());
|
|
|
|
|
+ }else{
|
|
|
|
|
+ track.setResult("要审核的订单不存在");
|
|
|
|
|
+ }
|
|
|
|
|
+ track.setOrderNo(orderNo);
|
|
|
|
|
+ track.setModule(log.module());
|
|
|
|
|
+ track.setSubModule(log.subModule());
|
|
|
|
|
+ track.setOptType(log.optType().getCode());
|
|
|
|
|
+ track.setOptContent(log.description());
|
|
|
|
|
+ if(extracted.get("code").equals(200)){
|
|
|
|
|
+ track.setStatus(1);
|
|
|
|
|
+ }else{
|
|
|
|
|
+ track.setStatus(0);
|
|
|
|
|
+ }
|
|
|
|
|
+ traceService.save(track);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 审核批改订单
|
|
* 审核批改订单
|
|
|
* @param param
|
|
* @param param
|
|
@@ -152,6 +204,7 @@ public class OrderOperationLogAspect {
|
|
|
* @param log
|
|
* @param log
|
|
|
*/
|
|
*/
|
|
|
private void adjustVerifyLog(VerifyAdjustParam param, Object result, OrderOperationLog log) {
|
|
private void adjustVerifyLog(VerifyAdjustParam param, Object result, OrderOperationLog log) {
|
|
|
|
|
+ logger.info("adjustVerifyLog. param=[{}], result=[{}],log=[{}]", JSONUtil.toJsonStr(param), JSONUtil.toJsonStr(result), JSONUtil.toJsonStr(log));
|
|
|
|
|
|
|
|
// 定义要提取的字段
|
|
// 定义要提取的字段
|
|
|
List<SpElMapping> mappings = List.of(
|
|
List<SpElMapping> mappings = List.of(
|
|
@@ -215,7 +268,7 @@ public class OrderOperationLogAspect {
|
|
|
track.setOptContent(log.description());
|
|
track.setOptContent(log.description());
|
|
|
track.setCompanyId(insOrders.getCompanyId());
|
|
track.setCompanyId(insOrders.getCompanyId());
|
|
|
track.setLicenseNo(carInfo.getLicenseNo());
|
|
track.setLicenseNo(carInfo.getLicenseNo());
|
|
|
-
|
|
|
|
|
|
|
+ //track.setResult(JSONUtil.toJsonStr(result));
|
|
|
if(extracted.get("code").equals(200)){
|
|
if(extracted.get("code").equals(200)){
|
|
|
track.setStatus(QuoteNumberConstant.QuoteResult.SUCCESS.getCode());
|
|
track.setStatus(QuoteNumberConstant.QuoteResult.SUCCESS.getCode());
|
|
|
traceService.save(track);
|
|
traceService.save(track);
|