Commit e298edfd authored by 周健威's avatar 周健威

Merge remote-tracking branch 'origin/base-modify' into base-modify

parents 514f91a9 1408dd55
package com.github.wxiaoqi.security.api.vo.config; package com.github.wxiaoqi.security.api.vo.config;
import feign.Logger;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
import org.springframework.web.context.request.RequestContextHolder; import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes; import org.springframework.web.context.request.ServletRequestAttributes;
...@@ -18,7 +16,6 @@ import java.util.Enumeration; ...@@ -18,7 +16,6 @@ import java.util.Enumeration;
* @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失 * @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失
* @data 2019/6/25 16:22 * @data 2019/6/25 16:22
*/ */
@Slf4j
public class HeaderConfig implements RequestInterceptor { public class HeaderConfig implements RequestInterceptor {
@Override @Override
...@@ -33,10 +30,11 @@ public class HeaderConfig implements RequestInterceptor { ...@@ -33,10 +30,11 @@ public class HeaderConfig implements RequestInterceptor {
while (headerNames.hasMoreElements()){ while (headerNames.hasMoreElements()){
String headerName = headerNames.nextElement(); String headerName = headerNames.nextElement();
String headerValue = request.getHeader(headerName); String headerValue = request.getHeader(headerName);
log.info("----headerName===="+headerName+"----headerValue===="+headerValue);
template.header(headerName,headerValue); template.header(headerName,headerValue);
} }
} }
} }
} }
} }
...@@ -22,6 +22,6 @@ public interface CofigMapper extends Mapper<Cofig> { ...@@ -22,6 +22,6 @@ public interface CofigMapper extends Mapper<Cofig> {
* @param cofig * @param cofig
* @return * @return
*/ */
@Update("update config set `title`=#{title},`value`=#{value}`,`type`=#{type},`upd_time`=#{updTime} where `id`=#{id}") @Update("update config `cf` set cf.title=#{title},cf.value=#{value},cf.type=#{type},cf.upd_time=#{updTime} where cf.id=#{id}")
int updateConfig(Cofig cofig); int updateConfig(Cofig cofig);
} }
...@@ -12,7 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; ...@@ -12,7 +12,7 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
@Configuration("tourWebConfig") @Configuration("campsiteWebConfig")
@Primary @Primary
public class WebConfiguration implements WebMvcConfigurer { public class WebConfiguration implements WebMvcConfigurer {
......
...@@ -22,3 +22,4 @@ spring: ...@@ -22,3 +22,4 @@ spring:
nacos: nacos:
config: config:
server-addr: 10.5.52.2:8848 server-addr: 10.5.52.2:8848
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
<module>xx-common-platform</module> <module>xx-common-platform</module>
<module>xx-common-platform-web</module> <module>xx-common-platform-web</module>
<module>xx-common-platform-component</module> <module>xx-common-platform-component</module>
<module>xx-common-demo</module>
</modules> </modules>
</project> </project>
\ No newline at end of file
...@@ -11,17 +11,44 @@ ...@@ -11,17 +11,44 @@
<groupId>com.xxfc.platform</groupId> <groupId>com.xxfc.platform</groupId>
<artifactId>xx-common-platform-component</artifactId> <artifactId>xx-common-platform-component</artifactId>
<properties>
<swagger.version>2.9.2</swagger.version>
</properties>
<dependencies> <dependencies>
<dependency> <dependency>
<groupId>org.springframework.cloud</groupId> <groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId> <artifactId>spring-cloud-starter-openfeign</artifactId>
<scope>provided</scope>
</dependency>
<!-- https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-configuration-processor -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api --> <!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency> <dependency>
<groupId>javax.servlet</groupId> <groupId>com.github.wxiaoqi</groupId>
<artifactId>javax.servlet-api</artifactId> <artifactId>ace-common</artifactId>
<version>4.0.1</version> <version>2.0-SNAPSHOT</version>
<exclusions>
<exclusion>
<groupId>io.swagger</groupId>
<artifactId>swagger-annotations</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger2</artifactId>
<version>${swagger.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.version}</version>
<scope>provided</scope> <scope>provided</scope>
</dependency> </dependency>
</dependencies> </dependencies>
......
...@@ -2,6 +2,7 @@ package com.xxfc.platform.common.config; ...@@ -2,6 +2,7 @@ package com.xxfc.platform.common.config;
import feign.RequestInterceptor; import feign.RequestInterceptor;
import feign.RequestTemplate; import feign.RequestTemplate;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.context.request.RequestAttributes; import org.springframework.web.context.request.RequestAttributes;
...@@ -17,8 +18,6 @@ import java.util.Enumeration; ...@@ -17,8 +18,6 @@ import java.util.Enumeration;
* @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失 * @description 设置请求头部信息,防止微服务之间调用请求头部信息丢失
* @data 2019/6/25 16:22 * @data 2019/6/25 16:22
*/ */
@Configuration
@Component
public class HeaderConfig implements RequestInterceptor { public class HeaderConfig implements RequestInterceptor {
@Override @Override
......
package com.xxfc.platform.common.config; package com.xxfc.platform.common.config;
import io.swagger.annotations.Api;
import lombok.Setter;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.ParameterBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.schema.ModelRef;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Parameter;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
/** /**
* @author libin * @author libin
* @version 1.0 * @version 1.0
* @description TODO * @description 通用swagger设置
* @data 2019/6/26 10:28 * @data 2019/6/26 10:28
*/ */
@Profile(value = {"dev","test"})
@ConditionalOnClass(value = EnableSwagger2.class)
@ConditionalOnProperty(prefix = "xxfc",name = "swagger",havingValue = "true")
@EnableSwagger2
@Setter
public class SwaggerConfig { public class SwaggerConfig {
@Value("${xxfc.swagger.title:xxfc api swagger document}")
private String title;
@Value("${xxfc.swagger.description:前后端联调xxfc api 文档}")
private String description;
@Value("${xxfc.swagger.version:1.0.0}")
private String version;
@Value("${jwt.tokenHeader:Authorization}")
private String header;
@Bean
public Docket docket(){
ParameterBuilder ticketPar = new ParameterBuilder();
List<Parameter> parameters = new ArrayList<Parameter>();
ticketPar.name(header).description("user Authorization")
.modelRef(new ModelRef("string")).parameterType("header")
//header中的ticket参数非必填,传空也可以
.required(false).build();
//根据每个方法名也知道当前方法在设置什么参数
parameters.add(ticketPar.build());
return new Docket(DocumentationType.SWAGGER_2)
.apiInfo(apiInfo())
.select()
.apis(RequestHandlerSelectors.withClassAnnotation(Api.class))
.paths(PathSelectors.any())
.build()
.globalOperationParameters(parameters);
}
private ApiInfo apiInfo(){
return new ApiInfoBuilder()
.title(title)
.description(description)
.version(version)
.build();
}
} }
...@@ -55,6 +55,9 @@ public class OrderVehicleCrosstownController { ...@@ -55,6 +55,9 @@ public class OrderVehicleCrosstownController {
if(baseOrder.getStatus() == 4) { if(baseOrder.getStatus() == 4) {
baseOrder.setStatus(5); baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder); baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
} }
OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto(); OrderVehicleCrosstownDto vehicleCrosstownDto = new OrderVehicleCrosstownDto();
BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true)); BeanUtil.copyProperties(oldValue.get(0), vehicleCrosstownDto, CopyOptions.create().setIgnoreNullValue(true).setIgnoreError(true));
...@@ -70,8 +73,13 @@ public class OrderVehicleCrosstownController { ...@@ -70,8 +73,13 @@ public class OrderVehicleCrosstownController {
getOrderLicense(orderVehicleCrosstownDto); getOrderLicense(orderVehicleCrosstownDto);
orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto); orderVehicalCrosstownBiz.insertSelective(orderVehicleCrosstownDto);
//交车完成 设置订单状态为出行中 //交车完成 设置订单状态为出行中
if(baseOrder.getStatus() == 4) {
baseOrder.setStatus(5); baseOrder.setStatus(5);
baseOrderBiz.updateSelectiveById(baseOrder); baseOrderBiz.updateSelectiveById(baseOrder);
} else if(baseOrder.getStatus() == 5) {
baseOrder.setStatus(6);
baseOrderBiz.updateSelectiveById(baseOrder);
}
return ObjectRestResponse.succ(orderVehicleCrosstownDto); return ObjectRestResponse.succ(orderVehicleCrosstownDto);
} }
return ObjectRestResponse.createDefaultFail(); return ObjectRestResponse.createDefaultFail();
......
...@@ -119,11 +119,15 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -119,11 +119,15 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
* @return * @return
*/ */
public TourTagAndBannerDTO findTourTagById(Integer tagId){ public TourTagAndBannerDTO findTourTagById(Integer tagId){
TourTagAndBannerDTO tourTagAndBannerDTO = new TourTagAndBannerDTO();
//根据旅游标签id查询出标签信息 //根据旅游标签id查询出标签信息
TourTag tourTag = mapper.findById(tagId); TourTag tourTag = mapper.findById(tagId);
if (log.isDebugEnabled()){ if (log.isDebugEnabled()){
log.debug("根据标签id=[{}]查询出标签信息:[{}]",tagId,tourTag); log.debug("根据标签id=[{}]查询出标签信息:[{}]",tagId,tourTag);
} }
if (tourTag==null){
return tourTagAndBannerDTO;
}
TourTagDTO tourTagDTO = new TourTagDTO(); TourTagDTO tourTagDTO = new TourTagDTO();
BeanUtils.copyProperties(tourTag,tourTagDTO); BeanUtils.copyProperties(tourTag,tourTagDTO);
//根据旅游标签id查询出标签对应的轮播图信息 //根据旅游标签id查询出标签对应的轮播图信息
...@@ -131,7 +135,7 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> { ...@@ -131,7 +135,7 @@ public class TourTagBiz extends BaseBiz<TourTagMapper,TourTag> {
if (log.isDebugEnabled()){ if (log.isDebugEnabled()){
log.debug("根据标签id=[{}],查询出轮播图信息:[{}]",tagId,tourTagBannerDTOS); log.debug("根据标签id=[{}],查询出轮播图信息:[{}]",tagId,tourTagBannerDTOS);
} }
TourTagAndBannerDTO tourTagAndBannerDTO = new TourTagAndBannerDTO();
//组装数据 //组装数据
tourTagAndBannerDTO.setTourTagDTO(tourTagDTO); tourTagAndBannerDTO.setTourTagDTO(tourTagDTO);
tourTagAndBannerDTO.setTourTagBannerDTOS(tourTagBannerDTOS); tourTagAndBannerDTO.setTourTagBannerDTOS(tourTagBannerDTOS);
......
package com.xxfc.platform.tour.config; package com.xxfc.platform.tour.config;
import feign.Logger;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
...@@ -10,4 +11,8 @@ public class RestConfiguration { ...@@ -10,4 +11,8 @@ public class RestConfiguration {
public RestTemplate restTemplate() { public RestTemplate restTemplate() {
return new RestTemplate(); return new RestTemplate();
} }
@Bean
public Logger.Level feignLevel(){
return Logger.Level.HEADERS;
}
} }
...@@ -17,6 +17,17 @@ spring: ...@@ -17,6 +17,17 @@ spring:
nacos: nacos:
config: config:
file-extension: yaml file-extension: yaml
debug: true
feign:
compression:
response:
enabled: true
request:
enabled: true
logging:
level:
com.github.wxiaoqi: debug
com.xxfc: debug
--- ---
spring: spring:
profiles: dev profiles: dev
......
...@@ -19,5 +19,4 @@ public enum VehicleScoreType { ...@@ -19,5 +19,4 @@ public enum VehicleScoreType {
* 检验感受 * 检验感受
*/ */
EXPERIENCE; EXPERIENCE;
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment