Răsfoiți Sursa

永诚更新、增加操作日志

ligang134 3 ani în urmă
părinte
comite
e37fc1401e

+ 78 - 78
src/main/java/com/ydtech/aop/HttpAspect.java

@@ -1,78 +1,78 @@
-package com.ydtech.aop;
-
-
-import com.ydtech.core.page.HttpResult;
-import org.aspectj.lang.JoinPoint;
-import org.aspectj.lang.ProceedingJoinPoint;
-import org.aspectj.lang.annotation.*;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.stereotype.Component;
-import org.springframework.web.context.request.RequestContextHolder;
-import org.springframework.web.context.request.ServletRequestAttributes;
-
-import javax.servlet.http.HttpServletRequest;
-
-/**
- * https://blog.csdn.net/qq_31001665/article/details/71357825
- * Created by zhuzhengping on 2017/5/4.
- * 切面类
- * AOP切面,记录方法的调用,入参以及出參
- */
-@Aspect
-@Component
-public class HttpAspect {
-
-    private final static Logger LOGGER = LoggerFactory.getLogger(HttpAspect.class);
-
-    @Autowired
-    private GlobalExceptionHandler exceptionHandle;
-
-    @Pointcut("execution(public * com.ydtech.*.controller.*.*(..))")
-//    @Pointcut("@annotation(logOnly)")
-    public void log() {
-
-    }
-
-    @Before("log()")
-    public void doBefore(JoinPoint joinPoint) {
-        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
-        HttpServletRequest request = attributes.getRequest();
-
-        //url
-        LOGGER.info("url={}", request.getRequestURL());
-        //method
-        LOGGER.info("method={}", request.getMethod());
-        //ip
-        LOGGER.info("id={}", request.getRemoteAddr());
-        //class_method
-        LOGGER.info("class_method={}", joinPoint.getSignature().getDeclaringTypeName() + "," + joinPoint.getSignature().getName());
-        //args[]
-        LOGGER.info("args={}", joinPoint.getArgs());
-    }
-
-    @Around("log()")
-    public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
-        HttpResult result = null;
-        try {
-
-        } catch (Exception e) {
-            return exceptionHandle.exceptionGet(e);
-        }
-        if (result == null) {
-            return proceedingJoinPoint.proceed();
-        } else {
-            return result;
-        }
-    }
-
-    @AfterReturning(pointcut = "log()", returning = "object")//打印输出结果
-    public void doAfterReturing(Object object) {
-        if (object != null) {
-            LOGGER.info("response={}", object.toString());
-        }
-    }
-}
-
-
+//package com.ydtech.aop;
+//
+//
+//import com.ydtech.core.page.HttpResult;
+//import org.aspectj.lang.JoinPoint;
+//import org.aspectj.lang.ProceedingJoinPoint;
+//import org.aspectj.lang.annotation.*;
+//import org.slf4j.Logger;
+//import org.slf4j.LoggerFactory;
+//import org.springframework.beans.factory.annotation.Autowired;
+//import org.springframework.stereotype.Component;
+//import org.springframework.web.context.request.RequestContextHolder;
+//import org.springframework.web.context.request.ServletRequestAttributes;
+//
+//import javax.servlet.http.HttpServletRequest;
+//
+///**
+// * https://blog.csdn.net/qq_31001665/article/details/71357825
+// * Created by zhuzhengping on 2017/5/4.
+// * 切面类
+// * AOP切面,记录方法的调用,入参以及出參
+// */
+//@Aspect
+//@Component
+//public class HttpAspect {
+//
+//    private final static Logger LOGGER = LoggerFactory.getLogger(HttpAspect.class);
+//
+//    @Autowired
+//    private GlobalExceptionHandler exceptionHandle;
+//
+//    @Pointcut("execution(public * com.ydtech.*.controller.*.*(..))")
+////    @Pointcut("@annotation(logOnly)")
+//    public void log() {
+//
+//    }
+//
+//    @Before("log()")
+//    public void doBefore(JoinPoint joinPoint) {
+//        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+//        HttpServletRequest request = attributes.getRequest();
+//
+//        //url
+//        LOGGER.info("url={}", request.getRequestURL());
+//        //method
+//        LOGGER.info("method={}", request.getMethod());
+//        //ip
+//        LOGGER.info("id={}", request.getRemoteAddr());
+//        //class_method
+//        LOGGER.info("class_method={}", joinPoint.getSignature().getDeclaringTypeName() + "," + joinPoint.getSignature().getName());
+//        //args[]
+//        LOGGER.info("args={}", joinPoint.getArgs());
+//    }
+//
+//    @Around("log()")
+//    public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
+//        HttpResult result = null;
+//        try {
+//
+//        } catch (Exception e) {
+//            return exceptionHandle.exceptionGet(e);
+//        }
+//        if (result == null) {
+//            return proceedingJoinPoint.proceed();
+//        } else {
+//            return result;
+//        }
+//    }
+//
+//    @AfterReturning(pointcut = "log()", returning = "object")//打印输出结果
+//    public void doAfterReturing(Object object) {
+//        if (object != null) {
+//            LOGGER.info("response={}", object.toString());
+//        }
+//    }
+//}
+//
+//

+ 5 - 2
src/main/java/com/ydtech/aop/HttpAspect_CBIT.java

