Procházet zdrojové kódy

Merge branch 'dev' of chenweida/wlyy2.0 into dev

chenweida před 7 roky
rodič
revize
4db557b3c6

+ 10 - 12
svr-lib-parent-pom/pom.xml

@ -58,8 +58,6 @@
        <version.spring-data-hadoop>2.3.0.RELEASE</version.spring-data-hadoop>
        <version.springside>4.2.3-GA</version.springside>
        <version.zipkin>1.24.0</version.zipkin>
        <version.hibernate>5.0.12.Final</version.hibernate>
        <version.hibernate-jpa>1.0.0.Final</version.hibernate-jpa>
        <version.servlet-api>3.1.0</version.servlet-api>
        <version.swagger>2.7.0</version.swagger>
        <version.swagger-ui>2.7.0</version.swagger-ui>
@ -258,16 +256,16 @@
                <classifier>GA</classifier>
            </dependency>
            <!--hibernate start-->
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-core</artifactId>
                <version>${version.hibernate}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate.javax.persistence</groupId>
                <artifactId>hibernate-jpa-2.1-api</artifactId>
                <version>${version.hibernate-jpa}</version>
            </dependency>
            <!--<dependency>-->
                <!--<groupId>org.hibernate</groupId>-->
                <!--<artifactId>hibernate-core</artifactId>-->
                <!--<version>${version.hibernate}</version>-->
            <!--</dependency>-->
            <!--<dependency>-->
                <!--<groupId>org.hibernate.javax.persistence</groupId>-->
                <!--<artifactId>hibernate-jpa-2.1-api</artifactId>-->
                <!--<version>${version.hibernate-jpa}</version>-->
            <!--</dependency>-->
            <!--hibernate end-->
            <!--fastdfs start-->

+ 6 - 3
svr/svr-base/src/main/java/com/yihu/jw/business/demo/DemoController.java

@ -2,6 +2,7 @@ package com.yihu.jw.business.demo;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.business.user.dao.BaseRoleDao;
import com.yihu.jw.exception.SystemException;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.fegin.DemoFeign;
@ -26,13 +27,15 @@ import javax.servlet.http.HttpServletRequest;
@Api(description = "demo例子")
@RefreshScope
public class DemoController {
    @Autowired
    private BaseRoleDao baseRoleDao;
    @ApiOperation(value = "根据code查找患者")
    @GetMapping(value = "findByCode")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "患者code", required = true) @RequestParam(value = "code", required = true) String code) {
        return  Envelop.getSuccess(code);
            @ApiParam(name = "code", value = "患者code", required = false) @RequestParam(value = "code", required = false) String code) {
        baseRoleDao.findAllByName("管理员");
        return  Envelop.getSuccess("成功");
    }
}

+ 10 - 4
svr/svr-base/src/main/java/com/yihu/jw/config/jpa/HibernateProperties.java

@ -1,9 +1,13 @@
package com.yihu.jw.config.jpa;
import org.hibernate.EmptyInterceptor;
import org.hibernate.Interceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Properties;
/**
@ -20,17 +24,19 @@ public class HibernateProperties {
//    private String naming_strategy;
    @Value("${hibernate.physical_naming_strategy}")
    private String  physical_naming_strategy;
    private String physical_naming_strategy;
    @Value("${hibernate.implicit_naming_strategy}")
    private String implicit_naming_strategy;
    @Autowired
    private List<Interceptor> interceptors;
    public  Properties hibProperties() {
    public Properties hibProperties() {
        Properties properties = new Properties();
        properties.put("hibernate.dialect",dialect);
        properties.put("hibernate.dialect", dialect);
        properties.put("hibernate.show_sql", show_sql);
        properties.put("hibernate.physical_naming_strategy", physical_naming_strategy);
        properties.put("hibernate.implicit_naming_strategy", implicit_naming_strategy);
        properties.put("hibernate.ejb.interceptor", interceptors.get(0));
        return properties;
    }
}

+ 2 - 0
svr/svr-base/src/main/resources/application.yml

@ -38,6 +38,8 @@ yihu:
    client:
      advice:
        sql: true
        http: true
        hibernateSql: true #默认false
---
spring:

+ 7 - 2
web-gateway/pom.xml

@ -61,10 +61,15 @@
            <groupId>com.yihu.base</groupId>
            <artifactId>common-swagger</artifactId>
        </dependency>
        <dependency>
        <groupId>com.yihu</groupId>
        <artifactId>common-security-starter</artifactId>
        <version>1.0.7</version>
        </dependency>
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>common-security-starter</artifactId>
            <version>1.0.7</version>
            <artifactId>common-router-starter</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>

+ 32 - 0
web-gateway/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -16,6 +16,9 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
import java.util.ArrayList;
import java.util.List;
import static com.google.common.base.Predicates.or;
import static springfox.documentation.builders.PathSelectors.regex;
@Configuration
@EnableSwagger2
@ComponentScan("com.yihu.jw.controller.**")
@ -143,4 +146,33 @@ public class SwaggerConfig {
        return apiInfo;
    }
    @Bean
    public Docket allAPL() {
        List<Parameter> pars = addToken();
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("all")
                .useDefaultResponseMessages(false)
                .apiInfo(wlyyApiInfo())
                .select()
                .apis(RequestHandlerSelectors.any()) // 对所有api进行监控
                .paths(or(
                        regex("/.*")
                ))
                .paths(PathSelectors.any())
                .build().globalOperationParameters(pars);
    }
    private ApiInfo appApiInfo() {
        ApiInfo apiInfo = new ApiInfo("基卫2.0API",
                "基卫2.0API,提供基础卫生相关服务。",
                "1.0",
                "No terms of service",
                "wenfujian@jkzl.com",
                "The Apache License, Version 2.0",
                "http://www.apache.org/licenses/LICENSE-2.0.html"
        );
        return apiInfo;
    }
}

+ 2 - 6
web-gateway/src/main/java/com/yihu/jw/controller/DemoController.java

@ -35,7 +35,6 @@ public class DemoController {
    private String aaaa;
    @GetMapping("/hello")
    @ResponseBody
    public Envelop hello1(@RequestParam(name = "id") Integer id,
                          @RequestParam(name = "name") String name,
                          HttpServletRequest request
@ -60,14 +59,11 @@ public class DemoController {
    }
    @GetMapping("/hello2")
    @ResponseBody
    public String hello2(String id) throws Exception {
        System.out.println("haha2.........");
        return "hello2";
    public Envelop hello2(String id) throws Exception {
        return Envelop.getSuccess("hahaha");
    }
    @GetMapping("/refresh")
    @ResponseBody
    public String refresh(HttpServletRequest request) throws Exception {
        return aaaa;
    }

+ 10 - 2
web-gateway/src/main/resources/application.yml

@ -28,7 +28,7 @@ spring:
  redis:
    host: 172.19.103.88 # Redis server host.
    port: 6379 # Redis server port.
    database: 0
    database: 10
##开启feign断路器
feign:
@ -85,7 +85,15 @@ ribbon:
yihu:
  admin:
    client:
      advice:
        sql: false
        http: true
        zuul:
          pre: true
          post: true
---