Bläddra i källkod

wlyy2.0整改

Progr1mmer 6 år sedan
förälder
incheckning
ae5b6845e1
100 ändrade filer med 303 tillägg och 1471 borttagningar
  1. 46 150
      app/app-iot-server/pom.xml
  2. 21 0
      app/app-iot-server/src/main/java/com/yihu/AppIotServer.java
  3. 0 35
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/AppIotServer.java
  4. 0 87
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebUserDetailsService.java
  5. 0 48
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/CurrentRequest.java
  6. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/config/SwaggerConfig.java
  7. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/AuthorityKey.java
  8. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/Constants.java
  9. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/ServiceApi.java
  10. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/BaseController.java
  11. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/ErrorController.java
  12. 4 4
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/FileUploadController.java
  13. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/IndexController.java
  14. 2 2
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/IotSystemDictController.java
  15. 5 5
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/LoginController.java
  16. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/company/IotCompanyController.java
  17. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/device/IotDeviceController.java
  18. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/device/IotDeviceOrderController.java
  19. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/device/IotDeviceQualityController.java
  20. 4 4
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/product/IotProductController.java
  21. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/third/wlyy/MonitoringHealthPlatformController.java
  22. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/model/AccessToken.java
  23. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ListResult.java
  24. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/model/MenuResult.java
  25. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/model/ObjectResult.java
  26. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/model/Result.java
  27. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ehr/MRsMetadata.java
  28. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ehr/MStdDataSet.java
  29. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/model/user/UserModel.java
  30. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebHttpSessionConfiguration.java
  31. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebSecurityConfiguration.java
  32. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAccessDecisionManager.java
  33. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationFailureHandler.java
  34. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationProvider.java
  35. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationSuccessHandler.java
  36. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationToken.java
  37. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebContextLogoutHandler.java
  38. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebUserDetails.java
  39. 4 5
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebUserDetailsService.java
  40. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebUsernamePasswordAuthenticationFilter.java
  41. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/entryPoint/LoginEntryPoint.java
  42. 10 10
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/BaseService.java
  43. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/FileUploadService.java
  44. 7 7
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/LoginService.java
  45. 5 5
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/SystemDictService.java
  46. 8 8
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/company/CompanyService.java
  47. 6 6
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/device/DeviceOrderService.java
  48. 11 11
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/device/DeviceService.java
  49. 6 6
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/device/IotDeviceQualityService.java
  50. 7 7
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/product/ProductService.java
  51. 8 8
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/third/wlyy/MonitoringHealthService.java
  52. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/ControllerTools.java
  53. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/CurrentRequest.java
  54. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/ObjectMapperUtil.java
  55. 4 4
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/encode/AES.java
  56. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/Base64.java
  57. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/DES.java
  58. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/HexEncode.java
  59. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/RSA.java
  60. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/excel/AExcelReader.java
  61. 2 2
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/excel/reader/IotDeviceImportVOReader.java
  62. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/file/FileUtil.java
  63. 3 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpClientUtil.java
  64. 2 2
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpHelper.java
  65. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpResponse.java
  66. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpUtil.java
  67. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/operator/CollectionUtil.java
  68. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/operator/DateUtil.java
  69. 2 2
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/operator/MD5.java
  70. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/operator/StringUtil.java
  71. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/spring/SpringContextHolder.java
  72. 1 0
      app/app-iot-server/src/main/resources/application.yml
  73. 0 0
      app/app-iot-server/src/main/resources/logback.xml.bak
  74. 32 130
      app/public-health-server/pom.xml
  75. 20 0
      app/public-health-server/src/main/java/com/yihu/AppHealthServer.java
  76. 0 34
      app/public-health-server/src/main/java/com/yihu/ehr/health/AppHealthServer.java
  77. 0 37
      app/public-health-server/src/main/java/com/yihu/ehr/health/controller/common/ErrorController.java
  78. 0 92
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAccessDecisionManager.java
  79. 0 270
      app/public-health-server/src/main/java/com/yihu/ehr/health/service/common/BaseService.java
  80. 0 357
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/file/FileUtil.java
  81. 0 36
      app/public-health-server/src/main/java/com/yihu/ehr/health/util/http/HttpResponse.java
  82. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/config/SwaggerConfig.java
  83. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/constant/Constants.java
  84. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/constant/ServiceApi.java
  85. 2 6
      app/public-health-server/src/main/java/com/yihu/ehr/health/controller/archives/ArchivesController.java
  86. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/controller/common/BaseController.java
  87. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/controller/common/IndexController.java
  88. 3 4
      app/public-health-server/src/main/java/com/yihu/ehr/health/controller/dictionary/SystemDictController.java
  89. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/AccessToken.java
  90. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/model/ListResult.java
  91. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/MenuResult.java
  92. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ObjectResult.java
  93. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/Result.java
  94. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/user/UserModel.java
  95. 1 1
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/config/EhrWebHttpSessionConfiguration.java
  96. 0 0
      app/public-health-server/src/main/java/com/yihu/health/security/config/EhrWebSecurityConfiguration.java
  97. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationFailureHandler.java
  98. 1 5
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationProvider.java
  99. 1 3
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationSuccessHandler.java
  100. 0 0
      app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationToken.java

+ 46 - 150
app/app-iot-server/pom.xml

@ -4,9 +4,9 @@
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.ehr.iot</groupId>
@ -14,53 +14,36 @@
    <packaging>war</packaging>
    <version>${parent.version}</version>
    <!-- 依赖包 -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>log4j-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>us.codecraft</groupId>
            <artifactId>webmagic-core</artifactId>
            <version>0.4.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>log4j</artifactId>
                    <groupId>log4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>us.codecraft</groupId>
            <artifactId>webmagic-extension</artifactId>
            <version>0.4.2</version>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>1.3.3</version>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- 使用intellij作为集成开发环境 -->
        <!--<dependency>-->
        <!--<groupId>org.springframework.session</groupId>-->
        <!--<artifactId>spring-session-data-redis</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
@ -71,185 +54,99 @@
            <artifactId>jstl</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <!--<dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>-->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>3.0.5</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.4.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>classmate</artifactId>
                    <groupId>com.fasterxml</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>eu.medsea.mimeutil</groupId>
            <artifactId>mime-util</artifactId>
            <version>2.1.3</version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.sun.jna</groupId>
            <artifactId>jna</artifactId>
            <version>3.0.9</version>
            <groupId>io.searchbox</groupId>
            <artifactId>jest</artifactId>
            <version>2.4.0</version>
        </dependency>
        <!--<dependency>-->
            <!--<groupId>org.springframework.session</groupId>-->
            <!--<artifactId>spring-session-data-redis</artifactId>-->
        <!--</dependency>-->
        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20151123</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
            <version>1.2.17</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jexcelapi</groupId>
            <artifactId>jxl</artifactId>
            <version>2.6</version>
        </dependency>
        <dependency>
            <groupId>com.sun.jna</groupId>
            <artifactId>jna</artifactId>
            <version>3.0.9</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-admin-gateway-model</artifactId>
            <version>1.1.0</version>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-util</artifactId>
            <version>1.1.0</version>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>log4j-core</artifactId>
                    <groupId>org.apache.logging.log4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-api</artifactId>
                    <groupId>org.apache.logging.log4j</groupId>
                    <groupId>org.slf4j</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-rest-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
            <artifactId>common-rest-model-es</artifactId>
        </dependency>
        <!-- ehr -->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-admin-gateway-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-data-fastdfs</artifactId>
            <version>1.0.0</version>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-util</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-rest-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <!-- jkzl starter -->
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model-es</artifactId>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
    </dependencies>
@ -268,7 +165,6 @@
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->

+ 21 - 0
app/app-iot-server/src/main/java/com/yihu/AppIotServer.java

@ -0,0 +1,21 @@
package com.yihu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
public class AppIotServer extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication app = new SpringApplication(AppIotServer.class);
        app.run(args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AppIotServer.class);
    }
}

+ 0 - 35
app/app-iot-server/src/main/java/com/yihu/ehr/iot/AppIotServer.java

@ -1,35 +0,0 @@
package com.yihu.ehr.iot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableAutoConfiguration(exclude = {
        SecurityAutoConfiguration.class,
        ManagementWebSecurityAutoConfiguration.class,
        DataSourceAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class})
@ComponentScan(basePackages={"com.yihu.base","com.yihu.ehr.iot"})
//@EnableRedisHttpSession
public class AppIotServer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AppIotServer.class);
    }
	public static void main(String[] args) {
        SpringApplication app = new SpringApplication(AppIotServer.class);
        app.run(args);
	}
}

+ 0 - 87
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebUserDetailsService.java

@ -1,87 +0,0 @@
package com.yihu.ehr.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.util.rest.Envelop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.util.Assert;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebUserDetailsService implements UserDetailsService {
    private final Logger logger = LoggerFactory.getLogger(this.getClass());
    private final ObjectMapper objectMapper = new ObjectMapper();
    private final String profileInnerUrl;
    public EhrWebUserDetailsService(String profileInnerUrl){
        Assert.hasText(profileInnerUrl, "ProfileInnerUrl must not be empty or null");
        this.profileInnerUrl = profileInnerUrl;
    }
    /**
     * Step 2
     * @param username
     * @return
     * @throws UsernameNotFoundException
     */
    @Override
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("login_code", username);
            HttpResponse httpResponse = HttpHelper.get(profileInnerUrl + "/users/" + username, params);
            if(httpResponse.getStatusCode() == 200) {
                Envelop envelop = this.objectMapper.readValue(httpResponse.getBody(), Envelop.class);
                if (envelop.isSuccessFlg()){
                    String user = this.objectMapper.writeValueAsString(envelop.getObj());
                    UserDetailModel userDetailModel = this.objectMapper.readValue(user, UserDetailModel.class);
                    String password = userDetailModel.getPassword();
                    HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
                    //登陆成功后需要的属性
                    request.setAttribute("id", userDetailModel.getId());
                    request.setAttribute("username", username);
                    request.setAttribute("realName", userDetailModel.getRealName());
                    request.setAttribute("user",userDetailModel);
                    return new User(username, password, getGrantedAuthorities(username));
                }
                logger.error(httpResponse.getBody());
                logger.error(envelop.getErrorMsg());
            }
        }catch (Exception e) {
            e.printStackTrace();
        }
        throw new UsernameNotFoundException(username);
    }
    private Collection<GrantedAuthority> getGrantedAuthorities(String username) {
        Collection<GrantedAuthority> authorities = new ArrayList<>(1);
        authorities.add(new SimpleGrantedAuthority("ROLE_USER"));
        return authorities;
    }
}

+ 0 - 48
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/CurrentRequest.java

@ -1,48 +0,0 @@
package com.yihu.ehr.iot.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.iot.util.spring.SpringContextHolder;
import com.yihu.ehr.util.rest.Envelop;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.session.SessionInformation;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.stereotype.Component;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
/**
 * @author lith
 * @created 2018/02/06
 */
@Component
public class CurrentRequest {
    @Autowired
    SessionRegistry sessionRegistry;
    /**
     * 获取当前登录用户,当前已登录的用户都缓存在session中
     * @param request
     * @return
     */
    public  UserDetailModel getCurrentUser(HttpServletRequest request){
        String sessionId = request.getSession().getId();
        UserDetailModel user = null;
        SessionInformation sessionInformation = sessionRegistry.getSessionInformation(sessionId);
        if(null != sessionInformation.getPrincipal()){
            user = (UserDetailModel)sessionInformation.getPrincipal();
        }
        return user;
    }
}

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/config/SwaggerConfig.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.config;
package com.yihu.iot.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/AuthorityKey.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.constant;
package com.yihu.iot.constant;
/**
 * Created by janseny on 2017/9/30.

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/Constants.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.constant;
package com.yihu.iot.constant;
/**
 * Created by lingfeng on 2015/6/23.

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/ServiceApi.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.constant;
package com.yihu.iot.constant;
/**
 * @author yeshijie on 2018/1/22.

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/BaseController.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.controller.common;
package com.yihu.iot.controller.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.util.rest.Envelop;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/ErrorController.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.controller.common;
package com.yihu.iot.controller.common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

+ 4 - 4
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/FileUploadController.java

@ -1,8 +1,8 @@
package com.yihu.ehr.iot.controller.common;
package com.yihu.iot.controller.common;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.base.fastdfs.FastDFSHelper;
import com.yihu.ehr.iot.service.common.FileUploadService;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.iot.service.common.FileUploadService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -31,7 +31,7 @@ import java.util.Map;
public class FileUploadController extends BaseController {
    @Autowired
    private FastDFSHelper fastDFSHelper;
    private FastDFSUtil fastDFSHelper;
    @Value("${fast-dfs.public-server}")
    private String fastdfs_file_url;
    @Autowired

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/IndexController.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.controller.common;
package com.yihu.iot.controller.common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

+ 2 - 2
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/IotSystemDictController.java

@ -1,6 +1,6 @@
package com.yihu.ehr.iot.controller.common;
package com.yihu.iot.controller.common;
import com.yihu.ehr.iot.service.common.SystemDictService;
import com.yihu.iot.service.common.SystemDictService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.rm.iot.IotRequestMapping;

+ 5 - 5
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/common/LoginController.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.controller.common;
package com.yihu.iot.controller.common;
import com.yihu.ehr.iot.model.Result;
import com.yihu.ehr.iot.service.common.LoginService;
import com.yihu.iot.model.Result;
import com.yihu.iot.service.common.LoginService;
import com.yihu.ehr.util.rest.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -51,9 +51,9 @@ public class LoginController extends BaseController{
    @ResponseBody
    @ApiOperation(value = "登录验证")
    public Result login(HttpServletRequest request,
            @ApiParam(name = "userName", value = "登录账号")
                        @ApiParam(name = "userName", value = "登录账号")
            @RequestParam(value = "userName") String userName,
            @ApiParam(name = "password", value = "密码")
                        @ApiParam(name = "password", value = "密码")
            @RequestParam(value = "password") String password) {
            return loginService.login(request, userName, password);
    }

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/company/IotCompanyController.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.controller.company;
package com.yihu.iot.controller.company;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.service.company.CompanyService;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.company.CompanyService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/device/IotDeviceController.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.controller.device;
package com.yihu.iot.controller.device;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.service.device.DeviceService;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.device.DeviceService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.restmodel.iot.common.ExistVO;

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/device/IotDeviceOrderController.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.controller.device;
package com.yihu.iot.controller.device;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.service.device.DeviceOrderService;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.device.DeviceOrderService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/device/IotDeviceQualityController.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.controller.device;
package com.yihu.iot.controller.device;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.service.device.IotDeviceQualityService;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.device.IotDeviceQualityService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import com.yihu.jw.rm.iot.IotRequestMapping;

+ 4 - 4
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/product/IotProductController.java

@ -1,8 +1,8 @@
package com.yihu.ehr.iot.controller.product;
package com.yihu.iot.controller.product;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.model.ehr.MStdDataSet;
import com.yihu.ehr.iot.service.product.ProductService;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.model.ehr.MStdDataSet;
import com.yihu.iot.service.product.ProductService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/third/wlyy/MonitoringHealthPlatformController.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.controller.third.wlyy;
package com.yihu.iot.controller.third.wlyy;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.service.third.wlyy.MonitoringHealthService;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.third.wlyy.MonitoringHealthService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/model/AccessToken.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.model;
package com.yihu.iot.model;
/**
 * Created by zhenglingfeng on 2017/3/8.

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ListResult.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model;
package com.yihu.iot.model;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/model/MenuResult.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.model;
package com.yihu.iot.model;
import java.util.ArrayList;
import java.util.List;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/model/ObjectResult.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.model;
package com.yihu.iot.model;
/**

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/model/Result.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.model;
package com.yihu.iot.model;
import java.lang.reflect.Field;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ehr/MRsMetadata.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model.ehr;
package com.yihu.iot.model.ehr;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ehr/MStdDataSet.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model.ehr;
package com.yihu.iot.model.ehr;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/model/user/UserModel.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.model.user;
package com.yihu.iot.model.user;
import java.io.Serializable;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebHttpSessionConfiguration.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.security.config;
package com.yihu.iot.security.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/config/EhrWebSecurityConfiguration.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.security.config;
package com.yihu.iot.security.config;
import com.yihu.ehr.iot.security.core.*;
import com.yihu.ehr.iot.security.entryPoint.LoginEntryPoint;
import com.yihu.iot.security.entryPoint.LoginEntryPoint;
import com.yihu.iot.security.core.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAccessDecisionManager.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.security.core;
package com.yihu.iot.security.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationFailureHandler.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.security.core;
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.util.rest.Envelop;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationProvider.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.security.core;
package com.yihu.iot.security.core;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationSuccessHandler.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.security.core;
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationToken.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.security.core;
package com.yihu.iot.security.core;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebContextLogoutHandler.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.security.core;
package com.yihu.iot.security.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebUserDetails.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.security.core;
package com.yihu.iot.security.core;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;

+ 4 - 5
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebUserDetailsService.java

@ -1,9 +1,9 @@
package com.yihu.ehr.health.security.core;
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.health.util.http.HttpHelper;
import com.yihu.ehr.health.util.http.HttpResponse;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.ehr.util.rest.Envelop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -13,6 +13,7 @@ import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
//import org.springframework.session.FindByIndexNameSessionRepository;
import org.springframework.util.Assert;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
@ -23,8 +24,6 @@ import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
//import org.springframework.session.FindByIndexNameSessionRepository;
/**
 * Created by progr1mmer on 2018/1/26.
 */

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebUsernamePasswordAuthenticationFilter.java

@ -1,9 +1,9 @@
package com.yihu.ehr.iot.security.core;
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.ehr.util.rest.Envelop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/entryPoint/LoginEntryPoint.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.security.entryPoint;
package com.yihu.iot.security.entryPoint;
import com.alibaba.fastjson.JSONObject;
import org.springframework.security.core.AuthenticationException;

+ 10 - 10
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/BaseService.java

@ -1,18 +1,18 @@
package com.yihu.ehr.iot.service.common;
package com.yihu.iot.service.common;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.model.AccessToken;
import com.yihu.ehr.iot.model.ListResult;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.model.Result;
import com.yihu.ehr.iot.util.encode.AES;
import com.yihu.ehr.iot.util.encode.Base64;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.iot.util.operator.StringUtil;
import com.yihu.iot.model.AccessToken;
import com.yihu.iot.model.ListResult;
import com.yihu.iot.model.ObjectResult;
import com.yihu.iot.model.Result;
import com.yihu.iot.util.encode.AES;
import com.yihu.iot.util.encode.Base64;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.iot.util.operator.StringUtil;
import com.yihu.ehr.util.rest.Envelop;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/FileUploadService.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.service.common;
package com.yihu.iot.service.common;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.restmodel.iot.common.UploadVO;

+ 7 - 7
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/LoginService.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.service.common;
package com.yihu.iot.service.common;
import com.yihu.ehr.agModel.user.RoleOrgModel;
import com.yihu.ehr.agModel.user.UserDetailModel;
@ -8,12 +8,12 @@ import com.yihu.ehr.model.geography.MGeographyDict;
import com.yihu.ehr.model.org.MOrganization;
import com.yihu.ehr.model.resource.MRsRolesResource;
import com.yihu.ehr.model.user.MRoles;
import com.yihu.ehr.iot.constant.AuthorityKey;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.iot.model.AccessToken;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.model.Result;
import com.yihu.iot.constant.AuthorityKey;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.iot.model.AccessToken;
import com.yihu.iot.model.ObjectResult;
import com.yihu.iot.model.Result;
import com.yihu.ehr.util.log.LogService;
import com.yihu.ehr.util.rest.Envelop;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;

+ 5 - 5
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/common/SystemDictService.java

@ -1,10 +1,10 @@
package com.yihu.ehr.iot.service.common;
package com.yihu.iot.service.common;
import com.yihu.ehr.constants.ErrorCode;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.model.ObjectResult;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import org.springframework.stereotype.Service;

+ 8 - 8
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/company/CompanyService.java

@ -1,13 +1,13 @@
package com.yihu.ehr.iot.service.company;
package com.yihu.iot.service.company;
import com.yihu.ehr.constants.ErrorCode;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.model.Result;
import com.yihu.ehr.iot.model.user.UserModel;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.model.ObjectResult;
import com.yihu.iot.model.Result;
import com.yihu.iot.model.user.UserModel;
import com.yihu.iot.service.common.BaseService;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;

+ 6 - 6
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/device/DeviceOrderService.java

@ -1,9 +1,9 @@
package com.yihu.ehr.iot.service.device;
package com.yihu.iot.service.device;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.service.common.BaseService;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;
@ -18,7 +18,7 @@ import java.util.Map;
 * @author yeshijie on 2017/12/8.
 */
@Service
public class DeviceOrderService extends BaseService{
public class DeviceOrderService extends BaseService {
    /**
     * 创建设备订单

+ 11 - 11
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/device/DeviceService.java

@ -1,16 +1,16 @@
package com.yihu.ehr.iot.service.device;
package com.yihu.iot.service.device;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.base.fastdfs.FastDFSHelper;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.service.common.FileUploadService;
import com.yihu.ehr.iot.util.excel.AExcelReader;
import com.yihu.ehr.iot.util.excel.reader.IotDeviceImportVOReader;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.service.common.BaseService;
import com.yihu.iot.service.common.FileUploadService;
import com.yihu.iot.util.excel.AExcelReader;
import com.yihu.iot.util.excel.reader.IotDeviceImportVOReader;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.base.BaseEnvelop;
import com.yihu.jw.restmodel.iot.common.ExistVO;
@ -33,10 +33,10 @@ import java.util.Map;
 * @author yeshijie on 2017/12/8.
 */
@Service
public class DeviceService extends BaseService{
public class DeviceService extends BaseService {
    @Autowired
    private FastDFSHelper fastDFSHelper;
    private FastDFSUtil fastDFSHelper;
    @Value("${neiwang.enable}")
    private Boolean isneiwang;  //如果不是内网项目要转到到内网在上传
    @Autowired

+ 6 - 6
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/device/IotDeviceQualityService.java

@ -1,9 +1,9 @@
package com.yihu.ehr.iot.service.device;
package com.yihu.iot.service.device;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.service.common.BaseService;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import org.springframework.stereotype.Service;
@ -16,7 +16,7 @@ import java.util.Map;
 * @author yeshijie on 2018/01/24.
 */
@Service
public class IotDeviceQualityService extends BaseService{
public class IotDeviceQualityService extends BaseService {
    /**
     * 创建设备质检

+ 7 - 7
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/product/ProductService.java

@ -1,12 +1,12 @@
package com.yihu.ehr.iot.service.product;
package com.yihu.iot.service.product;
import com.yihu.ehr.constants.ErrorCode;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.model.ehr.MStdDataSet;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.model.ObjectResult;
import com.yihu.iot.model.ehr.MStdDataSet;
import com.yihu.iot.service.common.BaseService;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;

+ 8 - 8
app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/third/wlyy/MonitoringHealthService.java

@ -1,14 +1,14 @@
package com.yihu.ehr.iot.service.third.wlyy;
package com.yihu.iot.service.third.wlyy;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.ehr.util.datetime.DateUtil;
import com.yihu.iot.constant.ServiceApi;
import com.yihu.iot.service.common.BaseService;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.ApiOperation;
import iot.device.LocationDataVO;
import org.apache.commons.lang.StringUtils;
@ -28,7 +28,7 @@ import java.util.Map;
 * @author yeshijie on 2018/2/11.
 */
@Service
public class MonitoringHealthService extends BaseService{
public class MonitoringHealthService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(MonitoringHealthService.class);
    @Value("${third.wlyy.url}")
@ -150,7 +150,7 @@ public class MonitoringHealthService extends BaseService{
        if(jsonObject.getInteger("status")==10000){
            String accesstoken = jsonObject.getJSONObject("result").getString("accesstoken");
            tokenMap.put("token",accesstoken);
            tokenMap.put("time",DateUtil.getStringDate());
            tokenMap.put("time", DateUtil.toString(new Date(), DateUtil.DEFAULT_YMDHMSDATE_FORMAT));
            return accesstoken;
        }
        return null;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/util/ControllerTools.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.util;
package com.yihu.iot.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.util.rest.Envelop;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/util/CurrentRequest.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.util;
package com.yihu.iot.util;
import com.yihu.ehr.agModel.user.UserDetailModel;
import org.springframework.beans.factory.annotation.Autowired;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/util/ObjectMapperUtil.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.util;
package com.yihu.iot.util;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;

+ 4 - 4
app/public-health-server/src/main/java/com/yihu/ehr/health/util/encode/AES.java

@ -1,9 +1,9 @@
package com.yihu.ehr.health.util.encode;
package com.yihu.iot.util.encode;
import com.yihu.ehr.health.util.operator.DateUtil;
import com.yihu.ehr.health.util.operator.MD5;
import com.yihu.ehr.health.util.operator.StringUtil;
import com.yihu.iot.util.operator.DateUtil;
import com.yihu.iot.util.operator.MD5;
import com.yihu.iot.util.operator.StringUtil;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/Base64.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.encode;
package com.yihu.iot.util.encode;
/**

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/DES.java

@ -1,8 +1,8 @@
package com.yihu.ehr.iot.util.encode;
package com.yihu.iot.util.encode;
import com.yihu.ehr.iot.util.operator.DateUtil;
import com.yihu.ehr.iot.util.operator.StringUtil;
import com.yihu.iot.util.operator.DateUtil;
import com.yihu.iot.util.operator.StringUtil;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/HexEncode.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.encode;
package com.yihu.iot.util.encode;
/**
 * @created Created by Air on 2015/6/2.

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/encode/RSA.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.encode;
package com.yihu.iot.util.encode;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/excel/AExcelReader.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.excel;
package com.yihu.iot.util.excel;
import jxl.Sheet;
import jxl.Workbook;

+ 2 - 2
app/public-health-server/src/main/java/com/yihu/ehr/health/util/excel/reader/IotDeviceImportVOReader.java

@ -1,6 +1,6 @@
package com.yihu.ehr.health.util.excel.reader;
package com.yihu.iot.util.excel.reader;
import com.yihu.ehr.health.util.excel.AExcelReader;
import com.yihu.iot.util.excel.AExcelReader;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import jxl.Sheet;
import jxl.Workbook;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/file/FileUtil.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.file;
package com.yihu.iot.util.file;
import eu.medsea.mimeutil.MimeUtil;

+ 3 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpClientUtil.java

@ -1,7 +1,7 @@
package com.yihu.ehr.iot.util.http;
package com.yihu.iot.util.http;
import com.yihu.ehr.iot.util.encode.Base64;
import com.yihu.ehr.iot.util.operator.StringUtil;
import com.yihu.iot.util.encode.Base64;
import com.yihu.iot.util.operator.StringUtil;
import org.apache.http.Consts;
import org.apache.http.HttpEntity;
import org.apache.http.NameValuePair;

+ 2 - 2
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpHelper.java

@ -1,6 +1,6 @@
package com.yihu.ehr.iot.util.http;
package com.yihu.iot.util.http;
import com.yihu.ehr.iot.constant.Constants;
import com.yihu.iot.constant.Constants;
import org.apache.http.NameValuePair;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.conn.ssl.TrustSelfSignedStrategy;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpResponse.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.http;
package com.yihu.iot.util.http;
/**
 * add by hzp at 2016-3-10

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/http/HttpUtil.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.http;
package com.yihu.iot.util.http;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/operator/CollectionUtil.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.operator;
package com.yihu.iot.util.operator;
import org.apache.commons.collections.CollectionUtils;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/operator/DateUtil.java

@ -12,7 +12,7 @@
 * -------------------------------------------------------------------------
 * 1.0    2010/07/12    tuchengye              New Making
 ***************************************************************************/
package com.yihu.ehr.iot.util.operator;
package com.yihu.iot.util.operator;
import java.sql.Date;
import java.sql.Time;

+ 2 - 2
app/public-health-server/src/main/java/com/yihu/ehr/health/util/operator/MD5.java

@ -1,7 +1,7 @@
package com.yihu.ehr.health.util.operator;
package com.yihu.iot.util.operator;
import com.yihu.ehr.health.util.encode.HexEncode;
import com.yihu.iot.util.encode.HexEncode;
import java.io.File;
import java.io.FileInputStream;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/util/operator/StringUtil.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.util.operator;
package com.yihu.iot.util.operator;
import org.apache.commons.lang3.StringUtils;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/util/spring/SpringContextHolder.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.util.spring;
package com.yihu.iot.util.spring;
import org.springframework.beans.BeansException;

+ 1 - 0
app/app-iot-server/src/main/resources/application.yml

@ -85,6 +85,7 @@ logging:
neiwang:
  enable: true
  wlyy: http://localhost:9099/iot/
---
spring:
  profiles: jwtest

app/app-iot-server/src/main/resources/logback.xml → app/app-iot-server/src/main/resources/logback.xml.bak


+ 32 - 130
app/public-health-server/pom.xml

@ -8,9 +8,9 @@
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>svr-lib-parent-pom</artifactId>
        <version>1.0.2</version>
        <relativePath>../../svr-lib-parent-pom/pom.xml</relativePath>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.0.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <!-- 依赖包 -->
@ -19,10 +19,6 @@
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>log4j-over-slf4j</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-tomcat</artifactId>
@ -34,30 +30,17 @@
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>us.codecraft</groupId>
            <artifactId>webmagic-core</artifactId>
            <version>0.4.2</version>
            <exclusions>
                <exclusion>
                    <artifactId>log4j</artifactId>
                    <groupId>log4j</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>us.codecraft</groupId>
            <artifactId>webmagic-extension</artifactId>
            <version>0.4.2</version>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>1.3.3</version>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!-- 使用intellij作为集成开发环境 -->
        <!-- Tomcat启动 -->
        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
@ -68,118 +51,44 @@
            <artifactId>jstl</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-web</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-config</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-taglibs</artifactId>
            <version>4.0.0.RELEASE</version>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>3.0.5</version>
            <exclusions>
                <exclusion>
                    <groupId>com.google.guava</groupId>
                    <artifactId>guava</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.4.0</version>
            <exclusions>
                <exclusion>
                    <artifactId>classmate</artifactId>
                    <groupId>com.fasterxml</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-collections4</artifactId>
            <version>4.0</version>
        </dependency>
        <dependency>
            <groupId>eu.medsea.mimeutil</groupId>
            <artifactId>mime-util</artifactId>
            <version>2.1.3</version>
            <exclusions>
                <exclusion>
                    <artifactId>slf4j-log4j12</artifactId>
                    <groupId>org.slf4j</groupId>
                </exclusion>
            </exclusions>
            <groupId>io.searchbox</groupId>
            <artifactId>jest</artifactId>
            <version>2.4.0</version>
        </dependency>
        <dependency>
            <groupId>net.lingala.zip4j</groupId>
            <artifactId>zip4j</artifactId>
            <version>1.3.2</version>
        </dependency>
        <dependency>
            <groupId>commons-fileupload</groupId>
            <artifactId>commons-fileupload</artifactId>
            <version>1.3</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>commons-httpclient</groupId>
            <artifactId>commons-httpclient</artifactId>
            <version>3.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
            <version>4.5.1</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20151123</version>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.12</version>
        </dependency>
        <dependency>
            <groupId>net.sourceforge.jexcelapi</groupId>
            <artifactId>jxl</artifactId>
@ -187,49 +96,42 @@
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-admin-gateway-model</artifactId>
            <version>1.1.0</version>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-util</artifactId>
            <version>1.1.0</version>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <exclusions>
                <exclusion>
                    <artifactId>log4j-core</artifactId>
                    <groupId>org.apache.logging.log4j</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>log4j-api</artifactId>
                    <groupId>org.apache.logging.log4j</groupId>
                    <groupId>org.slf4j</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <!-- ehr -->
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-rest-model</artifactId>
            <artifactId>commons-admin-gateway-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <version>1.0.0</version>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-util</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <artifactId>common-data-fastdfs</artifactId>
            <version>1.0.0</version>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-rest-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <!-- jkzl starter -->
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-logging</artifactId>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
    </dependencies>

+ 20 - 0
app/public-health-server/src/main/java/com/yihu/AppHealthServer.java

@ -0,0 +1,20 @@
package com.yihu;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication
public class AppHealthServer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AppHealthServer.class);
    }
	public static void main(String[] args) {
        SpringApplication app = new SpringApplication(AppHealthServer.class);
        app.run(args);
	}
}

+ 0 - 34
app/public-health-server/src/main/java/com/yihu/ehr/health/AppHealthServer.java

@ -1,34 +0,0 @@
package com.yihu.ehr.health;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration;
import org.springframework.boot.autoconfigure.orm.jpa.HibernateJpaAutoConfiguration;
import org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@EnableAutoConfiguration(exclude = {
        SecurityAutoConfiguration.class,
        ManagementWebSecurityAutoConfiguration.class,
        DataSourceAutoConfiguration.class,
        HibernateJpaAutoConfiguration.class,
        DataSourceTransactionManagerAutoConfiguration.class})
@ComponentScan(basePackages={"com.yihu.base", "com.yihu.ehr.health"})
public class AppHealthServer extends SpringBootServletInitializer {
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(AppHealthServer.class);
    }
	public static void main(String[] args) {
        SpringApplication app = new SpringApplication(AppHealthServer.class);
        app.run(args);
	}
}

+ 0 - 37
app/public-health-server/src/main/java/com/yihu/ehr/health/controller/common/ErrorController.java

@ -1,37 +0,0 @@
package com.yihu.ehr.health.controller.common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * Controller - 全局错误页
 * Created by progr1mmer on 2017/11/6.
 */
@Controller
@Api(value = "Error", description = "全局错误页")
public class ErrorController extends BaseController{
    @GetMapping("/400")
    @ApiOperation(value = "BAD REQUEST")
    public void badRequest(HttpServletResponse response) throws IOException{
        response.sendRedirect(contextPath + "/front/views/error/400.html");
    }
    @GetMapping("/404")
    @ApiOperation(value = "NOT FOUND")
    public void notFound(HttpServletResponse response) throws IOException{
        response.sendRedirect(contextPath + "/front/views/error/404.html");
    }
    @GetMapping("/500")
    @ApiOperation(value = "INTERNAL SERVER ERROR")
    public void serverError(HttpServletResponse response) throws IOException{
        response.sendRedirect(contextPath + "/front/views/error/500.html");
    }
}

+ 0 - 92
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAccessDecisionManager.java

@ -1,92 +0,0 @@
package com.yihu.ehr.health.security.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.access.AccessDecisionVoter;
import org.springframework.security.access.AccessDeniedException;
import org.springframework.security.access.ConfigAttribute;
import org.springframework.security.access.vote.AbstractAccessDecisionManager;
import org.springframework.security.authentication.InsufficientAuthenticationException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.SpringSecurityMessageSource;
import org.springframework.util.Assert;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
/**
 * Final AccessDecisionManager
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebAccessDecisionManager extends AbstractAccessDecisionManager {
    private final Log logger = LogFactory.getLog(this.getClass());
    private List<AccessDecisionVoter<? extends Object>> decisionVoters;
    protected MessageSourceAccessor messages = SpringSecurityMessageSource.getAccessor();
    private boolean allowIfAllAbstainDecisions = false;
    public EhrWebAccessDecisionManager(List<AccessDecisionVoter<? extends Object>> decisionVoters) {
        super(decisionVoters);
        Assert.notEmpty(decisionVoters, "A list of AccessDecisionVoters is required");
        this.decisionVoters = decisionVoters;
    }
    @Override
    public void decide(Authentication authentication, Object o, Collection<ConfigAttribute> collection) throws AccessDeniedException, InsufficientAuthenticationException {
    }
    public void afterPropertiesSet() throws Exception {
        Assert.notEmpty(this.decisionVoters, "A list of AccessDecisionVoters is required");
        Assert.notNull(this.messages, "A message source must be set");
    }
    public List<AccessDecisionVoter<? extends Object>> getDecisionVoters() {
        return this.decisionVoters;
    }
    public boolean isAllowIfAllAbstainDecisions() {
        return this.allowIfAllAbstainDecisions;
    }
    public void setAllowIfAllAbstainDecisions(boolean allowIfAllAbstainDecisions) {
        this.allowIfAllAbstainDecisions = allowIfAllAbstainDecisions;
    }
    public void setMessageSource(MessageSource messageSource) {
        this.messages = new MessageSourceAccessor(messageSource);
    }
    public boolean supports(ConfigAttribute attribute) {
        Iterator var2 = this.decisionVoters.iterator();
        AccessDecisionVoter voter;
        do {
            if(!var2.hasNext()) {
                return false;
            }
            voter = (AccessDecisionVoter)var2.next();
        } while(!voter.supports(attribute));
        return true;
    }
    public boolean supports(Class<?> clazz) {
        Iterator var2 = this.decisionVoters.iterator();
        AccessDecisionVoter voter;
        do {
            if(!var2.hasNext()) {
                return true;
            }
            voter = (AccessDecisionVoter)var2.next();
        } while(voter.supports(clazz));
        return false;
    }
}

+ 0 - 270
app/public-health-server/src/main/java/com/yihu/ehr/health/service/common/BaseService.java

@ -1,270 +0,0 @@
package com.yihu.ehr.health.service.common;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.health.model.AccessToken;
import com.yihu.ehr.health.model.ListResult;
import com.yihu.ehr.health.model.ObjectResult;
import com.yihu.ehr.health.model.Result;
import com.yihu.ehr.health.util.CurrentRequest;
import com.yihu.ehr.health.util.encode.AES;
import com.yihu.ehr.health.util.encode.Base64;
import com.yihu.ehr.health.util.http.HttpHelper;
import com.yihu.ehr.health.util.http.HttpResponse;
import com.yihu.ehr.health.util.operator.StringUtil;
import com.yihu.ehr.util.rest.Envelop;
import org.apache.commons.lang.ArrayUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Serveice - 基类
 * Author Progr1mmer
 */
public class BaseService {
    @Autowired
    protected ObjectMapper objectMapper;
    @Value("${permissions.info}")
    protected String permissionsInfo;
    @Value("${app.clientId}")
    protected String clientId;
//    @Value("${app.baseClientId}")
//    protected String baseClientId;
    @Value("${service-gateway.profileInnerUrl}")
    protected String profileInnerUrl;
    @Value("${service-gateway.profileOuterUrl}")
    protected String profileOuterUrl;
    @Value("${service-gateway.portalInnerUrl}")
    protected String portalInnerUrl;
    @Value("${service-gateway.portalOuterUrl}")
    protected String portalOuterUrl;
    @Value("${service-gateway.archivesInnerUrl}")
    protected String archivesInnerUrl;
    @Value("${service-gateway.iotUrl}")
    protected String iotUrl;
    @Value("${app.oauth2InnerUrl}")
    protected String oauth2InnerUrl;
    @Value("${app.oauth2OuterUrl}")
    protected String oauth2OuterUrl;
    @Autowired
    private CurrentRequest currentRequest;
    public String readFile(String filePath, String charSet) {
        try {
            return readString(new FileInputStream(new File(filePath)), charSet);
        } catch (FileNotFoundException e) {
            e.printStackTrace();
            return null;
        }
    }
    public String readString(InputStream is, String charSet) {
        try {
            return new String(readByte(is), charSet);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
            return null;
        }
    }
    public byte[] readByte(InputStream is) {
        try {
            int temp;
            byte[] tempBuffer = new byte[1024];
            byte[] buffer = new byte[0];
            while ((temp = is.read(tempBuffer)) != -1) {
                buffer = ArrayUtils.addAll(buffer, ArrayUtils.subarray(tempBuffer, 0, temp));
            }
            return buffer;
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    public <T> T toModel(String json,Class<T> targetCls){
        try {
            T model = objectMapper.readValue(json, targetCls);
            return model;
        }catch (Exception e){
            e.printStackTrace();
            return null;
        }
    }
    /**
     * json转为指定对象
     *
     * @param json
     * @param t
     * @param <T>
     * @return
     */
    public <T> T toObj(String json, Class<T> t) {
        try {
            return objectMapper.readValue(json, t);
        } catch (IOException e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 对象转json
     * @param obj
     * @return
     */
    public String toJson(Object obj) {
        try {
            return objectMapper.writeValueAsString(obj);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return null;
        }
    }
    /**
     * 将envelop中的DetailList串转化为模板对象集合
     * @param modelList
     * @param targets
     * @param targetCls
     * @param <T>
     * @return
     */
    public <T> Collection<T> getEnvelopList(List modelList, Collection<T> targets, Class<T> targetCls) {
        try {
            for (Object aModelList : modelList) {
                String objJsonData = objectMapper.writeValueAsString(aModelList);
                T model = objectMapper.readValue(objJsonData, targetCls);
                targets.add(model);
            }
            return targets;
        } catch (Exception ex) {
            ex.printStackTrace();
            return null;
        }
    }
    public Map<String, Object> getDecryptionParms(Map<String, Object> params) throws Exception {
        if(!StringUtil.isEmpty(params.get("userId"))){
            String userId = new String(Base64.decode(params.get("userId").toString()), "utf-8");
            params.put("userId", userId);
            String key = AES.genKey(userId);
            String iv = AES.genIV(userId);
            for (String paramKey : params.keySet()) {
                if (!paramKey.equals("userId") && !StringUtil.isEmpty(params.get(paramKey))) {
                    params.put(paramKey, AES.decrypt(params.get(paramKey).toString(), key, iv));
                }
            }
        }
        return params;
    }
    /**
     * 获取省列表
     * @param level
     * @return
     */
    public Result getProvinces(Integer level) {
        try {
            Map<String, Object> request = new HashMap<>();
            Map<String, Object> header = new HashMap<>();
            HttpResponse response = HttpHelper.get(profileInnerUrl + ("/geography_entries/level/" +level), request, header);
            if (response!=null && response.getStatusCode() == 200) {
                return toModel(response.getBody(),ListResult.class);
            }
            else {
                return Result.error(response.getStatusCode(),response.getBody());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(e.getMessage());
        }
    }
    /**
     * 获取市列表
     * @param pid
     * @return
     */
    public Result getCitys(Integer pid) {
        try {
            Map<String, Object> request = new HashMap<>();
            Map<String, Object> header = new HashMap<>();
            HttpResponse response = HttpHelper.get(profileInnerUrl + ("/geography_entries/pid/" +pid), request, header);
            if (response != null && response.getStatusCode() == 200) {
                return toModel(response.getBody(),ListResult.class);
            }
            else {
                return Result.error(response.getStatusCode(),response.getBody());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(e.getMessage());
        }
    }
    public Result getDictNameById(Integer id) {
        try {
            Map<String, Object> request = new HashMap<>();
            Map<String, Object> header = new HashMap<>();
            HttpResponse response = HttpHelper.get(profileInnerUrl + ("/geography_entries/" +id), request, header);
            if (response!=null && response.getStatusCode() == 200) {
                return toModel(response.getBody(),ObjectResult.class);
            }
            else {
                return Result.error(response.getStatusCode(),response.getBody());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(e.getMessage());
        }
    }
    /**
     * 获取存储在缓存中的token信息及clientId信息
     */
    public Map<String, Object> getHeader() {
        HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
        Map<String, Object> header = new HashMap<>();
        AccessToken accessToken = (AccessToken)request.getSession().getAttribute("token");
        header.put("token",accessToken.getAccessToken());
        header.put("clientId",clientId);
        return header;
    }
    public Envelop failed(String errMsg) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
        envelop.setErrorMsg(errMsg);
        return envelop;
    }
    public Envelop success(Object object) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(true);
        envelop.setObj(object);
        return envelop;
    }
    public Envelop success(List<Object> objectList) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(true);
        envelop.setObj(objectList);
        return envelop;
    }
}

+ 0 - 357
app/public-health-server/src/main/java/com/yihu/ehr/health/util/file/FileUtil.java

@ -1,357 +0,0 @@
package com.yihu.ehr.health.util.file;
import eu.medsea.mimeutil.MimeUtil;
import org.springframework.web.multipart.MultipartFile;
import java.io.*;
import java.util.Collection;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
/**
 * @author Air
 * @version 1.0
 * @created 2015.06.25 14:14
 */
public class FileUtil {
    public static boolean writeFile(String filePath, String data, String encoding) throws IOException {
        File file = new File(filePath);
        if (!file.getParentFile().exists()) {
            if (!file.getParentFile().mkdirs()) {
                return false;
            }
        }
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        OutputStreamWriter outputStreamWriter = new OutputStreamWriter(fileOutputStream, encoding);
        outputStreamWriter.write(data);
        outputStreamWriter.flush();
        outputStreamWriter.close();
        return true;
    }
    public static boolean writeFile(String filePath, byte[] bytes, String encoding) throws IOException {
        File file = new File(filePath);
        if (!file.getParentFile().exists()) {
            if (!file.getParentFile().mkdirs()) {
                return false;
            }
        }
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        byte[] bbuf = new byte[1024];
        InputStream fis = new ByteArrayInputStream(bytes);
        int hasRead = 0;
        //循环从输入流中取出数据
        while ((hasRead = fis.read(bbuf)) > 0) {
            fileOutputStream.write(bbuf, 0, hasRead);
        }
        fileOutputStream.close();
        return true;
    }
    public static boolean writeFile(String filePath,InputStream fis, String encoding) throws IOException {
        File file = new File(filePath);
        if (!file.getParentFile().exists()) {
            if (!file.getParentFile().mkdirs()) {
                return false;
            }
        }
        FileOutputStream fileOutputStream = new FileOutputStream(file);
        byte[] bbuf = new byte[1024];
        int hasRead = 0;
        //循环从输入流中取出数据
        while ((hasRead = fis.read(bbuf)) > 0) {
            fileOutputStream.write(bbuf, 0, hasRead);
        }
        fileOutputStream.close();
        return true;
    }
    /**
     * 删除整个目录
     *
     * @param dir 目录
     * @return boolean
     * @created Airhead
     */
    public static boolean deleteDirectory(File dir) {
        if (dir.isDirectory()) {
            String[] children = dir.list();
            //递归删除目录中的子目录下
            for (int i = 0; i < children.length; i++) {
                boolean success = deleteDirectory(new File(dir, children[i]));
                if (!success) {
                    return false;
                }
            }
        }
        // 目录此时为空,可以删除
        return dir.delete();
    }
    /**
     * file转string
     * @param file 文件
     * @return string类型流
     */
    public static String convertFileToString(File file) {
        StringBuilder sb = new StringBuilder();
        if(file.isFile()&&file.exists()) {
            InputStreamReader read = null;
            try {
                read = new InputStreamReader(new FileInputStream(file), "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            } catch (FileNotFoundException e) {
                e.printStackTrace();
            }
            BufferedReader reader = new BufferedReader(read);
            String line = null;
            try {
                while ((line = reader.readLine()) != null) {
                    sb.append(line);
                }
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
        return sb.toString();
    }
    public static String streamToString(InputStream inputStream) {
        StringBuilder sb = new StringBuilder();
            InputStreamReader read = null;
            try {
                read = new InputStreamReader(inputStream, "UTF-8");
            } catch (UnsupportedEncodingException e) {
                e.printStackTrace();
            }
            BufferedReader reader = new BufferedReader(read);
            String line = null;
            try {
                while ((line = reader.readLine()) != null) {
                    sb.append(line);
                }
            } catch (IOException e) {
                e.printStackTrace();
            } finally {
                try {
                    reader.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        return sb.toString();
    }
    /**
     * 清空文件内容
     * @param filePath 文件路径
     * @param content 写入内容
     */
    public static void clearInfoForFile(String filePath,String content) {
        File file =new File(filePath);
        try {
            if(!file.exists()) {
                file.createNewFile();
            }
            FileWriter fileWriter =new FileWriter(file);
            fileWriter.write(content);
            fileWriter.flush();
            fileWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    /**
     * 记录文件最后读取的位置
     * @param readPath  被读取文件路径
     * @param savePath  保存被读取文件的最后位置 的文件路径
     */
    public static Integer  saveFilePos(String  readPath,  String  savePath)  {
        boolean result=false;
        File readFile=new File(readPath);
        Integer lenth=null;
        try  {
            if(readFile.exists()){
                InputStream inputStream = new FileInputStream(readPath);
                lenth = inputStream.available();
                clearInfoForFile(savePath,"");//清空内容
                writeFile(savePath,lenth.toString(),"UTF-8");//重新写入标识
            }
        }
        catch  (Exception  e)  {
            e.printStackTrace();
        }
        return lenth;
    }
    public static Integer getFileSize(String path) {
        Integer size=0;
        InputStream inputStream=null;
        File file=new File(path);
        if (file.exists()){
            try {
                inputStream = new FileInputStream(path);
                size = inputStream.available();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
       return size;
    }
    /**
     * 读取文本文件内容
     * @param file  文件路径
     * @return
     */
    public static String readFileText(File file) {
        StringBuilder stringBuilder = new StringBuilder();
        InputStream in = null;
        BufferedReader br = null;
        try {
            in = new FileInputStream(file);
            br = new BufferedReader(new InputStreamReader(in, "UTF-8"));
            String line = null;
            while ((line = br.readLine()) != null) {
                stringBuilder.append(line);
            }
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (in != null) {
                try {
                    in.close();
                } catch (IOException e1) {
                }
            }
        }
        return stringBuilder.toString();
    }
    public static  byte[] getBytesByStream(InputStream inputStream){
        byte[] buffer = null;
        try {
            ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
            byte[] b = new byte[1024];
            int n;
            while ((n = inputStream.read(b)) != -1) {
                bos.write(b, 0, n);
            }
            bos.close();
            buffer = bos.toByteArray();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return buffer;
    }
    /**
     * 获得指定文件的byte数组
     */
    public static  byte[] getBytes(String filePath){
        byte[] buffer = null;
        try {
            File file = new File(filePath);
            FileInputStream fis = new FileInputStream(file);
            ByteArrayOutputStream bos = new ByteArrayOutputStream(1000);
            byte[] b = new byte[1024];
            int n;
            while ((n = fis.read(b)) != -1) {
                bos.write(b, 0, n);
            }
            fis.close();
            bos.close();
            buffer = bos.toByteArray();
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return buffer;
    }
    // 将byte数组转换成InputStream
    public static InputStream byteTOInputStream(byte[] in) throws Exception {
        ByteArrayInputStream is = new ByteArrayInputStream(in);
        return is;
    }
    /**
     * 获取文件Mine-Type
     * @param file
     * @return
     */
    public static String getMimeType(File file) {
        MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
        Collection<?> collection=MimeUtil.getMimeTypes(file);
        return collection.toString();
    }
    public static String getMimeType(byte[] bytes) {
        MimeUtil.registerMimeDetector("eu.medsea.mimeutil.detector.MagicMimeMimeDetector");
        Collection<?> collection=MimeUtil.getMimeTypes(bytes);
        return collection.toString();
    }
    /**
     * 非结构化档案--文件类型map生成
     * @param map
     * @return
     */
    public static Map<String, StringBuffer> groupDataMap(Map<String, String> map) {
        Map<String, StringBuffer> result = new HashMap<String, StringBuffer>();
        Iterator<String> rs=map.keySet().iterator();
        while (rs.hasNext()) {
            String key = rs.next();
            String value = map.get(key);
            if (result.containsKey(value)) {
                result.get(value).append(",").append(key);
            } else {
                result.put(value, new StringBuffer(key));
            }
        }
        return result;
    }
    /**
     * 获取文件后缀名
     * @param file
     * @return
     */
    public static String getSuffix(File file){
        String suffix = file.getName().substring(file.getName().lastIndexOf(".") + 1);
        return suffix;
    }
    public static String getSuffix(MultipartFile file){
        String suffix = file.getName().substring(file.getName().lastIndexOf(".") + 1);
        return suffix;
    }
}

+ 0 - 36
app/public-health-server/src/main/java/com/yihu/ehr/health/util/http/HttpResponse.java

@ -1,36 +0,0 @@
package com.yihu.ehr.health.util.http;
/**
 * add by hzp at 2016-3-10
 */
public class HttpResponse {
    public HttpResponse()
    {
    }
    public HttpResponse(int statusCode, String body) {
        this.statusCode = statusCode;
        this.body = body;
    }
    private int statusCode;
    private String body;
    public int getStatusCode() {
        return statusCode;
    }
    public void setStatusCode(int statusCode) {
        this.statusCode = statusCode;
    }
    public String getBody() {
        return body;
    }
    public void setBody(String body) {
        this.body = body;
    }
}

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/config/SwaggerConfig.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.config;
package com.yihu.health.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/constant/Constants.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.constant;
package com.yihu.health.constant;
/**
 * Created by lingfeng on 2015/6/23.

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/constant/ServiceApi.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.constant;
package com.yihu.health.constant;
/**
 * @author yeshijie on 2018/1/22.

+ 2 - 6
app/public-health-server/src/main/java/com/yihu/ehr/health/controller/archives/ArchivesController.java

@ -1,9 +1,7 @@
package com.yihu.ehr.health.controller.archives;
package com.yihu.health.controller.archives;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.health.service.archives.ArchivesService;
import com.yihu.health.service.archives.ArchivesService;
import com.yihu.jw.restmodel.archives.PatientArchivesInfoVO;
import com.yihu.jw.restmodel.archives.PatientArchivesVO;
import com.yihu.jw.restmodel.common.Envelop;
@ -14,8 +12,6 @@ import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
 * Created by Trick on 2018/2/22.
 */

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/controller/common/BaseController.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.controller.common;
package com.yihu.health.controller.common;
import com.yihu.ehr.util.rest.Envelop;
import org.springframework.beans.factory.annotation.Value;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/controller/common/IndexController.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.controller.common;
package com.yihu.health.controller.common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

+ 3 - 4
app/public-health-server/src/main/java/com/yihu/ehr/health/controller/dictionary/SystemDictController.java

@ -1,9 +1,8 @@
package com.yihu.ehr.health.controller.dictionary;
package com.yihu.health.controller.dictionary;
import com.yihu.ehr.health.controller.common.BaseController;
import com.yihu.ehr.health.service.dictionary.SystemDictService;
import com.yihu.health.controller.common.BaseController;
import com.yihu.health.service.dictionary.SystemDictService;
import com.yihu.jw.restmodel.archives.dict.SystemDictVO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/AccessToken.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model;
package com.yihu.health.model;
/**
 * Created by zhenglingfeng on 2017/3/8.

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/model/ListResult.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.model;
package com.yihu.health.model;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/MenuResult.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model;
package com.yihu.health.model;
import java.util.ArrayList;
import java.util.List;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ObjectResult.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model;
package com.yihu.health.model;
/**

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/Result.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model;
package com.yihu.health.model;
import java.lang.reflect.Field;

+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/user/UserModel.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.model.user;
package com.yihu.health.model.user;
import java.io.Serializable;

+ 1 - 1
app/public-health-server/src/main/java/com/yihu/ehr/health/security/config/EhrWebHttpSessionConfiguration.java

@ -1,4 +1,4 @@
package com.yihu.ehr.health.security.config;
package com.yihu.health.security.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

app/public-health-server/src/main/java/com/yihu/ehr/health/security/config/EhrWebSecurityConfiguration.java → app/public-health-server/src/main/java/com/yihu/health/security/config/EhrWebSecurityConfiguration.java


+ 1 - 1
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationFailureHandler.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.security.core;
package com.yihu.health.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.util.rest.Envelop;

+ 1 - 5
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationProvider.java

@ -1,4 +1,4 @@
package com.yihu.ehr.iot.security.core;
package com.yihu.health.security.core;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
@ -13,10 +13,6 @@ import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.util.Assert;
import org.springframework.web.context.request.RequestContextHolder;
import org.springframework.web.context.request.ServletRequestAttributes;
import javax.servlet.http.HttpServletRequest;
/**
 * Created by progr1mmer on 2018/1/26.

+ 1 - 3
app/app-iot-server/src/main/java/com/yihu/ehr/iot/security/core/EhrWebAuthenticationSuccessHandler.java

@ -1,14 +1,12 @@
package com.yihu.ehr.iot.security.core;
package com.yihu.health.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.ehr.agModel.user.UserDetailModel;
import com.yihu.ehr.iot.util.CurrentRequest;
import com.yihu.ehr.util.rest.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.web.authentication.AuthenticationSuccessHandler;
import javax.servlet.ServletException;

+ 0 - 0
app/public-health-server/src/main/java/com/yihu/ehr/health/security/core/EhrWebAuthenticationToken.java


Vissa filer visades inte eftersom för många filer har ändrats