@@ -29,7 +29,8 @@ import java.util.Date;
 @Component
 public class HttpAspect_CBIT {
 
-    private final static Logger LOGGER = LoggerFactory.getLogger(HttpAspect.class);
+    private final static Logger LOGGER = LoggerFactory.getLogger(HttpAspect_CBIT.class);
+//    private final static Logger LOGGER = LoggerFactory.getLogger(HttpAspect.class);
 
     @Autowired
     private GlobalExceptionHandler exceptionHandle;
@@ -38,7 +39,9 @@ public class HttpAspect_CBIT {
 
 
     @Pointcut("execution(public * com.ydtech.modules.ins.controller.InsCBITAPIController.*(..)) || execution(public * com.ydtech.modules.ins.controller.InsALY_CBITAPIController.*(..))" +
-            "|| execution(public * com.ydtech.modules.ins.controller.YongAnController.*(..))")
+            "|| execution(public * com.ydtech.modules.ins.controller.YongAnController.*(..))"
+    )
+//    @Pointcut("execution(public * com.ydtech.modules.*.controller.*.*(..)) ")
     public void log() {
 
     }

+ 119 - 0
src/main/java/com/ydtech/aop/LogAspect.java

@@ -0,0 +1,119 @@
+package com.ydtech.aop;
+
+import com.alibaba.fastjson.JSONObject;
+import com.ydtech.core.page.HttpResult;
+import com.ydtech.modules.admin.model.SysLog;
+import com.ydtech.modules.admin.service.SysLogService;
+import com.ydtech.security.utils.JwtTokenUtils;
+import io.swagger.annotations.ApiOperation;
+import org.aspectj.lang.JoinPoint;
+import org.aspectj.lang.ProceedingJoinPoint;
+import org.aspectj.lang.annotation.*;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+
+import javax.servlet.http.HttpServletRequest;
+import java.lang.reflect.Method;
+import java.util.Date;
+
+/**
+ * 日志切面类
+ * AOP切面,记录方法的调用,入参以及出參
+ */
+@Aspect
+@Component
+public class LogAspect {
+
+    private final static Logger LOGGER = LoggerFactory.getLogger(LogAspect.class);
+
+    @Autowired
+    private GlobalExceptionHandler exceptionHandle;
+    @Autowired
+    private SysLogService sysLogService;
+
+
+    @Pointcut("execution(public * com.ydtech.modules.*.controller.*.*(..)) ")
+    public void log() {
+
+    }
+
+    @Before("log()")
+    public void doBefore(JoinPoint joinPoint) {
+        ServletRequestAttributes attributes = (ServletRequestAttributes) RequestContextHolder.getRequestAttributes();
+        HttpServletRequest request = attributes.getRequest();
+
+        //请求人 url method ip class_method
+        SysLog sysLog = new SysLog(JwtTokenUtils.getUsernameFromRequest(request), request.getRequestURL().toString(), request.getMethod(), joinPoint.getSignature().getDeclaringTypeName(), joinPoint.getSignature().getName(), request.getRemoteAddr(), new Date());
+
+        try {
+            //获取注解注释
+            String annotationValue = getAnnotationValue(joinPoint);
+            sysLog.setDescription(annotationValue);
+
+            //获取请求参数
+            Object[] args = joinPoint.getArgs();
+            for (Object obj : args) {
+                if (null != obj && (obj.getClass().getName().startsWith("com.ydtech.modules") || obj instanceof String)) {
+                    sysLog.setParams(JSONObject.toJSON(obj).toString());
+                }
+            }
+            if (request.getMethod().equals("GET")) {
+                sysLog.setParams(request.getQueryString());
+            }
+            sysLog.preInsert();
+            sysLogService.insert(sysLog);
+        } catch (ClassNotFoundException e) {
+            e.printStackTrace();
+        }
+
+    }
+
+    @Around("log()")
+    public Object doAround(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {
+        HttpResult result = null;
+        try {
+
+        } catch (Exception e) {
+            return exceptionHandle.exceptionGet(e);
+        }
+        if (result == null) {
+            return proceedingJoinPoint.proceed();
+        } else {
+            return result;
+        }
+    }
+
+    @AfterReturning(pointcut = "log()", returning = "object")//打印输出结果
+    public void doAfterReturing(Object object) {
+        if (object != null) {
+            LOGGER.info("response={}", object.toString());
+        }
+    }
+
+    private String getAnnotationValue(JoinPoint joinPoint) throws ClassNotFoundException {
+        //反射获取类
+        Class<?> clazz = Class.forName(joinPoint.getSignature().getDeclaringTypeName());
+        //通过方法名反射获取method
+        Method[] declaredMethods = clazz.getDeclaredMethods();
+        //请求方法名
+        String requestName = joinPoint.getSignature().getName();
+
+        for (Method method : declaredMethods) {
+            String name = method.getName();
+            //获取方法上的注解
+            if (name.equals(requestName)) {
+                ApiOperation annotation = method.getAnnotation(ApiOperation.class);
+                if (annotation != null) {
+                    return annotation.value();
+                }
+            }
+        }
+        return null;
+    }
+}
+
+

+ 7 - 6
src/main/java/com/ydtech/components/YongchengRequestApiComponents.java → src/main/java/com/ydtech/components/InsAlltrustRequestApiComponents.java

@@ -13,7 +13,7 @@ import org.springframework.stereotype.Component;
  */
 @Component
 @Data
-public class YongchengRequestApiComponents {
+public class InsAlltrustRequestApiComponents {
 
     @Value("${yc.api.url}")
     String url = "";
@@ -30,6 +30,8 @@ public class YongchengRequestApiComponents {
     private String dptCde;
     @Value("${yc.api.agent.agentCode}")
     private String agentCode;
+    @Value("${yc.api.agent.conferCode}")
+    private String conferCode;
     @Value("${yc.api.agent.agentType}")
     private String agentType;
     @Value("${yc.api.agent.agentNme}")
@@ -40,7 +42,7 @@ public class YongchengRequestApiComponents {
     private String operatorCode;
     @Value("${yc.api.agent.salesmanNo}")
     private String salesmanNo;
-    @Value("${yc.api.agent.cChaType}")
+    @Value("${yc.api.agent.CChaType}")
     private String cChaType;
     @Value("${yc.api.agent.custNature}")
     private String custNature;
@@ -63,14 +65,13 @@ public class YongchengRequestApiComponents {
         if (null == agent) {
             agent = new Agent();
             agent.setAgentCode(agentCode);
-            agent.setConferCode(agentType);
+            agent.setConferCode(conferCode);
             agent.setAgentType(agentType);
             agent.setAgentNme(agentNme);
             agent.setQlftNo(qlftNo);
             agent.setCustNature(custNature);
-            agent.setAgentProfId(agentCode);
-            agent.setSubCoNo(agentType);
-            agent.setCustNature(cOprcde);
+            agent.setAgentProfId(qlftNo);
+            agent.setSubCoNo(conferCode);
         }
         return agent;
     }

+ 36 - 89
src/main/java/com/ydtech/modules/ins/controller/InsYongChengApiController.java → src/main/java/com/ydtech/modules/ins/controller/InsAlltrustApiController.java

@@ -3,36 +3,28 @@ package com.ydtech.modules.ins.controller;
 
 import com.ydtech.aop.request.MethodLogAnnotation;
 import com.ydtech.aop.request.RequestSingleParam;
-import com.ydtech.constants.enums.InsYcAccident;
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.esm.model.InsTaskImage;
 import com.ydtech.modules.esm.service.InsTaskImageService;
 import com.ydtech.modules.ins.model.ya.CarModel_Req;
 import com.ydtech.modules.ins.model.yc.CallBackRequest;
-import com.ydtech.modules.ins.service.InsYongchengApiService;
+import com.ydtech.modules.ins.service.InsAlltrustApiService;
 import com.ydtech.modules.order.components.InsOrdersComponents;
+import com.ydtech.modules.order.entity.vo.AccidentalDrivingVo;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
+import com.ydtech.modules.order.entity.vo.BaseQuoteVo;
 import com.ydtech.utils.Base64Utils;
-import com.ydtech.utils.RedisUtils;
 import com.ydtech.utils.StringUtils;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiImplicitParam;
 import io.swagger.annotations.ApiImplicitParams;
 import io.swagger.annotations.ApiOperation;
-import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
-import java.io.UnsupportedEncodingException;
-import java.nio.charset.StandardCharsets;
 import java.util.*;
 
-import sun.misc.BASE64Decoder;
-import sun.misc.BASE64Encoder;
-
 import javax.servlet.http.HttpServletRequest;
 
 /**
@@ -43,12 +35,12 @@ import javax.servlet.http.HttpServletRequest;
 @Api(tags = "永诚API方式对接")
 @RestController
 @RequestMapping("/api/yongCheng")
-public class InsYongChengApiController {
+public class InsAlltrustApiController {
 
     private static final Logger log = LoggerFactory.getLogger("alltrust");
 
     @Autowired
-    InsYongchengApiService insYongchengApiService;
+    InsAlltrustApiService insYongchengApiService;
 
     @Autowired
     InsOrdersComponents insOrdersComponents;
@@ -66,53 +58,37 @@ public class InsYongChengApiController {
     @ApiOperation(value = "永诚API方式 - 报价")
     @PostMapping("/quote")
     @MethodLogAnnotation(title = "永诚API方式 - 报价")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "orderNo", value = "订单号")
-    })
-    public HttpResult quoteApi(String orderNo) {
-        BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(orderNo);
+    public HttpResult quoteApi(@RequestBody BaseQuoteVo<AccidentalDrivingVo> quoteVo) {
+        BaseQuoteInfoVo quoteInfo = insOrdersComponents.getQuoteInfo(quoteVo.getOrderNo());
         return insYongchengApiService.quoteApi(quoteInfo);
     }
 
     @ApiOperation(value = "永诚API方式 - 核保")
     @PostMapping("/audit")
     @MethodLogAnnotation(title = "永诚API方式 - 核保")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "quoteOrderNo", value = "报价订单号")
-    })
-    public HttpResult auditApi(String quoteOrderNo) {
-        return insYongchengApiService.auditApi(quoteOrderNo);
+    public HttpResult auditApi(@RequestSingleParam(value = "companyId") String companyId) {
+        return insYongchengApiService.auditApi(companyId);
     }
 
     @ApiOperation(value = "永诚API方式 - 影像上传")
     @PostMapping(value = "/UploadImage")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "quoteNo", value = "报价号"),
-            @ApiImplicitParam(name = "quoteOrderNo", value = "报价订单号")
-    })
-    public HttpResult UploadImageApi(String quoteNo, String quoteOrderNo) {
-        List<InsTaskImage> insTaskImage = insTaskImageService.selectByTaskId(quoteNo);
-        return insYongchengApiService.UploadImageApi(insTaskImage, quoteOrderNo);
+    public HttpResult UploadImageApi(@RequestSingleParam(value = "companyId") String companyId) {
+
+        return insYongchengApiService.UploadImageApi(companyId);
     }
 
 
     @ApiOperation(value = "永诚API方式 - 获取支付链接")
     @PostMapping("/getPayUrl")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "quoteOrderNo", value = "报价订单号")
-    })
-    public HttpResult getPayUrl(String quoteOrderNo) {
-        return insYongchengApiService.getPayUrlApi(quoteOrderNo);
+    public HttpResult getPayUrl(@RequestSingleParam(value = "companyId") String companyId) {
+        return insYongchengApiService.getPayUrlApi(companyId);
     }
 
 
     @ApiOperation(value = "永诚API方式 - 补传回调及订单信息查询接口")
     @PostMapping("/callbackAnOrder")
-    @ApiImplicitParams({
-            @ApiImplicitParam(name = "quoteOrderNo", value = "报价订单号")
-    })
-    public HttpResult callbackAnOrder(String quoteOrderNo) {
-        return insYongchengApiService.callbackAnOrder(quoteOrderNo);
+    public HttpResult callbackAnOrder(@RequestSingleParam(value = "companyId") String companyId) {
+        return insYongchengApiService.callbackAnOrder(companyId);
     }
 
 
@@ -174,24 +150,12 @@ public class InsYongChengApiController {
     @ApiOperation(value = "永诚API方式 -电子保单")
     @PostMapping("/getPolicyPrint")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "quoteOrderNo", value = "报价订单号"),
+            @ApiImplicitParam(name = "companyId",required = true, value = "报价订单号"),
             @ApiImplicitParam(name = "type", value = "类型,1交强,2商业")
     })
-    public HttpResult getPolicyPrintApi(String quoteOrderNo,String type) {
-//        //子订单
-//        InsAreaCompany iac = insAreaCompanyService.getById(companyId);
-//        iac.getPaymentLink()
-        return insYongchengApiService.getPolicyPrintApi(quoteOrderNo,StringUtils.toString(type,"1"));
+    public HttpResult getPolicyPrintApi(String companyId,String type) {
+        return insYongchengApiService.getPolicyPrintApi(companyId,StringUtils.toString(type,"1"));
     }
-//
-//    /*
-//    02-车险电子标志
-//     */
-//    @PostMapping("/getPolicyPrint2")
-//    public HttpResult getPolicyPrint2(@RequestBody InsOrder orderno) {
-//
-//        return yongAnService.getPolicyPrint(orderno.getOrderno(), orderno.getPolicytype(), "02");
-//    }
 
     /**
      * 获得意外险列表
@@ -199,44 +163,27 @@ public class InsYongChengApiController {
     @ApiOperation(value = "永诚API方式 -意外险列表")
     @PostMapping("/gainAccidentList")
     @ApiImplicitParams({
-            @ApiImplicitParam(name = "quoteOrderNo", value = "报价订单号")
+            @ApiImplicitParam(name = "companyId",required = true, value = "报价订单号")
     })
-    public HttpResult gainAccidentList(String quoteOrderNo) {
-        return insYongchengApiService.gainAccidentList(quoteOrderNo);
+    public HttpResult gainAccidentList(String companyId) {
+        return insYongchengApiService.gainAccidentList(companyId);
     }
 
 
-    /**
-     * 测试获取redis
-     */
-    @ApiOperation(value = "测试获取redis")
-    @GetMapping("/testRedis")
-    public HttpResult testRedis() {
-        log.info("this is a info log");
-        log.warn("this is a warn log");
-        log.error("this is a error log");
-        log.debug("ddddddddddddddd");
-        return HttpResult.ok(RedisUtils.exists("aaa"));
-
-    }
+//    /**
+//     * 测试获取redis
+//     * @
+//     */
+//    @ApiOperation(value = "测试获取redis")
+//    @GetMapping("/testRedis")
+//    public HttpResult testRedis() {
+//        log.info("this is a info log");
+//        log.warn("this is a warn log");
+//        log.error("this is a error log");
+//        log.debug("ddddddddddddddd");
+//        return HttpResult.ok(RedisUtils.exists("aaa"));
+//
+//    }
 
 
-//    @ApiOperation(value = "根据多个字典类型查询字典数据")
-//    @GetMapping("/listAllDataByTypes")
-//    public List<DictionaryManagement> listAllDataByTypes(@RequestParam Set<String> dictTypeList) {
-//        List<DictionaryManagement> dmList = new ArrayList<>();
-//        Map<String, DictionaryManagement> dmMap = DictEnumConfig.getDmMap();
-//        Set<String> dictTypeListRemain = new HashSet<>();
-//        for (String dictType : dictTypeList) {
-//            if (dmMap.containsKey(dictType)){
-//                DictionaryManagement dictionaryManagement = dmMap.get(dictType);
-//                dmList.add(dictionaryManagement);
-//            }else {
-//                dictTypeListRemain.add(dictType);
-//            }
-//        }
-////        List<DictionaryManagement> dictionaryManagements = dictionaryManagementService.listAllDataByTypes(dictTypeListRemain);
-////        dmList.addAll(dictionaryManagements);
-//        return dmList;
-//    }
 }

+ 10 - 0
src/main/java/com/ydtech/modules/ins/model/ya/CarModel_Req.java

@@ -1,6 +1,8 @@
 package com.ydtech.modules.ins.model.ya;
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import io.swagger.annotations.ApiModel;
+import io.swagger.annotations.ApiModelProperty;
 import lombok.Data;
 
 /**
@@ -9,14 +11,22 @@ import lombok.Data;
  * @date 2022-07-13 17:11
  */
 @Data
+@ApiModel("永安车型")
 public class CarModel_Req {
 
+    @ApiModelProperty("车辆识别代号(车架号)")
     private String frameNo;//车辆识别代号(车架号)
+    @ApiModelProperty("号牌号码")
     private String licenseNo;//号牌号码
+    @ApiModelProperty("发动机号")
     private String engineNo;//发动机号
+    @ApiModelProperty("初登日期")
     private String enrollDate;//初登日期
+    @ApiModelProperty("车型名称")
     private String modelName;
+    @ApiModelProperty("车型编码")
     private String modelCode;
+    @ApiModelProperty("是否新车")
     private String newVehicle;//是否新车
 
     public CarModel_Req(String frameNo, String enrollDate, String modelName) {

+ 3 - 4
src/main/java/com/ydtech/modules/ins/model/yc/accident/Accident.java

@@ -1,12 +1,11 @@
-package com.ydtech.modules.ins.model.yc.pay;
+package com.ydtech.modules.ins.model.yc.accident;
 
 import com.alibaba.fastjson.JSON;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import com.ydtech.components.YongchengRequestApiComponents;
+import com.ydtech.components.InsAlltrustRequestApiComponents;
 import com.ydtech.modules.ins.model.cbit.VehicleModel_QueRen;
 import com.ydtech.modules.ins.model.yc.AuthorityDataXml;
-import com.ydtech.modules.order.entity.InsAreaCompany;
 import com.ydtech.modules.order.entity.InsOrders;
 import lombok.Data;
 
@@ -69,7 +68,7 @@ public class Accident {
      * @author: lig
      * @date: 2023-02-15
      */
-    public static Accident buildPayParam(InsOrders order, AuthorityDataXml authorityDataXml, YongchengRequestApiComponents apiComponents) {
+    public static Accident buildPayParam(InsOrders order, AuthorityDataXml authorityDataXml, InsAlltrustRequestApiComponents apiComponents) {
 
         Accident m = new Accident();
 //

+ 2 - 3
src/main/java/com/ydtech/modules/ins/model/yc/imageUp/ImageUp.java

@@ -2,8 +2,7 @@ package com.ydtech.modules.ins.model.yc.imageUp;
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import com.ydtech.components.YongchengRequestApiComponents;
-import com.ydtech.modules.ins.model.InsOrder;
+import com.ydtech.components.InsAlltrustRequestApiComponents;
 import com.ydtech.modules.ins.model.yc.AuthorityDataXml;
 import com.ydtech.modules.order.entity.InsOrders;
 import com.ydtech.utils.StringUtils;
@@ -102,7 +101,7 @@ public class ImageUp {
      * @author: lig
      * @date: 2023-02-15
      */
-    public static ImageUp buildImageUpParam(InsOrders order, AuthorityDataXml authorityDataXml, String encoderBase, String imgType, YongchengRequestApiComponents apiComponents) {
+    public static ImageUp buildImageUpParam(InsOrders order, AuthorityDataXml authorityDataXml, String encoderBase, String imgType, InsAlltrustRequestApiComponents apiComponents) {
 
 //        CustomerInfoVo insureInfo = JSONObject.parseObject(order.getInsureinfo().toJSONString(), CustomerInfoVo.class);
 //        CustomerInfoVo applyInfo = JSONObject.parseObject(order.getApplyinfo().toJSONString(), CustomerInfoVo.class);

+ 3 - 2
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Applicant.java

@@ -254,7 +254,7 @@ public class Applicant {
         applicant.setCMobile(policyHolderInfo.getMobile());
         applicant.setCCertfCde(policyHolderInfo.getIdentifyNumber());
         applicant.setCCertfCls("120001");
-        applicant.setCResvTxt5("007");
+        applicant.setCResvTxt5("000");
         applicant.setCClntMrk("1");
         applicant.setCAreaCde("103132");
         applicant.setCCntrNme(policyHolderInfo.getName());
@@ -266,7 +266,8 @@ public class Applicant {
 
         applicant.setCRelCde(ownerInfo.getName().equals(policyHolderInfo.getName())?"601005":"601008");
 
-        applicant.setTCertfClsValiDate("9999-12-31");
+
+        applicant.setTCertfClsValiDate(policyHolderInfo.getIdentifyValidEndDate());
 
 
 

+ 5 - 9
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Base.java

@@ -1,17 +1,13 @@
 package com.ydtech.modules.ins.model.yc.ruote;
 
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.ydtech.components.YongchengRequestApiComponents;
+import com.ydtech.components.InsAlltrustRequestApiComponents;
 import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
 import com.ydtech.modules.ins.vo.RiskInfoVo;
 import com.ydtech.utils.DateTimeUtil;
 import com.ydtech.utils.DateUtil;
 import lombok.Data;
-import org.apache.commons.lang3.StringUtils;
-import org.apache.commons.lang3.time.DateUtils;
 
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
@@ -282,7 +278,7 @@ public class Base {
     private String CBsnsTyp;
 
 
-    public static Base buildBase(YaQuoteInfoVo yaQuoteInfoVo, YongchengRequestApiComponents apiComponents) {
+    public static Base buildBase(YaQuoteInfoVo yaQuoteInfoVo, InsAlltrustRequestApiComponents apiComponents) {
 //    public static Base buildBase(YaQuoteInfoVo yaQuoteInfoVo,Agent agent) {
         Base base = new Base();
 
@@ -293,7 +289,7 @@ public class Base {
         base.setNPrmRmbExch("1");
         base.setCAmtCur("01");
         base.setCPrmCur("01");
-        base.setCOprCde(apiComponents.getCBsnsTyp());
+        base.setCOprCde(apiComponents.getCOprcde());
         base.setCImmeffMrk("1");
         base.setCUserType("0");
         base.setUserType("0");
@@ -307,8 +303,8 @@ public class Base {
         base.setTaxFlag("1");
         base.setRenewalFlagJQ("0");
         base.setRenewalFlagSY("0");
-        base.setCSlsCde(apiComponents.getCChaType());
-        base.setOperatorCode(apiComponents.getSalesmanNo());
+        base.setCSlsCde(apiComponents.getSalesmanNo());
+        base.setOperatorCode(apiComponents.getOperatorCode());
         base.setTIssueTm(DateUtil.getDateFormat(new Date(), "yyyy-MM-dd"));
         base.setCChaType("191010");
 

+ 1 - 1
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Insured.java

@@ -284,7 +284,7 @@ public class Insured {
 //        insured.setCProvince(Province.buildProvince(insuredPersonInfo.getAddr()));
 //        insured.setCCity(City.buildCity(insuredPersonInfo.getAddr()));
 
-        insured.setTCertfClsValiDate("9999-12-31");
+        insured.setTCertfClsValiDate(insuredPersonInfo.getIdentifyValidEndDate());
 
         insured.setCRelCdes(ownerInfo.getName().equals(insuredPersonInfo.getName())?"601005":"601008");
 

+ 2 - 2
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Ruote.java

@@ -3,7 +3,7 @@ package com.ydtech.modules.ins.model.yc.ruote;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlElementWrapper;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
 import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
-import com.ydtech.components.YongchengRequestApiComponents;
+import com.ydtech.components.InsAlltrustRequestApiComponents;
 import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
 import com.ydtech.modules.ins.model.yc.AuthorityDataXml;
 import com.ydtech.modules.ins.model.yc.YcBuildData;
@@ -151,7 +151,7 @@ public class Ruote {
      * @author: lig
      * @date: 2023年02月08日 0008
      */
-    public static Ruote buildQuoteParam(YaQuoteInfoVo yaQuoteInfoVo, AuthorityDataXml authorityDataXml, Agent agent, YongchengRequestApiComponents apiComponents) {
+    public static Ruote buildQuoteParam(YaQuoteInfoVo yaQuoteInfoVo, AuthorityDataXml authorityDataXml, Agent agent, InsAlltrustRequestApiComponents apiComponents) {
 //    public static Ruote buildQuoteParam(YaQuoteInfoVo yaQuoteInfoVo, AuthorityDataXml authorityDataXml,Agent agent) {
 
         Ruote m = new Ruote();

+ 6 - 5
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhl.java

@@ -347,7 +347,6 @@ public class Vhl {
 //        vhl.setNResvNum1(carInfo.getSeatCount());
 
 
-        vhl.setNDefDisplacement(carInfo.getEnginedesc());
 
         LocalDate lDate = LocalDate.parse(carInfo.getRegisterDate());
         LocalDate newlDate = LocalDate.now();
@@ -373,14 +372,15 @@ public class Vhl {
         //305005001:未验 305005002:已验车 305005003:免验车 305005004:需验车
         vhl.setCInspectionCde("305005003");
         vhl.setCDevice8Mrk("0");
-        vhl.setNDisplacement(carInfo.getExhaustScale());
-        vhl.setNDefDisplacement(carInfo.getExhaustScale());
+        String enginedesc = carInfo.getEnginedesc();
+        vhl.setNDisplacement(enginedesc);
+        vhl.setNDefDisplacement(enginedesc);
         vhl.setFuelType("32773001");
 //        vhl.setNActualValue(String.valueOf((Double.parseDouble(carInfo.getPurchasePrice()) * 0.9)));
 //        vhl.setNNewPurchaseValue(String.valueOf((Double.parseDouble(carInfo.getPurchasePrice()) * 0.9)));
         vhl.setNPureRange("0.0");
-        //@TODO 功率取不到
-        vhl.setCDisplacementLvl("67");
+        vhl.setCDisplacementLvl(carInfo.getPowerScale());
+//        vhl.setCDisplacementLvl("67");
         vhl.setCFstRegYm(carInfo.getIssueDate());
         vhl.setNNewPriceValue(carInfo.getPurchasePrice());
 
@@ -424,6 +424,7 @@ public class Vhl {
         vhl.setCRegVhlTyp("K33");
 
 
+
         return vhl;
     }
 

+ 1 - 2
src/main/java/com/ydtech/modules/ins/model/yc/ruote/Vhlowner.java

@@ -132,8 +132,7 @@ public class Vhlowner {
 //        vhlowner.setCProvince(Province.buildProvince(ownerInfo.getAddr()));
 //        vhlowner.setCCity(City.buildCity(ownerInfo.getAddr()));
 
-        //@TODO 不确定
-        vhlowner.setCWorkdptKind("330");
+        vhlowner.setCWorkdptKind("900");
         //地址  自建
         vhlowner.setCWaddress(ownerInfo.getAddr());
 

+ 2 - 7
src/main/java/com/ydtech/modules/ins/service/InsYongchengApiService.java → src/main/java/com/ydtech/modules/ins/service/InsAlltrustApiService.java

@@ -1,18 +1,13 @@
 package com.ydtech.modules.ins.service;
 
 import com.ydtech.core.page.HttpResult;
-import com.ydtech.modules.esm.model.InsTaskImage;
 import com.ydtech.modules.ins.model.ya.CarModel_Req;
-import com.ydtech.modules.ins.model.ya.YaQuoteInfoVo;
 import com.ydtech.modules.ins.model.yc.CallBackRequest;
-import com.ydtech.modules.ins.model.yc.YongchengPolicyPrintResponse;
 import com.ydtech.modules.order.entity.vo.BaseQuoteInfoVo;
 
-import java.io.IOException;
-import java.util.List;
 import java.util.Map;
 
-public interface InsYongchengApiService{
+public interface InsAlltrustApiService {
 
 
 
@@ -39,7 +34,7 @@ public interface InsYongchengApiService{
      * @param
      * @return
      */
-    HttpResult UploadImageApi(List<InsTaskImage> insTaskImage,String quoteOrderNo);
+    HttpResult UploadImageApi(String quoteOrderNo);
 //    /**
 //     * 影像上传
 //     *

+ 35 - 46
src/main/java/com/ydtech/modules/ins/service/impl/InsYongchengApiServiceImpl.java → src/main/java/com/ydtech/modules/ins/service/impl/InsAlltrustApiServiceImpl.java

@@ -6,7 +6,7 @@ import com.fasterxml.jackson.annotation.JsonInclude;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.databind.*;
 import com.fasterxml.jackson.dataformat.xml.XmlMapper;
-import com.ydtech.components.YongchengRequestApiComponents;
+import com.ydtech.components.InsAlltrustRequestApiComponents;
 import com.ydtech.constants.InsTaskHistoryEnum;
 import com.ydtech.constants.enums.InsOrderStatus;
 import com.ydtech.constants.enums.InsQuoteFlow;
@@ -31,8 +31,7 @@ import com.ydtech.modules.ins.model.yc.imageUp.response.ImageUpResponse;
 import com.ydtech.modules.ins.model.yc.modelsQuery.ModelsQueryResponse;
 import com.ydtech.modules.ins.model.yc.modelsQuery.ModelsQueryXml;
 import com.ydtech.modules.ins.model.yc.order.CallbackAnOrder;
-import com.ydtech.modules.ins.model.yc.order.response.CallbackAnOrderResponse;
-import com.ydtech.modules.ins.model.yc.pay.Accident;
+import com.ydtech.modules.ins.model.yc.accident.Accident;
 import com.ydtech.modules.ins.model.yc.pay.Pay;
 import com.ydtech.modules.ins.model.yc.pay.response.AccidentResponse;
 import com.ydtech.modules.ins.model.yc.pay.response.PayResponse;
@@ -50,7 +49,6 @@ import com.ydtech.modules.order.service.InsOrdersService;
 import com.ydtech.utils.HttpXmlUtil;
 import com.ydtech.utils.IDCardUtils;
 import com.ydtech.utils.StringUtils;
-import lombok.extern.slf4j.Slf4j;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.springframework.beans.BeanUtils;
@@ -68,13 +66,13 @@ import java.util.*;
 
 
 @Service
-public class InsYongchengApiServiceImpl implements InsYongchengApiService {
+public class InsAlltrustApiServiceImpl implements InsAlltrustApiService {
 
 
-    private static final Logger log = LoggerFactory.getLogger("yongcheng");
+    private static final Logger log = LoggerFactory.getLogger("alltrust");
 
     @Autowired
-    private YongchengRequestApiComponents apiComponents;
+    private InsAlltrustRequestApiComponents apiComponents;
 
     @Autowired
     private InsAlltrustRegionMapper insAlltrustRegionMapper;
@@ -106,6 +104,8 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
     private InsAreaCompanyService insAreaCompanyService;
     @Autowired
     private InsOrdersService insOrdersService;
+    @Autowired
+    private InsTaskImageService insTaskImageService;
 
     @Autowired
     InsApiLogService insApiLogService;
@@ -157,33 +157,6 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
     }
 
 
-//    private final YongchengRequestComponents yongchengRequestComponents;
-//
-//    private final OrderComponents orderComponents;
-//
-//    private final StringRedisTemplate redisTemplate;
-//
-//    private final InsOrderService insOrderService;
-//
-//    private final InsTaskHistoryComponents insTaskHistoryComponents;
-//
-//    private final InsTaskImageService insTaskImageService;
-
-//    public InsYongchengApiServiceImpl(YongchengRequestComponents yongchengRequestComponents, OrderComponents orderComponents, StringRedisTemplate redisTemplate, InsOrderService insOrderService, InsTaskHistoryComponents insTaskHistoryComponents, InsTaskImageService insTaskImageService) {
-//        this.yongchengRequestComponents = yongchengRequestComponents;
-//        this.orderComponents = orderComponents;
-//        this.redisTemplate = redisTemplate;
-//        this.insOrderService = insOrderService;
-//        this.insTaskHistoryComponents = insTaskHistoryComponents;
-//        this.insTaskImageService = insTaskImageService;
-//    }
-
-//    public double parseDouble(String s) {
-//        if (StringUtils.isNullOrEmpty(s)) {
-//            return 0;
-//        }
-//        return Double.parseDouble(s);
-//    }
 
 
     //
@@ -196,9 +169,9 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
     @Override
     public HttpResult modelsQueryApi(CarModel_Req carModelReq) {
 
-        if (org.springframework.util.StringUtils.isEmpty(carModelReq.getFrameNo()) || org.springframework.util.StringUtils.isEmpty(carModelReq.getEnrollDate()) || org.springframework.util.StringUtils.isEmpty(carModelReq.getModelName())) {
-            return HttpResult.error("frameNo, enrollDate, modelName 这些参数不能为空!");
-        }
+//        if (org.springframework.util.StringUtils.isEmpty(carModelReq.getFrameNo()) || org.springframework.util.StringUtils.isEmpty(carModelReq.getEnrollDate()) || org.springframework.util.StringUtils.isEmpty(carModelReq.getModelName())) {
+//            return HttpResult.error("frameNo, enrollDate, modelName 这些参数不能为空!");
+//        }
 
         ModelsQueryXml m = buildModelsQueryParam(carModelReq);
         ObjectMapper xmlMapper = this.gainXmlMapper();
@@ -210,6 +183,9 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
         try {
             String cleanStr = YcBuildData.cleanResponseStr(responseData);
             ModelsQueryResponse rd = xmlMapper.readValue(cleanStr, ModelsQueryResponse.class);
+            if(rd.getReturnCode().equals("E0001")){
+                return HttpResult.ok(rd.getMsg());
+            }
             return HttpResult.ok(buildCarModel(rd));
         } catch (IOException e) {
             throw new RuntimeException(e);
@@ -335,7 +311,11 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
             iac.setSyappoint(""); //商业特别约定
 
             insAreaCompanyService.updateById(iac);
-            return HttpResult.ok(msg + "状态:" + InsOrderStatus.matchKey(iac.getOrderstatus()).getDesc());
+            if(InsOrderStatus.S_2.getCode().equals(InsOrderStatus.matchKey(iac.getOrderstatus()).getCode())){
+                return HttpResult.ok(msg);
+            }else{
+                return HttpResult.error(msg + "状态:" + InsOrderStatus.matchKey(iac.getOrderstatus()).getDesc());
+            }
 
 //            //插入轨迹表
 //            insTaskHistoryService.insertByOrderStatus(order);
@@ -355,14 +335,17 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
      * 4 影像上传
      */
     @Override
-    public HttpResult UploadImageApi(List<InsTaskImage> taskImageList, String quoteOrderNo) {
-
+    public HttpResult UploadImageApi(String quoteOrderNo) {
 
         HttpResult resutl = HttpResult.ok();
-        InsAreaCompany iac = insAreaCompanyService.getById(quoteOrderNo);
+        InsAreaCompany iac = insAreaCompanyService.getByIdIsExist(quoteOrderNo);
         InsOrders order = insOrdersService.getById(iac.getOrderno());
+        List<InsTaskImage> insTaskImages = insTaskImageService.selectByTaskId(order.getQuoteno());
 
-        taskImageList.stream().forEach(a -> {
+//        InsAreaCompany iac = insAreaCompanyService.getById(quoteOrderNo);
+//        InsOrders order = insOrdersService.getById(iac.getOrderno());
+
+        insTaskImages.stream().forEach(a -> {
             InsApiLog apiLog = null;
             //组装参数
             log.debug("=========永诚API方式 - xml请求 - 影像上传开始======");
@@ -1027,10 +1010,10 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
         Map<String,String> m = IDCardUtils.addressResolution(address);
         String city = m.get("city");
         String district = m.get("district");
-        if(StringUtils.isNullOrEmpty(district)){
-            //第二级赋值到第三级
-            district = city;
-        }
+//        if(StringUtils.isNullOrEmpty(district)){
+//            //第二级赋值到第三级
+//            district = city;
+//        }
 
         if(StringUtils.isNullOrEmpty(district)){
             return null;
@@ -1040,6 +1023,12 @@ public class InsYongchengApiServiceImpl implements InsYongchengApiService {
         LambdaQueryWrapper<InsAlltrustRegion> lqw = new LambdaQueryWrapper<>();
         lqw.eq(InsAlltrustRegion::getArea,district);
         List<InsAlltrustRegion> list = insAlltrustRegionMapper.selectList(lqw);
+        //如果地区查不到
+        if(null == list || list.size() < 1){
+            lqw = new LambdaQueryWrapper<>();
+            lqw.eq(InsAlltrustRegion::getArea,city);
+            list = insAlltrustRegionMapper.selectList(lqw);
+        }
         if(null != list && list.size() > 0){
             Map rMap = new HashMap();
             rMap.put("provinceCode",list.get(0).getProvinceCode());

+ 3 - 1
src/main/java/com/ydtech/modules/ins/vo/CarInfoVo.java

@@ -101,5 +101,7 @@ public class CarInfoVo {
     private String carnature;
     @ApiModelProperty(value = "所属性质(1个人 2企业 3机关)")
     private String property;
+    @ApiModelProperty(value = "发动机功率")
+    private String powerScale;
 
-}
+}

+ 22 - 9
src/main/resources/application-prod.yml

@@ -182,17 +182,30 @@ ya:
 yc:
   api:
     agent:
-      agentCode: 250000P00004
-      agentNme: 191010
-      agentType: 250000P0000401
-      cBsnsTyp: 100030057
-      cChaType: 100030057
-      cOprcde: 192099
-      custNature: 191010
+      # 机构代码(dptCde)
       dptCde: 14A4
-      operatorCode: 2752454675645
-      qlftNo: 永鑫保险销售服务有限公司山西分公司
+      # 渠道编码(agentCode)
+      agentCode: 250000P00004
+      # 协议编码(conferCode)
+      conferCode: 250000P0000401
+      # 渠道分类(agentType)
+      agentType: 191010
+      # 代理人名称(agentNme)
+      agentNme: 永鑫保险销售服务有限公司山西分公司
+      # 代理人资格证号(qlftNo)
+      qlftNo: 2752454675645
+      # 录入人(operatorCode)
+      operatorCode: 100030057
+      # 业务员代码(salesmanNo)
       salesmanNo: 100030057
+      # 新业务来源(CChaType)
+      CChaType: 191010
+      # 客户性质(custNature)
+      custNature: 192099
+      # 操作人员代码(cOprcde)
+      cOprcde: 100030057
+      # 业务来源(cBsnsTyp)
+      cBsnsTyp: 19002
     password: yc@20230202!
     pay:
       callBack: http://127.0.0.1:8080/api/yongCheng/callBack

+ 24 - 18
src/main/resources/application-test.yml

@@ -184,14 +184,16 @@ spring:
   # redis 配置
   redis:
     database: 0
-    host: localhost
+#    host: 127.0.0.1
+    host: 172.24.144.218
     lettuce:
       pool:
         max-active: 8
         max-idle: 8
         max-wait: 100
         min-idle: 0
-    password: ''
+#    password: ''
+    password: sxzgkj@2023
     port: 6379
     timeOut: 3000
   servlet:
@@ -230,28 +232,32 @@ yc:
   #api方式
   api:
     agent:
+      # 机构代码(dptCde)
+      dptCde: 14A4
       # 渠道编码(agentCode)
       agentCode: 250000P00004
-      # 渠道分类(agentType)
-      agentNme: 191010
       # 协议编码(conferCode)
-      agentType: 250000P0000401
-      # 操作人员代码(cOprcde)
-      cBsnsTyp: 100030057
-      # 业务员代码(salesmanNo)
-      cChaType: 100030057
-      # 客户性质(custNature)
-      cOprcde: 192099
-      # 新业务来源(CChaType)
-      custNature: 191010
-      # 机构代码(dptCde)
-      dptCde: 14A4
-      # 代理人资格证号(qlftNo)
-      operatorCode: 2752454675645
+      conferCode: 250000P0000401
+      # 渠道分类(agentType)
+      agentType: 191010
       # 代理人名称(agentNme)
-      qlftNo: 永鑫保险销售服务有限公司山西分公司
+      agentNme: 永鑫保险销售服务有限公司山西分公司
+      # 代理人资格证号(qlftNo)
+      qlftNo: 2752454675645
       # 录入人(operatorCode)
+      operatorCode: 100030057
+      # 业务员代码(salesmanNo)
       salesmanNo: 100030057
+      # 新业务来源(CChaType)
+      CChaType: 191010
+      # 客户性质(custNature)
+      custNature: 192099
+      # 操作人员代码(cOprcde)
+      cOprcde: 100030057
+      # 业务来源(cBsnsTyp)
+      cBsnsTyp: 19002
+
+
     userName: tianqin
     password: 123456
     pay: