feat(可回溯): 重构
增加feign
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
||||
### Eclipse ###
|
||||
.apt_generated
|
||||
.classpath
|
||||
.factorypath
|
||||
.project
|
||||
.settings
|
||||
.springBeans
|
||||
.sts4-cache
|
||||
|
||||
### NetBeans ###
|
||||
/nbproject/private/
|
||||
/nbbuild/
|
||||
/dist/
|
||||
/nbdist/
|
||||
/.nb-gradle/
|
||||
build/
|
||||
!**/src/main/**/build/
|
||||
!**/src/test/**/build/
|
||||
|
||||
### VS Code ###
|
||||
.vscode/
|
||||
|
||||
### Mac OS ###
|
||||
.DS_Store
|
||||
@@ -0,0 +1,100 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>com.wabestway.recall</groupId>
|
||||
<artifactId>afis-recall-api</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.wabestway.common</groupId>
|
||||
<artifactId>afis-web-common</artifactId>
|
||||
<version>1.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-openfeign</artifactId>
|
||||
<version>2.2.3.RELEASE</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.google.code.gson</groupId>
|
||||
<artifactId>gson</artifactId>
|
||||
<version>2.8.6</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.springfox</groupId>
|
||||
<artifactId>springfox-swagger2</artifactId>
|
||||
<version>3.0.0</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>io.swagger</groupId>
|
||||
<artifactId>swagger-models</artifactId>
|
||||
<version>1.5.22</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--lombok插件 -->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.6</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-openfeign-core</artifactId>
|
||||
<version>2.2.3.RELEASE</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<distributionManagement>
|
||||
<repository>
|
||||
<id>release</id>
|
||||
<name>Nexus Release Repository</name>
|
||||
<url>http://dev.wabestway.com/nexus/repository/maven-releases/</url>
|
||||
</repository>
|
||||
<snapshotRepository>
|
||||
<!-- 需与server id一致 -->
|
||||
<id>snapshot</id>
|
||||
<name>Nexus Snapshot Repository</name>
|
||||
<url>http://dev.wabestway.com/nexus/repository/maven-snapshots/</url>
|
||||
</snapshotRepository>
|
||||
</distributionManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>none</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,7 @@
|
||||
package com.wabestway.recall;
|
||||
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
System.out.println("Hello world!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.wabestway.recall.api.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class TraceUpDTO {
|
||||
private String batchId;
|
||||
private long batchTime;
|
||||
List<TraceRecord> records;
|
||||
}
|
||||
|
||||
@Data
|
||||
class TraceRecord {
|
||||
/** 业务订单ID */
|
||||
private String orderId;
|
||||
/** 产品编码 */
|
||||
private String supplierProductCode;
|
||||
/** 产品名称 */
|
||||
private String supplierProductName;
|
||||
/** 保单号 */
|
||||
private String policyNo;
|
||||
/** 投保人名称 */
|
||||
private String holderName;
|
||||
/** 投保人手机号 */
|
||||
private String holderPhone;
|
||||
/** 保险公司名称 */
|
||||
private String supplierName;
|
||||
/** 保单起始日期 */
|
||||
private String startDate;
|
||||
/** 保单结束日期 */
|
||||
private String endDate;
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
package com.wabestway.recall.api.fallback;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.recall.api.dto.TraceUpDTO;
|
||||
import com.wabestway.recall.api.feign.TraceFeignClient;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TraceFeignClientFallback implements TraceFeignClient {
|
||||
|
||||
@Override
|
||||
public ResObj batchTraceUp(TraceUpDTO traceUpDTO) {
|
||||
log.error("回溯业务数据更新:{}", JSON.toJSONString(traceUpDTO));
|
||||
return ResObj.fail("服务不可用");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.wabestway.recall.api.feign;
|
||||
|
||||
import com.wabestway.commons.http.ResObj;
|
||||
import com.wabestway.recall.api.dto.TraceUpDTO;
|
||||
import com.wabestway.recall.api.fallback.TraceFeignClientFallback;
|
||||
import io.swagger.v3.oas.annotations.parameters.RequestBody;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
|
||||
@FeignClient(value = "afis-recall", fallback = TraceFeignClientFallback.class)
|
||||
public interface TraceFeignClient {
|
||||
@PostMapping("/api/traceUp")
|
||||
ResObj batchTraceUp(@RequestBody TraceUpDTO traceUpDTO);
|
||||
}
|
||||
Reference in New Issue
Block a user