Browse Source

first commit

15810770710@163.com 4 years ago
parent
commit
ed29192612

+ 180 - 0
pom.xml

@@ -0,0 +1,180 @@
+<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>
+
+    <parent>
+        <groupId>org.springframework.boot</groupId>
+        <artifactId>spring-boot-starter-parent</artifactId>
+        <version>2.2.2.RELEASE</version>
+    </parent>
+  <artifactId>iov-sjjh-servicenode-supplier-common</artifactId>
+  <version>1.0.2</version>
+
+  <name>iov-sjjh-servicenode-supplier-common</name>
+  <url>http://maven.apache.org</url>
+
+  <properties>
+    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+  </properties>
+
+  <dependencies>
+    <!-- 服务注册 -->
+		<dependency>
+			<groupId>org.springframework.cloud</groupId>
+		    <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-starter-web</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>io.springfox</groupId>
+			<artifactId>springfox-swagger2</artifactId>
+            <version>2.9.2</version>
+		</dependency>
+      <dependency>
+          <groupId>org.projectlombok</groupId>
+          <artifactId>lombok</artifactId>
+          <version>1.16.22</version>
+      </dependency>
+		<dependency>
+			<groupId>io.springfox</groupId>
+			<artifactId>springfox-swagger-ui</artifactId>
+            <version>2.9.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.boot</groupId>
+			<artifactId>spring-boot-devtools</artifactId>
+			<optional>true</optional>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.cloud</groupId>
+			<artifactId>spring-cloud-config-client</artifactId>
+		</dependency>
+		
+		<!-- aspire maven私服 -->
+		<dependency>
+       		<groupId>info.aspirecn.rdc</groupId>
+			<artifactId>aspirecloud-commons-sleuthlog-starter</artifactId>
+            <version>5.0.1</version>
+	    </dependency>
+      <dependency>
+          <groupId>org.springframework.boot</groupId>
+          <artifactId>spring-boot-starter-data-redis</artifactId>
+      </dependency>
+	    <dependency>
+			<groupId>info.aspirecn.rdc</groupId>
+			<artifactId>aspirecloud-commons-errorlog-starter</artifactId>
+            <version>5.0.2</version>
+		</dependency>
+		<dependency>
+			<groupId>com.squareup.okhttp3</groupId>
+			<artifactId>okhttp</artifactId>
+		</dependency>
+		<dependency>
+			<groupId>commons-codec</groupId>
+			<artifactId>commons-codec</artifactId>
+		</dependency>
+
+
+
+
+		
+  </dependencies>
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>org.springframework.cloud</groupId>
+                <artifactId>spring-cloud-dependencies</artifactId>
+                <version>Hoxton.RELEASE</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+	<build>
+		<plugins>
+			<plugin>
+				<groupId>org.springframework.boot</groupId>
+				<artifactId>spring-boot-maven-plugin</artifactId>
+
+			</plugin>
+			
+			<plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-jar-plugin</artifactId>
+                 <configuration>
+                    <archive>
+                        <manifest>
+                            <addClasspath>true</addClasspath>
+                            <classpathPrefix>lib/</classpathPrefix>
+                        </manifest>
+                    </archive>
+                </configuration>
+            </plugin>
+
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-dependency-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>copy-dependencies</id>
+                        <phase>prepare-package</phase>
+                        <goals>
+                            <goal>copy-dependencies</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>${project.build.directory}/lib</outputDirectory>
+                        </configuration>
+                    </execution>
+                    <execution>
+					    <id>copy</id>
+					    <phase>install</phase>
+					    <goals>
+					        <goal>copy-dependencies</goal>
+					    </goals>
+					    <configuration>
+					        <outputDirectory>
+					            ${project.build.directory}/lib
+					        </outputDirectory>
+					    </configuration>
+					</execution>
+                </executions>
+            </plugin>
+
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-resources-plugin</artifactId>
+				<executions>
+                    <execution>
+                        <id>default-resources</id>
+                        <phase>validate</phase>
+                        <goals>
+                            <goal>copy-resources</goal>
+                        </goals>
+                        <configuration>
+                            <outputDirectory>target/classes</outputDirectory>
+                            <useDefaultDelimiters>false</useDefaultDelimiters>
+                            <delimiters>
+                                <delimiter>@</delimiter>
+                            </delimiters>
+                            <resources>
+                                <resource>
+                                    <directory>src/main/resources/config</directory>
+                                    <targetPath>config</targetPath>
+                                    <filtering>true</filtering>
+                                    <includes>
+                                        <include>**</include>
+                                    </includes>
+                                </resource>
+                            </resources>
+                        </configuration>
+                    </execution>
+                </executions>
+			</plugin>
+
+
+		</plugins>
+	</build>
+</project>

+ 38 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/App.java

@@ -0,0 +1,38 @@
+package info.aspirecn.iov.sjjh.supplier.common;
+
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.cloud.netflix.eureka.EnableEurekaClient;
+import org.springframework.context.ApplicationContext;
+import org.springframework.core.env.Environment;
+import org.springframework.util.StopWatch;
+
+import com.fasterxml.jackson.core.JsonProcessingException;
+
+import info.aspirecn.rdc.aspirecloud.node.except.annotations.EnableAspireCloudRdcHandleExcept;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 
+ * @author bzh
+ *
+ */
+@SpringBootApplication
+@EnableAspireCloudRdcHandleExcept
+@Slf4j
+@EnableEurekaClient
+public class App {
+	public static void main(String[] args) throws JsonProcessingException {
+        StopWatch watch = new StopWatch();
+        watch.start();
+
+        ApplicationContext context = SpringApplication.run(App.class, args);
+        Environment environment = context.getBean(Environment.class);
+        String applicationName = environment.getProperty("spring.application.name");
+        
+        
+        watch.stop();
+        log.info("{} 启动完毕,times={}s", applicationName, watch.getTotalTimeSeconds());
+    }
+	
+}

+ 37 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/SwaggerConfig.java

@@ -0,0 +1,37 @@
+package info.aspirecn.iov.sjjh.supplier.common;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+import springfox.documentation.builders.ApiInfoBuilder;
+import springfox.documentation.builders.PathSelectors;
+import springfox.documentation.builders.RequestHandlerSelectors;
+import springfox.documentation.service.ApiInfo;
+import springfox.documentation.spi.DocumentationType;
+import springfox.documentation.spring.web.plugins.Docket;
+import springfox.documentation.swagger2.annotations.EnableSwagger2;
+
+/**
+ * 
+ * @author minmin
+ *
+ */
+@Configuration
+@EnableSwagger2
+public class SwaggerConfig {
+	@Value("${swagger.show}")
+    private boolean swaggerShow;
+
+    @Bean
+    public Docket createRestApi() {
+
+        return new Docket(DocumentationType.SWAGGER_2).enable(swaggerShow).apiInfo(apiInfo()).select()
+                .apis(RequestHandlerSelectors.basePackage("info.aspirecn.iov.sjjh.supplier.common.action"))
+                .paths(PathSelectors.any()).build();
+    }
+
+    private ApiInfo apiInfo() {
+        return new ApiInfoBuilder().title("10000039通道接口").description("").termsOfServiceUrl("").version("1.0.0").build();
+    }
+}

+ 99 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/action/SupplierCommonAction.java

@@ -0,0 +1,99 @@
+package info.aspirecn.iov.sjjh.supplier.common.action;
+
+
+
+
+import javax.servlet.http.HttpServletRequest;
+
+import info.aspirecn.iov.sjjh.supplier.common.service.SupplierCommonService;
+import info.aspirecn.iov.sjjh.supplier.common.util.Constants;
+import info.aspirecn.iov.sjjh.supplier.common.util.SupplierProperties;
+import info.aspirecn.iov.sjjh.supplier.common.vo.ChannelTypeHandleResponseObject;
+import org.apache.commons.codec.binary.Base64;
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestHeader;
+import org.springframework.web.bind.annotation.RequestParam;
+import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.context.request.RequestContextHolder;
+import org.springframework.web.context.request.ServletRequestAttributes;
+import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
+import io.swagger.annotations.ApiOperation;
+import io.swagger.annotations.ApiParam;
+import lombok.extern.slf4j.Slf4j;
+
+/**
+ * 
+ * @author bzh
+ *
+ */
+@Slf4j
+@RestController
+public class SupplierCommonAction {
+	/**日志参数中的错误参数名*/
+	private static final String LOG_ERROR_PARA = "respnoseCode";
+	/**日志参数中的是否收费*/
+	private static final String LOG_FEE_PARA = "isCharge";
+	@Autowired
+    private SupplierProperties supplierProperties;
+	@Autowired
+	private SupplierCommonService service;
+	
+	@ApiOperation(value = "通用通道接口", notes = "")
+	@PostMapping(value = "/common/{url}")
+    public ChannelTypeHandleResponseObject commonRoute(
+    		@ApiParam(value="通道ID")@RequestHeader(name="channelId")  String channelId,
+    		@ApiParam(value="超时时间,单位:毫秒",example = "10000")@RequestParam(name = "outTime", required = true) int outTime,
+    		@ApiParam(value="请求参数JSON串")@RequestParam(name = "customBody", required = true) String customBody) {		
+		HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes())
+				.getRequest();
+		request.setAttribute(Constants.LOG_UPSTREAM_RESPONSE_CODE,  Constants.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE);
+		String urI = request.getRequestURI();
+		int index = urI.lastIndexOf("/");
+		String urIStr = urI.substring(index+1);
+
+        String productId = supplierProperties.getUrlMap().get(urIStr);
+      /*  String  applicationName = supplierProperties.getApplicationName().get(urIStr);
+        request.setAttribute("applicationName",applicationName);*/
+		ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+		ret.setIsCharge(Constants.IS_NOT_CHARGE);
+		ret.setCode(Constants.FAIL);
+        if(!StringUtils.isEmpty(productId)){
+			String token =service.getToken();
+
+			if(!"".equals(token)){
+				//调用service
+				ret = service.route(request, customBody, outTime,token,productId);
+			}
+		}else{
+        	log.error("没有url对应的产品信息,urI:{},urlMap:{}",urI,supplierProperties.getUrlMap());
+		}
+
+		//把接口参数、调用结果和是否收费放入访问日志中
+		if(ret.getCode() != Constants.SUCCESS) {
+			request.setAttribute(LOG_ERROR_PARA, Constants.CHANNEL_LOG_ERROR_CODE);
+		} else {
+			request.setAttribute(LOG_ERROR_PARA, Constants.CHANNEL_LOG_SUCCESS_CODE);
+		}
+		request.setAttribute(LOG_FEE_PARA, ret.getIsCharge());
+
+		try {
+			request.setAttribute(Constants.CHANNEL_LOG_QUERY,
+					Base64.encodeBase64String(customBody.getBytes("utf-8")));
+
+		} catch (Exception ex) {
+			ErrorUtils.captureException(ex);
+			log.error("SupplierCommonAction.commonRoute.Exception{}", ex);
+		}
+
+		request.setAttribute(Constants.CHANNEL_TYPE_KEY,Constants.CHANNEL_TYPE_SYNC);
+		return ret;
+	}
+
+	@ApiOperation(value = "删除token", notes = "")
+	@PostMapping(value = "/deleteToken")
+	public Boolean deleteToken(@RequestParam(name = "appId")String appId,@RequestParam(name = "appSecret") String appSecret){
+		return service.deleteToken(appId,appSecret);
+	}
+}

+ 17 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/service/SupplierCommonService.java

@@ -0,0 +1,17 @@
+package info.aspirecn.iov.sjjh.supplier.common.service;
+
+import javax.servlet.http.HttpServletRequest;
+import info.aspirecn.iov.sjjh.supplier.common.vo.ChannelTypeHandleResponseObject;
+
+/**
+ * 
+ * @author bzh
+ *
+ */
+public interface SupplierCommonService {
+
+	String getToken();
+	public Boolean deleteToken(String appId,String appSecret);
+	ChannelTypeHandleResponseObject route(HttpServletRequest request, String customBody, int outTime, String token, String productId);
+
+}

+ 182 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/service/SupplierCommonServiceImpl.java

@@ -0,0 +1,182 @@
+package info.aspirecn.iov.sjjh.supplier.common.service;
+
+import javax.servlet.http.HttpServletRequest;
+import info.aspirecn.iov.sjjh.supplier.common.util.Constants;
+import info.aspirecn.iov.sjjh.supplier.common.util.SupplierProperties;
+import info.aspirecn.iov.sjjh.supplier.common.vo.ChannelTypeHandleResponseObject;
+import info.aspirecn.iov.sjjh.supplier.common.vo.RequestObject;
+import info.aspirecn.iov.sjjh.supplier.common.vo.ResponseObject;
+import info.aspirecn.iov.sjjh.supplier.common.vo.TokenResponseObject;
+import info.aspirecn.rdc.aspirecloud.node.except.utils.ErrorUtils;
+import okhttp3.*;
+import org.apache.commons.lang3.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.data.redis.core.StringRedisTemplate;
+import org.springframework.stereotype.Service;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+import lombok.extern.slf4j.Slf4j;
+
+import java.net.SocketTimeoutException;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.concurrent.TimeUnit;
+
+
+/**
+ * 
+ * @author bzh
+ *
+ */
+@Slf4j
+@Service
+public class SupplierCommonServiceImpl implements SupplierCommonService {
+
+
+	@Autowired
+	private ObjectMapper objectMapper;
+	@Value("#{'${common.errorCode}'.split(',')}")
+	List<String> errorCode;
+	@Autowired
+	SupplierProperties supplierProperties;
+
+	@Autowired
+	StringRedisTemplate stringRedisTemplate;
+
+	private OkHttpClient okHttpClient = new OkHttpClient.Builder().build();
+	@Override
+	public String getToken() {
+		String appId = supplierProperties.getAppId();
+		String appSecret = supplierProperties.getAppSecret();
+		String key = "sjjhCore:"+appId+"-"+appSecret;
+		String token="";
+		try{
+		token = stringRedisTemplate.boundValueOps(key).get();
+		if(StringUtils.isEmpty(token)){
+			String requestUrl = supplierProperties.getTokenUrl() + "?appId=" + appId + "&appSecret="+appSecret;
+			log.info("supplierCommon.getToken接口requestUrl={}", requestUrl);
+
+				Request okRequest = new Request.Builder().get().url(requestUrl).build();
+				OkHttpClient client = okHttpClient.newBuilder().connectTimeout(supplierProperties.getOutTime(), TimeUnit.MILLISECONDS)
+						.readTimeout(supplierProperties.getOutTime(), TimeUnit.MILLISECONDS).writeTimeout(supplierProperties.getOutTime(), TimeUnit.MILLISECONDS)
+						.build();
+				Response response = client.newCall(okRequest).execute();
+				String responseContext = response.body().string();
+				log.info("supplierCommon.getToken接口responseContext={}",responseContext);
+
+				boolean flag = response.isSuccessful();
+				if(flag){
+
+					TokenResponseObject responseObject = objectMapper.readValue(responseContext, TokenResponseObject.class);
+
+					int code  = responseObject.getCode();
+
+					if(code==1||code==2000){
+						token= responseObject.getToken();
+						stringRedisTemplate.boundValueOps(key).set(token);
+						stringRedisTemplate.expire(key,20,TimeUnit.MINUTES);
+					}
+
+				}
+
+		}
+
+		} catch (Exception e) {
+
+			log.info("supplierCommon.getToken接口Exception={}", e);
+
+		}
+		return token;
+	}
+
+	@Override
+	public Boolean deleteToken(String appId,String appSecret) {
+		String key = "sjjhCore:"+appId+"-"+appSecret;
+		return stringRedisTemplate.delete(key);
+	}
+
+	@Override
+	public ChannelTypeHandleResponseObject route(HttpServletRequest request, String customBody, int outTime, String token, String productId) {
+
+		ChannelTypeHandleResponseObject ret = new ChannelTypeHandleResponseObject();
+		ret.setIsCharge(Constants.IS_NOT_CHARGE);
+		ret.setCode(Constants.SUCCESS);
+		String upstreamCode = Constants.LOG_UPSTREAM_DEFAULT_RESPONSE_CODE;
+	try{
+		RequestObject requestObject = new RequestObject();
+		requestObject.setAccessId(request.getHeader("x-b3-traceid"));
+		requestObject.setCustomBody(objectMapper.readValue(customBody, Map.class));
+		requestObject.setProductId(productId);
+		String body = objectMapper.writeValueAsString(requestObject);
+		log.info("requestBody:{},url:{}",body,supplierProperties.getUrl());
+		RequestBody requestBody = RequestBody.create(MediaType.parse("application/json"), body);
+
+
+
+
+		Request okRequest = new Request.Builder()
+				.post(requestBody)
+				.header("token",token)
+				.url(supplierProperties.getUrl())
+				.build();
+		OkHttpClient client = okHttpClient.newBuilder()
+				.connectTimeout(outTime, TimeUnit.MILLISECONDS)
+				.readTimeout(outTime, TimeUnit.MILLISECONDS)
+				.writeTimeout(outTime, TimeUnit.MILLISECONDS)
+				.build();
+
+
+		Response response = client.newCall(okRequest).execute();
+		String commonResponseContext = response.body().string();
+		boolean flag =response.isSuccessful();
+
+
+		log.info("supplierCommon.route接口responseContext={}",commonResponseContext);
+		if(flag){
+			Set<String> names = response.headers().names();
+			/*for(String name: names){
+				log.info("name:{}",name);
+			}*/
+			List<String> headers = response.headers("isCharge");
+			String isCharge = "0";
+			if(headers !=null &&headers.size()>=1){
+				 isCharge = headers.get(0);
+			}
+
+
+			ResponseObject responseObject = objectMapper.readValue(commonResponseContext, ResponseObject.class);
+
+			int code  = responseObject.getResultCode();
+			upstreamCode = String.valueOf(code);
+			if(errorCode.contains(code)){
+				ret.setResultCode(Constants.OTHER_ERROR_CODE);
+				ret.setResultBody("查询错误");
+				ret.setResultDesc("查询错误");
+			}else {
+				ret.setResultCode(code);
+				ret.setResultBody(responseObject.getResultBody());
+				ret.setIsCharge(Integer.parseInt(isCharge));
+			}
+
+		}else{
+			log.info("发送请求没有成功,flag:{}",flag);
+			ret.setCode(Constants.FAIL);
+		}
+
+	} catch (SocketTimeoutException ste) {
+		ErrorUtils.captureException(ste);
+		log.info("supplierCommon.route接口SocketTimeoutException={}", ste);
+		ret.setCode(Constants.REQUEST_TIMEOUT);
+	} catch (Exception e) {
+		ErrorUtils.captureException(e);
+		log.info("supplierCommon.route接口Exception={}", e);
+		ret.setCode(Constants.FAIL);
+	}
+		request.setAttribute(Constants.LOG_UPSTREAM_RESPONSE_CODE,  upstreamCode);
+
+		return ret;
+	}
+}

+ 21 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/util/Constants.java

@@ -0,0 +1,21 @@
+package info.aspirecn.iov.sjjh.supplier.common.util;
+
+public class Constants {
+    public static int IS_NOT_CHARGE=0;
+    public static int  SUCCESS=1;
+    public static String LOG_UPSTREAM_DEFAULT_RESPONSE_CODE="-31131";
+    public static int OTHER_ERROR_CODE=3;
+    public static int REQUEST_TIMEOUT=2;
+    public static int FAIL=0;
+    /**通道日志中返回错误码*/
+    public static final String CHANNEL_LOG_ERROR_CODE = "500";
+    /**通道日志中返回正常码*/
+    public static final String CHANNEL_LOG_SUCCESS_CODE = "200";
+    public static final String CHANNEL_LOG_QUERY = "x-requestQuery";
+    public static final String CHANNEL_TYPE_KEY = "req_type";
+
+    //同步通道
+    public static final String CHANNEL_TYPE_SYNC = "sync";
+
+    public static String LOG_UPSTREAM_RESPONSE_CODE="upResponseCode";
+}

+ 19 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/util/SupplierProperties.java

@@ -0,0 +1,19 @@
+package info.aspirecn.iov.sjjh.supplier.common.util;
+
+import lombok.Data;
+import org.springframework.boot.context.properties.ConfigurationProperties;
+import org.springframework.stereotype.Component;
+
+import java.util.Map;
+
+@Data
+@ConfigurationProperties(prefix="supplier")
+@Component
+public class SupplierProperties {
+    private  String url;
+    Map<String,String> urlMap;
+    private String appId;
+    private String appSecret;
+    private String tokenUrl;
+    private int outTime;
+}

+ 35 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/vo/ChannelTypeHandleResponseObject.java

@@ -0,0 +1,35 @@
+package info.aspirecn.iov.sjjh.supplier.common.vo;
+
+
+import lombok.Data;
+
+@Data
+public class ChannelTypeHandleResponseObject {
+	private int code;
+	private int resultCode;
+	private Object resultBody;
+	private int isCharge;
+	/**计费次数:用于一次请求,多次计费*/
+	private int feeCount;
+	/*
+	* 计费金额,由通道决定计费金额*/
+	private int jfFree;
+	/*
+	 * 3 为固定计费中的由通道决定的计费方式*/
+	private int jflx;
+	//返回码描述
+	private String resultDesc;
+	/*异步是否成功 默认值为0,0代表同步接口
+		1代表异步接口需要回调
+		2代表异步失败
+		3 异步中同步数据返回不需要回调,直接返回
+	*/
+	private int ifSuccessAsyn;
+	/*
+	 * 异步回调的resultBody内容*/
+	private String asynResultBody;
+	
+	/*
+	 * 是否需要记录缓存日志*/
+	private boolean cacheLogSign;
+}

+ 10 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/vo/RequestObject.java

@@ -0,0 +1,10 @@
+package info.aspirecn.iov.sjjh.supplier.common.vo;
+
+import lombok.Data;
+
+@Data
+public class RequestObject {
+	private String productId;
+	private String accessId;
+	private Object customBody;
+}

+ 11 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/vo/ResponseObject.java

@@ -0,0 +1,11 @@
+package info.aspirecn.iov.sjjh.supplier.common.vo;
+
+import lombok.Data;
+
+@Data
+public class ResponseObject {
+	private String accessId;
+	private int resultCode;
+	private Object resultBody;
+	private String transationId;
+}

+ 10 - 0
src/main/java/info/aspirecn/iov/sjjh/supplier/common/vo/TokenResponseObject.java

@@ -0,0 +1,10 @@
+package info.aspirecn.iov.sjjh.supplier.common.vo;
+
+import lombok.Data;
+
+@Data
+public class TokenResponseObject {
+	private int code;
+	private String message;
+	private String token;
+}

+ 3 - 0
src/main/resources/config/banner.txt

@@ -0,0 +1,3 @@
+*******************************************************************************
+	 @project.artifactId@  (version:@project.version@)
+*******************************************************************************

+ 34 - 0
src/main/resources/config/bootstrap.yml

@@ -0,0 +1,34 @@
+spring:
+  application:
+    name: '@project.artifactId@'
+  banner:
+    location: classpath:config/banner.txt
+  profiles:
+    active: hwtest
+  cloud:
+    config:
+      discovery:
+        enabled: false
+      uri: http://10.8.18.157:32533
+      label: trunk
+      name: ${spring.application.name}
+      profile: ${spring.profiles.active}
+
+
+server:
+  port: 25102
+management:
+  server:
+    port: 35102
+
+
+
+
+swagger:
+  show: true
+info:
+  name: '@project.description@'
+  version: '@project.version@'
+
+
+

+ 37 - 0
src/main/resources/config/logback-spring.xml

@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<configuration>
+	<include resource="org/springframework/boot/logging/logback/defaults.xml" />
+	<include
+		resource="org/springframework/boot/logging/logback/console-appender.xml" />
+
+	<property name="LOG_FILE"
+		value="${LOG_FILE:-${LOG_PATH:-${LOG_TEMP:-${java.io.tmpdir:-/tmp}}}/spring.log}" />		
+	<springProperty scope="context" name="LOG_PATH" source="logging.path" defaultValue="/apps/var/jakarta/logs" />
+	<springProperty scope="context" name="application_name" source="spring.application.name" defaultValue="iov-sjjh-servicenode-supplier-10000007" />
+	<springProperty scope="context" name="sleuth_file" source="rdc.logging.sleuth-file" defaultValue="${LOG_PATH}/sleuth/sleuth.log" />
+	<springProperty scope="context" name="error_file" source="rdc.logging.error-file" defaultValue="${LOG_PATH}/error/error.log" />
+
+	<include resource="info/aspirecn/rdc/aspirecloud/node/except/xml/defaults.xml" />
+	<include resource="info/aspirecn/rdc/aspirecloud/node/brave/xml/defaults.xml" />
+
+	<appender name="TIME_FILE"
+		class="ch.qos.logback.core.rolling.RollingFileAppender">
+		<encoder>
+			<pattern>${FILE_LOG_PATTERN}</pattern>
+		</encoder>
+		<file>${LOG_FILE}</file>
+		<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
+			<fileNamePattern>${LOG_FILE}.%d{yyyy-MM-dd}.%i</fileNamePattern>
+			<maxHistory>5</maxHistory>
+			<timeBasedFileNamingAndTriggeringPolicy
+				class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
+				<maxFileSize>100MB</maxFileSize>
+			</timeBasedFileNamingAndTriggeringPolicy>
+		</rollingPolicy>
+	</appender>
+	
+	<root level="INFO">
+		<appender-ref ref="CONSOLE" />
+		<appender-ref ref="TIME_FILE" />
+	</root>
+</configuration>