浏览代码

代码修改

LAPTOP-KB9HII50\70708 3 年之前
父节点
当前提交
bdf63c1acb
共有 100 个文件被更改,包括 0 次插入12954 次删除
  1. 0 202
      app/app-iot-server/pom.xml
  2. 0 9
      app/app-iot-server/readme.MD
  3. 0 21
      app/app-iot-server/src/main/java/com/yihu/AppIotServer.java
  4. 0 32
      app/app-iot-server/src/main/java/com/yihu/iot/config/SwaggerConfig.java
  5. 0 14
      app/app-iot-server/src/main/java/com/yihu/iot/constant/AuthorityKey.java
  6. 0 50
      app/app-iot-server/src/main/java/com/yihu/iot/constant/Constants.java
  7. 0 120
      app/app-iot-server/src/main/java/com/yihu/iot/constant/ServiceApi.java
  8. 0 67
      app/app-iot-server/src/main/java/com/yihu/iot/controller/common/BaseController.java
  9. 0 37
      app/app-iot-server/src/main/java/com/yihu/iot/controller/common/ErrorController.java
  10. 0 265
      app/app-iot-server/src/main/java/com/yihu/iot/controller/common/FileUploadController.java
  11. 0 32
      app/app-iot-server/src/main/java/com/yihu/iot/controller/common/IndexController.java
  12. 0 35
      app/app-iot-server/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java
  13. 0 102
      app/app-iot-server/src/main/java/com/yihu/iot/controller/common/LoginController.java
  14. 0 193
      app/app-iot-server/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  15. 0 196
      app/app-iot-server/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  16. 0 174
      app/app-iot-server/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java
  17. 0 113
      app/app-iot-server/src/main/java/com/yihu/iot/controller/device/IotDeviceQualityController.java
  18. 0 164
      app/app-iot-server/src/main/java/com/yihu/iot/controller/product/IotProductController.java
  19. 0 214
      app/app-iot-server/src/main/java/com/yihu/iot/controller/third/wlyy/MonitoringHealthPlatformController.java
  20. 0 53
      app/app-iot-server/src/main/java/com/yihu/iot/model/AccessToken.java
  21. 0 112
      app/app-iot-server/src/main/java/com/yihu/iot/model/ListResult.java
  22. 0 46
      app/app-iot-server/src/main/java/com/yihu/iot/model/MenuResult.java
  23. 0 54
      app/app-iot-server/src/main/java/com/yihu/iot/model/ObjectResult.java
  24. 0 85
      app/app-iot-server/src/main/java/com/yihu/iot/model/Result.java
  25. 0 152
      app/app-iot-server/src/main/java/com/yihu/iot/model/ehr/MRsMetadata.java
  26. 0 143
      app/app-iot-server/src/main/java/com/yihu/iot/model/ehr/MStdDataSet.java
  27. 0 92
      app/app-iot-server/src/main/java/com/yihu/iot/model/user/UserModel.java
  28. 0 19
      app/app-iot-server/src/main/java/com/yihu/iot/security/config/EhrWebHttpSessionConfiguration.java
  29. 0 131
      app/app-iot-server/src/main/java/com/yihu/iot/security/config/EhrWebSecurityConfiguration.java
  30. 0 95
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAccessDecisionManager.java
  31. 0 40
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationFailureHandler.java
  32. 0 152
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationProvider.java
  33. 0 63
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationSuccessHandler.java
  34. 0 54
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationToken.java
  35. 0 40
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebContextLogoutHandler.java
  36. 0 47
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebUserDetails.java
  37. 0 84
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebUserDetailsService.java
  38. 0 177
      app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebUsernamePasswordAuthenticationFilter.java
  39. 0 36
      app/app-iot-server/src/main/java/com/yihu/iot/security/entryPoint/LoginEntryPoint.java
  40. 0 299
      app/app-iot-server/src/main/java/com/yihu/iot/service/common/BaseService.java
  41. 0 87
      app/app-iot-server/src/main/java/com/yihu/iot/service/common/FileUploadService.java
  42. 0 515
      app/app-iot-server/src/main/java/com/yihu/iot/service/common/LoginService.java
  43. 0 71
      app/app-iot-server/src/main/java/com/yihu/iot/service/common/SystemDictService.java
  44. 0 367
      app/app-iot-server/src/main/java/com/yihu/iot/service/company/CompanyService.java
  45. 0 168
      app/app-iot-server/src/main/java/com/yihu/iot/service/device/DeviceOrderService.java
  46. 0 265
      app/app-iot-server/src/main/java/com/yihu/iot/service/device/DeviceService.java
  47. 0 115
      app/app-iot-server/src/main/java/com/yihu/iot/service/device/IotDeviceQualityService.java
  48. 0 184
      app/app-iot-server/src/main/java/com/yihu/iot/service/product/ProductService.java
  49. 0 303
      app/app-iot-server/src/main/java/com/yihu/iot/service/third/wlyy/MonitoringHealthService.java
  50. 0 56
      app/app-iot-server/src/main/java/com/yihu/iot/util/ControllerTools.java
  51. 0 35
      app/app-iot-server/src/main/java/com/yihu/iot/util/CurrentRequest.java
  52. 0 21
      app/app-iot-server/src/main/java/com/yihu/iot/util/ObjectMapperUtil.java
  53. 0 143
      app/app-iot-server/src/main/java/com/yihu/iot/util/conceal/ConcealUtil.java
  54. 0 89
      app/app-iot-server/src/main/java/com/yihu/iot/util/encode/AES.java
  55. 0 132
      app/app-iot-server/src/main/java/com/yihu/iot/util/encode/Base64.java
  56. 0 67
      app/app-iot-server/src/main/java/com/yihu/iot/util/encode/DES.java
  57. 0 29
      app/app-iot-server/src/main/java/com/yihu/iot/util/encode/HexEncode.java
  58. 0 118
      app/app-iot-server/src/main/java/com/yihu/iot/util/encode/RSA.java
  59. 0 70
      app/app-iot-server/src/main/java/com/yihu/iot/util/excel/AExcelReader.java
  60. 0 33
      app/app-iot-server/src/main/java/com/yihu/iot/util/excel/reader/IotDeviceImportVOReader.java
  61. 0 357
      app/app-iot-server/src/main/java/com/yihu/iot/util/file/FileUtil.java
  62. 0 367
      app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpClientUtil.java
  63. 0 260
      app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpHelper.java
  64. 0 36
      app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpResponse.java
  65. 0 219
      app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpUtil.java
  66. 0 18
      app/app-iot-server/src/main/java/com/yihu/iot/util/operator/CollectionUtil.java
  67. 0 1525
      app/app-iot-server/src/main/java/com/yihu/iot/util/operator/DateUtil.java
  68. 0 75
      app/app-iot-server/src/main/java/com/yihu/iot/util/operator/MD5.java
  69. 0 1441
      app/app-iot-server/src/main/java/com/yihu/iot/util/operator/StringUtil.java
  70. 0 29
      app/app-iot-server/src/main/java/com/yihu/iot/util/spring/SpringContextHolder.java
  71. 0 165
      app/app-iot-server/src/main/resources/application.yml
  72. 0 178
      app/app-iot-server/src/main/resources/logback.xml.bak
  73. 0 12
      app/app-iot-server/src/main/webapp/front/css/animate.min.css
  74. 0 6
      app/app-iot-server/src/main/webapp/front/css/bootstrap.min.css
  75. 0 6
      app/app-iot-server/src/main/webapp/front/css/bootstrap.min14ed.css
  76. 0 1
      app/app-iot-server/src/main/webapp/front/css/demo/webuploader-demo.min.css
  77. 0 4
      app/app-iot-server/src/main/webapp/front/css/font-awesome.min93e3.css
  78. 0 389
      app/app-iot-server/src/main/webapp/front/css/index.css
  79. 0 46
      app/app-iot-server/src/main/webapp/front/css/login.css
  80. 0 1
      app/app-iot-server/src/main/webapp/front/css/login.min.css
  81. 二进制
      app/app-iot-server/src/main/webapp/front/css/patterns/header-profile-skin-1.png
  82. 二进制
      app/app-iot-server/src/main/webapp/front/css/patterns/header-profile-skin-3.png
  83. 二进制
      app/app-iot-server/src/main/webapp/front/css/patterns/header-profile.png
  84. 二进制
      app/app-iot-server/src/main/webapp/front/css/patterns/shattered.png
  85. 0 251
      app/app-iot-server/src/main/webapp/front/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css
  86. 0 1
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/css/blueimp-gallery.min.css
  87. 二进制
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/error.png
  88. 0 5
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/error.svg
  89. 二进制
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/loading.gif
  90. 二进制
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/play-pause.png
  91. 0 6
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/play-pause.svg
  92. 二进制
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/video-play.png
  93. 0 5
      app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/video-play.svg
  94. 0 1
      app/app-iot-server/src/main/webapp/front/css/plugins/bootstrap-table/bootstrap-table.min.css
  95. 二进制
      app/app-iot-server/src/main/webapp/front/css/plugins/chosen/chosen-sprite.png
  96. 二进制
      app/app-iot-server/src/main/webapp/front/css/plugins/chosen/chosen-sprite@2x.png
  97. 0 423
      app/app-iot-server/src/main/webapp/front/css/plugins/chosen/chosen.css
  98. 0 168
      app/app-iot-server/src/main/webapp/front/css/plugins/clockpicker/clockpicker.css
  99. 0 77
      app/app-iot-server/src/main/webapp/front/css/plugins/codemirror/ambiance.css
  100. 0 0
      app/app-iot-server/src/main/webapp/front/css/plugins/codemirror/codemirror.css

+ 0 - 202
app/app-iot-server/pom.xml

@ -1,202 +0,0 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <parent>
        <groupId>com.yihu.jw</groupId>
        <artifactId>wlyy-parent-pom</artifactId>
        <version>2.4.0</version>
        <relativePath>../../wlyy-parent-pom/pom.xml</relativePath>
    </parent>
    <groupId>com.yihu.ehr.iot</groupId>
    <artifactId>app-iot-server</artifactId>
    <packaging>war</packaging>
    <version>${project.parent.version}</version>
    <!-- 依赖包 -->
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <exclusions>
                <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>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-security</artifactId>
        </dependency>
        <!--<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>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>org.apache.tiles</groupId>
            <artifactId>tiles-extras</artifactId>
            <version>3.0.5</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger2</artifactId>
            <version>2.7.0</version>
        </dependency>
        <dependency>
            <groupId>io.springfox</groupId>
            <artifactId>springfox-swagger-ui</artifactId>
            <version>2.7.0</version>
        </dependency>
        <dependency>
            <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>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.4</version>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20160212</version>
        </dependency>
        <dependency>
            <groupId>com.alibaba</groupId>
            <artifactId>fastjson</artifactId>
        </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.jw</groupId>
            <artifactId>common-request-mapping</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model</artifactId>
            <exclusions>
                <exclusion>
                    <groupId>org.slf4j</groupId>
                    <artifactId>*</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-rest-model-es</artifactId>
        </dependency>
        <!-- ehr -->
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-admin-gateway-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-util</artifactId>
            <version>1.1.0</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.ehr</groupId>
            <artifactId>commons-rest-model</artifactId>
            <version>1.1.0</version>
        </dependency>
        <!-- jkzl starter -->
        <dependency>
            <groupId>com.yihu</groupId>
            <artifactId>fastdfs-starter</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpmime</artifactId>
        </dependency>
        <dependency>
            <groupId>eu.medsea.mimeutil</groupId>
            <artifactId>mime-util</artifactId>
            <version>2.1.3</version>
        </dependency>
        <dependency>
            <groupId>com.h2database</groupId>
            <artifactId>h2</artifactId>
            <scope>runtime</scope>
        </dependency>
    </dependencies>
    <build>
        <finalName>app-iot-server</finalName>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin </artifactId>
            </plugin>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
        <resources>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->
                <directory>${basedir}/src/main/webapp</directory>
                <targetPath>${project.build.directory}/classes</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
            <resource>
                <!--打包的时候把resources下的资源移到classpath下-->
                <directory>${basedir}/src/main/resources</directory>
                <targetPath>${project.build.directory}/classes</targetPath>
                <includes>
                    <include>**/**</include>
                </includes>
            </resource>
        </resources>
    </build>
</project>

+ 0 - 9
app/app-iot-server/readme.MD

@ -1,9 +0,0 @@
文件上传:
    ehr的处理:
        1、图片上传是把图片转成base64位,在到微服务处理的把base64字符串转成图片
        2、excel导入,在总支撑品台解析成要导入的对象的json传在传到微服务
    物联网:
        参照ehr,图片上传直接在和前端对接的项目中处理,直接把url传到微服务,微服务直接保存。
        

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

@ -1,21 +0,0 @@
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 - 32
app/app-iot-server/src/main/java/com/yihu/iot/config/SwaggerConfig.java

@ -1,32 +0,0 @@
package com.yihu.iot.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .useDefaultResponseMessages(false)
                .forCodeGeneration(false)
                .pathMapping("/")
                .select()
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder().title("物联网 SwaggerUI").description("Government Server").version("v1.0").build();
    }
}

+ 0 - 14
app/app-iot-server/src/main/java/com/yihu/iot/constant/AuthorityKey.java

@ -1,14 +0,0 @@
package com.yihu.iot.constant;
/**
 * Created by janseny on 2017/9/30.
 */
public class AuthorityKey {
    public static final String IsAccessAll = "isAccessAll";
    public static final String UserAreaSaas = "userAreaSaas";
    public static final String UserOrgSaas = "userOrgSaas";
    public static final String UserRoles = "userRoles";
    public static final String UserResource = "userResource";
}

+ 0 - 50
app/app-iot-server/src/main/java/com/yihu/iot/constant/Constants.java

@ -1,50 +0,0 @@
package com.yihu.iot.constant;
/**
 * Created by lingfeng on 2015/6/23.
 */
public class Constants {
    /**
     * the Special characters
     */
    public static final String ASTERISK = "*";
    public static final String BLANK = " ";
    public static final String EMPTY = "";
    public static final String PERCENT = "%";
    public static final String LEFT_BRACKET = "(";
    public static final String RIGHT_BRACKET = ")";
    public static final String COMMA = ",";
    public static final String UNDERLINE = "_";
    public static final String RAIL = "-";
    /**
     * common
     */
    public static final String OK = "ok";
    public static final String NO = "no";
    public static final String DATA = "data";
    public static final String LEFT_DIAGONAL = "/";
    public static final String DOCUMENT = "documents";
    /**
     * api 接口请求间隔
     */
    public static final Long MAX_INTERVAL = 5000L;
    /**
     * 事件类型 暂用
     */
    public static final String EVENT_TYPE_CLINIC = "0";//门诊
    public static final String EVENT_TYPE_HOSPITAL = "1";//住院
    public static final String EVENT_TYPE_P_EXAMINATION = "2";//体检
    /**
     * sll 加密
     */
    public static String SSL_KEYSOTRE = "";
    public static String SSL_PASSWORD = "";
}

+ 0 - 120
app/app-iot-server/src/main/java/com/yihu/iot/constant/ServiceApi.java

@ -1,120 +0,0 @@
package com.yihu.iot.constant;
/**
 * @author yeshijie on 2018/1/22.
 */
public class ServiceApi {
    public ServiceApi() {
    }
    public static class Company {
        public static final String Base = "wg/company/";
        public static final String FindCompanyPage = Base +"findCompanyPage";
        public static final String AddCompany = Base +"addCompany";
        public static final String FindCompanyById = Base +"findCompanyById";
        public static final String DelCompanyCert = Base +"delCompanyCert";
        public static final String FindByBusinessLicense = Base +"findByBusinessLicense";
        public static final String UpdCompany = Base +"updCompany";
        public static final String DelCompany = Base +"delCompany";
        public static final String FindCompanyCertPage = Base +"findCompanyCertPage";
        public static final String FindCompanyCertById = Base +"findCompanyCertById";
        public static final String FindCompanyCertByCompanyId = Base +"findCompanyCertByCompanyId";
        public static final String AddCompanyCert = Base +"addCompanyCert";
        public Company() {
        }
    }
    public static class System{
        public static final String Base = "wg/systemDict/";
        public static final String FindDictByCode = Base +"findDictByCode";
    }
    public static class FileUpload{
        public static final String Base = "wg/fileUpload/";
        public static final String UploadStream = Base +"uploadStream";//文件流上传
        public static final String UploadImg = Base +"uploadImg";//文件流上传图片
        public static final String UploadattAchment = Base +"uploadattAchment";//文件流上传附件
        public static final String UploadString = Base +"uploadString";//base64字符串上传
    }
    public static class Product {
        public static final String Base = "wg/product/";
        public static final String FindProductPage = Base +"findProductPage";
        public static final String FindProductPageByCompanyId = Base +"findProductPageByCompanyId";
        public static final String AddProduct = Base +"addProduct";
        public static final String FindProductById = Base +"findProductById";
        public static final String MaintenanceUnitById = Base +"maintenanceUnitById";
        public static final String UpdProduct= Base +"updProduct";
        public static final String DelProduct= Base + "delProduct";
        public Product() {
        }
    }
    public static class Device{
        public static final String Base = "wg/device/";
        public static final String CreateDevice = Base +"createDevice";
        public static final String GetDeviceById = Base +"getDeviceById";
        public static final String QueryDevicePage = Base +"queryDevicePage";
        public static final String GetDeviceList = Base +"getDeviceList";
        public static final String DelDevice = Base +"delDevice";
        public static final String UpdDevice = Base +"updDevice";
        public static final String IsSnExist = Base +"isSnExist";
        public static final String IsSimExist = Base +"isSimExist";
        public static final String UpdSim = Base +"updSim";
        public static final String ImportDevice = Base +"importDevice";
        public static final String IsImportDevice = Base +"isImportDevice";
        public static final String QueryImportRecordPage = Base +"queryImportRecordPage";
        public Device() {
        }
    }
    public static class DeviceOrder{
        public static final String Base = "wg/order/";
        public static final String FindPage = Base +"findPage";
        public static final String FindById = Base +"findById";
        public static final String DelOrder = Base +"delOrder";
        public static final String DelPurchase = Base +"delPurchase";
        public static final String UpdOrder = Base +"updOrder";
        public static final String CreateOrder = Base +"createOrder";
        public static final String FindPurcharsePage = Base +"findPurcharsePage";
        public static final String FindPurcharseById = Base +"findPurcharseById";
        public static final String FindQualityPage = Base +"findQualityPage";
        public DeviceOrder() {
        }
    }
    public static class Quality{
        public static final String Base = "wg/quality/";
        public static final String CreateDevice = Base +"createDevice";
        public static final String AddQualityPlan = Base +"addQualityPlan";
        public static final String DelQualityPlan = Base +"delQualityPlan";
        public static final String UpdQualityPlan = Base +"updQualityPlan";
        public static final String CompleteQualityPlan = Base +"completeQualityPlan";
        public static final String CompletePlanByPurchaseId = Base +"completePlanByPurchaseId";
        public static final String QueryQualityPlanPage = Base +"queryQualityPlanPage";
        public static final String FindById = Base +"findById";
        public Quality() {
        }
    }
    public static class PatientDevice{
        public static final String Base = "wg/patientDevice/";
        public static final String findLocationByIdCard = Base + "findLocationByIdCard";
        public PatientDevice(){
        }
    }
}

+ 0 - 67
app/app-iot-server/src/main/java/com/yihu/iot/controller/common/BaseController.java

@ -1,67 +0,0 @@
package com.yihu.iot.controller.common;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.util.rest.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Controller - 基类
 * Created by Progr1mmer on 2017/3/17.
 */
public class BaseController {
    @Value("${app.clientId}")
    protected String clientId;
    @Value("${server.contextPath}")
    protected String contextPath;
    @Autowired
    protected HttpServletRequest request;
    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.setDetailModelList(objectList);
        return envelop;
    }
    /**
     * 返回接口处理结果
     *
     * @param code  结果码,成功为200
     * @param msg   结果提示信息
     * @return
     */
    public String error(int code, String msg) {
        try {
            Map<Object, Object> map = new HashMap<Object, Object>();
            ObjectMapper mapper = new ObjectMapper();
            map.put("status", code);
            map.put("msg", msg);
            return mapper.writeValueAsString(map);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

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

@ -1,37 +0,0 @@
package com.yihu.iot.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 - 265
app/app-iot-server/src/main/java/com/yihu/iot/controller/common/FileUploadController.java

@ -1,265 +0,0 @@
package com.yihu.iot.controller.common;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.fastdfs.FastDFSUtil;
import com.yihu.iot.service.common.FileUploadService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest;
import javax.servlet.http.HttpServletRequest;
import java.io.*;
import java.net.URLDecoder;
import java.util.Base64;
import java.util.Map;
/**
 * @author yeshijie on 2017/12/7.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.file_upload)
@Api(tags = "文件上传相关操作", description = "文件上传相关操作")
public class FileUploadController extends BaseController {
    @Autowired
    private FastDFSUtil fastDFSHelper;
    @Value("${fast-dfs.public-server}")
    private String fastdfs_file_url;
    @Autowired
    private FileUploadService fileUploadService;
    @Value("${neiwang.enable}")
    private Boolean isneiwang;  //如果不是内网项目要转到到内网在上传
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream_img)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public MixEnvelop<UploadVO, UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file){
        try {
            // 得到文件的完整名称  xxx.txt
            String fullName = file.getOriginalFilename();
            if(StringUtils.isBlank(fullName)){
                return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload_format,IotRequestMapping.api_iot_fail);
            }
            //得到文件类型
            String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
            if(StringUtils.isBlank(fileType)||!"jpg,jpeg,png".contains(fileType)){
                return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload_format,IotRequestMapping.api_iot_fail);
            }
            long size = file.getSize();
            long max = 5*1024*1024;
            if(size>max){
                return MixEnvelop.getError("文件大小不超过5M",IotRequestMapping.api_iot_fail);
            }
            String fileName = fullName.substring(0, fullName.lastIndexOf("."));
            //上传到fastdfs
            ObjectNode objectNode = null;
            //解析返回的objectNode
            UploadVO uploadVO = null;
            if(isneiwang){
                objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
                uploadVO = new UploadVO();
                uploadVO.setFileName(fileName);
                uploadVO.setFileType(fileType);
                uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
                uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
            }else {
                uploadVO = fileUploadService.request(request,file.getInputStream(),fullName);
                if(uploadVO==null){
                    return MixEnvelop.getError("文件上传失败",IotRequestMapping.api_iot_fail);
                }
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create, uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream_attachment)
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    public MixEnvelop<UploadVO, UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                              @RequestParam(value = "file", required = true) MultipartFile file){
        try {
            // 得到文件的完整名称  xxx.txt
            String fullName = file.getOriginalFilename();
            if(StringUtils.isBlank(fullName)){
                return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload_format,IotRequestMapping.api_iot_fail);
            }
            //得到文件类型
            String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
            if(StringUtils.isBlank(fileType)||!"doc、docx、pdf、xls、xlsx、jpg、jpeg、png".contains(fileType)){
                return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload_format,IotRequestMapping.api_iot_fail);
            }
            long size = file.getSize();
            long max = 5*1024*1024;
            if(size>max){
                return MixEnvelop.getError("文件大小不超过5M",IotRequestMapping.api_iot_fail);
            }
            String fileName = fullName.substring(0, fullName.lastIndexOf("."));
            //上传到fastdfs
            ObjectNode objectNode = null;
            //解析返回的objectNode
            UploadVO uploadVO = null;
            if(isneiwang){
                objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
                uploadVO = new UploadVO();
                uploadVO.setFileName(fileName);
                uploadVO.setFileType(fileType);
                uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
                uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
            }else {
                uploadVO = fileUploadService.request(request,file.getInputStream(),fullName);
                if(uploadVO==null){
                    return MixEnvelop.getError("文件上传失败",IotRequestMapping.api_iot_fail);
                }
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create, uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public MixEnvelop<UploadVO, UploadVO> uploadStream(@ApiParam(value = "文件", required = true) @RequestParam(value = "file", required = true) MultipartFile file) {
        try {
            // 得到文件的完整名称  xxx.txt
            String fullName = file.getOriginalFilename();
            //得到文件类型
            String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
            String fileName = fullName.substring(0, fullName.lastIndexOf("."));
            //上传到fastdfs
            ObjectNode objectNode = null;
            //解析返回的objectNode
            UploadVO uploadVO = null;
            if(isneiwang){
                objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
                uploadVO = new UploadVO();
                uploadVO.setFileName(fileName);
                uploadVO.setFileType(fileType);
                uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
                uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
            }else {
                uploadVO = fileUploadService.request(request,file.getInputStream(),fullName);
                if(uploadVO==null){
                    return MixEnvelop.getError("文件上传失败",IotRequestMapping.api_iot_fail);
                }
            }
            return MixEnvelop.getSuccess(IotRequestMapping.Common.message_success_create, uploadVO);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_string)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public MixEnvelop<UploadVO, UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流") @RequestBody String jsonData) throws Exception {
        try {
            String date = URLDecoder.decode(jsonData,"UTF-8");
            String[] fileStreams = date.split(",");
            String is = URLDecoder.decode(fileStreams[1],"UTF-8").replace(" ","+");
            byte[] in = Base64.getDecoder().decode(is);
            InputStream inputStream = new ByteArrayInputStream(in);
            ObjectNode objectNode = null;
            //上传到fastdfs
            String fileType = "png";
            //解析返回的objectNode
            UploadVO uploadVO = null;
            if(isneiwang){
                objectNode = fastDFSHelper.upload(inputStream, fileType, "");
                String groupName = objectNode.get("groupName").toString();
                String remoteFileName = objectNode.get("remoteFileName").toString();
                uploadVO = new UploadVO();
                uploadVO.setFileName(remoteFileName);
                uploadVO.setFileType(groupName);
                uploadVO.setFullUri(objectNode.get("fileId").toString().replaceAll("\"", ""));
                uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fileId").toString().replaceAll("\"", ""));
            }else {
                uploadVO = fileUploadService.request(request,inputStream,"");
                if(uploadVO ==null){
                    return MixEnvelop.getError("文件上传失败",IotRequestMapping.api_iot_fail);
                }
            }
            //返回文件路径
            return MixEnvelop.getSuccess(IotRequestMapping.FileUpload.message_success_upload, uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @RequestMapping(value = "commonUpload", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation("公共的文件上传")
    public MixEnvelop<UploadVO, UploadVO> commonUpload(HttpServletRequest request) {
        InputStream in = null;
        try {
            String paths = request.getParameter("filePaths");
            ObjectNode result = null;
            if (StringUtils.isBlank(paths)) {
                //为空是文件上传
                MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
                // 文件保存的临时路径
                Map<String, MultipartFile> fileMap = multipartRequest.getFileMap();
                String fileName = null;
                for (Map.Entry<String, MultipartFile> entity : fileMap.entrySet()) {
                    // 上传文件
                    MultipartFile mf = entity.getValue();
                    fileName = mf.getOriginalFilename();
                    in = mf.getInputStream();
                    result = fastDFSHelper.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
                }
            } else {
                String[] pathArr = paths.split(",");
                for (String path : pathArr) {
                    //传路径自己去路径上传
                    File file = new File(path);
                    String fileName = null;
                    if (file.exists()) {
                        fileName = file.getName();
                        in = new FileInputStream(file);
                        result = fastDFSHelper.upload(in, fileName.substring(fileName.lastIndexOf(".") + 1), "");
                    }
                }
            }
            //解析返回的objectNode
            UploadVO uploadVO = new UploadVO();
            uploadVO.setFullUri(result.get("fileId").toString().replaceAll("\"", ""));
            uploadVO.setFullUrl(fastdfs_file_url + result.get("fileId").toString().replaceAll("\"", ""));
            return MixEnvelop.getSuccess(IotRequestMapping.FileUpload.message_success_upload, result);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }finally {
            if(in!=null){
                try {
                    in.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }
    }
}

+ 0 - 32
app/app-iot-server/src/main/java/com/yihu/iot/controller/common/IndexController.java

@ -1,32 +0,0 @@
package com.yihu.iot.controller.common;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * Controller - 首页
 * Created by progr1mmer on 2017/11/6.
 */
@Controller
@RequestMapping("/index")
@Api(value = "Index", description = "首页")
public class IndexController extends BaseController {
    /**
     * 首页
     * @param response
     * @return
     */
    @RequestMapping(method = RequestMethod.GET)
    @ApiOperation(value = "首页")
    public void index(HttpServletResponse response)throws IOException {
        response.sendRedirect(contextPath + "/front/views/index.html");
    }
}

+ 0 - 35
app/app-iot-server/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -1,35 +0,0 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.service.common.SystemDictService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author yeshijie on 2018/1/16.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.system_dict)
@Api(tags = "系统字典相关操作", description = "系统字典相关操作")
public class IotSystemDictController  extends BaseController{
    @Autowired
    private SystemDictService systemDictService;
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    @ApiOperation(value = "获取字典列表(不分页)")
    public MixEnvelop<IotSystemDictVO, IotSystemDictVO> getList(
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
            @RequestParam(value = "dictName", required = true) String dictName) throws Exception {
        return systemDictService.getList(dictName);
    }
}

+ 0 - 102
app/app-iot-server/src/main/java/com/yihu/iot/controller/common/LoginController.java

@ -1,102 +0,0 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.model.Result;
import com.yihu.iot.service.common.LoginService;
import com.yihu.jw.util.rest.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * Controller - 登陆
 * Created by Progr1mmer on 2017/2/21.
 */
@Controller
@RequestMapping("/login")
@Api(value = "Login", description = "登陆控制器")
public class LoginController extends BaseController{
    @Autowired
    private LoginService loginService;
    /**
     * 登陆页面
     * @param response
     * @return
     */
    @RequestMapping(method = RequestMethod.GET)
    @ApiOperation(value = "登陆首页")
    public void index(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
//        response.sendRedirect(contextPath + "/front/views/login.html");
        request.getRequestDispatcher("/front/views/login.html").forward(request, response);
    }
    /**
     * 登陆验证
     * @param request
     * @param userName
     * @param password
     * @return
     */
    @RequestMapping(value = "/submit", method = RequestMethod.POST)
    @ResponseBody
    @ApiOperation(value = "登录验证")
    public Result login(HttpServletRequest request,
                        @ApiParam(name = "userName", value = "登录账号")
            @RequestParam(value = "userName") String userName,
                        @ApiParam(name = "password", value = "密码")
            @RequestParam(value = "password") String password) {
            return loginService.login(request, userName, password);
    }
    /**
     * 退出登陆
     * @param request
     * @param response
     * @throws IOException
     */
    @RequestMapping(value = "/exit", method = RequestMethod.GET)
    @ApiOperation(value = "用户安全退出")
    public void exit(HttpServletRequest request, HttpServletResponse response) throws IOException {
        request.getSession().removeAttribute("isLogin");
        request.getSession().removeAttribute("token");
        request.getSession().removeAttribute("loginName");
        request.getSession().removeAttribute("userId");
        response.sendRedirect(contextPath + "/login");
    }
    /**
     * 政府服务平台-oauth2验证集成
     * @param response
     * @param request
     * @throws IOException
     */
    @RequestMapping(value = "/signin")
    @ApiOperation(value = "oauth2验证集成")
    public void signIn(HttpServletResponse response, HttpServletRequest request) throws IOException {
        String clientId = request.getParameter("clientId");
        String host = request.getHeader("referer");
        request.getSession().setAttribute("host", host);
        response.sendRedirect(contextPath + "/front/views/signin.html?clientId=" + clientId);
    }
    /*
     * 自动登录
     */
    @RequestMapping(value = "/autoLogin", method = RequestMethod.POST)
    @ResponseBody
    public Envelop autoLogin(HttpServletRequest request, Model model,
                             @ApiParam(name = "token", value = "TOKEN")
                             @RequestParam(value = "token") String token) throws Exception {
        return loginService.autoLogin(request, model, token);
    }
}

+ 0 - 193
app/app-iot-server/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -1,193 +0,0 @@
package com.yihu.iot.controller.company;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.company.CompanyService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/1/16.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.company)
@Api(tags = "企业管理相关操作", description = "企业管理相关操作")
public class IotCompanyController extends BaseController {
    @Autowired
    private CompanyService companyService;
    @GetMapping(value = IotRequestMapping.Company.findCompanyPage)
    @ApiOperation(value = "分页查找企业", notes = "分页查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyPage(@ApiParam(name = "name", value = "供应商名称或联系人姓名", defaultValue = "")
                                                 @RequestParam(value = "name", required = false) String name,
                                                    @ApiParam(name = "status", value = "审核状态", defaultValue = "")
                                                 @RequestParam(value = "status", required = false) String status,
                                                    @ApiParam(name = "type", value = "企业类型", defaultValue = "")
                                                 @RequestParam(value = "type", required = false) String type,
                                                    @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                 @RequestParam(value = "page", required = false) Integer page,
                                                    @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                 @RequestParam(value = "size", required = false) Integer size){
        try {
            return companyService.findCompanyPage(name,status,type,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.addCompany)
    @ApiOperation(value = "创建企业", notes = "创建企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> addCompany(@ApiParam(name = "jsonData", value = "json串", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            return companyService.addCompany(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyById)
    @ApiOperation(value = "根据id查找企业", notes = "根据id查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByCode(@ApiParam(name = "id", value = "企业id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return companyService.findByCode(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findByBusinessLicense)
    @ApiOperation(value = "根据营业执照号查找企业", notes = "根据营业执照号查找企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "营业执照号")
                                                       @RequestParam(value = "businessLicense", required = true) String businessLicense) {
        try {
            return companyService.findByBusinessLicense(businessLicense);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.delCompany)
    @ApiOperation(value = "删除企业", notes = "删除企业")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompany(@ApiParam(name = "id", value = "企业id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return companyService.delCompany(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.updCompany)
    @ApiOperation(value = "修改企业信息", notes = "修改企业信息")
    public MixEnvelop<IotCompanyVO, IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json串", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            return companyService.updCompany(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    @ApiOperation(value = "分页获取企业证书", notes = "分页获取企业证书")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertPage
            (@ApiParam(name = "name", value = "证书名称", defaultValue = "")
             @RequestParam(value = "name", required = false) String name,
             @ApiParam(name = "companyId", value = "企业id", defaultValue = "")
             @RequestParam(value = "companyId", required = false) String companyId,
             @ApiParam(name = "page", value = "第几页", defaultValue = "")
             @RequestParam(value = "page", required = false) Integer page,
             @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
             @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return companyService.findCompanyCertPage(name,page,size,companyId);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertById)
    @ApiOperation(value = "根据id查找企业证书", notes = "根据id查找企业证书")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "企业证书id")
                                                                @RequestParam(value = "id", required = true) String id) {
        try {
            return companyService.findCompanyCertById(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertByCompanyId)
    @ApiOperation(value = "根据企业id查找企业证书", notes = "根据企业id查找企业证书")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertByCompanyId(@ApiParam(name = "companyId", value = "企业id")
                                                                       @RequestParam(value = "companyId", required = true) String companyId) {
        try {
            return companyService.findCompanyCertByCompanyId(companyId);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.addCompanyCert)
    @ApiOperation(value = "创建企业证书", notes = "创建企业证书")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> addCompanyCert(@ApiParam(name = "jsonData", value = "json串", defaultValue = "")
                                                           @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            return companyService.addCompanyCert(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.changePassWord)
    @ApiOperation(value = "修改用户密码", notes = "修改用户密码")
    public MixEnvelop changePassWord(@ApiParam(name = "userId", value = "用户id", defaultValue = "")
                                  @RequestParam(value = "userId", required = true)String userId,
                                     @ApiParam(name = "passWord", value = "密码", defaultValue = "")
                                  @RequestParam(value = "passWord", required = true)String passWord){
        try {
            return companyService.changePassWord(userId,passWord);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.delCompanyCert)
    @ApiOperation(value = "删除企业证书", notes = "删除企业证书")
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> delCompanyCert(@ApiParam(name = "id", value = "id", defaultValue = "")
                                                           @RequestParam(value = "id", required = true)String id) {
        try {
            return companyService.delCompanyCert(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 0 - 196
app/app-iot-server/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java

@ -1,196 +0,0 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.device.DeviceService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.iot.common.ExistVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2017/12/8.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.device)
@Api(tags = "设备管理相关操作", description = "设备管理相关操作")
public class IotDeviceController extends BaseController{
    @Autowired
    private DeviceService deviceService;
    @PostMapping(value = IotRequestMapping.Device.api_create)
    @ApiOperation(value = "创建设备", notes = "创建设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> create(@ApiParam(name = "json_data", value = "", defaultValue = "")
                          @RequestParam String jsonData) {
        try {
            return deviceService.create(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Device.api_getById)
    @ApiOperation(value = "根据code查找设备", notes = "根据code查找设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id ) {
        try {
            return deviceService.findByCode(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Device.isSnExist)
    @ApiOperation(value = "sn码是否存在", notes = "sn码是否存在")
    public MixEnvelop<ExistVO, ExistVO> isSnExist(@ApiParam(name = "sn", value = "sn")
                                      @RequestParam(value = "sn", required = true) String sn) {
        try {
            return deviceService.isSnExist(sn);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Device.isSimExist)
    @ApiOperation(value = "sim卡号是否存在", notes = "sim卡号是否存在")
    public MixEnvelop<ExistVO, ExistVO> isSimExist(@ApiParam(name = "sim", value = "sim")
                                           @RequestParam(value = "sim", required = true) String sim) {
        try {
            return deviceService.isSimExist(sim);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Device.api_delete)
    @ApiOperation(value = "删除设备", notes = "删除设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> delDevice(@ApiParam(name = "id", value = "id")
                                          @RequestParam(value = "id", required = true) String id
    ) {
        try {
            return deviceService.delDevice(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Device.api_update)
    @ApiOperation(value = "修改设备", notes = "修改设备")
    public Envelop updDevice(@ApiParam(name = "jsonData", value = "", defaultValue = "")
                                 @RequestParam String jsonData) {
        try {
            return deviceService.updDevice(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Device.updSim)
    @ApiOperation(value = "修改sim卡号", notes = "修改sim卡号")
    public Envelop updSim(@ApiParam(name = "sim", value = "sim")
                              @RequestParam(value = "sim", required = true) String sim,
                          @ApiParam(name = "id", value = "设备id")
                              @RequestParam(value = "id", required = true) String id) {
        try {
            return deviceService.updSim(sim,id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Device.api_queryPage)
    @ApiOperation(value = "分页查找设备", notes = "分页查找设备")
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findProductPageByCompanyId(@ApiParam(name = "sn", value = "SN码或SIM卡号", defaultValue = "")
                                                           @RequestParam(value = "sn", required = false) String sn,
                                                              @ApiParam(name = "hospital", value = "社区医院", defaultValue = "")
                                                           @RequestParam(value = "hospital", required = false) String hospital,
                                                              @ApiParam(name = "orderId", value = "订单id", defaultValue = "")
                                                           @RequestParam(value = "orderId", required = false) String orderId,
                                                              @ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                                           @RequestParam(value = "purcharseId", required = false) String purcharseId,
                                                              @ApiParam(name = "isBinding", value = "是否绑定(1已绑定,2未绑定)", defaultValue = "")
                                                           @RequestParam(value = "isBinding", required = false) Integer isBinding,
                                                              @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                           @RequestParam(value = "page", required = false) Integer page,
                                                              @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                           @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return deviceService.findProductPageByCompanyId(sn,hospital,orderId,purcharseId,isBinding,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Device.isImportDevice)
    @ApiOperation(value = "是否正在导入设备数据", notes = "是否正在导入设备数据")
    public MixEnvelop<ExistVO, ExistVO> isImportDevice(@ApiParam(name = "purcharseId", value = "purcharseId")
                                           @RequestParam(value = "purcharseId", required = true) String purcharseId
    ) {
        try {
            return deviceService.isImportDevice(purcharseId);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @PostMapping(value = IotRequestMapping.Device.importDevice)
    @ApiOperation(value = "设备导入", notes = "设备导入")
    public MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> uploadStream(@ApiParam(value = "文件", required = true)
                                          @RequestParam(value = "file", required = true) MultipartFile file,
                                                            @ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                          @RequestParam(value = "purcharseId", required = true) String purcharseId) {
        try {
            return deviceService.uploadStream(file,purcharseId,request);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @GetMapping(value = IotRequestMapping.Device.queryImportRecordPage)
    @ApiOperation(value = "分页查找导入记录", notes = "分页查找导入记录")
    public MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> queryImportRecordPage(@ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                                           @RequestParam(value = "purcharseId", required = true) String purcharseId,
                                                                     @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                           @RequestParam(value = "page", required = false) Integer page,
                                                                     @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                           @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return queryImportRecordPage(purcharseId,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 0 - 174
app/app-iot-server/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java

@ -1,174 +0,0 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.device.DeviceOrderService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2017/12/8.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.order)
@Api(tags = "设备订单管理相关操作", description = "设备订单管理相关操作")
public class IotDeviceOrderController extends BaseController {
    @Autowired
    private DeviceOrderService deviceOrderService;
    @PostMapping(value = IotRequestMapping.DeviceOrder.createOrder)
    @ApiOperation(value = "创建设备订单", notes = "创建设备订单")
    public MixEnvelop<IotOrderVO, IotOrderVO> create(@ApiParam(name = "jsonData", value = "", defaultValue = "")
                          @RequestParam String jsonData) {
        try {
            return deviceOrderService.create(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findById)
    @ApiOperation(value = "根据id查找设备订单", notes = "根据id查找设备订单")
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id) {
        try {
            return deviceOrderService.findByCode(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPage)
    @ApiOperation(value = "分页查找设备订单", notes = "分页查找设备订单")
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> findPage(@ApiParam(name = "name", value = "供应商名称或负责人姓名", defaultValue = "")
                                                 @RequestParam(value = "name", required = false) String name,
                                                 @ApiParam(name = "type", value = "企业类型", defaultValue = "")
                                                 @RequestParam(value = "type", required = false) String type,
                                                 @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                 @RequestParam(value = "page", required = false) Integer page,
                                                 @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                 @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return deviceOrderService.findPage(name,type,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceOrder.delOrder)
    @ApiOperation(value = "删除订单", notes = "删除订单")
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> delOrder(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return deviceOrderService.delOrder(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceOrder.delPurchase)
    @ApiOperation(value = "删除采购订单", notes = "删除采购订单")
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> delPurchase(@ApiParam(name = "id", value = "id")
                                                   @RequestParam(value = "id", required = true) String id) {
        try {
            return deviceOrderService.delPurchase(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceOrder.updOrder)
    @ApiOperation(value = "修改订单", notes = "修改订单")
    public MixEnvelop<IotOrderVO, IotOrderVO> updOrder(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        try {
            return deviceOrderService.updOrder(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPurcharsePage)
    @ApiOperation(value = "分页查找采购清单", notes = "分页查找采购清单")
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findPurcharsePage(@ApiParam(name = "orderId", value = "订单id", defaultValue = "")
                                                     @RequestParam(value = "orderId", required = true) String orderId,
                                                            @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                     @RequestParam(value = "page", required = false) Integer page,
                                                            @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                     @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return deviceOrderService.findPurcharsePage(orderId,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPurcharseById)
    @ApiOperation(value = "根据id查找采购订单", notes = "根据id查找采购订单")
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findPurcharseById(
            @ApiParam(name = "id", value = "id")
            @RequestParam(value = "id", required = true) String id) {
        try {
            return deviceOrderService.findPurcharseById(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findQualityPage)
    @ApiOperation(value = "质检管理", notes = "质检管理")
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findQualityPage(
            @ApiParam(name = "qualityStatus", value = "质检状态", defaultValue = "")
            @RequestParam(value = "qualityStatus", required = false) String qualityStatus,
            @ApiParam(name = "orderNo", value = "订单编号", defaultValue = "")
            @RequestParam(value = "orderNo", required = false) String orderNo,
            @ApiParam(name = "startTime", value = "开始时间", defaultValue = "")
            @RequestParam(value = "startTime", required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间", defaultValue = "")
            @RequestParam(value = "endTime", required = false) String endTime,
            @ApiParam(name = "page", value = "第几页", defaultValue = "")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
            @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return deviceOrderService.findQualityPage(qualityStatus, orderNo, startTime, endTime, page, size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 0 - 113
app/app-iot-server/src/main/java/com/yihu/iot/controller/device/IotDeviceQualityController.java

@ -1,113 +0,0 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.device.IotDeviceQualityService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/01/24.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.quality)
@Api(tags = "设备质检管理相关操作", description = "设备质检管理相关操作")
public class IotDeviceQualityController extends BaseController{
    @Autowired
    private IotDeviceQualityService iotDeviceQualityService;
    @PostMapping(value = IotRequestMapping.DeviceQuality.addQualityPlan)
    @ApiOperation(value = "创建设备质检", notes = "创建设备质检")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> create(@ApiParam(name = "jsonData", value = "", defaultValue = "")
                          @RequestParam String jsonData) {
        try {
            return iotDeviceQualityService.create(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceQuality.findById)
    @ApiOperation(value = "根据code查找设备质检", notes = "根据code查找设备质检")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id
    ) {
        try {
            return iotDeviceQualityService.findByCode(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.DeviceQuality.queryQualityPlanPage)
    @ApiOperation(value = "分页获取设备质检计划", notes = "分页获取设备质检计划")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryQualityPlanPage(
            @ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
            @RequestParam(value = "purcharseId", required = false) String purcharseId,
            @ApiParam(name = "orderNo", value = "订单编号", defaultValue = "")
            @RequestParam(value = "orderNo", required = false) String orderNo,
            @ApiParam(name = "startTime", value = "开始时间", defaultValue = "")
            @RequestParam(value = "startTime", required = false) String startTime,
            @ApiParam(name = "endTime", value = "结束时间", defaultValue = "")
            @RequestParam(value = "endTime", required = false) String endTime,
            @ApiParam(name = "page", value = "第几页", defaultValue = "")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
            @RequestParam(value = "size", required = false) Integer size){
        try {
            return iotDeviceQualityService.queryQualityPlanPage(purcharseId, orderNo, startTime, endTime, page, size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceQuality.delQualityPlan)
    @ApiOperation(value = "删除质检计划", notes = "删除质检计划")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> delQualityPlan(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return iotDeviceQualityService.delQualityPlan(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceQuality.completeQualityPlan)
    @ApiOperation(value = "完成质检计划", notes = "完成质检计划")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> completeQualityPlan(@ApiParam(name = "actualTime", value = "完成时间", defaultValue = "")
                                            @RequestParam(value = "actualTime", required = true) String actualTime,
                                                                            @ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return iotDeviceQualityService.completeQualityPlan(actualTime, id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.DeviceQuality.completePlanByPurchaseId)
    @ApiOperation(value = "完成质检计划(按采购id)", notes = "完成质检计划(按采购id)")
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> completePlanByPurchaseId(@ApiParam(name = "actualTime", value = "完成时间", defaultValue = "")
                                                                              @RequestParam(value = "actualTime", required = true) String actualTime,
                                                                                 @ApiParam(name = "purchaseId", value = "purchaseId")
                                                                              @RequestParam(value = "purchaseId", required = true) String purchaseId) {
        try {
            return iotDeviceQualityService.completePlanByPurchaseId(actualTime, purchaseId);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

+ 0 - 164
app/app-iot-server/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -1,164 +0,0 @@
package com.yihu.iot.controller.product;
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.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/1/17.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.product)
@Api(tags = "产品管理相关操作", description = "产品管理相关操作")
public class IotProductController extends BaseController {
    @Autowired
    private ProductService productService;
    @GetMapping(value = IotRequestMapping.Product.data_sets)
    @ApiOperation(value = "测量数据", notes = "测量数据")
    public MixEnvelop<MStdDataSet, MStdDataSet> data_sets(@ApiParam(name = "name", value = "名称", defaultValue = "")
                                         @RequestParam(value = "name", required = false) String name,
                                             @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                         @RequestParam(value = "page", required = false) Integer page,
                                             @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                         @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return productService.data_sets(page, size, name);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Product.findProductPage)
    @ApiOperation(value = "分页查找产品", notes = "分页查找产品")
    public MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> findCompanyPage(
            @ApiParam(name = "name", value = "注册证号或产品名称", defaultValue = "")
            @RequestParam(value = "name", required = false) String name,
            @ApiParam(name = "classify", value = "产品分类", defaultValue = "")
            @RequestParam(value = "classify", required = false) String classify,
            @ApiParam(name = "companyId", value = "企业id", defaultValue = "")
            @RequestParam(value = "companyId", required = false) String companyId,
            @ApiParam(name = "page", value = "第几页", defaultValue = "")
            @RequestParam(value = "page", required = false) Integer page,
            @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
            @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return productService.findCompanyPage(name,classify,companyId,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Product.findProductPageByCompanyId)
    @ApiOperation(value = "分页查找产品(按企业id)", notes = "分页查找产品")
    public MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> findProductPageByCompanyId(@ApiParam(name = "name", value = "产品名称", defaultValue = "")
                                                         @RequestParam(value = "name", required = false) String name,
                                                                       @ApiParam(name = "companyId", value = "企业id", defaultValue = "")
                                                         @RequestParam(value = "companyId", required = true) String companyId,
                                                                       @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                         @RequestParam(value = "page", required = false) Integer page,
                                                                       @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                         @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return productService.findProductPageByCompanyId(name,companyId,page,size);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.addProduct)
    @ApiOperation(value = "创建产品", notes = "创建产品")
    public MixEnvelop<IotProductVO, IotProductVO> addProduct(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        try {
            return productService.addProduct(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Product.findProductById)
    @ApiOperation(value = "根据id查找产品", notes = "根据id查找产品")
    public MixEnvelop<IotProductVO, IotProductVO> findByCode(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return productService.findByCode(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Product.maintenanceUnitById)
    @ApiOperation(value = "根据id查找产品的维护单位", notes = "根据id查找产品的维护单位")
    public MixEnvelop<IotMaintenanceUnitVO, IotMaintenanceUnitVO> maintenanceUnitById(@ApiParam(name = "productId", value = "productId")
                                            @RequestParam(value = "productId", required = true) String productId) {
        try {
            return productService.maintenanceUnitById(productId);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public MixEnvelop<IotProductVO, IotProductVO> delCompany(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            return productService.delCompany(id);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.updProduct)
    @ApiOperation(value = "修改产品信息", notes = "修改产品信息")
    public MixEnvelop<IotProductVO, IotProductVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        try {
            return productService.updCompany(jsonData);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
}

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

@ -1,214 +0,0 @@
package com.yihu.iot.controller.third.wlyy;
import com.yihu.iot.controller.common.BaseController;
import com.yihu.iot.service.third.wlyy.MonitoringHealthService;
import com.yihu.jw.restmodel.web.MixEnvelop;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import iot.device.LocationDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * 远程监测健康平台-访问wlyy
 * @author yeshijie on 2018/2/11.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.wlyy)
@Api(tags = "远程监测健康平台", description = "远程监测健康平台")
public class MonitoringHealthPlatformController extends BaseController{
    @Autowired
    private MonitoringHealthService monitoringHealthService;
    @RequestMapping(value = "/equipmentDistribution",method = RequestMethod.GET)
    @ApiOperation("设备发放情况")
    public String equipmentDistribution(){
        try {
            return monitoringHealthService.equipmentDistribution();
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @GetMapping(value = IotRequestMapping.PatientDevice.findLocationByIdCard)
    @ApiOperation(value = "根据idCard查询设备地址", notes = "根据idCard查询设备地址")
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocationsByIdCard(
            @ApiParam(name = "diseaseCondition", value = "病情:0绿标,1黄标,2红标,-1没有标注的居民", defaultValue = "")
            @RequestParam(value = "diseaseCondition",required = false) Integer diseaseCondition,
            @ApiParam(name = "type", value = "1高血压 2糖尿病", defaultValue = "")
            @RequestParam(value = "type",required = false) String type,
            @ApiParam(name="page",value="第几页(默认第一页)",defaultValue = "1")
            @RequestParam(value="page",required = false) Integer page,
            @ApiParam(name="pageSize",value="每页几行(默认10条记录)",defaultValue = "10")
            @RequestParam(value="pageSize",required = false) Integer pageSize) {
        try {
            if(page==null){
                page = 1;
            }
            if(pageSize==null){
                pageSize = 10;
            }
            return monitoringHealthService.findDeviceLocations(diseaseCondition,page,pageSize,type);
        } catch (Exception e) {
            e.printStackTrace();
            return MixEnvelop.getError(e.getMessage());
        }
    }
    @RequestMapping(value = "/chronicDiseaseCount",method = RequestMethod.GET)
    @ApiOperation("慢病患者情况-统计")
    public String chronicDiseaseCount(
            @ApiParam(name="type",value="类型(2糖尿病,1高血压)",defaultValue = "")
            @RequestParam(value="type",required = false) String type){
        try {
            return monitoringHealthService.chronicDiseaseCount(type);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/searchPatient",method = RequestMethod.GET)
    @ApiOperation("居民 医生搜索")
    public String searchPatient(
            @ApiParam(name="name",value="姓名")
            @RequestParam(value="name",required = false) String name,
            @ApiParam(name="idcards",value="身份证(多个用逗号间隔)")
            @RequestParam(value="idcards",required = false) String idcards,
            @ApiParam(name="page",value="第几页(默认第一页)",defaultValue = "1")
            @RequestParam(value="page",required = false) Integer page,
            @ApiParam(name="pageSize",value="每页几行(默认10条记录)",defaultValue = "10")
            @RequestParam(value="pageSize",required = false) Integer pageSize){
        try {
            if(page==null){
                page = 1;
            }
            if(pageSize==null){
                pageSize = 10;
            }
            return monitoringHealthService.searchPatient(name,page,pageSize,idcards);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/warningInformationAlarm",method = RequestMethod.GET)
    @ApiOperation("预警信息警报")
    public String warningInformationAlarm(
            @ApiParam(name="page",value="第几页(默认第一页)",defaultValue = "1")
            @RequestParam(value="page",required = false) Integer page,
            @ApiParam(name="pageSize",value="每页几行(默认10条记录)",defaultValue = "10")
            @RequestParam(value="pageSize",required = false) Integer pageSize){
        try {
            if(page==null){
                page = 1;
            }
            if(pageSize==null){
                pageSize = 10;
            }
            return monitoringHealthService.warningInformationAlarm(page,pageSize);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/deviceBinding",method = RequestMethod.GET)
    @ApiOperation("设备绑定情况")
    public String deviceBinding(
            @ApiParam(name="type",value="设备类型(1血糖仪,2血压计)",defaultValue = "")
            @RequestParam(value="type",required = false) String type){
        try {
            return monitoringHealthService.deviceBinding(type);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/persionalInfo",method = RequestMethod.GET)
    @ApiOperation("个人信息")
    public String persionalInfo(@ApiParam(name="patient",value="居民code",defaultValue = "")
                                @RequestParam(value="patient",required = true) String patient){
        try {
            return monitoringHealthService.persionalInfo(patient);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/familyMember",method = RequestMethod.GET)
    @ApiOperation("家人信息")
    public String familyMember(@ApiParam(name="patient",value="居民code",defaultValue = "")
                               @RequestParam(value="patient",required = true) String patient){
        try {
            return monitoringHealthService.familyMember(patient);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "/healthDevice",method = RequestMethod.GET)
    @ApiOperation("健康设备")
    public String healthDevice(@ApiParam(name="patient",value="居民code",defaultValue = "")
                               @RequestParam(value="patient",required = true) String patient){
        try {
            return monitoringHealthService.healthDevice(patient);
        }catch (Exception e){
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @RequestMapping(value = "chart", method = RequestMethod.GET)
    @ApiOperation("根据患者标志获取健康指标(图表)")
    public String getHealthIndexChartByPatient(@ApiParam(name="patient",value="居民code",defaultValue = "")
                                               @RequestParam(value="patient",required = true) String patient,
                                               @ApiParam(name = "type", value = "指标类型(1血糖,2血压,3体重,4腰围)", defaultValue = "1")
                                               @RequestParam(value = "type", required = true) Integer type,
                                               @ApiParam(name = "gi_type", value = "就餐类型0全部", defaultValue = "1")
                                               @RequestParam(value = "gi_type", required = false) Integer gi_type,
                                               @ApiParam(name="time",value="时间(一周,一月,半年)",defaultValue = "")
                                               @RequestParam(value="time",required = true) String time,
                                               @ApiParam(name = "begin", value = "开始时间", defaultValue = "2017-05-22")
                                               @RequestParam(value = "begin", required = true) String begin,
                                               @ApiParam(name = "end", value = "结束时间", defaultValue = "2018-06-02")
                                               @RequestParam(value = "end", required = true) String end) {
        try {
            return monitoringHealthService.getHealthIndexChartByPatient(patient,type,gi_type,begin,end,time);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
    @ApiOperation("获取门诊记录/住院记录(基卫+APP)")
    @RequestMapping(value = "/event", produces = "application/json;charset=UTF-8", method = RequestMethod.GET)
    public String getAllEvent(@ApiParam(name = "patient", value = "患者代码", defaultValue = "")
                              @RequestParam(value = "patient", required = true) String patient,
                              @ApiParam(name = "type", value = "类型(1血糖,2血压)", defaultValue = "")
                              @RequestParam(value = "type", required = false) String type,
                              @ApiParam(name = "page", value = "第几页", defaultValue = "1")
                              @RequestParam(value = "page", required = true) String page,
                              @ApiParam(name = "pageSize", value = "每页几行", defaultValue = "10")
                              @RequestParam(value = "pageSize", required = true) String pageSize) {
        try {
            return monitoringHealthService.getAllEvent(patient, type, page, pageSize);
        } catch (Exception e) {
            e.printStackTrace();
            return error(-1,"查询失败");
        }
    }
}

+ 0 - 53
app/app-iot-server/src/main/java/com/yihu/iot/model/AccessToken.java

@ -1,53 +0,0 @@
package com.yihu.iot.model;
/**
 * Created by zhenglingfeng on 2017/3/8.
 */
public class AccessToken {
    private String accessToken;
    private String refreshToken;
    private String tokenType;
    private String user;
    private int expiresIn;
    public String getAccessToken() {
        return accessToken;
    }
    public void setAccessToken(String accessToken) {
        this.accessToken = accessToken;
    }
    public String getRefreshToken() {
        return refreshToken;
    }
    public void setRefreshToken(String refreshToken) {
        this.refreshToken = refreshToken;
    }
    public String getTokenType() {
        return tokenType;
    }
    public void setTokenType(String tokenType) {
        this.tokenType = tokenType;
    }
    public String getUser() {
        return user;
    }
    public void setUser(String user) {
        this.user = user;
    }
    public int getExpiresIn() {
        return expiresIn;
    }
    public void setExpiresIn(int expiresIn) {
        this.expiresIn = expiresIn;
    }
}

+ 0 - 112
app/app-iot-server/src/main/java/com/yihu/iot/model/ListResult.java

@ -1,112 +0,0 @@
package com.yihu.iot.model;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
import java.io.IOException;
import java.io.Serializable;
import java.util.List;
/**
 * 列表对象
 */
public class ListResult extends Result implements Serializable {
    private int pageSize = 10;
    private int currPage = 1;
    private int totalPage;
    private int totalCount;
    private Object obj;
    private List detailModelList;
    public ListResult() {
    }
    public ListResult(int pageSize, int currPage) {
        this.pageSize = pageSize;
        this.currPage = currPage;
    }
    public static ListResult fromJson(String json) {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.readValue(json, ListResult.class);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
    public String toJson() {
        ObjectMapper objectMapper = new ObjectMapper();
        try {
            return objectMapper.writeValueAsString(this);
        } catch (JsonProcessingException e) {
            e.printStackTrace();
            return "";
        }
    }
    public Object getObj() {
        return obj;
    }
    public void setObj(Object obj) {
        this.obj = obj;
    }
    public int getPageSize() {
        return pageSize;
    }
    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }
    public int getCurrPage() {
        return currPage;
    }
    public void setCurrPage(int currPage) {
        this.currPage = currPage;
    }
    public int getTotalPage() {
        if (totalCount % pageSize == 0) {
            totalPage = totalCount / pageSize;
        } else {
            totalPage = totalCount / pageSize + 1;
        }
        return totalPage;
    }
    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
    public int getTotalCount() {
        if (totalCount == 0 && detailModelList != null) {
            totalCount = detailModelList.size();
        }
        return totalCount;
    }
    public void setTotalCount(int totalCount) {
        this.totalCount = totalCount;
    }
    public List getDetailModelList() {
        return detailModelList;
    }
    public void setDetailModelList(List detailModelList) {
        this.detailModelList = detailModelList;
    }
}

+ 0 - 46
app/app-iot-server/src/main/java/com/yihu/iot/model/MenuResult.java

@ -1,46 +0,0 @@
package com.yihu.iot.model;
import java.util.ArrayList;
import java.util.List;
/**
 * Created by wxw on 2017/11/3.
 */
public class MenuResult {
    private int id;
    private String name;
    private String url;
    private List<MenuResult> children = new ArrayList<>();
    public int getId() {
        return id;
    }
    public void setId(int id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    public List<MenuResult> getChildren() {
        return children;
    }
    public void setChildren(List<MenuResult> children) {
        this.children = children;
    }
}

+ 0 - 54
app/app-iot-server/src/main/java/com/yihu/iot/model/ObjectResult.java

@ -1,54 +0,0 @@
package com.yihu.iot.model;
/**
 * Created by hzp on 20170315.
 */
public class ObjectResult extends Result {
    private Object data;
    private Object obj;
    private String errorMsg;
    private int errorCode;
    public Object getData() {
        return data;
    }
    public void setData(Object data) {
        this.data = data;
    }
    public Object getObj() {
        return obj;
    }
    public void setObj(Object obj) {
        this.obj = obj;
    }
    public String getErrorMsg() {
        return errorMsg;
    }
    public void setErrorMsg(String errorMsg) {
        this.errorMsg = errorMsg;
    }
    public int getErrorCode() {
        return errorCode;
    }
    public void setErrorCode(int errorCode) {
        this.errorCode = errorCode;
    }
    public ObjectResult()
    {}
    public ObjectResult(boolean successFlg,String message){
        super.setSuccessFlg(successFlg);
        super.setMessage(message);
    }
}

+ 0 - 85
app/app-iot-server/src/main/java/com/yihu/iot/model/Result.java

@ -1,85 +0,0 @@
package com.yihu.iot.model;
import java.lang.reflect.Field;
/**
 * Created by chenweida on 2015/12/11.
 * 基础对象
 */
public class Result {
    protected boolean successFlg = true;
    protected String message;
    protected int code;
    public boolean isSuccessFlg() {
        return successFlg;
    }
    public void setSuccessFlg(boolean successFlg) {
        this.successFlg = successFlg;
    }
    public String getMessage() {
        return message;
    }
    public void setMessage(String message) {
        this.message = message;
    }
    public int getCode() {
        return code;
    }
    public void setCode(int code) {
        this.code = code;
    }
    /**
     * 错误消息
     */
    public static Result error(String message) {
        Result re= new Result();
        re.successFlg = false;
        re.message = message;
        re.code = -1;
        return re;
    }
    /**
     * 错误消息
     */
    public static Result error(int code,String message) {
        Result re= new Result();
        re.successFlg = false;
        re.message = message;
        re.code = code;
        return re;
    }
    /**
     * 成功消息
     */
    public static Result success(String message) {
        Result re= new Result();
        re.successFlg = true;
        re.message = message;
        re.code = 200;
        return re;
    }
    public void checkValue() {
        try {
            Field[] fields = this.getClass().getDeclaredFields();
            for (int j = 0; j < fields.length; j++) {
                fields[j].setAccessible(true);
                if (fields[j].getType().getName().equals(String.class.getTypeName())
                        && fields[j].get(this) == null){
                    fields[j].set(this, "");//设置为空字串
                }
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

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

@ -1,152 +0,0 @@
package com.yihu.iot.model.ehr;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * @author yeshijie on 2018/2/28.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "ehr数据元")
public class MRsMetadata {
    @ApiModelProperty("ID")
    private String id;
    @ApiModelProperty("业务领域")
    private String domain;
    @ApiModelProperty("业务领域名称")
    private String domainName;
    @ApiModelProperty("数据元名称")
    private String name;
    @ApiModelProperty("内部标识符")
    private String stdCode;
    @ApiModelProperty("展示代码")
    private String displayCode;
    @ApiModelProperty("类型")
    private String columnType;
    @ApiModelProperty("类型名称")
    private String columnTypeName;
    @ApiModelProperty("是否可为空  默认可为空1")
    private String nullAble;
    @ApiModelProperty("关联字典RS_DICTIONARY编码")
    private String dictCode;
    @ApiModelProperty("关联字典RS_DICTIONARY名称")
    private String dictName;
    @ApiModelProperty("说明")
    private String description;
    @ApiModelProperty("是否有效(0否 1是 默认1)")
    private String valid;
    @ApiModelProperty("dictId")
    private int dictId;
    @ApiModelProperty("数据 来源1 档案数据 2 指标统计")
    private Integer dataSource;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getDomain() {
        return domain;
    }
    public void setDomain(String domain) {
        this.domain = domain;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getStdCode() {
        return stdCode;
    }
    public void setStdCode(String stdCode) {
        this.stdCode = stdCode;
    }
    public String getDisplayCode() {
        return displayCode;
    }
    public void setDisplayCode(String displayCode) {
        this.displayCode = displayCode;
    }
    public String getDictCode() {
        return dictCode;
    }
    public void setDictCode(String dictCode) {
        this.dictCode = dictCode;
    }
    public String getColumnType() {
        return columnType;
    }
    public void setColumnType(String columnType) {
        this.columnType = columnType;
    }
    public String getNullAble() {
        return nullAble;
    }
    public void setNullAble(String nullAble) {
        this.nullAble = nullAble;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getValid() {
        return valid;
    }
    public void setValid(String valid) {
        this.valid = valid;
    }
    public int getDictId() {
        return dictId;
    }
    public void setDictId(int dictId) {
        this.dictId = dictId;
    }
    public Integer getDataSource() {
        return dataSource;
    }
    public void setDataSource(Integer dataSource) {
        this.dataSource = dataSource;
    }
    public String getDomainName() {
        return domainName;
    }
    public void setDomainName(String domainName) {
        this.domainName = domainName;
    }
    public String getColumnTypeName() {
        return columnTypeName;
    }
    public void setColumnTypeName(String columnTypeName) {
        this.columnTypeName = columnTypeName;
    }
    public String getDictName() {
        return dictName;
    }
    public void setDictName(String dictName) {
        this.dictName = dictName;
    }
}

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

@ -1,143 +0,0 @@
package com.yihu.iot.model.ehr;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * @author yeshijie on 2018/2/28.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "ehr标准数据集")
public class MStdDataSet {
    @ApiModelProperty("ID")
    private Long id;
    @ApiModelProperty("所属的文档ID. 暂时为空")
    private Long documentId;
    @ApiModelProperty("类别/业务领域")
    private Integer catalog;
    @ApiModelProperty("hashCode")
    private Integer hashCode;
    @ApiModelProperty("lang")
    private Integer lang;
    @ApiModelProperty("标准发布者")
    private Integer publisher;
    @ApiModelProperty("multiRecord")
    private Boolean multiRecord;
    @ApiModelProperty("标准参考")
    private String reference;
    @ApiModelProperty("标准规范中的版本")
    private String stdVersion;
    @ApiModelProperty("数据集编码")
    private String code;
    @ApiModelProperty("数据集名称")
    private String name;
    @ApiModelProperty("摘要")
    private String summary;
    @ApiModelProperty("innerVersionId")
    private String innerVersionId;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getDocumentId() {
        return documentId;
    }
    public void setDocumentId(Long documentId) {
        this.documentId = documentId;
    }
    public Integer getCatalog() {
        return catalog;
    }
    public void setCatalog(Integer catalog) {
        this.catalog = catalog;
    }
    public Integer getHashCode() {
        return hashCode;
    }
    public void setHashCode(Integer hashCode) {
        this.hashCode = hashCode;
    }
    public Integer getLang() {
        return lang;
    }
    public void setLang(Integer lang) {
        this.lang = lang;
    }
    public Integer getPublisher() {
        return publisher;
    }
    public void setPublisher(Integer publisher) {
        this.publisher = publisher;
    }
    public Boolean getMultiRecord() {
        return multiRecord;
    }
    public void setMultiRecord(Boolean multiRecord) {
        this.multiRecord = multiRecord;
    }
    public String getReference() {
        return reference;
    }
    public void setReference(String reference) {
        this.reference = reference;
    }
    public String getStdVersion() {
        return stdVersion;
    }
    public void setStdVersion(String stdVersion) {
        this.stdVersion = stdVersion;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getSummary() {
        return summary;
    }
    public void setSummary(String summary) {
        this.summary = summary;
    }
    public String getInnerVersionId() {
        return innerVersionId;
    }
    public void setInnerVersionId(String innerVersionId) {
        this.innerVersionId = innerVersionId;
    }
}

+ 0 - 92
app/app-iot-server/src/main/java/com/yihu/iot/model/user/UserModel.java

@ -1,92 +0,0 @@
package com.yihu.iot.model.user;
import java.io.Serializable;
/**
 * ehr用户model
 * @author yeshijie on 2018/2/2.
 */
public class UserModel implements Serializable{
    private String id;
    private String email;
    private String loginCode;
    private String realName;
    private String password;
    private String newPassWord;
    private String telephone;
    private String idCardNo;
    private String role;
    public String getId() {
        return id;
    }
    public void setId(String id) {
        this.id = id;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getLoginCode() {
        return loginCode;
    }
    public void setLoginCode(String loginCode) {
        this.loginCode = loginCode;
    }
    public String getRealName() {
        return realName;
    }
    public void setRealName(String realName) {
        this.realName = realName;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getNewPassWord() {
        return newPassWord;
    }
    public void setNewPassWord(String newPassWord) {
        this.newPassWord = newPassWord;
    }
    public String getTelephone() {
        return telephone;
    }
    public void setTelephone(String telephone) {
        this.telephone = telephone;
    }
    public String getIdCardNo() {
        return idCardNo;
    }
    public void setIdCardNo(String idCardNo) {
        this.idCardNo = idCardNo;
    }
    public String getRole() {
        return role;
    }
    public void setRole(String role) {
        this.role = role;
    }
}

+ 0 - 19
app/app-iot-server/src/main/java/com/yihu/iot/security/config/EhrWebHttpSessionConfiguration.java

@ -1,19 +0,0 @@
package com.yihu.iot.security.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.session.SessionRegistryImpl;
/**
 * Created by progr1mmer on 2018/1/27.
 */
@Configuration
//@EnableRedisHttpSession
public class EhrWebHttpSessionConfiguration {
    @Bean
    SessionRegistry sessionRegistry(){
        return new SessionRegistryImpl();
    }
}

+ 0 - 131
app/app-iot-server/src/main/java/com/yihu/iot/security/config/EhrWebSecurityConfiguration.java

@ -1,131 +0,0 @@
package com.yihu.iot.security.config;
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;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.authentication.encoding.Md5PasswordEncoder;
import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.builders.WebSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter;
import org.springframework.security.web.authentication.session.ConcurrentSessionControlAuthenticationStrategy;
/**
 * Created by progr1mmer on 2018/1/26.
 */
@Configuration
@EnableWebSecurity
public class EhrWebSecurityConfiguration extends WebSecurityConfigurerAdapter {
    @Value("${app.oauth2InnerUrl}")
    protected String oauth2InnerUrl;
    @Value("${service-gateway.profileInnerUrl}")
    protected String profileInnerUrl;
    @Autowired
    private EhrWebAuthenticationProvider ehrWebAuthenticationProvider;
    @Autowired
    private EhrWebAuthenticationSuccessHandler ehrWebAuthenticationSuccessHandler;
    @Autowired
    private EhrWebAuthenticationFailureHandler ehrWebAuthenticationFailureHandler;
    //@Autowired
    //private EhrWebAccessDecisionManager ehrWebAccessDecisionManager;
    @Autowired
    private SessionRegistry sessionRegistry;
    @Autowired
    private LoginEntryPoint loginEntryPoint;
    @Autowired
    private EhrWebContextLogoutHandler ehrWebContextLogoutHandler;
    @Override
    public void configure(WebSecurity web) throws Exception {
        //web.ignoring().antMatchers("/ambulance/search"); //忽略授权地址
    }
    @Override
    protected void configure(HttpSecurity http) throws Exception {
        // ---------- 自定义Filter Start ----------
        EhrWebUsernamePasswordAuthenticationFilter ehrWebUsernamePasswordAuthenticationFilter = new EhrWebUsernamePasswordAuthenticationFilter(oauth2InnerUrl, profileInnerUrl);
        ehrWebUsernamePasswordAuthenticationFilter.setAuthenticationSuccessHandler(ehrWebAuthenticationSuccessHandler);
        ehrWebUsernamePasswordAuthenticationFilter.setAuthenticationFailureHandler(ehrWebAuthenticationFailureHandler);
        ehrWebUsernamePasswordAuthenticationFilter.setAuthenticationManager(authenticationManagerBean());
        ehrWebUsernamePasswordAuthenticationFilter.setSessionAuthenticationStrategy(new ConcurrentSessionControlAuthenticationStrategy(sessionRegistry));
        http.addFilterBefore(ehrWebUsernamePasswordAuthenticationFilter, UsernamePasswordAuthenticationFilter.class);
        // ---------- 自定义Filter End ----------
        //http.sessionManagement().maximumSessions(3).expiredUrl("/login?expired").sessionRegistry(sessionRegistry);
        //http.addFilter(ehrWebUsernamePasswordAuthenticationFilter);
        http.authorizeRequests()
                //.accessDecisionManager(ehrWebAccessDecisionManager)
                //.antMatchers("/front/views/*.html").hasRole("USER") //拦截html
                //.antMatchers("/user").hasRole("USER")
                //.antMatchers("/ambulance/**").hasRole("USER")
                //.antMatchers("/admin/**").hasRole("ADMIN")
                .antMatchers("/front/css/**").permitAll()
                .antMatchers("/front/fonts/**").permitAll()
                .antMatchers("/front/images/**").permitAll()
                .antMatchers("/front/js/**").permitAll()
                .antMatchers("/front/views/signin.html").permitAll()
                .antMatchers("/login/**").permitAll()
                .antMatchers("/svr-iot/wlyy/**").permitAll()//健康监测平台没有做登录(这里添加免登录验证)
                .antMatchers("/svr-iot/fileUpload/commonUpload").permitAll()//公共的文件上传(这里添加免登录验证)
                .antMatchers("/front/views/**").hasRole("USER")
                .antMatchers("/**").hasRole("USER")
                .and().formLogin().loginPage("/login")
                .and().exceptionHandling().authenticationEntryPoint(loginEntryPoint)
                .and().logout().addLogoutHandler(ehrWebContextLogoutHandler).logoutUrl("/logout").logoutSuccessUrl("/login")
                .and().headers().frameOptions().disable()
                .and().csrf().disable();
    }
    @Override
    protected void configure(AuthenticationManagerBuilder auth) throws Exception {
        auth.authenticationProvider(ehrWebAuthenticationProvider); //自定义认证提供者
    }
    @Bean
    EhrWebUserDetailsService ehrWebUserDetailsService(){
        return new EhrWebUserDetailsService(profileInnerUrl);
    }
    @Bean
    EhrWebAuthenticationProvider ehrWebAuthenticationProvider(UserDetailsService userDetailsService) {
        EhrWebAuthenticationProvider ehrWebAuthenticationProvider = new EhrWebAuthenticationProvider(userDetailsService);
        ehrWebAuthenticationProvider.setPasswordEncoder(new Md5PasswordEncoder());
        return ehrWebAuthenticationProvider;
    }
    @Bean
    EhrWebAuthenticationSuccessHandler ehrWebAuthenticationSuccessHandler(){
        return new EhrWebAuthenticationSuccessHandler();
    }
    @Bean
    EhrWebAuthenticationFailureHandler ehrWebAuthenticationFailureHandler(){
        return new EhrWebAuthenticationFailureHandler();
    }
    @Bean
    EhrWebContextLogoutHandler ehrWebContextLogoutHandler(){
        return new EhrWebContextLogoutHandler();
    }
    @Bean
    LoginEntryPoint loginEntryPoint(){
        return new LoginEntryPoint("/login");
    }
    /**
    @Bean
    EhrWebAccessDecisionManager ehrWebAccessDecisionManager() {
        return new EhrWebAccessDecisionManager(null);
    }
    */
}

+ 0 - 95
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAccessDecisionManager.java

@ -1,95 +0,0 @@
package com.yihu.iot.security.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.MessageSource;
import org.springframework.context.support.MessageSourceAccessor;
import org.springframework.security.access.AccessDecisionManager;
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 - 40
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationFailureHandler.java

@ -1,40 +0,0 @@
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.util.rest.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AuthenticationFailureHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebAuthenticationFailureHandler implements AuthenticationFailureHandler {
    @Autowired
    private ObjectMapper objectMapper;
    /**
     * Step 4
     * @param httpServletRequest
     * @param httpServletResponse
     * @param authException
     * @throws IOException
     * @throws ServletException
     */
    @Override
    public void onAuthenticationFailure(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, AuthenticationException authException) throws IOException, ServletException {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
        envelop.setErrorMsg("invalid account or password !");
        envelop.setErrorCode(-1);
        httpServletResponse.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
        httpServletResponse.getWriter().print(objectMapper.writeValueAsString(envelop));
    }
}

+ 0 - 152
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationProvider.java

@ -1,152 +0,0 @@
package com.yihu.iot.security.core;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.security.authentication.InternalAuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.authentication.dao.AbstractUserDetailsAuthenticationProvider;
import org.springframework.security.authentication.dao.SaltSource;
import org.springframework.security.authentication.encoding.PasswordEncoder;
import org.springframework.security.authentication.encoding.PlaintextPasswordEncoder;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.core.session.SessionRegistry;
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;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebAuthenticationProvider extends AbstractUserDetailsAuthenticationProvider {
    private static final String USER_NOT_FOUND_PASSWORD = "userNotFoundPassword";
    private PasswordEncoder passwordEncoder;
    private String userNotFoundEncodedPassword;
    private SaltSource saltSource;
    private UserDetailsService userDetailsService;
    private SessionRegistry sessionRegistry;
    public EhrWebAuthenticationProvider() {
        this.setPasswordEncoder((PasswordEncoder)(new PlaintextPasswordEncoder()));
    }
    public EhrWebAuthenticationProvider(UserDetailsService userDetailsService) {
        this.userDetailsService = userDetailsService;
        this.setPasswordEncoder((PasswordEncoder)(new PlaintextPasswordEncoder()));
    }
    /**
    public EhrWebAuthenticationProvider(UserDetailsService userDetailsService, SessionRegistry sessionRegistry) {
        this.userDetailsService = userDetailsService;
        this.sessionRegistry = sessionRegistry;
        this.setPasswordEncoder((PasswordEncoder)(new PlaintextPasswordEncoder()));
    }
     */
    /**
     * Step 3
     * @param userDetails
     * @param authentication
     * @throws AuthenticationException
     */
    protected void additionalAuthenticationChecks(UserDetails userDetails, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        Object salt = null;
        if(this.saltSource != null) {
            salt = this.saltSource.getSalt(userDetails);
        }
        if(authentication.getCredentials() == null) {
            this.logger.debug("Authentication failed: no credentials provided");
            throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
        } else {
            EhrWebAuthenticationToken ehrWebAuthenticationToken = (EhrWebAuthenticationToken) authentication;
            if(!ehrWebAuthenticationToken.isSso()) {
                String presentedPassword = authentication.getCredentials().toString();
                if (!this.passwordEncoder.isPasswordValid(userDetails.getPassword(), presentedPassword, salt)) {
                    this.logger.debug("Authentication failed: password does not match stored value");
                    throw new BadCredentialsException(this.messages.getMessage("AbstractUserDetailsAuthenticationProvider.badCredentials", "Bad credentials"));
                }
            }
            //HttpServletRequest request = ((ServletRequestAttributes) RequestContextHolder.getRequestAttributes()).getRequest();
            //sessionRegistry.registerNewSession(request.getSession().getId(), userDetails);
        }
    }
    protected void doAfterPropertiesSet() throws Exception {
        Assert.notNull(this.userDetailsService, "A UserDetailsService must be set");
    }
    protected final UserDetails retrieveUser(String username, UsernamePasswordAuthenticationToken authentication) throws AuthenticationException {
        UserDetails loadedUser;
        try {
            loadedUser = this.getUserDetailsService().loadUserByUsername(username);
        } catch (UsernameNotFoundException var6) {
            if(authentication.getCredentials() != null) {
                String presentedPassword = authentication.getCredentials().toString();
                this.passwordEncoder.isPasswordValid(this.userNotFoundEncodedPassword, presentedPassword, (Object)null);
            }
            throw var6;
        } catch (Exception var7) {
            throw new InternalAuthenticationServiceException(var7.getMessage(), var7);
        }
        if(loadedUser == null) {
            throw new InternalAuthenticationServiceException("UserDetailsService returned null, which is an interface contract violation");
        } else {
            return loadedUser;
        }
    }
    public void setPasswordEncoder(Object passwordEncoder) {
        Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
        if(passwordEncoder instanceof PasswordEncoder) {
            this.setPasswordEncoder((PasswordEncoder)passwordEncoder);
        } else if(passwordEncoder instanceof org.springframework.security.crypto.password.PasswordEncoder) {
            final org.springframework.security.crypto.password.PasswordEncoder delegate = (org.springframework.security.crypto.password.PasswordEncoder)passwordEncoder;
            this.setPasswordEncoder(new PasswordEncoder() {
                public String encodePassword(String rawPass, Object salt) {
                    this.checkSalt(salt);
                    return delegate.encode(rawPass);
                }
                public boolean isPasswordValid(String encPass, String rawPass, Object salt) {
                    this.checkSalt(salt);
                    return delegate.matches(rawPass, encPass);
                }
                private void checkSalt(Object salt) {
                    Assert.isNull(salt, "Salt value must be null when used with crypto module PasswordEncoder");
                }
            });
        } else {
            throw new IllegalArgumentException("passwordEncoder must be a PasswordEncoder instance");
        }
    }
    private void setPasswordEncoder(PasswordEncoder passwordEncoder) {
        Assert.notNull(passwordEncoder, "passwordEncoder cannot be null");
        this.userNotFoundEncodedPassword = passwordEncoder.encodePassword("userNotFoundPassword", (Object)null);
        this.passwordEncoder = passwordEncoder;
    }
    protected PasswordEncoder getPasswordEncoder() {
        return this.passwordEncoder;
    }
    public void setSaltSource(SaltSource saltSource) {
        this.saltSource = saltSource;
    }
    protected SaltSource getSaltSource() {
        return this.saltSource;
    }
    public void setUserDetailsService(UserDetailsService userDetailsService) {
        this.userDetailsService = userDetailsService;
    }
    protected UserDetailsService getUserDetailsService() {
        return this.userDetailsService;
    }
}

+ 0 - 63
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationSuccessHandler.java

@ -1,63 +0,0 @@
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.agModel.user.UserDetailModel;
import com.yihu.jw.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.web.authentication.AuthenticationSuccessHandler;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebAuthenticationSuccessHandler implements AuthenticationSuccessHandler {
    @Autowired
    private ObjectMapper objectMapper;
    @Autowired
    SessionRegistry sessionRegistry;
    /**
     * Step 4
     * @param httpServletRequest
     * @param httpServletResponse
     * @param authentication
     * @throws IOException
     * @throws ServletException
     */
    @Override
    public void onAuthenticationSuccess(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) throws IOException, ServletException {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(true);
        Map userMap = new HashMap();
        String id = (String) httpServletRequest.getAttribute("id");
        String username = (String) httpServletRequest.getAttribute("username");
        String realName = (String) httpServletRequest.getAttribute("realName");
        userMap.put("id", id);
        userMap.put("username", username);
        userMap.put("realName", realName);
        envelop.setObj(userMap);
        List modelList = new ArrayList<>();
        UserDetailModel userDetailModel = (UserDetailModel)httpServletRequest.getAttribute("user");
        modelList.add(userDetailModel);
        envelop.setDetailModelList(modelList);
        httpServletResponse.setContentType(MediaType.APPLICATION_JSON_UTF8_VALUE);
        httpServletResponse.getWriter().print(objectMapper.writeValueAsString(envelop));
        sessionRegistry.registerNewSession(httpServletRequest.getSession().getId(),userDetailModel);
    }
}

+ 0 - 54
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebAuthenticationToken.java

@ -1,54 +0,0 @@
package com.yihu.iot.security.core;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.SpringSecurityCoreVersion;
import java.util.Collection;
/**
 * Sso integrated
 * Created by progr1mmer on 2018/1/27.
 */
public class EhrWebAuthenticationToken extends UsernamePasswordAuthenticationToken {
    private static final long serialVersionUID = SpringSecurityCoreVersion.SERIAL_VERSION_UID;
    // ~ Instance fields
    // ================================================================================================
    private final Object principal;
    private Object credentials;
    private boolean isSso;
    // ~ Constructors
    // ===================================================================================================
    /**
     * This constructor can be safely used by any code that wishes to create a
     * <code>UsernamePasswordAuthenticationToken</code>, as the {@link #isAuthenticated()}
     * will return <code>false</code>.
     *
     */
        public EhrWebAuthenticationToken(Object principal, Object credentials, boolean isSso) {
        super(principal, credentials);
        this.principal = principal;
        this.credentials = credentials;
        this.isSso = isSso;
        setAuthenticated(false);
    }
    public boolean isSso() {
        return this.isSso;
    }
    @Override
    public Object getPrincipal() {
        return principal;
    }
    @Override
    public Object getCredentials() {
        return credentials;
    }
}

+ 0 - 40
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebContextLogoutHandler.java

@ -1,40 +0,0 @@
package com.yihu.iot.security.core;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.security.web.authentication.logout.SecurityContextLogoutHandler;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebContextLogoutHandler extends SecurityContextLogoutHandler {
    protected final Log logger = LogFactory.getLog(this.getClass());
    @Autowired
    SessionRegistry sessionRegistry;
    /**
     * Step 5
     * @param httpServletRequest
     * @param httpServletResponse
     * @param authentication
     */
    @Override
    public void logout(HttpServletRequest httpServletRequest, HttpServletResponse httpServletResponse, Authentication authentication) {
        Assert.notNull(httpServletRequest, "HttpServletRequest required");
            HttpSession session = httpServletRequest.getSession(false);
            if (session != null) {
                this.logger.debug("removeSessionInformation, session: " + session.getId());
                sessionRegistry.removeSessionInformation(session.getId());
            }
    }
}

+ 0 - 47
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebUserDetails.java

@ -1,47 +0,0 @@
package com.yihu.iot.security.core;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
import java.util.Collection;
/**
 * Created by progr1mmer on 2018/1/26.
 */
public class EhrWebUserDetails implements UserDetails {
    @Override
    public Collection<? extends GrantedAuthority> getAuthorities() {
        return null;
    }
    @Override
    public boolean isEnabled() {
        return false;
    }
    @Override
    public boolean isCredentialsNonExpired() {
        return false;
    }
    @Override
    public String getPassword() {
        return null;
    }
    @Override
    public String getUsername() {
        return null;
    }
    @Override
    public boolean isAccountNonExpired() {
        return false;
    }
    @Override
    public boolean isAccountNonLocked() {
        return false;
    }
}

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

@ -1,84 +0,0 @@
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.agModel.user.UserDetailModel;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.util.rest.Envelop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
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 - 177
app/app-iot-server/src/main/java/com/yihu/iot/security/core/EhrWebUsernamePasswordAuthenticationFilter.java

@ -1,177 +0,0 @@
package com.yihu.iot.security.core;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.agModel.user.UserDetailModel;
import com.yihu.iot.util.http.HttpHelper;
import com.yihu.iot.util.http.HttpResponse;
import com.yihu.jw.util.rest.Envelop;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.security.authentication.AuthenticationServiceException;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter;
import org.springframework.security.web.util.matcher.AntPathRequestMatcher;
import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.HashMap;
import java.util.Map;
/**
 * Sso integrated
 * Created by progr1mmer on 2018/1/27.
 */
public class EhrWebUsernamePasswordAuthenticationFilter extends AbstractAuthenticationProcessingFilter {
    private static Logger logger = LoggerFactory.getLogger(EhrWebUsernamePasswordAuthenticationFilter.class);
    public static final String SPRING_SECURITY_FORM_USERNAME_KEY = "username";
    public static final String SPRING_SECURITY_FORM_PASSWORD_KEY = "password";
    private ObjectMapper objectMapper = new ObjectMapper();
    private String usernameParameter = "username";
    private String passwordParameter = "password";
    private String clientIdParameter = "clientId";
    private String accessTokenParameter = "accessToken";
    private boolean postOnly = true;
    private final String oauth2InnerUrl;
    private final String profileInnerUrl;
    public EhrWebUsernamePasswordAuthenticationFilter(String oauth2InnerUrl, String profileInnerUrl) {
        super(new AntPathRequestMatcher("/login", "POST"));
        Assert.hasText(oauth2InnerUrl, "Oauth2InnerUrl must not be empty or null");
        Assert.hasText(profileInnerUrl, "ProfileInnerUrl must not be empty or null");
        this.oauth2InnerUrl = oauth2InnerUrl;
        this.profileInnerUrl = profileInnerUrl;
    }
    /**
     * Step 1
     * @param request
     * @param response
     * @return
     * @throws AuthenticationException
     */
    @Override
    public Authentication attemptAuthentication(HttpServletRequest request, HttpServletResponse response) throws AuthenticationException {
        if(this.postOnly && !request.getMethod().equals("POST")) {
            throw new AuthenticationServiceException("Authentication method not supported: " + request.getMethod());
        } else {
            String username = null;
            String password = null;
            if(isSso(request)) {
                Map<String, Object> params = new HashMap<>();
                params.put("clientId", this.obtainClientId(request));
                params.put("accessToken", this.obtainAccessToken(request));
                try {
                    HttpResponse httpResponse = HttpHelper.post(oauth2InnerUrl + "/oauth/validToken", params);
                    if(httpResponse.getStatusCode() == 200) {
                        Map<String, Object> map = objectMapper.readValue(httpResponse.getBody(), Map.class);
                        String loginName = (String) map.get("user");
                        //验证通过。赋值session中的用户信息
                        params.clear();
                        params.put("login_code", loginName);
                        httpResponse = HttpHelper.get(profileInnerUrl + "/users/" + loginName, params);
                        Envelop envelop = this.objectMapper.readValue(httpResponse.getBody(), Envelop.class);
                        String user = this.objectMapper.writeValueAsString(envelop.getObj());
                        UserDetailModel userDetailModel = this.objectMapper.readValue(user, UserDetailModel.class);
                        username = userDetailModel.getLoginCode();
                        password = userDetailModel.getPassword();
                    }else {
                        logger.error(httpResponse.getBody());
                    }
                }catch (Exception e) {
                    e.printStackTrace();
                }
            }else {
                username = this.obtainUsername(request);
                password = this.obtainPassword(request);
            }
            if(username == null) {
                username = "";
            }
            if(password == null) {
                password = "";
            }
            username = username.trim();
            UsernamePasswordAuthenticationToken authRequest = new EhrWebAuthenticationToken(username, password, isSso(request)); //单点登陆集成
            this.setDetails(request, authRequest);
            return this.getAuthenticationManager().authenticate(authRequest);
        }
    }
    //单点登陆集成 ------------ Start -------------
    protected String obtainClientId(HttpServletRequest request) {
        return request.getParameter(this.clientIdParameter);
    }
    protected String obtainAccessToken(HttpServletRequest request) {
        return request.getParameter(this.accessTokenParameter);
    }
    //单点登陆集成 ------------ End -------------
    protected String obtainPassword(HttpServletRequest request) {
        return request.getParameter(this.passwordParameter);
    }
    protected String obtainUsername(HttpServletRequest request) {
        return request.getParameter(this.usernameParameter);
    }
    public void setPostOnly(boolean postOnly) {
        this.postOnly = postOnly;
    }
    protected void setDetails(HttpServletRequest request, UsernamePasswordAuthenticationToken authRequest) {
        authRequest.setDetails(this.authenticationDetailsSource.buildDetails(request));
    }
    //单点登陆集成 ------------ Start -------------
    public void setClientIdParameter(String clientIdParameter) {
        Assert.hasText(clientIdParameter, "ClientId parameter must not be empty or null");
        this.clientIdParameter = clientIdParameter;
    }
    public void setAccessTokenParameter(String accessTokenParameter) {
        Assert.hasText(accessTokenParameter, "AccessTokenParameter parameter must not be empty or null");
        this.accessTokenParameter = accessTokenParameter;
    }
    //单点登陆集成 ------------ End -------------
    public void setUsernameParameter(String usernameParameter) {
        Assert.hasText(usernameParameter, "Username parameter must not be empty or null");
        this.usernameParameter = usernameParameter;
    }
    public void setPasswordParameter(String passwordParameter) {
        Assert.hasText(passwordParameter, "Password parameter must not be empty or null");
        this.passwordParameter = passwordParameter;
    }
    public final String getClientIdParameter() {
        return this.clientIdParameter;
    }
    public final String getAccessTokenParameter() {
        return this.accessTokenParameter;
    }
    public final String getUsernameParameter() {
        return this.usernameParameter;
    }
    public final String getPasswordParameter() {
        return this.passwordParameter;
    }
    private boolean isSso(HttpServletRequest request){
        return null != request.getParameter(accessTokenParameter);
    }
}

+ 0 - 36
app/app-iot-server/src/main/java/com/yihu/iot/security/entryPoint/LoginEntryPoint.java

@ -1,36 +0,0 @@
package com.yihu.iot.security.entryPoint;
import com.alibaba.fastjson.JSONObject;
import org.springframework.security.core.AuthenticationException;
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * @author yeshijie on 2018/3/9.
 */
public class LoginEntryPoint extends LoginUrlAuthenticationEntryPoint {
    public LoginEntryPoint(String loginFormUrl) {
        super(loginFormUrl);
    }
    @Override
    public void commence(HttpServletRequest request, HttpServletResponse response, AuthenticationException authException) throws IOException, ServletException {
        JSONObject json = new JSONObject();
        json.put("status",998);
        json.put("errorMsg","未登录或,登录超时");
        response.setCharacterEncoding("UTF-8");
        response.setContentType("application/json");
        response.getWriter().println(json.toString());
        response.getWriter().flush();
//        super.commence(request, response, authException);
    }
}

+ 0 - 299
app/app-iot-server/src/main/java/com/yihu/iot/service/common/BaseService.java

@ -1,299 +0,0 @@
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.jw.agModel.user.UserDetailModel;
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.jw.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.security.core.session.SessionInformation;
import org.springframework.security.core.session.SessionRegistry;
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.iotUrl}")
    protected String iotUrl;
    @Value("${app.oauth2InnerUrl}")
    protected String oauth2InnerUrl;
    @Value("${app.oauth2OuterUrl}")
    protected String oauth2OuterUrl;
    @Autowired
    protected SessionRegistry sessionRegistry;
    @Autowired
    protected HttpServletRequest request;
    /**
     * 获取当前登录用户,当前已登录的用户都缓存在session中
     * @return
     */
    public JSONObject getCurrentUser(){
        JSONObject json = new JSONObject();
        String sessionId = request.getSession().getId();
        UserDetailModel user = null;
        SessionInformation sessionInformation = sessionRegistry.getSessionInformation(sessionId);
        if(null != sessionInformation.getPrincipal()){
            user = (UserDetailModel)sessionInformation.getPrincipal();
            json.put("id",user.getId());
            json.put("code",user.getLoginCode());
            json.put("name",user.getRealName());
        }
        return json;
    }
    /**
     * 获取登录信息
     * @return
     */
    public Map<String,Object> getLoginHeader(){
        Map<String, Object> header = new HashMap<>();
        header.put("User-Agent",getCurrentUser());
        return header;
    }
    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 - 87
app/app-iot-server/src/main/java/com/yihu/iot/service/common/FileUploadService.java

@ -1,87 +0,0 @@
package com.yihu.iot.service.common;
import com.alibaba.fastjson.JSONObject;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
/**
 * @author yeshijie on 2017/12/7.
 */
@Service
public class FileUploadService extends BaseService{
    @Value("${neiwang.wlyy}")
    private String neiwangWlyy;  //内网的项目地址
    /**
     * 通用的文件上传
     * @param request
     * @param in
     * @param fileName
     * @return
     */
    public UploadVO request(HttpServletRequest request, InputStream in, String fileName) {
        String url = neiwangWlyy + "/svr-iot/fileUpload/commonUpload";//uri请求路径 http://172.19.103.88/wlyy/upload/chat
        CloseableHttpClient httpClient = HttpClientBuilder.create().build();
        String result = "";
        UploadVO uploadVO = null;
        try {
            HttpPost httpPost = new HttpPost(url);
            MultipartEntityBuilder builder = MultipartEntityBuilder.create();
            builder.addBinaryBody("file", in, ContentType.MULTIPART_FORM_DATA, fileName);// 文件流
            builder.addTextBody("filename", fileName);// 类似浏览器表单提交,对应input的name和value
            if (!org.springframework.util.StringUtils.isEmpty(request.getParameter("type"))) {
                builder.addTextBody("type", request.getParameter("type")); //发送类型
            }
            HttpEntity entity = builder.build();
            httpPost.setEntity(entity);
            HttpResponse response = httpClient.execute(httpPost);// 执行提交
            HttpEntity responseEntity = response.getEntity();
            if (responseEntity != null) {
                // 将响应内容转换为字符串
                result = EntityUtils.toString(responseEntity, Charset.forName("UTF-8"));
            }
            JSONObject jsonObject = JSONObject.parseObject(result);
            if(jsonObject.getInteger("status")==200){
                JSONObject obj = jsonObject.getJSONObject("obj");
                uploadVO = new UploadVO();
                uploadVO.setFileName(obj.getString("groupName"));
                uploadVO.setFileType(obj.getString("remoteFileName"));
                uploadVO.setFullUri(obj.getString("fileId"));
                uploadVO.setFullUrl(obj.getString("fileUrl"));
            }
        } catch (IOException e) {
            e.printStackTrace();
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            try {
                httpClient.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
            try {
                in.close();
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
        return uploadVO;
    }
}

+ 0 - 515
app/app-iot-server/src/main/java/com/yihu/iot/service/common/LoginService.java

@ -1,515 +0,0 @@
package com.yihu.iot.service.common;
import com.yihu.jw.agModel.user.RoleOrgModel;
import com.yihu.jw.agModel.user.UserDetailModel;
import com.yihu.jw.constants.ServiceApi;
import com.yihu.jw.constants.SessionAttributeKeys;
import com.yihu.jw.model.geography.MGeographyDict;
import com.yihu.jw.model.org.MOrganization;
import com.yihu.jw.model.resource.MRsRolesResource;
import com.yihu.jw.model.user.MRoles;
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.jw.util.log.LogService;
import com.yihu.jw.util.rest.Envelop;
import org.springframework.security.authentication.UsernamePasswordAuthenticationToken;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.authority.SimpleGrantedAuthority;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;
import org.springframework.ui.Model;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.RequestParam;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;
import java.util.*;
/**
 * Service - 登陆
 * @author Progr1mmer
 */
@Service
public class LoginService extends BaseService {
    //------------------------ 初始化内外网IP start ------------------------
    private final long a1 = getIpNum("10.0.0.0");
    private final long a2 = getIpNum("10.255.255.255");
    private final long b1 = getIpNum("172.16.0.0");
    private final long b2 = getIpNum("172.31.255.255");
    private final long c1 = getIpNum("192.168.0.0");
    private final long c2 = getIpNum("192.168.255.255");
    private final long d1 = getIpNum("10.44.0.0");
    private final long d2 = getIpNum("10.69.0.255");
    public void initUrlInfo(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_CLIENT_IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("HTTP_X_FORWARDED_FOR");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        if(ip != null) {
            if("0:0:0:0:0:0:0:1".equals(ip)) {
                request.getSession().setAttribute("isInnerIp", true);
            }else {
                if("127.0.0.1".equals(ip) || isInnerIP(ip)) {
                    request.getSession().setAttribute("isInnerIp", true);
                }else {
                    request.getSession().setAttribute("isInnerIp", false);
                }
            }
        }
    }
    public boolean isInnerIP(String ip){
        long n = getIpNum(ip);
        return (n >= a1 && n <= a2) || (n >= b1 && n <= b2) || (n >= c1 && n <= c2) || (n >= d1 && n <= d2);
    }
    public long getIpNum(String ipAddress) {
        String [] ip = ipAddress.split("\\.");
        long a = Integer.parseInt(ip[0]);
        long b = Integer.parseInt(ip[1]);
        long c = Integer.parseInt(ip[2]);
        long d = Integer.parseInt(ip[3]);
        return a * 256 * 256 * 256 + b * 256 * 256 + c * 256 + d;
    }
    //------------------------ 初始化内外网IP end ------------------------
    /**
     * 用户名密码登录
     * @param request
     * @param userName
     * @param password
     * @return
     */
    public Result login(HttpServletRequest request, String userName, String password) {
        try {
            ObjectResult result = new ObjectResult();
            Map<String, Object> params = new HashMap<>();
            params.put("userName", userName);
            params.put("password", password);
            params.put("clientId", clientId);
            HttpResponse response = HttpHelper.get(portalInnerUrl + "/oauth/login", params);
            if (response != null && response.getStatusCode() == 200) {
                ObjectResult re = toModel(response.getBody(), ObjectResult.class);
                if (re.isSuccessFlg()){
                    Map userMap = new HashMap<>();
                    userMap.put("user",re.getData());
                    result.setData(userMap);
                    String userId = ((LinkedHashMap) re.getData()).get("id").toString();
                    //获取token
                    Result tokenResponse = getAccessToken(userName, password, clientId);
                    if (tokenResponse.isSuccessFlg()) {
                        initUrlInfo(request);
                        String data = objectMapper.writeValueAsString(((ObjectResult) tokenResponse).getData());
                        AccessToken token = objectMapper.readValue(data,AccessToken.class);
                        request.getSession().setAttribute("isLogin", true);
                        request.getSession().setAttribute("token", token);
                        request.getSession().setAttribute("loginName", userName);
                        request.getSession().setAttribute("userId", userId);
                        result.setSuccessFlg(true);
                        result.setMessage("登录成功");
                        result.setCode(200);
                        return result;
                    }
                    else{
                        return tokenResponse;
                    }
                }
                else {
                    return re;
                }
            } else {
                return Result.error(response.getStatusCode(), response.getBody());
            }
        } catch (Exception e) {
            e.printStackTrace();
            return Result.error(e.getMessage());
        }
    }
    /**
     * 自动登录
     * @param request
     * @param model
     * @param token
     * @return
     * @throws Exception
     */
    public Envelop autoLogin(HttpServletRequest request, Model model, @RequestParam String token) throws Exception {
        try {
            String clientId = request.getParameter("clientId").toString();
            Map<String, Object> params = new HashMap<>();
            params.put("clientId", clientId);
            params.put("accessToken", token);
            HttpResponse response = HttpHelper.post(oauth2InnerUrl + "/oauth/validToken", params);
            Map<String, Object> map = objectMapper.readValue(response.getBody(), Map.class);
            if ((Boolean) map.get("successFlg")) {
                AccessToken accessToken = objectMapper.readValue(objectMapper.writeValueAsString(map.get("data")), AccessToken.class);
                String loginName = accessToken.getUser();
                //验证通过。赋值session中的用户信息
                response = HttpHelper.get(profileInnerUrl + "/users/" + loginName, params);
                Envelop envelop = (Envelop) this.objectMapper.readValue(response.getBody(), Envelop.class);
                String ex = this.objectMapper.writeValueAsString(envelop.getObj());
                UserDetailModel userDetailModel = this.objectMapper.readValue(ex, UserDetailModel.class);
                //获取用户的角色,机构,视图 等权限
                getUserRolePermissions(userDetailModel, loginName, request);
                // 注:SessionAttributeKeys.CurrentUser 是用 @SessionAttributes 来最终赋值,换成用 session.setAttribute() 赋值后将会被覆盖。
                model.addAttribute(SessionAttributeKeys.CurrentUser, userDetailModel);
                HttpSession session = request.getSession();
                //增加超级管理员信息
                if(loginName.equals(permissionsInfo)) {
                    session.setAttribute(AuthorityKey.IsAccessAll, true);
                }else {
                    session.setAttribute(AuthorityKey.IsAccessAll, false);
                }
                session.setAttribute("isLogin", true);
                session.setAttribute("token", accessToken);
                session.setAttribute("loginName", loginName);
                session.setAttribute("userId", userDetailModel.getId());
                session.setAttribute("clientId", clientId);
                //获取用户角色信息
                List<Map<String, Object>> features = getUserFeatures(userDetailModel.getId());
                Collection<GrantedAuthority> grantedAuthorities = new ArrayList<>();
                if (features != null) {
                    for (Map<String, Object> temp : features) {
                        if (temp.get("url") != null && !StringUtils.isEmpty(temp.get("url").toString())){
                            grantedAuthorities.add(new SimpleGrantedAuthority(temp.get("url").toString()));
                        }
                    }
                }
                //生成认证token
                Authentication AuthenticationToken = new UsernamePasswordAuthenticationToken(loginName, "", grantedAuthorities);
                //将信息存放到SecurityContext
                SecurityContextHolder.getContext().setAuthentication(AuthenticationToken);
                return success(userDetailModel);
            } else {
                String msg = String.valueOf(map.get("message"));
                return failed(msg);
            }
        } catch (Exception e) {
            return failed(e.getMessage());
        }
    }
    /**
     * 通过用户名密码获取token
     * @param userName
     * @param password
     * @param clientId
     * @return
     */
    public Result getAccessToken(String userName, String password, String clientId) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("userName", userName);
            params.put("password", password);
            params.put("clientId", clientId);
            HttpResponse response = HttpHelper.post(oauth2InnerUrl + "oauth/accessToken", params);
            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
     * @param refreshToken
     * @param clientId
     * @return
     */
    public Result refreshToken(String refreshToken, String clientId) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("refreshToken", refreshToken);
            params.put("clientId", clientId);
            HttpResponse response = HttpHelper.post(oauth2InnerUrl + "oauth/refreshToken", params);
            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
     * @param clientId
     * @param accessToken
     * @return
     */
    public Result validToken(String clientId, String accessToken) {
        try {
            Map<String, Object> params = new HashMap<>();
            params.put("clientId", clientId);
            params.put("accessToken", accessToken);
            HttpResponse response = HttpHelper.post(oauth2InnerUrl + "oauth/validToken", params);
            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());
        }
    }
    /**
     * 获取用户的角色,机构,视图 等权限
     * @param userDetailModel
     * @param request
     * @throws Exception
     */
    public void getUserRolePermissions(UserDetailModel userDetailModel, String loginCode, HttpServletRequest request) throws Exception {
        HttpSession session = request.getSession();
        if(loginCode.equals(permissionsInfo)){
            session.setAttribute(AuthorityKey.UserRoles, null);
            session.setAttribute(AuthorityKey.UserResource, null);
            session.setAttribute(AuthorityKey.UserAreaSaas, null);
            session.setAttribute(AuthorityKey.UserOrgSaas, null);
        }else{
            //获取用户角色
            String roleStr = "";
            List<String> roleList = new ArrayList<>();
            roleStr =  gerUserRoles(userDetailModel.getId());
            if( !StringUtils.isEmpty(roleStr)){
                roleList =  Arrays.asList(roleStr.split(","));
                session.setAttribute(AuthorityKey.UserRoles, roleList);
                //获取角色机构
                List<RoleOrgModel> roleOrgModels = new ArrayList<>();
                gerRolesOrgs(roleList,roleOrgModels);
                if(roleOrgModels !=null && roleOrgModels.size() >0){
                    List<String> roleOrgCodes = new ArrayList<>();
                    for(RoleOrgModel roleOrgModel : roleOrgModels){
                        roleOrgCodes.add(roleOrgModel.getOrgCode());
                    }
                    getUserSaasOrgAndArea(roleOrgCodes, request);
                }else{
                    List<String> userOrgList = new ArrayList<>();
                    userOrgList.add("-NoneOrg");
                    session.setAttribute(AuthorityKey.UserOrgSaas, userOrgList);
                }
                //获取角色视图
                List<String> rolesResourceIdList =  new ArrayList<>();
                List<MRsRolesResource> rolesResourceList = new ArrayList<>();
                gerRolesResource(roleList, rolesResourceList);
                if(rolesResourceList !=null && rolesResourceList.size() >0){
                    for(MRsRolesResource rsRolesResource : rolesResourceList){
                        rolesResourceIdList.add(rsRolesResource.getResourceId());
                    }
                    session.setAttribute(AuthorityKey.UserResource, rolesResourceIdList);
                }else{
                    rolesResourceIdList.add("-NoneResource");
                    session.setAttribute(AuthorityKey.UserResource, rolesResourceIdList);
                }
            }else{
                roleList.add("-NoneRole");
                session.setAttribute(AuthorityKey.UserRoles, roleList);
            }
        }
    }
    /**
     * 获取用户角色
     * @param userId
     * @return
     */
    public String gerUserRoles(String userId){
        //获取用户所属角色
        String roleStr = "";
        try {
            String url = "/roles/role_user/userRolesIds";
            Map<String,Object> params = new HashMap<>();
            params.put("user_id",userId);
            HttpResponse response = HttpHelper.get(profileInnerUrl + url,params);
            Envelop envelop = objectMapper.readValue(response.getBody(),Envelop.class);
            if (envelop.isSuccessFlg() && null != envelop.getObj() && !"".equals(envelop.getObj())) {
                roleStr = envelop.getObj().toString();
            }
        } catch (Exception ex) {
            LogService.getLogger(LoginService.class).error(ex.getMessage());
        }
        return  roleStr;
    }
    /**
     * 获取角色机构
     * @param roleList 角色组列表
     * @return
     */
    public List<RoleOrgModel> gerRolesOrgs(List<String> roleList,List<RoleOrgModel> roleOrgs){
        for(String roleId : roleList){
            try {
                Map<String,Object> params = new HashMap<>();
                String roleUrl = "/roles/role/"+roleId;
                params.put("id",Long.valueOf(roleId));
                HttpResponse response = HttpHelper.get(profileInnerUrl + roleUrl,params);
                Envelop envelopRole = objectMapper.readValue(response.getBody(),Envelop.class);
                if(envelopRole.getObj() != null){
                    MRoles mRoles = objectMapper.convertValue(envelopRole.getObj(), MRoles.class);
                    if ( ! StringUtils.isEmpty( mRoles.getOrgCode() )){
                        RoleOrgModel roleOrgModel = new RoleOrgModel();
                        roleOrgModel.setOrgCode(mRoles.getOrgCode());
                        roleOrgModel.setRoleId(mRoles.getId());
                        roleOrgs.add(roleOrgModel);
                    }
                }
                String url = ServiceApi.Roles.RoleOrgsNoPage;
                params.clear();
                params.put("filters","roleId=" + roleId);
                response = HttpHelper.get(profileInnerUrl + url,params);
                Envelop envelop = objectMapper.readValue(response.getBody(),Envelop.class);
                if (envelop.isSuccessFlg() && null != envelop.getDetailModelList() &&  envelop.getDetailModelList().size()>0) {
                    List<RoleOrgModel> roleOrgModels = envelop.getDetailModelList();
                    if(roleOrgModels != null && roleOrgModels.size() > 0){
                        for(int i = 0; i < roleOrgModels.size() ;i++){
                            RoleOrgModel orgModel = objectMapper.convertValue(roleOrgModels.get(i), RoleOrgModel.class) ;
                            roleOrgs.add(orgModel);
                        }
                    }
                }
            } catch (Exception ex) {
                LogService.getLogger(LoginService.class).error(ex.getMessage());
            }
        }
        return  roleOrgs;
    }
    /**
     * 获取用的saas机构
     */
    public void getUserSaasOrgAndArea(List<String> roleOrgCodes, HttpServletRequest request) throws Exception {
        Envelop envelop = new Envelop();
        List<String> userOrgList = new ArrayList<>();
        for(String code : roleOrgCodes){
            userOrgList.add(code);
        }
        //使用orgCode获取saas化的机构或者区域。
        String urlUOrg = "/org/getUserOrgSaasByUserOrgCode/";
        Map<String, Object> uParams = new HashMap<>();
        uParams.put("orgCodeStr",org.apache.commons.lang.StringUtils.join(roleOrgCodes,',') );
        HttpResponse response = HttpHelper.get(profileInnerUrl + urlUOrg, uParams);
        envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        HttpSession session = request.getSession();
        session.setAttribute("userAreaSaas", envelop.getObj());
        session.setAttribute("userOrgSaas", envelop.getDetailModelList());
        userOrgList = envelop.getDetailModelList();
        List<String> districtList = (List<String>) envelop.getObj();
        String geographyUrl = "/geography_entries/";
        if(districtList != null && districtList.size() > 0){
            for(String code : districtList){
                uParams.clear();
                response = HttpHelper.get(profileInnerUrl + geographyUrl + code, uParams);
                envelop = objectMapper.readValue(response.getBody(),Envelop.class);
                MGeographyDict mGeographyDict = null;
                String objJsonData = objectMapper.writeValueAsString(envelop.getObj());
                mGeographyDict = objectMapper.readValue(objJsonData, MGeographyDict.class);
                if(mGeographyDict != null){
                    String province = "";
                    String city = "";
                    String district = "";
                    if(mGeographyDict.getLevel() == 1){
                        province =  mGeographyDict.getName();
                    }else if(mGeographyDict.getLevel() == 2){
                        city =  mGeographyDict.getName();
                    }else if(mGeographyDict.getLevel() == 3){
                        district =  mGeographyDict.getName();
                    }
                    String  orgGeographyStr = "/organizations/geography";
                    uParams.clear();
                    uParams.put("province",province);
                    uParams.put("city",city);
                    uParams.put("district",district);
                    response = HttpHelper.get(profileInnerUrl + orgGeographyStr , uParams);
                    envelop = objectMapper.readValue(response.getBody(),Envelop.class);
                    if(envelop !=null && envelop.getDetailModelList() != null ){
                        List<MOrganization> organizations = (List<MOrganization>)getEnvelopList(envelop.getDetailModelList(),new ArrayList<MOrganization>(),MOrganization.class);
                        if(organizations !=null ){
                            java.util.Iterator it = organizations.iterator();
                            while(it.hasNext()){
                                MOrganization mOrganization = (MOrganization)it.next();
                                userOrgList.add(mOrganization.getCode());
                            }
                        }
                    }
                }
            }
        }
        userOrgList.removeAll(Collections.singleton(null));
        userOrgList.removeAll(Collections.singleton(""));
        request.getSession().setAttribute(AuthorityKey.UserOrgSaas, userOrgList);
    }
    /**
     * 获取角色视图列表
     * @param roleList
     * @param rolesResourceList
     * @return
     */
    public List<MRsRolesResource> gerRolesResource(List<String> roleList,List<MRsRolesResource> rolesResourceList){
        for(String roleId : roleList){
            try {
                String url = ServiceApi.Resources.GetRolesGrantResources;
                Map<String,Object> params = new HashMap<>();
                params.put("rolesId",roleId);
                HttpResponse response = HttpHelper.get(profileInnerUrl + url,params);
                Envelop envelop = objectMapper.readValue(response.getBody(),Envelop.class);
                if (envelop.isSuccessFlg() && null != envelop.getDetailModelList() && envelop.getDetailModelList().size() > 0 ) {
                    List<MRsRolesResource> roleResourceModels = envelop.getDetailModelList();
                    if(roleResourceModels != null && roleResourceModels.size() > 0){
                        for(int i = 0; i < roleResourceModels.size() ;i++){
                            MRsRolesResource rolesResource = objectMapper.convertValue(roleResourceModels.get(i),MRsRolesResource.class) ;
                            rolesResourceList.add(rolesResource);
                        }
                    }
                }
            } catch (Exception ex) {
                LogService.getLogger(LoginService.class).error(ex.getMessage());
            }
        }
        return  rolesResourceList;
    }
    private List<Map<String, Object>> getUserFeatures(String userId) throws Exception {
        Map params = new HashMap<>();
        params.put("user_id", userId);
        HttpResponse response = HttpHelper.get(profileInnerUrl + "/roles/user/features", params);
        Envelop envelop =  objectMapper.readValue(response.getBody(), Envelop.class);
        if (envelop.isSuccessFlg()) {
            return envelop.getDetailModelList();
        } else {
            throw new Exception(envelop.getErrorMsg());
        }
    }
}

+ 0 - 71
app/app-iot-server/src/main/java/com/yihu/iot/service/common/SystemDictService.java

@ -1,71 +0,0 @@
package com.yihu.iot.service.common;
import com.yihu.jw.constants.ErrorCode;
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.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
/**
 * @author yeshijie on 2018/1/16.
 */
@Service
public class SystemDictService extends BaseService{
    /**
     * 获取字典列表(不分页)
     * @param dictName
     * @return
     * @throws Exception
     */
    public MixEnvelop<IotSystemDictVO, IotSystemDictVO> getList(String dictName) throws Exception {
        if("HOSPITAL".equals(dictName)){
            return organizations();
        }
        Map<String, Object> params = new HashMap<>();
        params.put("dictName", dictName);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.System.FindDictByCode, params);
        MixEnvelop<IotSystemDictVO, IotSystemDictVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 获取组织机构信息
     * @return
     */
    private MixEnvelop<IotSystemDictVO, IotSystemDictVO> organizations(){
        String url = "/organizations";
        MixEnvelop<IotSystemDictVO, IotSystemDictVO> envelop = new MixEnvelop<>();
        Map<String, Object> params = new HashMap<>();
        params.put("fields","");
        params.put("sorts","");
        params.put("filters", "orgCode?3502");
        params.put("page", 1);
        params.put("size", 100);
        try {
            HttpResponse response = HttpHelper.get(profileInnerUrl + url, params);
            ObjectResult result =  objectMapper.readValue(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
                envelop.setStatus(200);
            }else {
                envelop.setStatus(-1);
                envelop.setMessage(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setMessage(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
}

+ 0 - 367
app/app-iot-server/src/main/java/com/yihu/iot/service/company/CompanyService.java

@ -1,367 +0,0 @@
package com.yihu.iot.service.company;
import com.yihu.jw.constants.ErrorCode;
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.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
 * @author yeshijie on 2018/1/22.
 */
@Service
public class CompanyService extends BaseService {
    @Value("${ehr.user.roleId}")
    private String roleId;//物联网默认用户角色
    /**
     * 分页查找企业
     * @param name
     * @param status
     * @param type
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findCompanyPage(String name, String status, String type, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("name", name);
        params.put("status", status);
        params.put("type", type);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Company.FindCompanyPage, params);
        MixEnvelop<IotCompanyVO, IotCompanyVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 创建企业
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> addCompany(String jsonData) throws IOException {
        MixEnvelop<IotCompanyVO, IotCompanyVO> envelop = new MixEnvelop<>();
        //新增ehr用户
        IotCompanyVO iotCompany = toModel(jsonData, IotCompanyVO.class);
        envelop = userVerification(iotCompany,envelop);
        if(envelop.getStatus()!=null&&envelop.getStatus()==-1){
            return envelop;
        }
        //验证账户
        Result login_code = existence("login_code",iotCompany.getAccount());
        if(login_code.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setMessage("该账号已存在");
            return envelop;
        }
        //验证身份证
        Result id_card_no = existence("id_card_no",iotCompany.getContactsIdcard());
        if(id_card_no.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setMessage("该身份证号已被注册,请确认。");
            return envelop;
        }
        //验证邮件
        Result email = existence("email",iotCompany.getContactsEmail());
        if(email.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setMessage("该邮箱已存在");
            return envelop;
        }
        //验证手机号
        Result telephone = existence("telephone",iotCompany.getContactsMobile());
        if(telephone.isSuccessFlg()){
            envelop.setStatus(-1);
            envelop.setMessage("该手机号码已存在");
            return envelop;
        }
        MixEnvelop<UserModel, UserModel> userModelEnvelop = updateUser(iotCompany);
        if(userModelEnvelop.getStatus()!=200){
            envelop.setStatus(-1);
            envelop.setMessage(userModelEnvelop.getMessage());
            return envelop;
        }
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", toJson(iotCompany));
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Company.AddCompany, params);
        envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 校验用户信息
     * @param iotCompany
     * @param envelop
     * @return
     */
    private MixEnvelop<IotCompanyVO, IotCompanyVO> userVerification(IotCompanyVO iotCompany, MixEnvelop<IotCompanyVO, IotCompanyVO> envelop){
        if(StringUtils.isEmpty(iotCompany.getAccount())){
            envelop.setStatus(-1);
            envelop.setMessage("账号不能为空");
            return envelop;
        }
        if(StringUtils.isEmpty(iotCompany.getContactsIdcard())){
            envelop.setStatus(-1);
            envelop.setMessage("身份证号不能为空");
            return envelop;
        }
        if(StringUtils.isEmpty(iotCompany.getContactsEmail())){
            envelop.setStatus(-1);
            envelop.setMessage("邮箱不能为空");
            return envelop;
        }
        if(StringUtils.isEmpty(iotCompany.getContactsMobile())){
            envelop.setStatus(-1);
            envelop.setMessage("手机号码账号不能为空");
            return envelop;
        }
        return envelop;
    }
    /**
     * 验证用户信息
     */
    private Result existence(String existenceType, String existenceNm){
        String getUserUrl = "/users/existence";
        Result result = null;
        Map<String, Object> params = new HashMap<>();
        params.put("existenceType",existenceType);
        params.put("existenceNm",existenceNm);
//        params.put("username",null);
//        params.put("password",null);
        try {
            HttpResponse response = HttpHelper.get(profileInnerUrl + getUserUrl, params);
            result = objectMapper.readValue(response.getBody(),Result.class);
            return result;
        } catch (Exception e) {
            e.printStackTrace();
            result = new Result();
            result.setSuccessFlg(false);
            result.setMessage(ErrorCode.SystemError.toString());
            return result;
        }
    }
    /**
     * 新增用户
     * @param iotCompany
     * @return
     */
    private MixEnvelop<UserModel, UserModel> updateUser(IotCompanyVO iotCompany){
        String url = "/user/";
        UserModel userModel = new UserModel();
        userModel.setEmail(iotCompany.getContactsEmail());
        userModel.setIdCardNo(iotCompany.getContactsIdcard());
        userModel.setLoginCode(iotCompany.getAccount());
        userModel.setTelephone(iotCompany.getContactsMobile());
        userModel.setRealName(iotCompany.getContactsName());
        userModel.setRole(roleId);
        MixEnvelop envelop  = new MixEnvelop();
        Map<String, Object> params = new HashMap<>();
        params.put("user_json_data",toJson(userModel));
        try {
            Map<String, Object> head = new HashMap<>();
            head.put("Content-Type","application/json; charset=UTF-8");
            HttpResponse response = HttpHelper.post(profileInnerUrl + url, params,head);
            ObjectResult result = toModel(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                UserModel addUserModel = toModel(toJson(result.getObj()),UserModel.class);
                iotCompany.setEhrUserId(addUserModel.getId());
                envelop.setStatus(200);
            }else {
                envelop.setStatus(-1);
                envelop.setMessage(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setMessage(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    /**
     * 修改密码
     * @param userId
     * @param passWord
     * @return
     */
    public MixEnvelop changePassWord(String userId, String passWord){
        MixEnvelop envelop = new MixEnvelop();
        String url = "/users/changePassWord";
        Map<String, Object> params = new HashMap<>();
        params.put("user_id",userId);
        params.put("password",passWord);
        try {
            HttpResponse response = HttpHelper.put(profileInnerUrl + url, params);
            ObjectResult result = toModel(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                envelop.setStatus(200);
                envelop.setMessage("修改成功");
            }else {
                envelop.setStatus(-1);
                envelop.setMessage(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setMessage(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    /**
     * 根据id查找企业
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByCode(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Company.FindCompanyById, params);
        MixEnvelop<IotCompanyVO, IotCompanyVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 删除企业证书
     * @param id
     * @return
     */
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> delCompanyCert(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Company.DelCompanyCert, params);
        MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据营业执照号查找企业
     * @param businessLicense
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> findByBusinessLicense(String businessLicense) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("businessLicense", businessLicense);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Company.FindByBusinessLicense, params);
        MixEnvelop<IotCompanyVO, IotCompanyVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 删除企业
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> delCompany(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Company.DelCompany, params);
        MixEnvelop<IotCompanyVO, IotCompanyVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 修改企业信息
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyVO, IotCompanyVO> updCompany(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Company.UpdCompany, params);
        MixEnvelop<IotCompanyVO, IotCompanyVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 分页获取企业证书
     * @param name
     * @param companyId
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertPage(String name, Integer page, Integer size, String companyId) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("name", name);
        params.put("companyId", companyId);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Company.FindCompanyCertPage, params);
        MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据id查找企业证书
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertById(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Company.FindCompanyCertById, params);
        MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据企业id查找企业证书
     * @param companyId
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> findCompanyCertByCompanyId(String companyId) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("companyId", companyId);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Company.FindCompanyCertByCompanyId, params);
        MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 创建企业证书
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> addCompanyCert(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Company.AddCompanyCert, params);
        MixEnvelop<IotCompanyCertificateVO, IotCompanyCertificateVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
}

+ 0 - 168
app/app-iot-server/src/main/java/com/yihu/iot/service/device/DeviceOrderService.java

@ -1,168 +0,0 @@
package com.yihu.iot.service.device;
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.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
 * @author yeshijie on 2017/12/8.
 */
@Service
public class DeviceOrderService extends BaseService {
    /**
     * 创建设备订单
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotOrderVO, IotOrderVO> create(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.DeviceOrder.CreateOrder, params);
        MixEnvelop<IotOrderVO, IotOrderVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据id查找设备订单
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> findByCode(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.DeviceOrder.FindById, params);
        MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 分页查找设备订单
     * @param name
     * @param type
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> findPage(String name, String type, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("name", name);
        params.put("type", type);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.DeviceOrder.FindPage, params);
        MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 删除订单
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> delOrder(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.DeviceOrder.DelOrder, params);
        MixEnvelop<IotDeviceOrderVO, IotDeviceOrderVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 删除采购订单
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> delPurchase(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.DeviceOrder.DelPurchase, params);
        MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 修改订单
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotOrderVO, IotOrderVO> updOrder(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.DeviceOrder.UpdOrder, params);
        MixEnvelop<IotOrderVO, IotOrderVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 分页查找采购清单
     * @param orderId
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findPurcharsePage(String orderId, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("orderId", orderId);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.DeviceOrder.FindPurcharsePage, params);
        MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据id查找采购订单
     * @param id
     * @return
     */
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findPurcharseById(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.DeviceOrder.FindPurcharseById, params);
        MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 质检管理
     * @param qualityStatus
     * @param orderNo
     * @param startTime
     * @param endTime
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> findQualityPage(String qualityStatus,
                                                          String orderNo, String startTime, String endTime, Integer page, Integer size) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("qualityStatus", qualityStatus);
        params.put("orderNo", orderNo);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.DeviceOrder.FindQualityPage, params);
        MixEnvelop<IotOrderPurchaseVO, IotOrderPurchaseVO> envelop = objectMapper.readValue(response.getBody(), MixEnvelop.class);
        return envelop;
    }
}

+ 0 - 265
app/app-iot-server/src/main/java/com/yihu/iot/service/device/DeviceService.java

@ -1,265 +0,0 @@
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.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.web.MixEnvelop;
import com.yihu.jw.restmodel.web.Envelop;
import com.yihu.jw.restmodel.iot.common.ExistVO;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author yeshijie on 2017/12/8.
 */
@Service
public class DeviceService extends BaseService {
    @Autowired
    private FastDFSUtil fastDFSHelper;
    @Value("${neiwang.enable}")
    private Boolean isneiwang;  //如果不是内网项目要转到到内网在上传
    @Autowired
    private FileUploadService fileUploadService;
    /**
     * 创建设备
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> create(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Device.CreateDevice, params);
        MixEnvelop<IotDeviceVO, IotDeviceVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据code查找设备
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findByCode(String id)throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Device.GetDeviceById, params);
        MixEnvelop<IotDeviceVO, IotDeviceVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * sn码是否存在
     * @param sn
     * @return
     * @throws IOException
     */
    public MixEnvelop<ExistVO, ExistVO> isSnExist(String sn) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("sn", sn);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Device.IsSnExist, params);
        MixEnvelop<ExistVO, ExistVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * sim卡号是否存在
     * @param sim
     * @return
     * @throws IOException
     */
    public MixEnvelop<ExistVO, ExistVO> isSimExist(String sim) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("sim", sim);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Device.IsSimExist, params);
        MixEnvelop<ExistVO, ExistVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 修改sim卡号
     * @param sim
     * @param id
     * @return
     */
    public Envelop updSim(String sim, String id) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("sim", sim);
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Device.UpdSim, params);
        Envelop envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    /**
     * 删除
     * @param id
     * @return
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> delDevice(String id) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Device.DelDevice, params);
        MixEnvelop<IotDeviceVO, IotDeviceVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 修改设备
     * @param jsonData
     * @return
     */
    public Envelop updDevice(String jsonData) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Device.UpdDevice, params);
        Envelop envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    /**
     * 分页查找设备
     * @param sn
     * @param hospital
     * @param orderId
     * @param purcharseId
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceVO, IotDeviceVO> findProductPageByCompanyId(String sn, String hospital, String orderId,
                                                              String purcharseId, Integer isBinding, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("sn", sn);
        params.put("hospital", hospital);
        params.put("orderId", orderId);
        params.put("purcharseId", purcharseId);
        params.put("isBinding", isBinding);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Device.QueryDevicePage, params);
        MixEnvelop<IotDeviceVO, IotDeviceVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 是否正在导入设备数据
     * @param purcharseId
     * @return
     */
    public MixEnvelop<ExistVO, ExistVO> isImportDevice(String purcharseId) throws IOException {
        MixEnvelop<ExistVO, ExistVO> envelop = objectMapper.readValue(isImporting(purcharseId),MixEnvelop.class);
        return envelop;
    }
    /**
     * 是否正在导入设备数据
     * @param purcharseId
     * @return
     */
    public String isImporting(String purcharseId){
        Map<String, Object> params = new HashMap<>();
        params.put("purcharseId", purcharseId);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Device.IsImportDevice, params);
        return response.getBody();
    }
    /**
     * 设备导入
     * @param file
     * @param purcharseId
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> uploadStream(MultipartFile file, String purcharseId, HttpServletRequest request) throws Exception {
        String res = isImporting(purcharseId);
        JSONObject json = JSON.parseObject(res);
        if(json.getInteger("status")==200){
            if(json.getJSONObject("obj").getInteger("isExist")==1){
                return MixEnvelop.getError("已存在导入中的数据,请等待上次数据处理完后在导入");
            }
        }else {
            return MixEnvelop.getError("查询是否在导入中失败");
        }
        //文件上传
        // 得到文件的完整名称  xxx.txt
        String fullName = file.getOriginalFilename();
        //得到文件类型
        String fileType = fullName.substring(fullName.lastIndexOf(".") + 1).toLowerCase();
        if(!"xls".equals(fileType)){
            return MixEnvelop.getError("文件格式不正确");
        }
        String fileName = fullName.substring(0, fullName.lastIndexOf("."));
        //上传到fastdfs
        ObjectNode objectNode = null;
        Map<String, Object> params = params = new HashMap<>();;
        if(isneiwang){
            objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
            params.put("url", objectNode.get("fileId").toString().replaceAll("\"", ""));
        }else {
            UploadVO uploadVO = fileUploadService.request(request,file.getInputStream(),fullName);
            if(uploadVO==null){
                return MixEnvelop.getError("文件上传失败");
            }
            params.put("url", uploadVO.getFullUri());
        }
        //解析excel封装对象
        AExcelReader excelReader = new IotDeviceImportVOReader();
        excelReader.read(file.getInputStream());
        List<IotDeviceImportVO> correctLs = excelReader.getCorrectLs();
        params.put("purcharseId", purcharseId);
        params.put("jsonData", JSONObject.toJSONString(correctLs));
        params.put("fileName", fileName);
        String ret = HttpHelper.postBody(iotUrl + ServiceApi.Device.ImportDevice,JSONObject.toJSONString(params));
        MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> envelop = objectMapper.readValue(ret,MixEnvelop.class);
        return envelop;
    }
    /**
     * 分页查找导入记录
     * @param purcharseId
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> queryImportRecordPage(String purcharseId, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("purcharseId", purcharseId);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Device.QueryImportRecordPage, params);
        MixEnvelop<IotDeviceImportRecordVO, IotDeviceImportRecordVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
}

+ 0 - 115
app/app-iot-server/src/main/java/com/yihu/iot/service/device/IotDeviceQualityService.java

@ -1,115 +0,0 @@
package com.yihu.iot.service.device;
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.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceQualityInspectionPlanVO;
import org.springframework.stereotype.Service;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
 * @author yeshijie on 2018/01/24.
 */
@Service
public class IotDeviceQualityService extends BaseService {
    /**
     * 创建设备质检
     * @param jsonData
     * @return
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> create(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Quality.AddQualityPlan, params);
        MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据code查找设备质检
     * @param id
     * @return
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> findByCode(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Quality.FindById, params);
        MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 分页获取设备质检计划
     * @param purcharseId
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> queryQualityPlanPage(String purcharseId, String orderNo,
                                                                             String startTime, String endTime, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("purcharseId", purcharseId);
        params.put("orderNo", orderNo);
        params.put("startTime", startTime);
        params.put("endTime", endTime);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Quality.QueryQualityPlanPage, params);
        MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 删除质检计划
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> delQualityPlan(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Quality.DelQualityPlan, params);
        MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 完成质检计划
     * @param actualTime
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> completeQualityPlan(String actualTime, String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("actualTime", actualTime);
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Quality.CompleteQualityPlan, params);
        MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 完成质检计划(按采购id)
     * @param actualTime
     * @param purchaseId
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> completePlanByPurchaseId(String actualTime, String purchaseId) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("actualTime", actualTime);
        params.put("purchaseId", purchaseId);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Quality.CompletePlanByPurchaseId, params);
        MixEnvelop<IotDeviceQualityInspectionPlanVO, IotDeviceQualityInspectionPlanVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
}

+ 0 - 184
app/app-iot-server/src/main/java/com/yihu/iot/service/product/ProductService.java

@ -1,184 +0,0 @@
package com.yihu.iot.service.product;
import com.yihu.jw.constants.ErrorCode;
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.web.MixEnvelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
/**
 * @author yeshijie on 2018/1/17.
 */
@Service
public class ProductService extends BaseService {
    @Value("${ehr.metadata.version}")
    private String version;//版本 59083976eebd
    @Value("${ehr.metadata.reference}")
    private String reference;//标准来源 000000065a965615966b3a40c86ceba7
    /**
     * 测量数据(ehr标准规范管理-平台标准-标准数据集)
     * @return
     */
    public MixEnvelop<MStdDataSet, MStdDataSet> data_sets(Integer page, Integer size, String name){
        String url = "/std/data_sets";
        MixEnvelop<MStdDataSet, MStdDataSet> envelop = new MixEnvelop<>();
        Map<String, Object> params = new HashMap<>();
        String filters = "reference="+reference+";";
        if(StringUtils.isNotBlank(name)){
            filters+="name?"+name+";";
        }
        params.put("filters", filters);
        params.put("page", page);
        params.put("size", size);
        params.put("version", version);
        try {
            HttpResponse response = HttpHelper.get(profileInnerUrl + url, params);
            ObjectResult result =  objectMapper.readValue(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
                envelop.setStatus(200);
            }else {
                envelop.setStatus(-1);
                envelop.setMessage(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setMessage(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    /**
     * 分页查找产品
     * @param name
     * @param classify
     * @param page
     * @param size
     * @return
     */
    public MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> findCompanyPage(String name, String classify, String companyId, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("name", name);
        params.put("classify", classify);
        params.put("companyId", companyId);
        params.put("page", page);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.FindProductPage, params);
        MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 分页查找产品
     * @param name
     * @param companyId
     * @param page
     * @param size
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> findProductPageByCompanyId(String name, String companyId, Integer page, Integer size) throws IOException{
        Map<String, Object> params = new HashMap<>();
        params.put("name", name);
        params.put("page", page);
        params.put("companyId", companyId);
        params.put("size", size);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.FindProductPageByCompanyId, params);
        MixEnvelop<IotProductBaseInfoVO, IotProductBaseInfoVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 创建产品
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotProductVO, IotProductVO> addProduct(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Product.AddProduct, params);
        MixEnvelop<IotProductVO, IotProductVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据id查找产品
     * @param id
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotProductVO, IotProductVO> findByCode(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.FindProductById, params);
        MixEnvelop<IotProductVO, IotProductVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 根据产品id查找维护单位
     * @param productId
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotMaintenanceUnitVO, IotMaintenanceUnitVO> maintenanceUnitById(String productId) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("productId", productId);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.MaintenanceUnitById, params);
        MixEnvelop<IotMaintenanceUnitVO, IotMaintenanceUnitVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 删除产品
     * @param id
     * @return
     * @throws IOException
     */
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public MixEnvelop<IotProductVO, IotProductVO> delCompany(String id) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("id", id);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Product.DelProduct, params);
        MixEnvelop<IotProductVO, IotProductVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
    /**
     * 修改产品信息
     * @param jsonData
     * @return
     * @throws IOException
     */
    public MixEnvelop<IotProductVO, IotProductVO> updCompany(String jsonData) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("jsonData", jsonData);
        HttpResponse response = HttpHelper.post(iotUrl + ServiceApi.Product.UpdProduct, params);
        MixEnvelop<IotProductVO, IotProductVO> envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
        return envelop;
    }
}

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

@ -1,303 +0,0 @@
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.jw.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.web.MixEnvelop;
import io.swagger.annotations.ApiOperation;
import iot.device.LocationDataVO;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import java.io.IOException;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
/**
 * @author yeshijie on 2018/2/11.
 */
@Service
public class MonitoringHealthService extends BaseService {
    private Logger logger = LoggerFactory.getLogger(MonitoringHealthService.class);
    @Value("${third.wlyy.url}")
    private String wlyyUrl;
    @Value("${third.wlyy.appid}")
    private String appid;
    @Value("${third.wlyy.appsecret}")
    private String appSecret;
    public static Map<String,String> tokenMap = new HashMap<>();
    /**
     * 获取位置信息
     * @param diseaseCondition
     * @return
     */
    public MixEnvelop<LocationDataVO, LocationDataVO> findDeviceLocations(Integer diseaseCondition, Integer page, Integer size, String type) throws IOException {
        MixEnvelop<LocationDataVO, LocationDataVO> envelop = new MixEnvelop<>();
        MixEnvelop<LocationDataVO, LocationDataVO> envelopTmp = null;
        JSONArray jsonArray = new JSONArray();
        Integer total = 0;
        if(StringUtils.isNotBlank(type)){
            String re = searchpatientdevicesn(type, page, size);
            JSONObject json = JSON.parseObject(re);
            if(json.getInteger("status")==200){
                JSONObject data = json.getJSONObject("data");
                total = data.getInteger("total");
                JSONArray list = data.getJSONArray("list");
                for(int i=0;i<list.size();i++){
                    JSONArray jsonArrayTemp = new JSONArray();
                    JSONObject deviceSn = new JSONObject();
                    deviceSn.put("andOr","or");
                    deviceSn.put("field","deviceSn");
                    deviceSn.put("condition","=");
                    deviceSn.put("value",list.getString(i));
                    jsonArrayTemp.add(deviceSn);
                    JSONObject jsonObject = new JSONObject();
                    jsonObject.put("filter",jsonArray);
                    jsonObject.put("page",page);
                    jsonObject.put("size",size);
                    Map<String, Object> params = new HashMap<>();
                    params.put("jsonData", jsonObject.toString());
                    HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.PatientDevice.findLocationByIdCard, params);
                    envelopTmp = objectMapper.readValue(response.getBody(),MixEnvelop.class);
                    envelop.getDetailModelList().addAll(envelopTmp.getDetailModelList());
                }
            }
            envelop.setTotalCount(total);
            return envelop;
        }else {
            //查找全部
            if(diseaseCondition!=null){
                JSONObject json = new JSONObject();
                json.put("andOr","and");
                json.put("field","diseaseCondition");
                json.put("condition","=");
                json.put("value",diseaseCondition);
                jsonArray.add(json);
            }
            JSONObject jsonObject = new JSONObject();
            jsonObject.put("filter",jsonArray);
            jsonObject.put("page",page);
            jsonObject.put("size",size);
            Map<String, Object> params = new HashMap<>();
            params.put("jsonData", jsonObject.toString());
            HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.PatientDevice.findLocationByIdCard, params);
            envelop = objectMapper.readValue(response.getBody(),MixEnvelop.class);
            return envelop;
        }
    }
    /**
     * 根据病种类型,搜索已绑定设备的居民设备SN码
     * 类型(1高血压 2糖尿病)
     */
    public String searchpatientdevicesn(String type,Integer page,Integer size){
        String url = "/wlyygc/iot_monitoring/searchpatientdevicesn";
        Map<String, Object> params = new HashMap<>();
        params.put("type",type);
        params.put("page",page);
        params.put("pageSize",size);
        return sendGet(url,params);
    }
    /**
     * 访问i健康接口,自带登录信息
     * @param url
     * @return
     */
    private String sendGet(String url,Map<String, Object> params){
        params.put("accesstoken",getAccessToken());
        HttpResponse response = HttpHelper.get(wlyyUrl + url, params);
        return response.getBody();
    }
    /**
     * 返回accessToken
     * @return
     * @throws IOException
     */
    private synchronized String getAccessToken(){
        String token = "";
        if(tokenMap.get("token")!=null){
            token = tokenMap.get("token");
            String time = tokenMap.get("time");
            Date start = DateUtil.strToDate(time);
            long m = (System.currentTimeMillis()-start.getTime())/1000;
            long overTime = 15*6*60;//1.5小时
            if(m<overTime){
                return token;
            }
        }
        Map<String, Object> params = new HashMap<>();
        params.put("appid", appid);
        params.put("appSecret", appSecret);
        String url = "/gc/accesstoken";
        HttpResponse response = HttpHelper.post(wlyyUrl + url, params);
        JSONObject jsonObject = JSON.parseObject(response.getBody());
        if(jsonObject.getInteger("status")==10000){
            String accesstoken = jsonObject.getJSONObject("result").getString("accesstoken");
            tokenMap.put("token",accesstoken);
            tokenMap.put("time", DateUtil.toString(new Date(), DateUtil.DEFAULT_YMDHMSDATE_FORMAT));
            return accesstoken;
        }
        return null;
    }
    /**
     * 设备发放情况
     */
    public String equipmentDistribution(){
        String url = "/wlyygc/iot_monitoring/equipmentDistribution";
        Map<String, Object> params = new HashMap<>();
        return sendGet(url,params);
    }
    /**
     * 慢病患者情况-统计
     * 类型(2糖尿病,1高血压)
     */
    public String chronicDiseaseCount(String type){
        String url = "/wlyygc/iot_monitoring/chronicDiseaseCount";
        Map<String, Object> params = new HashMap<>();
        params.put("type",type);
        return sendGet(url,params);
    }
    /**
     * 预警信息警报
     * @param page
     * @param pageSize
     * @return
     */
    public String warningInformationAlarm(Integer page,Integer pageSize){
        String url = "/wlyygc/iot_monitoring/warningInformationAlarm";
        Map<String, Object> params = new HashMap<>();
        params.put("page",page);
        params.put("pageSize",pageSize);
        return sendGet(url,params);
    }
    /**
     * 居民 医生搜索
     * @param page
     * @param pageSize
     * @return
     */
    public String searchPatient(String name,Integer page,Integer pageSize,String idcards){
        String url = "/wlyygc/iot_monitoring/searchPatient";
        Map<String, Object> params = new HashMap<>();
        params.put("name",name);
        params.put("page",page);
        params.put("pageSize",pageSize);
        params.put("idcards",idcards);
        return sendGet(url,params);
    }
    /**
     * 设备绑定情况
     * @param type 设备类型(1血糖仪,2血压计
     * @return
     */
    public String deviceBinding(String type){
        String url = "/wlyygc/iot_monitoring/deviceBinding";
        Map<String, Object> params = new HashMap<>();
        params.put("type",type);
        return sendGet(url,params);
    }
    /**
     * 个人信息
     * @param patient
     * @return
     */
    @RequestMapping(value = "/persionalInfo",method = RequestMethod.GET)
    @ApiOperation("个人信息")
    public String persionalInfo(String patient){
        String url = "/wlyygc/iot_monitoring/persionalInfo";
        Map<String, Object> params = new HashMap<>();
        params.put("patient",patient);
        return sendGet(url,params);
    }
    /**
     * 家人信息
     * @param patient
     * @return
     */
    public String familyMember(String patient){
        String url = "/wlyygc/iot_monitoring/familyMember";
        Map<String, Object> params = new HashMap<>();
        params.put("patient",patient);
        return sendGet(url,params);
    }
    /**
     * 健康设备
     * @param patient
     * @return
     */
    @RequestMapping(value = "/healthDevice",method = RequestMethod.GET)
    @ApiOperation("健康设备")
    public String healthDevice(String patient){
        String url = "/wlyygc/iot_monitoring/healthDevice";
        Map<String, Object> params = new HashMap<>();
        params.put("patient",patient);
        return sendGet(url,params);
    }
    /**
     * 体征数据
     * @param patient
     * @param type
     * @param gi_type
     * @param begin
     * @param end
     * @return
     */
    public String getHealthIndexChartByPatient(String patient, Integer type, Integer gi_type, String begin, String end,String time) {
        String url = "/wlyygc/iot_monitoring/chart";
        Map<String, Object> params = new HashMap<>();
        params.put("patient",patient);
        params.put("type",type);
        params.put("time",time);
        params.put("begin",begin);
        params.put("end",end);
        params.put("gi_type",gi_type);
        return sendGet(url,params);
    }
    /**
     * 获取门诊记录/住院记录(基卫+APP)
     * @param patient
     * @param type 类型(1血糖,2血压)
     * @param page
     * @param pageSize
     * @return
     */
    public String getAllEvent(String patient,String type,String page,String pageSize) {
        String url = "/wlyygc/iot_monitoring/event";
        Map<String, Object> params = new HashMap<>();
        params.put("patient",patient);
        params.put("type",type);
        params.put("page",page);
        params.put("pageSize",pageSize);
        return sendGet(url,params);
    }
}

+ 0 - 56
app/app-iot-server/src/main/java/com/yihu/iot/util/ControllerTools.java

@ -1,56 +0,0 @@
package com.yihu.iot.util;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.util.rest.Envelop;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
/**
 * @author lincl
 * @version 1.0
 * @created 2016/7/22
 */
public class ControllerTools {
    private static ObjectMapper objectMapper = new ObjectMapper();
    public static boolean isAjaxRequest(HttpServletRequest request) {
        return "XMLHttpRequest".equalsIgnoreCase(request.getHeader("X-Requested-With"));
    }
    public static void print(HttpServletResponse response, Envelop envelop) throws IOException {
        response.getWriter().print(toJson(envelop));
    }
    public static void print(HttpServletResponse response, String msg) throws IOException {
        response.getWriter().print(toJson(exception(msg)));
    }
    public static void print(HttpServletResponse response, Exception e) throws IOException {
        response.getWriter().print(toJson(exception(e)));
    }
    
    public static Envelop exception(Exception e) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
        envelop.setErrorMsg(e.getMessage());
        return envelop;
    }
    public static Envelop exception(String msg) {
        Envelop envelop = new Envelop();
        envelop.setSuccessFlg(false);
        envelop.setErrorMsg(msg);
        return envelop;
    }
    public static String toJson(Object data) {
        try {
            return objectMapper.writeValueAsString(data);
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        }
    }
}

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

@ -1,35 +0,0 @@
package com.yihu.iot.util;
import com.yihu.jw.agModel.user.UserDetailModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.session.SessionInformation;
import org.springframework.security.core.session.SessionRegistry;
import org.springframework.stereotype.Component;
import javax.servlet.http.HttpServletRequest;
/**
 * @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;
    }
}

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

@ -1,21 +0,0 @@
package com.yihu.iot.util;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.springframework.beans.factory.annotation.Autowired;
import java.io.IOException;
/**
 * @author lincl
 * @version 1.0
 * @created 2016/7/25
 */
public class ObjectMapperUtil {
    @Autowired
    static ObjectMapper objectMapper = new ObjectMapper();
    public static Object toModel(String json, TypeReference typeReference) throws IOException {
        return objectMapper.readValue(json, typeReference);
    }
}

+ 0 - 143
app/app-iot-server/src/main/java/com/yihu/iot/util/conceal/ConcealUtil.java

@ -1,143 +0,0 @@
package com.yihu.iot.util.conceal;
/**
 * 数据脱敏工具
 * Created by zdm on 2019/4/2.
 */
public class ConcealUtil {
    private static final int SIZE = 6;
    private static final String SYMBOL = "*";
    /**
     * 电话号码脱敏,达到保密效果
     *
     * @param userName 用户名
     * @return 替换后的用户名
     */
    public static String phoneConceal(String userName) {
        String userNameAfterReplaced = "";
        if (userName == null) {
            userName = "";
        }
        int nameLength = userName.length();
        if (nameLength <= 1) {
            userNameAfterReplaced = "*";
        } else if (nameLength == 2) {
            userNameAfterReplaced = replaceAction(userName, "(?<=\\d{0})\\d(?=\\d{1})");
        } else if (nameLength >= 3 && nameLength <= 6) {
            userNameAfterReplaced = replaceAction(userName, "(?<=\\d{1})\\d(?=\\d{1})");
        } else if (nameLength >= 7 && nameLength <= 10) {
            userNameAfterReplaced = replaceAction(userName, "(?<=\\d{3})\\d(?=\\d{3})");
        } else if (nameLength >= 11) {
            userNameAfterReplaced = replaceAction(userName, "(?<=\\d{3})\\d(?=\\d{4})");
        }
        return userNameAfterReplaced;
    }
    /**
     * 实际替换动作
     *
     * @param username username
     * @param regular  正则
     * @return
     */
    private static String replaceAction(String username, String regular) {
        return username.replaceAll(regular, "*");
    }
    /**
     * 身份证号替换,保留前四位和后四位
     * <p>
     * 如果身份证号为空 或者 null ,返回null ;否则,返回替换后的字符串;
     *
     * @param idCard 身份证号
     * @return
     */
    public static String idCardConceal(String idCard) {
        if (idCard.isEmpty() || idCard == null) {
            return null;
        } else {
            return replaceAction(idCard, "(?<=\\d{6})\\d(?=\\d{4})");
        }
    }
    /**
     * 银行卡替换,保留后四位
     * <p>
     * 如果银行卡号为空 或者 null ,返回null ;否则,返回替换后的字符串;
     *
     * @param bankCard 银行卡号
     * @return
     */
    public static String bankCardConceal(String bankCard) {
        if (bankCard.isEmpty() || bankCard == null) {
            return null;
        } else {
            return replaceAction(bankCard, "(?<=\\d{0})\\d(?=\\d{4})");
        }
    }
    /**
     * 姓名及地址脱敏
     * @param value
     * @return
     */
    public static String nameOrAddrConceal(String value) {
        if (null == value || "".equals(value)) {
            return value;
        }
        int len = value.length();
        int pamaone = len / 2;
        int pamatwo = pamaone - 1;
        int pamathree = len % 2;
        StringBuilder stringBuilder = new StringBuilder();
        if (len <= 2) {
            if (pamathree == 1) {
                return SYMBOL;
            }
            stringBuilder.append(value.charAt(0));
            stringBuilder.append(SYMBOL);
        } else {
            if (pamatwo <= 0) {
                stringBuilder.append(value.substring(0, 1));
                stringBuilder.append(SYMBOL);
                stringBuilder.append(value.substring(len - 1, len));
            } else if (pamatwo >= SIZE / 2 && SIZE + 1 != len) {
                int pamafive = (len - SIZE) / 2;
                stringBuilder.append(value.substring(0, pamafive));
                for (int i = 0; i < SIZE; i++) {
                    stringBuilder.append(SYMBOL);
                }
                if ((pamathree == 0 && SIZE / 2 == 0) || (pamathree != 0 && SIZE % 2 != 0)) {
                    stringBuilder.append(value.substring(len - pamafive, len));
                } else {
                    stringBuilder.append(value.substring(len - (pamafive + 1), len));
                }
            } else {
                int pamafour = len - 2;
                stringBuilder.append(value.substring(0, 1));
                for (int i = 0; i < pamafour; i++) {
                    stringBuilder.append(SYMBOL);
                }
                stringBuilder.append(value.substring(len - 1, len));
            }
        }
        return stringBuilder.toString();
    }
/*    public static void main(String[] args) throws IOException {
        String strName= nameOrAddrConceal("张三");
        System.out.println(strName);
        String addr= nameOrAddrConceal("厦门市");
        System.out.println(addr);
        String idcard= idCardConceal("350825199012033283");
        System.out.println(idcard);
        String phone= phoneConceal("17689202624");
        System.out.println(phone);
    }*/
}

+ 0 - 89
app/app-iot-server/src/main/java/com/yihu/iot/util/encode/AES.java

@ -1,89 +0,0 @@
package com.yihu.iot.util.encode;
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;
import javax.crypto.spec.SecretKeySpec;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * @created Air 2015/6/2.
 */
public class AES {
    public static String encrypt(String encData ,String secretKey, String vector) throws Exception {
        if (StringUtil.isEmpty(encData)) {
            return "";
        }
        if(secretKey == null) {
            return null;
        }
        if(secretKey.length() != 16) {
            return null;
        }
        Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
        byte[] raw = secretKey.getBytes();
        SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
        IvParameterSpec iv = new IvParameterSpec(vector.getBytes());// 使用CBC模式,需要一个向量iv,可增加加密算法的强度
        cipher.init(Cipher.ENCRYPT_MODE, skeySpec, iv);
        return Base64.encode(cipher.doFinal(encData.getBytes("utf-8")));// 此处使用BASE64做转码。
    }
    public static String decrypt(String sSrc, String key, String ivs) throws Exception {
        if (StringUtil.isEmpty(sSrc)) {
            return "";
        }
        try {
            byte[] raw = key.getBytes("ASCII");
            SecretKeySpec skeySpec = new SecretKeySpec(raw, "AES");
            Cipher cipher = Cipher.getInstance("AES/CBC/PKCS5Padding");
            IvParameterSpec iv = new IvParameterSpec(ivs.getBytes());
            cipher.init(Cipher.DECRYPT_MODE, skeySpec, iv);
            byte[] encrypted1 = Base64.decode(sSrc);// 先用base64解密
            byte[] original = cipher.doFinal(encrypted1);
            String originalString = new String(original, "utf-8");
            return originalString;
        } catch (Exception ex) {
            return null;
        }
    }
    /**
     * 生成长度为16倍数的DES密钥,不足则末位补0
     *  格式:conten+YYYYMMDD时间+ 补位符0
     * @param content 密钥
     * @return 长度为16倍数的密钥
     */
    public static String genAesPass(String content) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.DEFAULT_CHAR_DATE_YMD_FORMAT);
        StringBuffer passWordBuffer = new StringBuffer();
        passWordBuffer = passWordBuffer.append(content).append(sdf.format(new Date()));
        Integer remainder = passWordBuffer.length() % 16;
        if (remainder != 0) {
            for (int i = 0; i < 16-remainder; i++) {
                passWordBuffer.append(0);
            }
        }
        return MD5.hash(passWordBuffer.toString()).toUpperCase();
    }
    public static String genKey(String content) throws Exception {
        if (StringUtil.isEmpty(content)) {
            return "";
        }
        return genAesPass(content).substring(0, 16).toUpperCase();
    }
    public static String genIV(String content) throws Exception {
        if (StringUtil.isEmpty(content)) {
            return "";
        }
        String iv = genAesPass(content);
        return iv.substring(iv.length() - 16, iv.length()).toUpperCase();
    }
}

+ 0 - 132
app/app-iot-server/src/main/java/com/yihu/iot/util/encode/Base64.java

@ -1,132 +0,0 @@
package com.yihu.iot.util.encode;
/**
 * 标准Base64编解码,具体规范请参见相关文档。
 */
public class Base64 {
    /**
     * Base64编码表。
     */
    private static char Base64Code[] = {
            'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P',
            'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f',
            'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
            'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/',
    };
    /**
     * Base64解码表。
     */
    private static byte Base64Decode[] = {
            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,  //注意两个63,为兼容SMP,
            -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 63, -1, 63,  //“/”和“-”都翻译成63。
            52, 53, 54, 55, 56, 57, 58, 59, 60, 61, -1, -1, -1, 0, -1, -1,
            -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,  //注意两个0:
            15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, -1, -1, -1, -1, -1,  //“A”和“=”都翻译成0。
            -1, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
            41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, -1, -1, -1, -1, -1,
    };
    /**
     * 构造方法私有化,防止实例化。
     */
    private Base64() {
    }
    /**
     * Base64编码。将字节数组中字节3个一组编码成4个可见字符。
     *
     * @param b 需要被编码的字节数据。
     * @return 编码后的Base64字符串。
     */
    public static String encode(byte[] b) {
        int code = 0;
        //按实际编码后长度开辟内存,加快速度
        StringBuffer sb = new StringBuffer(((b.length - 1) / 3) << 2 + 4);
        //进行编码
        for (int i = 0; i < b.length; i++) {
            code |= (b[i] << (16 - i % 3 * 8)) & (0xff << (16 - i % 3 * 8));
            if (i % 3 == 2 || i == b.length - 1) {
                sb.append(Base64Code[(code & 0xfc0000) >>> 18]);
                sb.append(Base64Code[(code & 0x3f000) >>> 12]);
                sb.append(Base64Code[(code & 0xfc0) >>> 6]);
                sb.append(Base64Code[code & 0x3f]);
                code = 0;
            }
        }
        //对于长度非3的整数倍的字节数组,编码前先补0,编码后结尾处编码用=代替,
        //=的个数和短缺的长度一致,以此来标识出数据实际长度
        if (b.length % 3 > 0) {
            sb.setCharAt(sb.length() - 1, '=');
        }
        if (b.length % 3 == 1) {
            sb.setCharAt(sb.length() - 2, '=');
        }
        return sb.toString();
    }
    /**
     * Base64解码。
     *
     * @param code 用Base64编码的ASCII字符串
     * @return 解码后的字节数据
     */
    public static byte[] decode(String code) {
        //检查参数合法性
        if (code == null) {
            return null;
        }
        int len = code.length();
        if (len % 4 != 0) {
            throw new IllegalArgumentException("Base64 string length must be 4*n");
        }
        if (code.length() == 0) {
            return new byte[0];
        }
        //统计填充的等号个数
        int pad = 0;
        if (code.charAt(len - 1) == '=') {
            pad++;
        }
        if (code.charAt(len - 2) == '=') {
            pad++;
        }
        int retLen = len / 4 * 3 - pad;
        byte[] ret = new byte[retLen];
        char ch1, ch2, ch3, ch4;
        int i;
        for (i = 0; i < len; i += 4) {
            int j = i / 4 * 3;
            ch1 = code.charAt(i);
            ch2 = code.charAt(i + 1);
            ch3 = code.charAt(i + 2);
            ch4 = code.charAt(i + 3);
            int tmp = (Base64Decode[ch1] << 18) | (Base64Decode[ch2] << 12)
                    | (Base64Decode[ch3] << 6) | (Base64Decode[ch4]);
            ret[j] = (byte) ((tmp & 0xff0000) >> 16);
            if (i < len - 4) {
                ret[j + 1] = (byte) ((tmp & 0x00ff00) >> 8);
                ret[j + 2] = (byte) ((tmp & 0x0000ff));
            } else {
                if (j + 1 < retLen) {
                    ret[j + 1] = (byte) ((tmp & 0x00ff00) >> 8);
                }
                if (j + 2 < retLen) {
                    ret[j + 2] = (byte) ((tmp & 0x0000ff));
                }
            }
        }
        return ret;
    }
}

+ 0 - 67
app/app-iot-server/src/main/java/com/yihu/iot/util/encode/DES.java

@ -1,67 +0,0 @@
package com.yihu.iot.util.encode;
import com.yihu.iot.util.operator.DateUtil;
import com.yihu.iot.util.operator.StringUtil;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import javax.crypto.SecretKeyFactory;
import javax.crypto.spec.DESKeySpec;
import java.text.SimpleDateFormat;
import java.util.Date;
/**
 * @created Air 2015/6/2.
 */
public class DES {
    public static String encrypt(String data, String passWord) throws Exception {
        if (StringUtil.isEmpty(data)) {
            return "";
        }
        DESKeySpec desKey = new DESKeySpec(passWord.getBytes("UTF-8"));
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
        SecretKey secretKey = keyFactory.generateSecret(desKey);
        Cipher cipher = Cipher.getInstance("DES");
        cipher.init(Cipher.ENCRYPT_MODE, secretKey);
        return Base64.encode(cipher.doFinal(data.getBytes("UTF-8")));
    }
    public static String decrypt(String data, String passWord) throws Exception {
        if (StringUtil.isEmpty(data)) {
            return "";
        }
        DESKeySpec desKey = new DESKeySpec(passWord.getBytes("UTF-8"));
        SecretKeyFactory keyFactory = SecretKeyFactory.getInstance("DES");
        SecretKey secretKey = keyFactory.generateSecret(desKey);
        Cipher cipher = Cipher.getInstance("DES");
        cipher.init(Cipher.DECRYPT_MODE, secretKey);
        return new String(cipher.doFinal(Base64.decode(data)), "UTF-8");
    }
    /**
     * 生成长度为16倍数的DES密钥,不足则末位补0
     *  格式:conten+YYYYMMDD时间+ 补位符0
     * @param content 密钥
     * @return 长度为16倍数的密钥
     */
    public static String genDesPass(String content) throws Exception {
        SimpleDateFormat sdf = new SimpleDateFormat(DateUtil.DEFAULT_CHAR_DATE_YMD_FORMAT);
        StringBuffer passWordBuffer = new StringBuffer();
        if (StringUtil.isEmpty(content)) {
            return "";
        }
        passWordBuffer = passWordBuffer.append(content).append(sdf.format(new Date()));
        Integer remainder = passWordBuffer.length() % 16;
        if (remainder != 0) {
            for (int i = 0; i < 16-remainder; i++) {
                passWordBuffer.append(0);
            }
        }
        return passWordBuffer.toString();
    }
}

+ 0 - 29
app/app-iot-server/src/main/java/com/yihu/iot/util/encode/HexEncode.java

@ -1,29 +0,0 @@
package com.yihu.iot.util.encode;
/**
 * @created Created by Air on 2015/6/2.
 */
public class HexEncode {
    static public String toHexString(byte[] bytes) {
        StringBuilder stringBuffer = new StringBuilder();
        for (byte aByte : bytes) {
            if (Integer.toHexString(0xFF & aByte).length() == 1) {
                stringBuffer.append("0").append(Integer.toHexString(0xFF & aByte));
            } else {
                stringBuffer.append(Integer.toHexString(0xFF & aByte));
            }
        }
        return stringBuffer.toString();
    }
    static public byte[] toBytes(String hexString) {
        byte[] bytes;
        bytes = new byte[hexString.length() / 2];
        for (int i = 0; i < bytes.length; i++) {
            bytes[i] = (byte) Integer.parseInt(hexString.substring(2 * i, 2 * i + 2), 16);
        }
        return bytes;
    }
}

+ 0 - 118
app/app-iot-server/src/main/java/com/yihu/iot/util/encode/RSA.java

@ -1,118 +0,0 @@
package com.yihu.iot.util.encode;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import javax.crypto.Cipher;
import java.security.*;
import java.security.interfaces.RSAPrivateKey;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.InvalidKeySpecException;
import java.security.spec.PKCS8EncodedKeySpec;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;
import java.util.HashMap;
/**
 * RSA加密辅助类,采用Base64编码
 *
 * @created Air  2015/6/02.
 */
public class RSA {
    public static final String PUBLIC_KEY = "public";
    public static final String PRIVATE_KEY = "private";
    public static final String KEY_ALGORITHM = "RSA";
    private static Logger logger = LogManager.getLogger(RSA.class);
    /**
     * 生成公钥和私钥
     *
     * @throws NoSuchAlgorithmException
     */
    public static HashMap<String, Key> generateKeys() throws NoSuchAlgorithmException {
        KeyPairGenerator keyPairGen = KeyPairGenerator.getInstance(KEY_ALGORITHM);
        keyPairGen.initialize(1024);
        KeyPair keyPair = keyPairGen.generateKeyPair();
        RSAPublicKey publicKey = (RSAPublicKey) keyPair.getPublic();
        RSAPrivateKey privateKey = (RSAPrivateKey) keyPair.getPrivate();
        HashMap<String, Key> map = new HashMap<>();
        map.put(PUBLIC_KEY, publicKey);
        map.put(PRIVATE_KEY, privateKey);
        return map;
    }
    public static String encodeKey(Key key) {
        return new String(Base64.getEncoder().encode(key.getEncoded()));
    }
    public static Key genPrivateKey(String key) {
        byte[] bytes = Base64.getDecoder().decode(key);
        PKCS8EncodedKeySpec pkcs8KeySpec = new PKCS8EncodedKeySpec(bytes);
        try {
            KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
            return keyFactory.generatePrivate(pkcs8KeySpec);
        } catch (NoSuchAlgorithmException | InvalidKeySpecException ex) {
            logger.error(ex.getMessage());
        }
        return null;
    }
    public static Key genPublicKey(String key) {
        byte[] bytes = Base64.getDecoder().decode(key);
        X509EncodedKeySpec x509KeySpec = new X509EncodedKeySpec(bytes);
        try {
            KeyFactory keyFactory = KeyFactory.getInstance(KEY_ALGORITHM);
            return keyFactory.generatePublic(x509KeySpec);
        } catch (NoSuchAlgorithmException | InvalidKeySpecException ex) {
            logger.error(ex.getMessage());
        }
        return null;
    }
    /**
     * @param data 明文
     * @param key  密钥
     * @return HexString密文
     * @throws Exception
     */
    public static String encrypt(String data, Key key) throws Exception {
        Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
        cipher.init(Cipher.ENCRYPT_MODE, key);
        return new String(Base64.getEncoder().encode(cipher.doFinal(data.getBytes())));
    }
    /**
     * @param data HexString密文
     * @param key  密钥
     * @return 明文
     * @throws Exception
     */
    public static String decrypt(String data, Key key) throws Exception {
        Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
        cipher.init(Cipher.DECRYPT_MODE, key);
        //return new String(cipher.doFinal(HexEncode.toBytes(data)));
        return new String(cipher.doFinal(Base64.getDecoder().decode(data)));
    }
    /**
     *  通过字符串私钥加密
     * @param data   明文
     * @param privateKey 字符串私钥
     * @return  密文
     * @throws Exception
     */
    public static String encryptByPriKey(String data, String privateKey) throws Exception {
        Cipher cipher = Cipher.getInstance(KEY_ALGORITHM);
        cipher.init(Cipher.ENCRYPT_MODE, genPrivateKey(privateKey));
        return new String(Base64.getEncoder().encode(cipher.doFinal(data.getBytes())));
    }
}

+ 0 - 70
app/app-iot-server/src/main/java/com/yihu/iot/util/excel/AExcelReader.java

@ -1,70 +0,0 @@
package com.yihu.iot.util.excel;
import jxl.Sheet;
import jxl.Workbook;
import java.io.File;
import java.io.InputStream;
import java.util.*;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * @author lincl
 * @version 1.0
 * @created 2016/6/18
 */
public abstract class AExcelReader {
    protected List errorLs = new ArrayList<>();
    protected List correctLs = new ArrayList<>();
    protected Map<String, Set> repeat = new HashMap<>();
    private static Pattern blankPattern = Pattern.compile("\\s*|\t|\r|\n");
    public abstract void read(Workbook rwb) throws Exception;
    public void read(File file) throws Exception {
        read(Workbook.getWorkbook(file));
    }
    public void read(InputStream is) throws Exception {
        read(Workbook.getWorkbook(is));
    }
    public static String replaceBlank(String str) {
        String dest = "";
        if (str!=null) {
            //去除字符串中的空格、回车、换行符、制表符
            Matcher m = blankPattern.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
    protected String getCellCont(Sheet sheet, int row, int col){
        return sheet.getCell(col, row).getContents();
    }
    public List getErrorLs() {
        return errorLs;
    }
    public void setErrorLs(List errorLs) {
        this.errorLs = errorLs;
    }
    public List getCorrectLs() {
        return correctLs;
    }
    public void setCorrectLs(List correctLs) {
        this.correctLs = correctLs;
    }
    public Map<String, Set> getRepeat() {
        return repeat;
    }
    public void setRepeat(Map<String, Set> repeat) {
        this.repeat = repeat;
    }
}

+ 0 - 33
app/app-iot-server/src/main/java/com/yihu/iot/util/excel/reader/IotDeviceImportVOReader.java

@ -1,33 +0,0 @@
package com.yihu.iot.util.excel.reader;
import com.yihu.iot.util.excel.AExcelReader;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportVO;
import jxl.Sheet;
import jxl.Workbook;
/**
 * @author yeshijie on 2018/1/23.
 */
public class IotDeviceImportVOReader extends AExcelReader {
    @Override
    public void read(Workbook rwb) throws Exception {
        try {
            Sheet sheet = rwb.getSheet(0) ;
            for (int i = 1; i < sheet.getRows(); i++) {
                IotDeviceImportVO device = new IotDeviceImportVO();
                device.setDeviceSn(getCellCont(sheet, i, 0));
                device.setHospital(getCellCont(sheet, i, 1));
                device.setSim(getCellCont(sheet, i, 2).trim());
                correctLs.add(device);
            }
        } catch (Exception e) {
            throw new RuntimeException("模板不正确,请下载新的模板,并按照示例正确填写后上传!");
        } finally {
            if (rwb != null){
                rwb.close();
            }
        }
    }
}

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

@ -1,357 +0,0 @@
package com.yihu.iot.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 - 367
app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpClientUtil.java

@ -1,367 +0,0 @@
package com.yihu.iot.util.http;
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;
import org.apache.http.client.CredentialsProvider;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.*;
import org.apache.http.client.protocol.HttpClientContext;
import org.apache.http.client.utils.URLEncodedUtils;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.entity.mime.content.FileBody;
import org.apache.http.impl.client.BasicCredentialsProvider;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.protocol.HTTP;
import org.apache.http.util.EntityUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import java.io.*;
import java.nio.charset.Charset;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by hzp on 2016/4/14.
 */
public class HttpClientUtil {
    /**
     * 发送post请求
     * @param url     请求地址
     * @param params  请求参数
     * @return
     */
    public static String postBody(String url, String params,Map<String,Object> header,SSLConnectionSocketFactory ssl, String user, String password) {
        RestTemplate restTemplate = new RestTemplate();
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        org.springframework.http.HttpEntity<String> formEntity = new org.springframework.http.HttpEntity<String>(params, headers);
        String ret = restTemplate.postForObject(url, formEntity, String.class);
        return ret;
    }
    /**************************** 私有方法 *****************************************/
    private static CloseableHttpClient getCloseableHttpClient(SSLConnectionSocketFactory ssl) {
        if(ssl == null)
        {
            return HttpClients.createDefault();
        }
        else{
            CloseableHttpClient httpClient = HttpClients.custom()
                    .setSSLSocketFactory(ssl)
                    .build();
            return httpClient;
        }
    }
    private static void close(CloseableHttpClient httpClient, CloseableHttpResponse response) {
        try {
            if (httpClient != null) {
                httpClient.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
        try {
            if (response != null) {
                response.close();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
    private static HttpRequestBase getRequest(String method,String url,Map<String,Object> params,Map<String,Object> header) throws Exception
    {
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        //配置参数
        if(params!=null) {
            for (String key : params.keySet()) {
                if (!StringUtil.isEmpty(String.valueOf(params.get(key))) && !"null".equals( String.valueOf(params.get(key)))) {
                    jsonParams.add(new BasicNameValuePair(key, String.valueOf(params.get(key))));
                }
            }
        }
        HttpRequestBase request;
        if(method.equals("POST"))
        {
            request = new HttpPost(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
        }
        else if(method.equals("PUT"))
        {
            request = new HttpPut(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
        }
        else if(method.equals("DELETE"))
        {
            request = new HttpDelete(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
        }
        else
        {
            request = new HttpGet(url + "?" + URLEncodedUtils.format(jsonParams, Consts.UTF_8));
        }
        //配置头部信息
        if(header!=null)
        {
            for (String key : header.keySet()) {
                request.addHeader(key, header.get(key).toString());
            }
        }
        return request;
    }
    /****************************** 公用方法 *******************************************/
    /**
     * get请求
     */
    public static HttpResponse request(String method, String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl, String user, String password) {
        HttpResponse re = new HttpResponse();
        CloseableHttpResponse response = null;
        CloseableHttpClient httpclient = getCloseableHttpClient(ssl);
        //设置请求信息
        try {
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            HttpRequestBase request = getRequest(method,url,params,header);
            request.setConfig(requestConfig);
            //需要验证
            if (!StringUtils.isEmpty(user) && !StringUtils.isEmpty(password)) {
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),new org.apache.http.auth.UsernamePasswordCredentials(user, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(request, context);
            } else {
                response = httpclient.execute(request);
            }
            re.setBody(EntityUtils.toString(response.getEntity(), "UTF-8"));
            re.setStatusCode(response.getStatusLine().getStatusCode());
        } catch (Exception e) {
            re.setStatusCode(201);
            re.setBody(e.getMessage());
            e.printStackTrace();
        } finally {
            close(httpclient, response);
        }
        return re;
    }
    /**
     * 发送文件
     *
     * @param url        路径
     * @param formParams 参数
     * @return
     */
    public static HttpResponse postFile(String url,
                                        File file, List<NameValuePair> formParams, SSLConnectionSocketFactory ssl, String username, String password, Map<String,Object> header) {
        HttpResponse re = new HttpResponse();
        CloseableHttpResponse response = null;
        CloseableHttpClient httpClient = getCloseableHttpClient(ssl);
        try{
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //创建httppost请求
            HttpPost httpPost = new HttpPost(url);
            if(header!=null) {
                for (String key : header.keySet()) {
                    httpPost.addHeader(key, header.get(key).toString());
                }
            }
            httpPost.setConfig(requestConfig);
            //新建文件对象并且设置文件
            FileBody bin = new FileBody(file);
            MultipartEntityBuilder reqEntity = MultipartEntityBuilder.create();
            reqEntity.addBinaryBody("pack", file);
            //设置参数
            if (formParams != null && formParams.size() > 0) {
                for (NameValuePair nv : formParams) {
                    reqEntity.addTextBody(nv.getName(), nv.getValue(), ContentType.create("text/plain", Charset.forName(HTTP.UTF_8)));
                }
            }
            httpPost.setEntity(reqEntity.build());
            //设置验证
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpClient.execute(httpPost, context);
            } else {
                response = httpClient.execute(httpPost);
            }
            re.setStatusCode(response.getStatusLine().getStatusCode());
            re.setBody(EntityUtils.toString(response.getEntity(), "UTF-8"));;
        } catch (Exception e) {
            re.setStatusCode(201);
            re.setBody(e.getMessage());
            e.printStackTrace();
        } finally {
            close(httpClient, response);
        }
        return re;
    }
    /**
     * 发送File
     */
    public static File downLoadFileByBase64(String filePath, Map<String, Object> params, String url, String username, String password) {
        File file = null;
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = getCloseableHttpClient(null);
        try {
            HttpPost httpPost = new HttpPost(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            //设置参数
            List<NameValuePair> formparams = new ArrayList<NameValuePair>();
            for (Map.Entry<String, Object> entry : params.entrySet()) {
                formparams.add(new BasicNameValuePair(entry.getKey(), String.valueOf(entry.getValue())));
            }
            UrlEncodedFormEntity entity = new UrlEncodedFormEntity(formparams, Consts.UTF_8);
            httpPost.setEntity(entity);
            httpPost.setConfig(requestConfig);
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpPost, context);
            } else {
                response = httpclient.execute(httpPost);
            }
            HttpEntity httpEntity = response.getEntity();
            String responString = EntityUtils.toString(httpEntity, "UTF-8");
            file = new File(filePath);
            file.getParentFile().mkdirs();
            InputStream i = new ByteArrayInputStream(Base64.decode(responString));
            FileOutputStream fileout = new FileOutputStream(file);
            /**
             * 根据实际运行效果 设置缓冲区大小
             */
            byte[] buffer = new byte[1024];
            int ch = 0;
            while ((ch = i.read(buffer)) != -1) {
                fileout.write(buffer, 0, ch);
            }
            i.close();
            fileout.flush();
            fileout.close();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            close(httpclient, response);
        }
        return file;
    }
    public static HttpResponse postForm(String url, List<NameValuePair> formParams) {
        CloseableHttpClient httpClient = HttpClients.createDefault();
        UrlEncodedFormEntity postEntity = new UrlEncodedFormEntity(formParams, Consts.UTF_8);
        HttpPost httpPost = new HttpPost(url);
        httpPost.setEntity(postEntity);
        CloseableHttpResponse response = null;
        HttpEntity entity = null;
        try {
            response = httpClient.execute(httpPost);
            entity = response.getEntity();
            HttpResponse res = new HttpResponse(response.getStatusLine().getStatusCode(), EntityUtils.toString(entity));
            return res;
        } catch (IOException e) {
            e.printStackTrace();
        } finally {
            close(httpClient, response);
        }
        return null;
    }
    /**
     * 下载文件
     */
    public static File downLoadFile(String filePath, String url, String username, String password) {
        File file = null;
        CloseableHttpResponse response = null;
        List<BasicNameValuePair> jsonParams = new ArrayList<>();
        CloseableHttpClient httpclient = getCloseableHttpClient(null);
        try {
            HttpGet httpGet = new HttpGet(url);
            //设置请求信息
            RequestConfig requestConfig = RequestConfig.custom().
                    setAuthenticationEnabled(true).build();
            if (!StringUtils.isEmpty(username) && !StringUtils.isEmpty(password)) {
                //需要验证
                HttpClientContext context = HttpClientContext.create();
                //通过http的上下文设置账号密码
                CredentialsProvider credsProvider = new BasicCredentialsProvider();
                credsProvider.setCredentials(new org.apache.http.auth.AuthScope(org.apache.http.auth.AuthScope.ANY_HOST, org.apache.http.auth.AuthScope.ANY_PORT),
                        new org.apache.http.auth.UsernamePasswordCredentials(username, password));
                context.setCredentialsProvider(credsProvider);
                response = httpclient.execute(httpGet, context);
            } else {
                response = httpclient.execute(httpGet);
            }
            HttpEntity httpEntity = response.getEntity();
            InputStream is = httpEntity.getContent();
            file = new File(filePath);
            file.getParentFile().mkdirs();
            FileOutputStream fileout = new FileOutputStream(file);
            /**
             * 根据实际运行效果 设置缓冲区大小
             */
            byte[] buffer = new byte[1024];
            int ch = 0;
            while ((ch = is.read(buffer)) != -1) {
                fileout.write(buffer, 0, ch);
            }
            is.close();
            fileout.flush();
            fileout.close();
        } catch (Exception e) {
            e.printStackTrace();
            return null;
        } finally {
            close(httpclient, response);
        }
        return file;
    }
}

+ 0 - 260
app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpHelper.java

@ -1,260 +0,0 @@
package com.yihu.iot.util.http;
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;
import org.apache.http.ssl.SSLContexts;
import org.springframework.stereotype.Component;
import javax.net.ssl.SSLContext;
import java.io.File;
import java.util.List;
import java.util.Map;
@Component
public class HttpHelper {
    private static SSLConnectionSocketFactory defaultSSL;
    private static String defaultHttpUser;
    private static String defaultHttpPassword;
    static {
        //默认配置
        try {
            if (Constants.SSL_KEYSOTRE != null && Constants.SSL_KEYSOTRE.length() > 0 && Constants.SSL_PASSWORD != null && Constants.SSL_PASSWORD.length() > 0) {
                SSLContext sslContext = SSLContexts.custom()
                        .loadTrustMaterial(new File(Constants.SSL_KEYSOTRE), Constants.SSL_PASSWORD.toCharArray(),
                                new TrustSelfSignedStrategy())
                        .build();
                defaultSSL = new SSLConnectionSocketFactory(
                        sslContext,
                        new String[]{"TLSv1"},
                        null,
                        SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
            }
        } catch (Exception e) {
            System.out.print(e.getMessage());
        }
    }
    /************************** Get方法 ******************************************/
    public static HttpResponse get(String url)
    {
        return get(url,null,null);
    }
    public static HttpResponse get(String url, Map<String,Object> params)
    {
        return get(url,params,null);
    }
    public static HttpResponse get(String url, Map<String,Object> params, Map<String,Object> header)
    {
        if(url.startsWith("https"))
        {
            return get(url,params,header,defaultSSL);
        }
        else{
            //默认http不走ssl和用户密码
            return get(url, params, header, null, null, null);
        }
    }
    public static HttpResponse get(String url, Map<String,Object> params, Map<String,Object> header, Boolean isCheck)
    {
        if(isCheck)
        {
            return get(url, params, header,defaultSSL, defaultHttpUser, defaultHttpPassword);
        }
        else{
            return get(url, params, header, null, null, null);
        }
    }
    public static HttpResponse get(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl)
    {
        return get(url, params, header, ssl, defaultHttpUser, defaultHttpPassword);
    }
    public static HttpResponse get(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl, String user, String password)
    {
        return HttpClientUtil.request("GET", url, params, header, ssl, user, password);
    }
    /************************** Post方法 ******************************************/
    public static HttpResponse post(String url)
    {
        return post(url, null, null);
    }
    public static HttpResponse post(String url, Map<String,Object> params)
    {
        return post(url, params, null);
    }
    public static HttpResponse post(String url, Map<String,Object> params, Map<String,Object> header)
    {
        if(url.startsWith("https"))
        {
            return post(url, params, header, defaultSSL);
        }
        else{
            //默认http不走ssl和用户密码
            return post(url, params, header, null, null, null);
        }
    }
    public static HttpResponse post(String url, Map<String,Object> params, Map<String,Object> header, Boolean isCheck)
    {
        if(isCheck)
        {
            return post(url, params, header, defaultSSL, defaultHttpUser, defaultHttpPassword);
        }
        else{
            return post(url, params, header, null, null, null);
        }
    }
    public static HttpResponse post(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl)
    {
        return post(url, params, header, ssl, defaultHttpUser, defaultHttpPassword);
    }
    public static HttpResponse post(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl, String user, String password)
    {
        return HttpClientUtil.request("POST",url,params,header,ssl,user,password);
    }
    public static HttpResponse postFile(String url, List<NameValuePair> formParams, String filePath, Map<String,Object> header)
    {
        File file = new File(filePath);
        if(url.startsWith("https"))
        {
            return HttpClientUtil.postFile(url, file, formParams, defaultSSL, defaultHttpUser, defaultHttpPassword, header);
        }
        else{
            //默认http不走ssl和用户密码
            return HttpClientUtil.postFile(url, file, formParams, null, defaultHttpUser, defaultHttpPassword, header);
        }
    }
    public static HttpResponse postFile(String url, List<NameValuePair> formParams, File file, Map<String,Object> header)
    {
        if(url.startsWith("https")) {
            return HttpClientUtil.postFile(url, file, formParams, defaultSSL,defaultHttpUser,defaultHttpPassword, header);
        }
        else{
            //默认http不走ssl和用户密码
            return HttpClientUtil.postFile(url, file, formParams, null,defaultHttpUser,defaultHttpPassword, header);
        }
    }
    /************************** Put方法 ******************************************/
    public static HttpResponse put(String url)
    {
        return put(url, null, null);
    }
    public static HttpResponse put(String url, Map<String,Object> params)
    {
        return put(url, params, null);
    }
    public static HttpResponse put(String url, Map<String,Object> params, Map<String,Object> header)
    {
        if(url.startsWith("https"))
        {
            return put(url, params, header, defaultSSL);
        }
        else{
            //默认http不走ssl和用户密码
            return put(url, params, header, null, null, null);
        }
    }
    public static HttpResponse put(String url, Map<String,Object> params, Map<String,Object> header, Boolean isCheck)
    {
        if(isCheck)
        {
            return put(url, params, header, defaultSSL, defaultHttpUser, defaultHttpPassword);
        }
        else{
            return put(url, params, header, null, null, null);
        }
    }
    public static HttpResponse put(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl)
    {
        return put(url, params, header, ssl, defaultHttpUser, defaultHttpPassword);
    }
    public static HttpResponse put(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl, String user, String password)
    {
        return HttpClientUtil.request("PUT",url,params,header,ssl,user,password);
    }
    /************************** Delete方法 **************************************/
    public static HttpResponse delete(String url)
    {
        return delete(url, null, null);
    }
    public static HttpResponse delete(String url, Map<String,Object> params)
    {
        return delete(url, params, null);
    }
    public static HttpResponse delete(String url, Map<String,Object> params, Map<String,Object> header)
    {
        if(url.startsWith("https"))
        {
            return delete(url, params, header, defaultSSL);
        }
        else{
            //默认http不走ssl和用户密码
            return delete(url, params, header, null, null, null);
        }
    }
    public static HttpResponse delete(String url, Map<String,Object> params, Map<String,Object> header, Boolean isCheck)
    {
        if(isCheck)
        {
            return delete(url, params, header, defaultSSL, defaultHttpUser, defaultHttpPassword);
        }
        else{
            return delete(url, params, header, null, null, null);
        }
    }
    public static HttpResponse delete(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl)
    {
        return delete(url, params, header, ssl, defaultHttpUser, defaultHttpPassword);
    }
    public static HttpResponse delete(String url, Map<String,Object> params, Map<String,Object> header, SSLConnectionSocketFactory ssl, String user, String password)
    {
        return HttpClientUtil.request("DELETE",url,params,header,ssl,user,password);
    }
    /************************************postBody*******************************************************************/
    public static String postBody(String url)
    {
        return postBody(url, null, null);
    }
    public static String postBody(String url, String params)
    {
        return postBody(url, params, null);
    }
    public static String postBody(String url, String params, Map<String,Object> header)
    {
        if(url.startsWith("https"))
        {
            return postBody(url, params, header, defaultSSL);
        }
        else{
            //默认http不走ssl和用户密码
            return postBody(url, params, header, null, null, null);
        }
    }
    public static String postBody(String url, String params, Map<String,Object> header, Boolean isCheck)
    {
        if(isCheck)
        {
            return postBody(url, params, header, defaultSSL, defaultHttpUser, defaultHttpPassword);
        }
        else{
            return postBody(url, params, header, null, null, null);
        }
    }
    public static String postBody(String url, String params, Map<String,Object> header, SSLConnectionSocketFactory ssl)
    {
        return postBody(url, params, header, ssl, defaultHttpUser, defaultHttpPassword);
    }
    public static String postBody(String url, String params, Map<String,Object> header, SSLConnectionSocketFactory ssl, String user, String password)
    {
        return HttpClientUtil.postBody(url,params,header,ssl,user,password);
    }
}

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

@ -1,36 +0,0 @@
package com.yihu.iot.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;
    }
}

+ 0 - 219
app/app-iot-server/src/main/java/com/yihu/iot/util/http/HttpUtil.java

@ -1,219 +0,0 @@
package com.yihu.iot.util.http;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import java.io.*;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLConnection;
/*
 * MD5 算法
 */
@Component
public class HttpUtil {
	private static final Logger logger = LoggerFactory.getLogger(HttpUtil.class);
	/**
	 * 向指定URL发送GET方法的请求
	 *
	 * @param url
	 *            发送请求的URL
	 * @param param
	 *            请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
	 * @return URL 所代表远程资源的响应结果
	 */
	public  String sendGet(String url, String param) {
		String result = "";
		BufferedReader in = null;
		try {
			String urlNameString = url + "?" + param;
			URL realUrl = new URL(urlNameString);
			// 打开和URL之间的连接
			URLConnection connection = realUrl.openConnection();
			// 设置通用的请求属性
			connection.setRequestProperty("accept", "*/*");
			connection.setRequestProperty("connection", "Keep-Alive");
			connection.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
			// 建立实际的连接
			connection.connect();
			// 定义 BufferedReader输入流来读取URL的响应
			in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			String line;
			while ((line = in.readLine()) != null) {
				result += line;
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (in != null) {
					in.close();
				}
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
		return result;
	}
	/**
	 * 向指定 URL 发送POST方法的请求
	 *
	 * @param url
	 *            发送请求的 URL带上参数
	 * @param param
	 *            POST参数。
	 * @return 所代表远程资源的响应结果
	 */
	public  String sendPost(String url, String param) {
		StringBuffer buffer = new StringBuffer();
		PrintWriter out = null;
		BufferedReader in = null;
		HttpURLConnection conn = null;
		try {
			URL realUrl = new URL(url);
			// 打开和URL之间的连接
			conn = (HttpURLConnection) realUrl.openConnection();
			conn.setRequestMethod("POST");
			conn.setConnectTimeout(5000);
			conn.setDoOutput(true);
			conn.setDoInput(true);
			conn.setUseCaches(false);
			conn.setRequestProperty("Content-Type", "application/text");
			conn.setRequestProperty("accept", "*/*");
			conn.setRequestProperty("connection", "Keep-Alive");
			conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
			OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), "UTF-8");
			osw.write(param.toString());
			osw.flush();
			// 读取返回内容
			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8"));
			String temp;
			while ((temp = br.readLine()) != null) {
				buffer.append(temp);
				buffer.append("\n");
			}
		} catch (Exception e) {
			logger.error("push message error:", e);
		} finally {
			try {
				if (out != null) {
					out.close();
				}
				if (in != null) {
					in.close();
				}
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
		return buffer.toString();
	}
	/**
	 * 向指定 URL 发送POST方法的请求
	 *
	 * @param url 发送请求的 URL带上参数
	 * @param param POST参数。
	 * @param charset 编码格式
	 * @return 所代表远程资源的响应结果
	 */
	public  String sendPost(String url, String param, String charset) {
		StringBuffer buffer = new StringBuffer();
		PrintWriter out = null;
		BufferedReader in = null;
		HttpURLConnection conn = null;
		try {
			URL realUrl = new URL(url);
			// 打开和URL之间的连接
			conn = (HttpURLConnection) realUrl.openConnection();
			conn.setRequestMethod("POST");
			conn.setDoOutput(true);
			conn.setDoInput(true);
			conn.setUseCaches(false);
			conn.setRequestProperty("Content-Type", "application/text");
			conn.setRequestProperty("accept", "*/*");
			conn.setRequestProperty("connection", "Keep-Alive");
			conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1;SV1)");
			OutputStreamWriter osw = new OutputStreamWriter(conn.getOutputStream(), charset);
			osw.write(param.toString());
			osw.flush();
			// 读取返回内容
			BufferedReader br = new BufferedReader(new InputStreamReader(conn.getInputStream(), charset));
			String temp;
			while ((temp = br.readLine()) != null) {
				buffer.append(temp);
				buffer.append("\n");
			}
		} catch (Exception e) {
			logger.error("push message error:", e);
		} finally {
			try {
				if (out != null) {
					out.close();
				}
				if (in != null) {
					in.close();
				}
			} catch (IOException ex) {
				ex.printStackTrace();
			}
		}
		return buffer.toString();
	}
	/**
	 * 向指定URL发送GET方法的请求
	 *
	 * @param url
	 *            发送请求的URL
	 * @param param
	 *            请求参数,请求参数应该是 name1=value1&name2=value2 的形式。
	 * @return URL 所代表远程资源的响应结果
	 */
	public  String sendLoginGet(String url, String param,String userAgent) {
		String result = "";
		BufferedReader in = null;
		try {
			String urlNameString = url;
			if(StringUtils.isNotBlank(param)){
				urlNameString+="?" + param;
			}
			URL realUrl = new URL(urlNameString);
			// 打开和URL之间的连接
			URLConnection connection = realUrl.openConnection();
			// 设置通用的请求属性
			connection.setRequestProperty("accept", "*/*");
			connection.setRequestProperty("connection", "Keep-Alive");
			connection.setRequestProperty("user-agent", userAgent);
			// 建立实际的连接
			connection.connect();
			// 定义 BufferedReader输入流来读取URL的响应
			in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
			String line;
			while ((line = in.readLine()) != null) {
				result += line;
			}
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			try {
				if (in != null) {
					in.close();
				}
			} catch (Exception e2) {
				e2.printStackTrace();
			}
		}
		return result;
	}
}

+ 0 - 18
app/app-iot-server/src/main/java/com/yihu/iot/util/operator/CollectionUtil.java

@ -1,18 +0,0 @@
package com.yihu.iot.util.operator;
import org.apache.commons.collections.CollectionUtils;
import java.util.Collection;
/**
 * Hibernate Criteria utils
 *
 * @since 1.0.6
 */
public class CollectionUtil {
    public static boolean isEmpty(Collection coll) {
        return CollectionUtils.isEmpty(coll);
    }
}

+ 0 - 1525
app/app-iot-server/src/main/java/com/yihu/iot/util/operator/DateUtil.java

@ -1,1525 +0,0 @@
/****************************************************************************
 * Copyright(c) Yamaha Motor Solutions CO.,Ltd. 2010 All Rights Reserved
 * <p>
 * System Name:(smart)Human Resource Management System
 * SubSystem Name:-
 * service for all substystems
 * <p>
 * File Name: DateUtil
 * <p>
 * HISTORY RECORD
 * Ver.   Date           Create User/Update     Comment
 * -------------------------------------------------------------------------
 * 1.0    2010/07/12    tuchengye              New Making
 ***************************************************************************/
package com.yihu.iot.util.operator;
import java.sql.Date;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.*;
import java.util.Calendar;
import java.util.GregorianCalendar;
import java.util.Locale;
import java.util.TimeZone;
public class DateUtil {
    public static final String DEFAULT_DATE_YEAR_FORMAT = "yyyy";
    public static final String DEFAULT_DATE_MONTH_FORMAT = "MM";
    public static final String PRINT_DATE_YM_FORMAT = "MMM., yyyy";
    public static final String PRINT_DATE_YMD_FORMAT = "MMM. d, yyyy";
    public static final Locale PRINT_LOCALE = Locale.ENGLISH;
    public static final String DEFAULT_YEARS = "0.0";
    public static final String DEFAULT_DATE_YMD_FORMAT = "yyyy-MM-dd";
    public static final String DEFAULT_DATE_YM_FORMAT = "yyyyMM";
    public static final String DEFAULT_DATE_MD_FORMAT = "MMdd";
    public static final String DEFAULT_CHAR_DATE_YMD_FORMAT = "yyyyMMdd";
    public static final String DEFAULT_TIMESTAMP_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS";
    public final static String DEFAULT_SIMPLEDATE_FORMAT = "yyyy-MM-dd HH:mm:ss SSS";
    public final static String DEFAULT_YMDHMSDATE_FORMAT = "yyyy-MM-dd HH:mm:ss";
    public static final String DEFAULT_TIME_FORMAT = "HH:mm:ss";
    public static final String DEFAULT_NOW_STRING_FORMAT = "yyyyMMddHHmmssSSS";
    public static final String DATE_MDY_FORMAT = "MMddyyyy";
    public static final String DATE_MY_FORMAT = "MMyyyy";
    public static final String DATE_WORLD_FORMAT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
    public static String changeFormat(String changeDate, String beforeFormat, String afterFormat) {
        if (StringUtil.isBlank(changeDate)) {
            return changeDate;
        }
        return formatDate(parseDate(changeDate, beforeFormat), afterFormat);
    }
    public static String changeToYMDFormatForPrint(String changeDate) {
        if (StringUtil.isBlank(changeDate)) {
            return "";
        }
        DateFormat df = new SimpleDateFormat(PRINT_DATE_YMD_FORMAT, Locale.ENGLISH);
        return df.format(parseDate(changeDate, DEFAULT_CHAR_DATE_YMD_FORMAT));
    }
    public static String changeToYMFormatForPrint(String changeDate) {
        if (StringUtil.isBlank(changeDate)) {
            return "";
        }
        DateFormat df = new SimpleDateFormat(PRINT_DATE_YM_FORMAT, Locale.ENGLISH);
        return df.format(parseDate(changeDate, DEFAULT_DATE_YM_FORMAT));
    }
    public static String getFirstDate(String yearMonthStr, String yearMonthFormat, String dateFormat) throws Exception {
        DateFormat dfYearMonth = new SimpleDateFormat(yearMonthFormat);
        DateFormat dfDate = new SimpleDateFormat(dateFormat);
        java.util.Date date;
        if (yearMonthStr == null || yearMonthStr.equals("")) {
            throw new Exception(yearMonthStr + " is invalid.");
        }
        try {
            date = dfYearMonth.parse(yearMonthStr);
        } catch (ParseException e) {
            throw new Exception(yearMonthStr + " is invalid.");
        }
        return dfDate.format(date);
    }
    public static String getLastDate(String dateSource, String dateSourceFormat, String dateFormat) throws Exception {
        DateFormat dsf = new SimpleDateFormat(dateSourceFormat);
        DateFormat df = new SimpleDateFormat(dateFormat);
        java.util.Date date;
        String resultDateString;
        if (dateSource == null || dateSource.equals("")) {
            throw new Exception(dateSource + " is invalid.");
        }
        try {
            date = dsf.parse(dateSource);
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            cal.set(Calendar.DAY_OF_MONTH, cal.getActualMaximum(Calendar.DAY_OF_MONTH));
            resultDateString = df.format(cal.getTime());
        } catch (ParseException e) {
            throw new Exception(dateSource + " is invalid.");
        }
        return resultDateString;
    }
    public static String getYearFromDBDate(String dateStr) {
        if (dateStr == null || dateStr.length() != DEFAULT_CHAR_DATE_YMD_FORMAT.length()) {
            return null;
        }
        return changeFormat(dateStr, DEFAULT_CHAR_DATE_YMD_FORMAT, DEFAULT_DATE_YEAR_FORMAT);
    }
    public static String getMonthFromDBDate(String dateStr) {
        if (dateStr == null || dateStr.length() != DEFAULT_CHAR_DATE_YMD_FORMAT.length()) {
            return null;
        }
        return changeFormat(dateStr, DEFAULT_CHAR_DATE_YMD_FORMAT, DEFAULT_DATE_MONTH_FORMAT);
    }
    public static String getYMFromDBDate(String dateStr) {
        if (dateStr == null || dateStr.length() != DEFAULT_CHAR_DATE_YMD_FORMAT.length()) {
            return null;
        }
        return changeFormat(dateStr, DEFAULT_CHAR_DATE_YMD_FORMAT, DEFAULT_DATE_YM_FORMAT);
    }
    public static int getDifferenceOfDays(java.util.Date dateFrom, java.util.Date dateTo) {
        return new Long((dateTo.getTime() - dateFrom.getTime()) / 1000 / 60 / 60 / 24).intValue();
    }
    public static int getDifferenceOfDays(String dateFromStr, String dateToStr, String dateFormat) {
        java.util.Date dateFrom = parseDate(dateFromStr, dateFormat);
        java.util.Date dateTo = parseDate(dateToStr, dateFormat);
        return getDifferenceOfDays(dateFrom, dateTo);
    }
    public static int getDifferenceOfDays(String dateFromStr, String dateToStr) {
        return getDifferenceOfDays(dateFromStr, dateToStr, DEFAULT_CHAR_DATE_YMD_FORMAT);
    }
    public static String formatTime(String timeStr) {
        if (timeStr == null || timeStr.length() != 6) {
            return null;
        }
        return StringUtil.substring(timeStr, 0, 2)
                + ":" + StringUtil.substring(timeStr, 2, 4)
                + ":" + StringUtil.substring(timeStr, 4);
    }
    public static String toString(Date date) {
        return toString((java.util.Date) date);
    }
    public static String toString(java.util.Date date) {
        return toString(date, DEFAULT_DATE_YMD_FORMAT);
    }
    public static String toString(Date date, String format) {
        return toString((java.util.Date) date, format);
    }
    public static String toString(java.util.Date date, String format) {
        if (date == null) {
            return null;
        }
        if (format == null) {
            throw new IllegalArgumentException("The value of an argument is inaccurate.");
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(date);
    }
    public static String formatTimestamp(Timestamp time) {
        return formatTimestamp(time, DEFAULT_TIMESTAMP_FORMAT);
    }
    public static String formatTimestamp(Timestamp time, String format) {
        if (time == null) {
            return null;
        }
        if (format == null) {
            throw new IllegalArgumentException("The value of an argument is inaccurate.");
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(time);
    }
    public static String toString(Time time, String format) {
        if (time == null) {
            return null;
        }
        if (format == null) {
            throw new IllegalArgumentException("The value of an argument is inaccurate.");
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(time);
    }
    public static Date formatCharDateYMD(String str) {
        return formatCharDateYMD(str, DEFAULT_DATE_YMD_FORMAT);
    }
    public static Date formatCharDateYMD(String str, String format) {
        if (str == null || str.trim().length() == 0) {
            return null;
        }
        if (format == null) {
            throw new IllegalArgumentException("The value of an argument is inaccurate.");
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        ParsePosition pos = new ParsePosition(0);
        java.util.Date date = sdf.parse(str, pos);
        if (date == null) {
            return null;
        }
        return new Date(date.getTime());
    }
    public static Date formatCharDateYMD(String yy, String mm, String dd) {
        if (yy == null || mm == null || dd == null || yy.trim().length() == 0 ||
                mm.trim().length() == 0 || dd.trim().length() == 0) {
            return null;
        }
        return formatCharDateYMD(yy + "-" + (mm != null && mm.length() == 1 ? "0" + mm : mm) + "-" +
                (dd != null && dd.length() == 1 ? "0" + dd : dd));
    }
    public static Timestamp toTimestamp(String str) {
        if (str == null) {
            return null;
        }
        try {
            return Timestamp.valueOf(str.trim());
        } catch (IllegalArgumentException iae) {
            return null;
        }
    }
    public static Timestamp toTimestamp(String str, String format) {
        if (str == null) {
            return null;
        }
        try {
            return new Timestamp(parseDate(str, format).getTime());
        } catch (Exception e) {
            return null;
        }
    }
    public static Time toTime(String str) {
        if (str == null) {
            return null;
        }
        try {
            return (str.length() == 5 ? Time.valueOf(str + ":00") : Time.valueOf(str));
        } catch (Exception e) {
            return null;
        }
    }
    public static String toString(Time time) {
        return toString(time, DEFAULT_TIME_FORMAT);
    }
    public static String toYM(String yy, String mm) {
        if (yy == null || mm == null) {
            return null;
        }
        if (yy.trim().length() == 0 && mm.trim().length() != 0 ||
                yy.trim().length() != 0 && mm.trim().length() == 0) {
            return null;
        }
        return yy + (mm != null && mm.length() == 1 ? "0" + mm : mm);
    }
    public static String getNowDate() {
        return getNowDate(DEFAULT_NOW_STRING_FORMAT);
    }
    public static String getNowDate(String format) {
        if (format == null) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format, Locale.JAPAN);
        java.util.Date date = Calendar.getInstance().getTime();
        if (date == null) {
            return null;
        }
        return sdf.format(date);
    }
    public static Date getSysDate() {
        return new Date(Calendar.getInstance().getTime().getTime());
    }
    public static java.util.Date getSysDateYMDHMS() {
        Date dSysDateYMD = DateUtil.getSysDate();
        Timestamp ts = formatYMDToYMDHMS(StringUtil.toString(dSysDateYMD));
        return ts;
    }
    public static Timestamp getSysDateTime() {
        return new Timestamp(Calendar.getInstance().getTime().getTime());
    }
    public static Time getSysTime() {
        return new Time(Calendar.getInstance().getTime().getTime());
    }
    public static String toAge(String birthDay) {
        if (birthDay == null || birthDay.length() != 8) {
            return null;
        }
        int birthYear = Integer.parseInt(birthDay.substring(0, 4));
        int birthMonth = Integer.parseInt(birthDay.substring(4, 6));
        int birthDayOfMonth = Integer.parseInt(birthDay.substring(6, 8));
        return toAge(birthYear, birthMonth, birthDayOfMonth);
    }
    public static String toAge(int birthYear, int birthMonth, int birthDayOfMonth) {
        Calendar cl = Calendar.getInstance();
        int year = cl.get(Calendar.YEAR);
        int month = cl.get(Calendar.MONTH) + 1;
        int day = cl.get(Calendar.DAY_OF_MONTH);
        int sa = 0;
        if (month > birthMonth) {
            sa = 0;
        } else if (month == birthMonth && day >= birthDayOfMonth) {
            sa = 0;
        } else {
            sa = 1;
        }
        int age = year - birthYear - sa;
        return Integer.toString(age);
    }
    public static Date addDate(int add, java.util.Date d) {
        return addDate(add, new Date(d.getTime()));
    }
    public static java.util.Date addDateTime(int add, java.util.Date d) {
        return addDateTime(add, new Date(d.getTime()));
    }
    public static Date addDate(int add, Date d) {
        if (d == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime((java.util.Date) d);
        cal.setTimeZone(TimeZone.getDefault());
        cal.add(Calendar.DAY_OF_MONTH, add);
        return new Date(cal.getTime().getTime());
    }
    public static java.util.Date addDateTime(int add, Date d) {
        if (d == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime((java.util.Date) d);
        cal.setTimeZone(TimeZone.getDefault());
        cal.add(Calendar.DAY_OF_MONTH, add);
        return cal.getTime();
    }
    public static String addDate(int add, String sDate) {
        if (sDate.length() < 8) {
            return null;
        }
        return formatDate(addDate(add, formatCharDateYMD(sDate, DEFAULT_CHAR_DATE_YMD_FORMAT)), DEFAULT_CHAR_DATE_YMD_FORMAT);
    }
    public static Date addMonth(int add, java.util.Date d) {
        return addMonth(add, new Date(d.getTime()));
    }
    public static Date addMonth(int add, Date d) {
        if (d == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime((java.util.Date) d);
        cal.setTimeZone(TimeZone.getDefault());
        cal.add(Calendar.MONTH, add);
        return new Date(cal.getTime().getTime());
    }
    public static String addMonth(int add, String sDate) {
        if (sDate.length() < 8) {
            return null;
        }
        return formatDate(addMonth(add, formatCharDateYMD(sDate, DEFAULT_CHAR_DATE_YMD_FORMAT)), DEFAULT_CHAR_DATE_YMD_FORMAT);
    }
    public static Date addYear(int add, java.util.Date d) {
        return addYear(add, new Date(d.getTime()));
    }
    public static Date addYear(int add, Date d) {
        if (d == null) {
            return null;
        }
        Calendar cal = Calendar.getInstance();
        cal.setTime((java.util.Date) d);
        cal.setTimeZone(TimeZone.getDefault());
        cal.add(Calendar.YEAR, add);
        return new Date(cal.getTime().getTime());
    }
    public static String addYear(int add, String sDate) {
        if (sDate.length() < 8) {
            return null;
        }
        return formatDate(addYear(add, formatCharDateYMD(sDate, DEFAULT_CHAR_DATE_YMD_FORMAT)), DEFAULT_CHAR_DATE_YMD_FORMAT);
    }
    public static String getNowDateTime() {
        SimpleDateFormat df = new SimpleDateFormat("yyyyMMddHHmmss", Locale.JAPAN);
        df.setTimeZone(TimeZone.getDefault());
        return df.format(new java.util.Date());
    }
    public static String getCurrentString() {
        return getCurrentString(DEFAULT_SIMPLEDATE_FORMAT);
    }
    public static String getCurrentString(String pattern) {
        SimpleDateFormat f = new SimpleDateFormat(pattern);
        return f.format(Calendar.getInstance(TimeZone.getDefault()).getTime());
    }
    public static long compareDate(String pattern, String s1, String s2) {
        SimpleDateFormat f = new SimpleDateFormat(pattern);
        try {
            return f.parse(s1).getTime() - f.parse(s2).getTime();
        } catch (Exception e) {
            return -1;
        }
    }
    public static long compareDate(java.util.Date s1, java.util.Date s2) {
        try {
            return compareDate(DEFAULT_DATE_YMD_FORMAT, toString(s1), toString(s2));
        } catch (Exception e) {
            return -1;
        }
    }
    public static long compareDateTime(java.util.Date s1, java.util.Date s2) {
        return s1.getTime() - s2.getTime();
    }
    public static java.util.Date parseDate(String value, String pattern) {
        try {
            TimeZone tz = TimeZone.getDefault();
            String dateFormat = pattern;
            SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
            sdf.setTimeZone(tz);
            // Parse date
            java.util.Date parsed = null;
            parsed = sdf.parse(value);
            return parsed;
        } catch (ParseException e) {
            return null;
        }
    }
    public static String formatDate(java.util.Date value, String pattern) {
        TimeZone tz = TimeZone.getDefault();
        SimpleDateFormat sdf = new SimpleDateFormat(pattern);
        sdf.setTimeZone(tz);
        return sdf.format(value);
    }
    public static int getLastDay(Date dt) {
        Calendar cal = Calendar.getInstance();
        cal.setTime(dt);
        int lastDay = cal.getActualMaximum(Calendar.DAY_OF_MONTH);
        return lastDay;
    }
    public static String getYMDFormat(String datePtn) {
        final String[][] DATE_FORMAT_YMD_LIST = {{"1", "yyyy/MM/dd"},
                {"2", "yyyy.MM.dd"},
                {"3", "yyyy-MM-dd"},
                {"4", "MM/dd/yyyy"},
                {"5", "MM.dd.yyyy"},
                {"6", "MM-dd-yyyy"},
                {"7", "dd/MM/yyyy"},
                {"8", "dd.MM.yyyy"},
                {"9", "dd-MM-yyyy"},
                {"A", "dd/MM yyyy"}
        };
        String format = null;
        for (int i = 0; i < DATE_FORMAT_YMD_LIST.length; i++) {
            if (DATE_FORMAT_YMD_LIST[i][0].equals(datePtn)) {
                format = DATE_FORMAT_YMD_LIST[i][1];
                break;
            }
        }
        if (format == null) {
            throw new IllegalArgumentException("The value of an argument is inaccurate.");
        }
        return format;
    }
    public static String getYMFormat(String datePtn) {
        final String[][] DATE_FORMAT_YM_LIST = {{"1", "yyyy/MM"},
                {"2", "yyyy.MM"},
                {"3", "yyyy-MM"},
                {"4", "MM/yyyy"},
                {"5", "MM.yyyy"},
                {"6", "MM-yyyy"},
                {"7", "MM/yyyy"},
                {"8", "MM.yyyy"},
                {"9", "MM-yyyy"},
                {"A", "MM yyyy"},
                {"B", "yyyyMM"}
        };
        String format = null;
        for (int i = 0; i < DATE_FORMAT_YM_LIST.length; i++) {
            if (DATE_FORMAT_YM_LIST[i][0].equals(datePtn)) {
                format = DATE_FORMAT_YM_LIST[i][1];
                break;
            }
        }
        if (format == null) {
            throw new IllegalArgumentException("The value of an argument is inaccurate.");
        }
        return format;
    }
    public static String toYMD(Date date, String datePtn) {
        if (date == null) {
            return null;
        }
        return toString(date, getYMDFormat(datePtn));
    }
    public static String formatDateYMD(String str, String datePtn) {
        if (str == null || str.trim().length() == 0) {
            return null;
        }
        return toYMD(formatCharDateYMD(str), datePtn);
    }
    public static String formatDateYMD(String yy, String mm, String dd, String datePtn) {
        if (yy == null || mm == null || dd == null || yy.trim().length() == 0
                || mm.trim().length() == 0 || dd.trim().length() == 0) {
            return null;
        }
        return formatDateYMD(yy + "-" + (mm != null && mm.length() == 1 ? "0" + mm : mm)
                + "-" + (dd != null && dd.length() == 1 ? "0" + dd : dd), datePtn);
    }
    public static String formatDateYM(Date date, String datePtn) {
        if (date == null) {
            return null;
        }
        return toString(date, getYMFormat(datePtn));
    }
    public static String formatDateYM(String str, String datePtn) {
        if (str == null || str.trim().length() == 0) {
            return null;
        }
        return formatDateYM(formatCharDateYMD(str, DEFAULT_DATE_YM_FORMAT), datePtn);
    }
    public static String formatDateYM(String yy, String mm, String datePtn) {
        if (yy == null || mm == null || yy.trim().length() == 0 || mm.trim().length() == 0) {
            return null;
        }
        return formatDateYM(yy + (mm != null && mm.length() == 1 ? "0" + mm : mm), datePtn);
    }
    public static String getTimestampFormat(String dateStyleId) {
        return getYMDFormat(dateStyleId) + " HH:mm:ss";
    }
    public static Date toDateFromTime(String time) {
        try {
            return toDateFromTime(Long.parseLong(time));
        } catch (Exception iae) {
            return null;
        }
    }
    public static Date toDateFromTime(long time) {
        return new Date(time);
    }
    public static Timestamp toTimestampFromTime(String time) {
        try {
            return toTimestampFromTime(Long.parseLong(time));
        } catch (Exception iae) {
            return null;
        }
    }
    public static Timestamp toTimestampFromTime(long time) {
        return new Timestamp(time);
    }
    public static Timestamp toTimestampFromGMT(int yy, int mm, int dd, int hh, int mi, int ss) {
        return toTimestampFromGMT(
                String.valueOf(yy),
                String.valueOf(mm),
                String.valueOf(dd),
                String.valueOf(hh),
                String.valueOf(mi),
                String.valueOf(ss));
    }
    public static Timestamp toTimestampFromGMT(String yy, String mm, String dd,
                                               String hh, String mi, String ss) {
        mm = mm != null && mm.length() == 1 ? "0" + mm : mm;
        dd = dd != null && dd.length() == 1 ? "0" + dd : dd;
        hh = hh != null && hh.length() == 1 ? "0" + hh : hh;
        mi = mi != null && mi.length() == 1 ? "0" + mi : mi;
        ss = ss != null && ss.length() == 1 ? "0" + ss : ss;
        return toTimestampFromGMT(yy + "-" + mm + "-" + dd + " " + hh + ":" + mi + ":" + ss);
    }
    public static Timestamp toTimestampFromGMT(String str) {
        if (str == null) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_TIMESTAMP_FORMAT);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        ParsePosition pos = new ParsePosition(0);
        java.util.Date date = sdf.parse(str, pos);
        if (date == null) {
            return null;
        }
        return new Timestamp(date.getTime());
    }
    public static Timestamp toTimestampFromGMT(Timestamp time) {
        return toTimestampFromGMT(StringUtil.toString(time));
    }
    public static Timestamp toTimestampFromLocal(String yy, String mm, String dd, String hh,
                                                 String mi, String ss, String differTimeSign,
                                                 String differenceTime, String summerTimeFrom,
                                                 String summerTimeTo, String summerTime) {
        mm = mm != null && mm.length() == 1 ? "0" + mm : mm;
        dd = dd != null && dd.length() == 1 ? "0" + dd : dd;
        hh = hh != null && hh.length() == 1 ? "0" + hh : hh;
        mi = mi != null && mi.length() == 1 ? "0" + mi : mi;
        ss = ss != null && ss.length() == 1 ? "0" + ss : ss;
        return toTimestampFromLocal(
                yy + "-" + mm + "-" + dd + " " + hh + ":" + mi + ":" + ss,
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime);
    }
    public static Timestamp toTimestampFromLocal(String str, String differTimeSign,
                                                 String differenceTime, String summerTimeFrom,
                                                 String summerTimeTo, String summerTime) {
        if (str == null) {
            return null;
        }
        Timestamp time = toTimestamp(str);
        if (time == null) {
            return null;
        }
        long localTime = toGMTTimeFromLocalTime(
                time.getTime(),
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime);
        return toTimestampFromGMT(new Timestamp(localTime));
    }
    public static Timestamp toTimestampFromLocal(Timestamp time, String differTimeSign,
                                                 String differenceTime, String summerTimeFrom,
                                                 String summerTimeTo, String summerTime) {
        return toTimestampFromLocal(
                StringUtil.toString(time),
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime);
    }
    public static long toGMTTime(long local) {
        SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_TIMESTAMP_FORMAT);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        ParsePosition pos = new ParsePosition(0);
        java.util.Date date = sdf.parse(StringUtil.toString(new Timestamp(local)), pos);
        if (date == null) {
            return -1;
        }
        return date.getTime();
    }
    public static long toGMTTime(Timestamp local) {
        if (local == null) {
            return -1;
        }
        return toGMTTime(local.getTime());
    }
    public static Timestamp toGMTTimestamp(long local) {
        long time = toGMTTime(local);
        if (time == -1) {
            return null;
        }
        return new Timestamp(time);
    }
    public static Timestamp toGMTTimestamp(Timestamp local) {
        if (local == null) {
            return null;
        }
        return toGMTTimestamp(local.getTime());
    }
    public static String toYMD(String yy, String mm, String dd) {
        if (yy == null || mm == null || dd == null) {
            return null;
        }
        if (yy.trim().length() == 0 || mm.trim().length() == 0) {
            return "";
        }
        mm = mm != null && mm.length() == 1 ? "0" + mm : mm;
        if (dd != null && dd.length() == 0) {
            dd = "  ";
        }
        if (dd != null && dd.length() == 1) {
            dd = "0" + dd;
        }
        return yy + mm + dd;
    }
    public static String getYearFromYM(String ym) {
        if (ym == null || ym.length() != DEFAULT_DATE_YM_FORMAT.length()) {
            return null;
        }
        return ym.substring(0, 4);
    }
    public static String getMonthFromYM(String ym) {
        if (ym == null || ym.length() != DEFAULT_DATE_YM_FORMAT.length()) {
            return null;
        }
        return ym.substring(4, 6);
    }
    public static String getYearFromYMD(Date ymd) {
        return getYearFromYMD(toString(ymd));
    }
    public static String getMonthFromYMD(Date ymd) {
        return getMonthFromYMD(toString(ymd));
    }
    public static String getDateFromYMD(Date ymd) {
        return getDateFromYMD(toString(ymd));
    }
    public static String getYearFromYMD(String ymd) {
        if (ymd == null || ymd.length() != DEFAULT_DATE_YMD_FORMAT.length()) {
            return null;
        }
        return ymd.substring(0, 4);
    }
    public static String getMonthFromYMD(String ymd) {
        if (ymd == null || ymd.length() != DEFAULT_DATE_YMD_FORMAT.length()) {
            return null;
        }
        return ymd.substring(5, 7);
    }
    public static String getDateFromYMD(String ymd) {
        if (ymd == null || ymd.length() != DEFAULT_DATE_YMD_FORMAT.length()) {
            return null;
        }
        return ymd.substring(8, 10);
    }
    public static String getHourFromHMS(String hms) {
        if (hms == null || hms.length() != DEFAULT_TIME_FORMAT.length()) {
            return null;
        }
        return hms.substring(0, 2);
    }
    public static String getMinuteFromHMS(String hms) {
        if (hms == null || hms.length() != DEFAULT_TIME_FORMAT.length()) {
            return null;
        }
        return hms.substring(3, 5);
    }
    public static String getSecondFromHMS(String hms) {
        if (hms == null || hms.length() != DEFAULT_TIME_FORMAT.length()) {
            return null;
        }
        return hms.substring(6, 8);
    }
    public static String formatDateYMD(Date date, String dateStyleId) {
        if (date == null) {
            return null;
        }
        return toString(date, getYMDFormat(dateStyleId));
    }
    public static long getSystemTime() {
        return Calendar.getInstance().getTime().getTime();
    }
    public static Timestamp getSystemTimestamp() {
        return new Timestamp(getSystemTime());
    }
    public static long getSystemTimeGMTToday() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        Timestamp today = toTimestamp(sdf.format(Calendar.getInstance().getTime()) + " 00:00:00");
        return toGMTTime(today);
    }
    public static Timestamp getSystemTimestampGMTToday() {
        long time = getSystemTimeGMTToday();
        if (time == -1) {
            return null;
        }
        return new Timestamp(time);
    }
    public static Date getSysDateGMTToday() {
        long time = getSystemTimeGMTToday();
        if (time == -1) {
            return null;
        }
        return new Date(getSystemTimeGMTToday());
    }
    public static String formatTimestamp(Timestamp time, String differTimeSign,
                                         String differenceTime, String summerTimeFrom,
                                         String summerTimeTo, String summerTime) {
        if (time == null) {
            return null;
        }
        return toStringFormatLocalTime(
                time.getTime(),
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                DEFAULT_TIMESTAMP_FORMAT);
    }
    public static String formatTimestamp(Timestamp time, String differTimeSign,
                                         String differenceTime, String summerTimeFrom,
                                         String summerTimeTo, String summerTime, String dateStyleId) {
        if (time == null) {
            return null;
        }
        return toStringFormatLocalTime(
                time.getTime(),
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                getTimestampFormat(dateStyleId));
    }
    public static String formatTimestamp(long time, String differTimeSign, String differenceTime,
                                         String summerTimeFrom, String summerTimeTo, String summerTime) {
        return toStringFormatLocalTime(
                time,
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                DEFAULT_TIMESTAMP_FORMAT);
    }
    public static String formatTimestamp(long time, String differTimeSign, String differenceTime,
                                         String summerTimeFrom, String summerTimeTo,
                                         String summerTime, String dateStyleId) {
        return toStringFormatLocalTime(
                time,
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                getTimestampFormat(dateStyleId));
    }
    public static String formatTimestampToDate(Timestamp time, String differTimeSign,
                                               String differenceTime, String summerTimeFrom,
                                               String summerTimeTo, String summerTime) {
        if (time == null) {
            return null;
        }
        return toStringFormatLocalTime(
                time.getTime(),
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                DEFAULT_DATE_YMD_FORMAT);
    }
    public static String formatTimestampToDate(Timestamp time, String differTimeSign,
                                               String differenceTime, String summerTimeFrom,
                                               String summerTimeTo, String summerTime, String dateStyleId) {
        if (time == null) {
            return null;
        }
        return toStringFormatLocalTime(
                time.getTime(),
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                getYMDFormat(dateStyleId));
    }
    public static String formatTimestampToDate(long time, String differTimeSign,
                                               String differenceTime, String summerTimeFrom,
                                               String summerTimeTo, String summerTime) {
        return toStringFormatLocalTime(
                time,
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                DEFAULT_DATE_YMD_FORMAT);
    }
    public static String formatTimestampToDate(long time, String differTimeSign,
                                               String differenceTime, String summerTimeFrom,
                                               String summerTimeTo, String summerTime, String dateStyleId) {
        return toStringFormatLocalTime(
                time,
                differTimeSign,
                differenceTime,
                summerTimeFrom,
                summerTimeTo,
                summerTime,
                getYMDFormat(dateStyleId));
    }
    public static String toStringFormatLocalTime(long time, String differTimeSign,
                                                 String differenceTime, String summerTimeFrom,
                                                 String summerTimeTo, String summerTime, String format) {
        long localTime = time;
        long differenceTimeLong = toDifferenceTimeLong(differenceTime);
        long summerTimeLong = toSummerTimeLong(summerTime);
        if (differTimeSign != null && differTimeSign.equals("+")) {
            localTime += differenceTimeLong;
        } else {
            localTime -= differenceTimeLong;
        }
        if (isSummerTime(time, summerTimeFrom, summerTimeTo)) {
            localTime -= summerTimeLong;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        return sdf.format(new java.util.Date(localTime));
    }
    public static long toGMTTimeFromLocalTime(long localTime, String differTimeSign,
                                              String differenceTime, String summerTimeFrom,
                                              String summerTimeTo, String summerTime) {
        long time = localTime;
        long differenceTimeLong = toDifferenceTimeLong(differenceTime);
        long summerTimeLong = toSummerTimeLong(summerTime);
        if (differTimeSign != null && differTimeSign.equals("+")) {
            time -= differenceTimeLong;
        } else {
            time += differenceTimeLong;
        }
        if (isSummerTime(localTime, summerTimeFrom, summerTimeTo)) {
            time += summerTimeLong;
        }
        return time;
    }
    public static long toDifferenceTimeLong(String differenceTime) {
        long differenceTimeLong;
        try {
            long differenceTimeM = Long.parseLong(differenceTime.substring(0, 2));
            long differenceTimeS = Long.parseLong(differenceTime.substring(2, 4));
            differenceTimeLong = (differenceTimeM * 60 * 60 * 1000) + (differenceTimeS * 60 * 1000);
        } catch (Exception e) {
            differenceTimeLong = 0;
        }
        return differenceTimeLong;
    }
    public static long toSummerTimeLong(String summerTime) {
        long summerTimeLong;
        try {
            long summerTimeM = Long.parseLong(summerTime.substring(0, 2));
            long summerTimeS = Long.parseLong(summerTime.substring(2, 4));
            summerTimeLong = (summerTimeM * 60 * 60 * 1000) + (summerTimeS * 60 * 1000);
        } catch (Exception e) {
            summerTimeLong = 0;
        }
        return summerTimeLong;
    }
    public static boolean isSummerTime(long time, String summerTimeFrom, String summerTimeTo) {
        if (summerTimeFrom == null || summerTimeFrom.trim().length() != 4 ||
                summerTimeTo == null || summerTimeTo.trim().length() != 4) {
            return false;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(DEFAULT_DATE_MD_FORMAT);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        String md = sdf.format(new java.util.Date(time));
        if (md.compareTo(summerTimeFrom) >= 0 && md.compareTo(summerTimeTo) <= 0) {
            // サマータイム
            return true;
        } else {
            return false;
        }
    }
    public static String formatGMTTimestamp(Timestamp time) {
        return toStringFormatGMTTime(time, DEFAULT_TIMESTAMP_FORMAT);
    }
    public static String formatGMTTimestamp(Timestamp time, String dateStyleId) {
        return toStringFormatGMTTime(time, getTimestampFormat(dateStyleId));
    }
    public static String formatGMTTimestamp(long time) {
        return toStringFormatGMTTime(time, DEFAULT_TIMESTAMP_FORMAT);
    }
    public static String formatGMTTimestamp(long time, String dateStyleId) {
        return toStringFormatGMTTime(time, getTimestampFormat(dateStyleId));
    }
    public static String formatGMTTimestampToDate(Timestamp time) {
        return toStringFormatGMTTime(time, DEFAULT_DATE_YMD_FORMAT);
    }
    public static String formatGMTTimestampToDate(Timestamp time, String dateStyleId) {
        return toStringFormatGMTTime(time, getYMDFormat(dateStyleId));
    }
    public static String formatGMTTimestampToDate(long time) {
        return toStringFormatGMTTime(time, DEFAULT_DATE_YMD_FORMAT);
    }
    public static String formatGMTTimestampToDate(long time, String dateStyleId) {
        return toStringFormatGMTTime(time, getYMDFormat(dateStyleId));
    }
    public static String toStringFormatGMTTime(Timestamp time, String format) {
        if (time == null) {
            return null;
        }
        return toStringFormatGMTTime(time.getTime(), format);
    }
    public static String toStringFormatGMTTime(long time, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        sdf.setTimeZone(TimeZone.getTimeZone("GMT"));
        return sdf.format(new java.util.Date(time));
    }
    public static String toStringFormatTime(long time, String format) {
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        return sdf.format(new java.util.Date(time));
    }
    public static int getLastDay(int yy, int mm) {
        GregorianCalendar gc = new GregorianCalendar(yy, mm - 1, 1);
        return gc.getActualMaximum(GregorianCalendar.DATE);
    }
    public static String getLocalPattern(Locale locale) {
        SimpleDateFormat f = new SimpleDateFormat();
        f.setCalendar(Calendar.getInstance(locale));
        return f.toLocalizedPattern();
    }
    public static int getYears(java.util.Date date0, java.util.Date date1) {
        Calendar calendar0 = Calendar.getInstance();
        calendar0.setTime(date0);
        Calendar calendar1 = Calendar.getInstance();
        calendar1.setTime(date1);
        int year0 = calendar0.get(Calendar.YEAR);
        int year1 = calendar1.get(Calendar.YEAR);
        int years = year1 - year0;
        return years;
    }
    public static String getDifferenceOfYears(java.util.Date dateFrom, java.util.Date dateTo) {
        String years = DEFAULT_YEARS;
        if (dateFrom == null || dateTo == null) {
            years = DEFAULT_YEARS;
        } else {
            int days = getDifferenceOfDays(dateFrom, dateTo);
            DecimalFormat df = new DecimalFormat("#.0");
            years = df.format(days / 365.0);
        }
        return years;
    }
    public static Date formatCharDateYMDHMS(String str) {
        String format = DEFAULT_YMDHMSDATE_FORMAT;
        if (str == null || str.trim().length() == 0) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        ParsePosition pos = new ParsePosition(0);
        java.util.Date date = sdf.parse(str, pos);
        if (date == null) {
            return null;
        }
        return new Date(date.getTime());
    }
    public static Timestamp formatYMDToYMDHMS(String str) {
        String format = DEFAULT_YMDHMSDATE_FORMAT;
        if (str == null || str.trim().length() == 0) {
            return null;
        }
        str += " 00:00:00";
        SimpleDateFormat sdf = new SimpleDateFormat(format);
        ParsePosition pos = new ParsePosition(0);
        java.util.Date date = sdf.parse(str, pos);
        if (date == null) {
            return null;
        }
        Timestamp ts = DateUtil.fromatDateToTimestamp(new Date(date.getTime()));
        return ts;
    }
    public static Timestamp fromatDateToTimestamp(java.util.Date date) {
        Timestamp ts = new Timestamp(System.currentTimeMillis());
        try {
            SimpleDateFormat df = new SimpleDateFormat(DEFAULT_YMDHMSDATE_FORMAT);
            String time = df.format(date);
            ts = Timestamp.valueOf(time);
        } catch (Exception e) {
            return null;
        }
        return ts;
    }
    /**
     * 获取标准时区偏移
     * @return
     */
    public static int geTimeZoneOffset(){
        int offset=0;
        Calendar cal = Calendar.getInstance();
        TimeZone timeZone = cal.getTimeZone();
        offset=timeZone.getRawOffset()/(1000*60*60);
        return offset;
    }
    /**
     *  凌晨0点的时间
     * @param date  时间
     * @param days  正数为 days天后 ,负数为 days天前
     * @return
     */
    public static java.util.Date getTimesmorning(java.util.Date date,int days){
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.set(Calendar.DATE, cal.get(Calendar.DATE) +(days));
        cal.set(Calendar.HOUR_OF_DAY, 0);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return  cal.getTime();
    }
    /**
     *  晚上24点的时间
     * @param date  时间
     * @param days  正数为 days天后 ,负数为 days天前
     * @return
     */
    public static java.util.Date getTimesnight(java.util.Date date,int days){
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.set(Calendar.DATE, cal.get(Calendar.DATE) +(days));
        cal.set(Calendar.HOUR_OF_DAY, 24);
        cal.set(Calendar.SECOND, 0);
        cal.set(Calendar.MINUTE, 0);
        cal.set(Calendar.MILLISECOND, 0);
        return  cal.getTime();
    }
    /**
     *  日期加减天数 (可优化)
     * @param date 时间
     * @param days 天数差
     * @return
     */
    public static java.util.Date setDateTime(java.util.Date date,int days){
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.set(Calendar.DATE, cal.get(Calendar.DATE) +(days));
        return  cal.getTime();
    }
    public static Boolean isExpire(java.util.Date fromDate, java.util.Date endDate, Integer expiresIn){
        DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        long diff = (endDate.getTime() - fromDate.getTime())/1000;
        if(diff > expiresIn){
            return true;
        }
        else{
            return false;
        }
    }
    public static String getUtcDate(String dateStr,String format){
        SimpleDateFormat sdf1 = new SimpleDateFormat(DATE_WORLD_FORMAT);
        SimpleDateFormat sdf2 = new SimpleDateFormat(format);
        String date= null;
        try {
            date = sdf1.format(sdf2.parse(dateStr));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
    public static String getUtcDate(java.util.Date date){
        SimpleDateFormat sdf1 = new SimpleDateFormat(DATE_WORLD_FORMAT);
        String utcDate = sdf1.format(date);
        return utcDate;
    }
    //utc时间转换
    public static String utcToDate(String utcTime,String format){
        SimpleDateFormat utcSdf = new SimpleDateFormat(DATE_WORLD_FORMAT);
        SimpleDateFormat newSdf = new SimpleDateFormat(format);
        String date= null;
        try {
            if (!StringUtil.isEmpty(utcTime))
                date = newSdf.format(utcSdf.parse(utcTime));
        } catch (ParseException e) {
            e.printStackTrace();
        }
        return date;
    }
}

+ 0 - 75
app/app-iot-server/src/main/java/com/yihu/iot/util/operator/MD5.java

@ -1,75 +0,0 @@
package com.yihu.iot.util.operator;
import com.yihu.iot.util.encode.HexEncode;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.reflect.Method;
import java.nio.MappedByteBuffer;
import java.nio.channels.FileChannel;
import java.security.AccessController;
import java.security.MessageDigest;
import java.security.PrivilegedAction;
/**
 * @created  Air 2015/6/2.
 */
public class MD5 {
    static public String hash(String str) throws Exception {
        MessageDigest messageDigest = null;
        messageDigest = MessageDigest.getInstance("MD5");
        messageDigest.reset();
        messageDigest.update(str.getBytes());
        return HexEncode.toHexString(messageDigest.digest());
    }
    public static String getMd5ByFile(File file) throws FileNotFoundException {
        String value = null;
        FileInputStream in = new FileInputStream(file);
        MappedByteBuffer byteBuffer =null;
        try {
            byteBuffer = in.getChannel().map(FileChannel.MapMode.READ_ONLY, 0, file.length());
            MessageDigest md5 = MessageDigest.getInstance("MD5");
            md5.update(byteBuffer);
//            BigInteger bi = new BigInteger(1, md5.digest());
//            value = bi.toString(16);
            value= HexEncode.toHexString(md5.digest());
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if(null != in) {
                try {
                    in.close();
                    clean(byteBuffer);
                } catch (IOException e) {
                    e.printStackTrace();
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
        return value;
    }
    public static void clean(final Object buffer) throws Exception {
        AccessController.doPrivileged(new PrivilegedAction() {
            public Object run() {
                try {
                    Method getCleanerMethod = buffer.getClass().getMethod("cleaner", new Class[0]);
                    getCleanerMethod.setAccessible(true);
                    sun.misc.Cleaner cleaner = (sun.misc.Cleaner) getCleanerMethod.invoke(buffer, new Object[0]);
                    cleaner.clean();
                } catch (Exception e) {
                    e.printStackTrace();
                }
                return null;
            }
        });
    }
}

+ 0 - 1441
app/app-iot-server/src/main/java/com/yihu/iot/util/operator/StringUtil.java

@ -1,1441 +0,0 @@
package com.yihu.iot.util.operator;
import org.apache.commons.lang3.StringUtils;
import javax.servlet.http.HttpServletRequest;
import java.io.IOException;
import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.io.Writer;
import java.sql.Clob;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class StringUtil {
    public static String substring(String str, int start) {
        return StringUtils.substring(str, start);
    }
    public static String substring(String str, int start, int end) {
        return StringUtils.substring(str, start, end);
    }
    public static boolean isBlank(String str) {
        return StringUtils.isBlank(str);
    }
    public static String toString(Object obj) {
        if (obj == null) {
            return null;
        }
        return obj.toString();
    }
    public static String trimLeft(String value) {
        if (value == null)
            return "";
        String result = value;
        char ch[] = result.toCharArray();
        int index = -1;
        for (int i = 0; i < ch.length; i++) {
            if (Character.isWhitespace(ch[i])) {
                index = i;
            } else {
                break;
            }
        }
        if (index != -1) {
            result = result.substring(index + 1);
        }
        return result;
    }
    /**
     * ?��??????????????????
     *
     * @param value ?????
     * @return String src????????
     */
    public static String trimRight(String value) {
        if (value == null)
            return "";
        String result = value;
        char ch[] = result.toCharArray();
        int endIndex = -1;
        for (int i = ch.length - 1; i > -1; i--) {
            if (Character.isWhitespace(ch[i])) {
                endIndex = i;
            } else {
                break;
            }
        }
        if (endIndex != -1) {
            result = result.substring(0, endIndex);
        }
        return result;
    }
    /**
     * ***************************************************** ??
     * ??????????????????"0",?????????? ????????param str:???????????? param len???????????? ?? ???Stirng
     * <p/> ??��????? ??????? ******************************************************
     */
    public static String fillHeadCharsLen(String strOri, int len) {
        return fillHeadCharsLen(strOri, "0", len);
    }
    /**
     * ***************************************************** ??
     * ???????????????????"0",?????????? ????????param str:???????????? param len???????????? ?? ???Stirng
     * <p/> ??��????? ??????? ******************************************************
     */
    public static String fillBackCharsLen(String strOri, int len) {
        return fillBackCharsLen(strOri, "0", len);
    }
    /**
     * ***************************************************** ??
     * ??????????????????????????,?????????? ????????param str:???????????? param subStr:????????????
     * param len???????????? ?? ???Stirng <p/> ??��????? ???????
     * ******************************************************
     */
    public static String fillHeadCharsLen(String strOri, String subStr, int len) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (subStr == null) {
            subStr = " ";
        }
        String fillStr = "";
        for (int i = 0; i < len; i++) {
            fillStr = fillStr + subStr;
        }
        subStr = fillStr + strOri;
        return (subStr.substring(subStr.length() - len, subStr.length()));
    }
    /**
     * ***************************************************** ??
     * ???????????????????????????,?????????? ????????param str:???????????? param subStr:????????????
     * param len???????????? ?? ???Stirng <p/> ??��????? ???????
     * ******************************************************
     */
    public static String fillBackCharsLen(String strOri, String subStr, int len) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (subStr == null) {
            subStr = " ";
        }
        String fillStr = "";
        for (int i = 0; i < len; i++) {
            fillStr = fillStr + subStr;
        }
        subStr = strOri + fillStr;
        return (subStr.substring(0, len));
    }
    /**
     * ***************************************************** ?? ??????????????????"0"
     * ????????param str:???????????? param counter??????????? ?? ???Stirng <p/> ??��????? ???????
     * ******************************************************
     */
    public static String fillHeadChars(String strOri, int counter) {
        return fillHeadChars(strOri, "0", counter);
    }
    /**
     * ***************************************************** ?? ???????????????????"0"
     * ????????param str:???????????? param counter??????????? ?? ???Stirng <p/> ??��????? ???????
     * ******************************************************
     */
    public static String fillBackChars(String strOri, int counter) {
        return fillBackChars(strOri, "0", counter);
    }
    /**
     * ***************************************************** ?? ??????????????????????????
     * ????????param str:???????????? param subStr:???????????? param counter??????????? ??
     * ???Stirng <p/> ??��????? ???????
     * ******************************************************
     */
    public static String fillHeadChars(String strOri, String subStr, int counter) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (counter <= 0 || subStr == null) {
            return strOri;
        }
        String fillStr = "";
        for (int i = 0; i < counter; i++) {
            fillStr = fillStr + subStr;
        }
        return (fillStr + strOri);
    }
    /**
     * ***************************************************** ?? ???????????????????????????
     * ????????param str:???????????? param subStr:???????????? param counter??????????? ??
     * ???Stirng <p/> ??��????? ???????
     * ******************************************************
     */
    public static String fillBackChars(String strOri, String subStr, int counter) {
        if (strOri == null || strOri.trim().length() == 0) {
            strOri = "";
        }
        if (counter <= 0 || subStr == null) {
            return strOri;
        }
        String fillStr = "";
        for (int i = 0; i < counter; i++) {
            fillStr = fillStr + subStr;
        }
        return (strOri + fillStr);
    }
    /**
     * ***************************************************** ??
     * ????��???????????????null(???????) ????????param str:???????????? ????????? ?? ??????null??true;
     * ?????false <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isEmpty(Object strObj) {
        if (strObj == null || strObj.toString().trim().length() < 1) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ??
     * ????��??????????????????null????(???????)?? ????????param str:???��??????? ????????? ??
     * ???true?????false????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isStrEmpty(String str) {
        if ((str == null) || (str.trim().length() < 1) || "null".endsWith(str.toLowerCase())) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ??
     * ????????????????????????????????null????? ????????param str:???????????? ????????? ??
     * ???????????????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String getValue(String str) {
        if (str == null) {
            return "";
        }
        if (str.trim().length() <= 0)
            return "";
        str = "H" + str;
        str = str.trim();
        str = str.substring(1);
        return str;
    }
    /**
     * ***************************************************** ?? ????��?????????????????????
     * ????????param text:???��?????????param len:????????? ????????? ?? ???return
     * true??��??????false??????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean chkTextLen(String text, int len) {
        if (text == null || text.length() > len) {
            return false;
        } else {
            return true;
        }
    }
    /**
     * ***************************************************** ??
     * ????��??????????????????????????? ????????param text:???��?????????param len:????????? ????????? ??
     * ???return true??��??????false??????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean chkTextTrimLen(String text, int len) {
        if (text == null || text.trim().length() > len) {
            return false;
        } else {
            return true;
        }
    }
    /**
     * ***************************************************** ??
     * ????��???????????????english ????????param text:???��????????? ????????? ?? ???return
     * true???????false:????????????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isStrEn(String text) {
        for (int i = 0; i < text.length(); i++) {
            if (text.charAt(i) > 127) {
                return false;
            }
        }
        return true;
    }
    /**
     * ***************************************************** ?? ????��????????????????
     * ????????param ch:???��????? ????????? ?? ???return true???????false:?????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isCharNum(char ch) {
        if (ch > 47 && ch < 58) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ??
     * ????��?????????????��????????? ????????param str:???��??????? ????????? ?? ???return
     * true??Null?????????????false:??????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isStrNum(String str) {
        if (isStrEmpty(str)) {
            return true;
        }
        boolean notNum = false;
        for (int i = 0; i < str.length(); i++) {
            if (!isCharNum(str.charAt(i))) {
                notNum = true;
            }
        }
        return !notNum;
    }
    /**
     * ***************************************************** ??
     * ????��?????????????��????????? ????????param strSrc:???��??????? ????????? ?? ???return
     * true??????????false:????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isNum(String strSrc) throws Exception {
        for (int i = 0; i < strSrc.length(); i++) {
            if (!isCharNum(strSrc.charAt(i)))
                return false;
        }
        return true;
    }
    /**
     * ***************************************************** ?? ????��??????????????????
     * ????????param ch:???��????? ????????? ?? ???return true????????????false:?????????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isCharLetter(char ch) {
        if ((ch >= 65 && ch <= 90) && (ch >= 97 && ch <= 122)) {
            return true;
        } else {
            return false;
        }
    }
    /**
     * ***************************************************** ?? ????��?????????????????????
     * ????????param str:???��??????? ????????? ?? ???return true??NULL???��?????????false:?????????
     * <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean isStrLetter(String str) {
        if (isStrEmpty(str))
            return true;
        boolean notLetter = false;
        for (int i = 0; i < str.length(); i++) {
            if (!isCharLetter(str.charAt(i))) {
                notLetter = true;
            }
        }
        return !notLetter;
    }
    /**
     * ***************************************************** ??
     * ?????????????????????????????? ????????param src:?????????? ????????? ?? ???return
     * ??????????????????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static char strToChar(String src) {
        src = src.trim();
        char result = src.charAt(0);
        return result;
    }
    /**
     * ***************************************************** ??
     * ??????????????????????ASCII?? ????????param sql:???????sql?????? ????????? ?? ?????????????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static String encodeSQL(String sql) {
        StringBuffer tempBuff = new StringBuffer();
        for (int i = 0; i < sql.length(); i++) {
            tempBuff.append(Integer.toHexString(sql.charAt(i)));
        }
        return tempBuff.toString();
    }
    /**
     * ***************************************************** ??
     * ??????????ASCII????????????????? ????????param encoded:???????????? ????????? ?? ?????????????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static String decodeSQL(String encoded) {
        StringBuffer tempBuff = new StringBuffer();
        for (int i = 0; i < encoded.length(); i += 2) {
            tempBuff.append((char) Integer.parseInt(
                    encoded.substring(i, i + 2), 16));
        }
        return tempBuff.toString();
    }
    /**
     * ***************************************************** ?? ?????????��??
     * ????????param path1:????��????param context1:?????? ????????? ?? ???return ???��?? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static String getAbsolutePath(String path1, String context1) {
        int i1 = path1.indexOf(context1);
        if (i1 < 0) {
            return path1;
        } else {
            return path1.substring(path1.indexOf(context1) + context1.length());
        }
    }
    /**
     * ***************************************************** ?? ????????? ????????param
     * str1:???????????????param sindex:???��???param eindex:????��?? ????????? ??
     * ???????????��????????��???????????????????��??��??0?????????��????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String getSubString(String str1, int sindex, int eindex) {
        if (str1 == null) {
            return "";
        }
        if (str1.trim().length() <= 0)
            return "";
        if (str1.length() > sindex) {
            if (eindex >= 0)
                return str1.substring(sindex, eindex);
            else if (eindex < 0)
                return str1.substring(sindex);
        }
        return "";
    }
    /**
     * ***************************************************** ??
     * ????????????????????????��??????????????? ????????param strs:???????????????�param size1:?????????�A??
     * ????????? ?? ???return ??????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String[] getValues(String[] strs, int size1) {
        String[] strs1 = new String[size1];
        for (int i = 0; i < size1; i++) {
            strs1[i] = "";
        }
        if (strs == null) {
            return strs1;
        } else {
            if (strs.length < size1) {
                for (int i = 0; i < strs.length; i++) {
                    strs1[i] = strs[i];
                }
                return strs1;
            } else {
                return strs;
            }
        }
    }
    /**
     * ***************************************************** ?? ????????????�I????
     * ????????param strSource ???�I?????????param strFrom ????????param strTo ???????? ????????? ??
     * ????�I???????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String replaceStrAll(String strSource, String strFrom,
                                       String strTo) {
        String strDest = "";
        int intFromLen = strFrom.length();
        int intPos;
        while ((intPos = strSource.indexOf(strFrom)) != -1) {
            strDest = strDest + strSource.substring(0, intPos);
            strDest = strDest + strTo;
            strSource = strSource.substring(intPos + intFromLen);
        }
        strDest = strDest + strSource;
        return strDest;
    }
    public static String replaceStr(String strTarget, String strNew) {
        int iIndex = -1;
        while (true) {
            iIndex = strTarget.indexOf('\n');
            if (iIndex < 0) {
                break;
            }
            String strTemp = null;
            strTemp = strTarget.substring(0, iIndex);
            strTarget = strTemp + strNew + strTarget.substring(iIndex + 1);
        }
        return strTarget;
    }
    /**
     * ***************************************************** ??
     * ????��????????????????��?????? ????????param str1 ?????????????param strarray ??????????????�
     * ????????? ?? ???return true??????;false??��???? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static boolean includestr(String str1, String[] strarray) {
        if (strarray == null || strarray.length <= 0)
            return false;
        for (int i = 0; i < strarray.length; i++) {
            if (strarray[i] == null) {
                if (str1 == null)
                    return true;
                else
                    continue;
            }
            if (strarray[i].trim().equals(str1)) {
                return true;
            }
        }
        return false;
    }
    /**
     * ***************************************************** ??
     * ?????\n?????????????????????????�?????\r ????????param fvalue ???????????? ????????? ?? ???return
     * ?????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String[] getAreaValues(String fvalue) {
        String tmpstr = fvalue;
        int i = 0;
        if (tmpstr == null)
            return null;
        if (tmpstr.trim().equals(""))
            return null;
        while (tmpstr.indexOf("\n") >= 0) {
            i++;
            tmpstr = tmpstr.substring(tmpstr.indexOf("\n") + 1);
        }
        if (tmpstr.trim().equals("")) {
            i--;
        }
        String[] fvalues = new String[i + 1];
        tmpstr = fvalue;
        i = 0;
        while (tmpstr.indexOf("\n") >= 0) {
            fvalues[i] = tmpstr.substring(0, tmpstr.indexOf("\n"));
            if (fvalues[i].indexOf("\r") >= 0)
                fvalues[i] = fvalues[i].substring(0, fvalues[i].indexOf("\r"));
            i++;
            tmpstr = tmpstr.substring(tmpstr.indexOf("\n") + 1);
        }
        if (!tmpstr.trim().equals(""))
            fvalues[i] = tmpstr;
        return fvalues;
    }
    /**
     * ***************************************************** ?? ???????????��?|????\n
     * ????????param fvalue ???????????? ????????? ?? ?????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String getrealAreaValues(String fvalue) {
        String tmpstr = fvalue;
        String returnstr = "";
        if (tmpstr == null)
            return null;
        if (tmpstr.trim().equals(""))
            return "";
        while (tmpstr.indexOf("|") > 0) {
            returnstr += tmpstr.substring(0, tmpstr.indexOf("|")) + "\n";
            tmpstr = tmpstr.substring(tmpstr.indexOf("|") + 1);
        }
        return returnstr;
    }
    /**
     * ***************************************************** ??
     * ?????????????��??��???????????? ????????param strInput ??????????????param chr ????????? ????????? ??
     * ???return ???????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static int countChar(String strInput, char chr) {
        int iCount = 0;
        char chrTmp = ' ';
        if (strInput.trim().length() == 0)
            return 0;
        // ?????????????????
        for (int i = 0; i < strInput.length(); i++) {
            chrTmp = strInput.charAt(i);
            if (chrTmp == chr) {
                iCount++;
            }
        }
        return iCount;
    }
    /**
     * ***************************************************** ?? ??????????????????????????
     * ????????param strs ???????????????? ????????? ?? ????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String strArrayToStr(String[] strs) {
        return strArrayToStr(strs, null);
    }
    /**
     * ***************************************************** ?? ??????��???????????????????
     * ????????param strs ???????????????? ????????? ?? ????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static void printStrs(String[] strs) {
        for (int i = 0; i < strs.length; i++) {
            System.out.println(strs[i]);
        }
    }
    /**
     * ***************************************************** ??
     * ???????????��??????��??????????????????? ????????param strs ?????????????????? ????????? ?? ????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static void printDualStr(String[][] dualStr) {
        for (int i = 0; i < dualStr.length; i++) {
            for (int j = 0; j < dualStr[i].length; j++) {
                System.out.print(dualStr[i][j] + " ");
            }
            System.out.println();
        }
    }
    /**
     * ***************************************************** ??
     * ???????????????????????��???��????��???? ????????param dualStr ??????????? ????????? ?? ???return
     * ???????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String[][] rowToColumn(String[][] dualStr) {
        String[][] returnDualStr = null;
        if (dualStr != null) {
            returnDualStr = new String[dualStr[0].length][dualStr.length];
            for (int i = 0; i < dualStr.length; i++)
                for (int j = 0; j < dualStr[0].length; j++)
                    returnDualStr[j][i] = dualStr[i][j];
        }
        return returnDualStr;
    }
    /**
     * ***************************************************** ??
     * ????????????????????String?????��???????????????? ????????param inStr ?????????? ????????? ?? ???return
     * ??????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String latinString(String inStr) {
        String res = inStr;
        if (null == res)
            return null;
        res = replaceStrAll(res, "\"", "\\\"");
        res = replaceStrAll(res, "'", "\\'");
        return res;
    }
    /**
     * ***************************************************** ?? ?????????????��???�I???????
     * ????????param String strTarget, String strNew ????????? ?? ???return String
     * ????????�I????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String replaceWhiteSpace(String strTarget, String strNew) {
        int iIndex = -1;
        while (true) {
            char cRep = 32;
            iIndex = strTarget.indexOf(cRep);
            if (iIndex < 0) {
                break;
            }
            String strTemp = null;
            strTemp = strTarget.substring(0, iIndex);
            strTarget = strTemp + strNew + strTarget.substring(iIndex + 1);
        }
        return strTarget;
    }
    /**
     * ***************************************************** ??
     * ?????????��?????????��????��?????????????��????��?????????��???? ????????param amount ???????, param
     * length ?????��??��???? ????????? ?? ???return ??????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String double2str(double amount, int length) {
        String strAmt = Double.toString(amount);
        int pos = strAmt.indexOf('.');
        if (pos != -1 && strAmt.length() > length + pos + 1)
            strAmt = strAmt.substring(0, pos + length + 1);
        return strAmt;
    }
    /**
     * ***************************************************** ??
     * ???????chr?????????????String???????split???????"|"??????? ????????param str ??????????,param
     * chr ?????? ????????? ?? ???return String[] ??????????????,????????????|?????????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static String[] doSplit(String str, char chr) {
        int iCount = 0;
        char chrTmp = ' ';
        // ?????????????????
        for (int i = 0; i < str.length(); i++) {
            chrTmp = str.charAt(i);
            if (chrTmp == chr) {
                iCount++;
            }
        }
        String[] strArray = new String[iCount];
        for (int i = 0; i < iCount; i++) {
            int iPos = str.indexOf(chr);
            if (iPos == 0) {
                strArray[i] = "";
            } else {
                strArray[i] = str.substring(0, iPos);
            }
            str = str.substring(iPos + 1); // ??iPos+1??????,str????????��
        }
        return strArray;
    }
    /**
     * ***************************************************** ??
     * ???????s?????????????String???????split???????"|"??????? ????????param str ??????????,param s
     * ???????? ????????? ?? ???return String[] ??????????????,??????????|?????????? <p/>
     * ??��?????20051220 ???????
     * ******************************************************
     */
    public static String[] strSplit(String src, String splitchar) {
        int resultSize = 0;
        int len = src.length();
        int idx = 0;
        String strTemp = "";
        for (int i = 0; i < len; i++) {
            if (src.substring(i, i + 1).equals(splitchar)) {
                resultSize++;
            }
        }
        if ((len > 1) & (!src.substring(len - 1, len).equals(splitchar))) {
            resultSize++;
        }
        String result[] = new String[resultSize];
        for (int i = 0; i < len; i++) {
            if (src.substring(i, i + 1).equals(splitchar)) {
                result[idx] = strTemp;
                idx++;
                strTemp = "";
            } else {
                strTemp = String.valueOf(strTemp)
                        + String.valueOf(src.charAt(i));
            }
        }
        if (!strTemp.equals("")) {
            result[idx] = strTemp;
        }
        return result;
    }
    /**
     * ***************************************************** ??
     * ???????strSeparator?????????????????????��??????? ????????param strToSplit ??????????,param
     * strSeparator ????????,param iLimit ?????�� ????????? ?? ???return String[] ??????????????
     * <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String[] split(String strToSplit, String strSeparator,
                                 int iLimit) {
        ArrayList tmpList = new ArrayList();
        int iFromIndex = 0;
        int iCurIndex = strToSplit.length();
        String strUnitInfo = "";
        int iCurCounts = 0;
        while ((iCurIndex != -1) && (iFromIndex < strToSplit.length())
                && (iCurCounts < iLimit)) {
            iCurIndex = strToSplit.indexOf(strSeparator, iFromIndex);
            if (iCurIndex == -1) {
                strUnitInfo = strToSplit.substring(iFromIndex, strToSplit
                        .length());
            } else {
                strUnitInfo = strToSplit.substring(iFromIndex, iCurIndex);
                iFromIndex = iCurIndex + 1;
            }
            tmpList.add(strUnitInfo);
            iCurCounts++;
        }
        int iCounts = tmpList.size();
        String tmpArray[] = new String[iCounts];
        for (int i = 0; i < iCounts; i++) {
            tmpArray[i] = (String) tmpList.get(i);
        }
        return tmpArray;
    }
    /**
     * ***************************************************** ??
     * ????????????��????????????????????...???? ????????param src ???????????,param len ?????�� ????????? ??
     * ???return String ??��????????????????????...??????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String strIntercept(String src, int len) {
        if (src == null) {
            return "";
        }
        if (src.length() > len) {
            src = String.valueOf(String.valueOf(src.substring(0, len))).concat(
                    "...");
        }
        return src;
    }
    /**
     * ***************************************************** ??
     * ?????????????ISO8859_1???? ????????param str_in ??????????????? ????????? ?? ???return String
     * ????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public static String strtochn(String str_in) {
        try {
            String temp_p = str_in;
            if (temp_p == null) {
                temp_p = "";
            }
            String temp = "";
            if (!temp_p.equals("")) {
                byte[] byte1 = temp_p.getBytes("ISO8859_1");
                temp = new String(byte1);
            }
            return temp;
        } catch (Exception e) {
        }
        return "null";
    }
    /**
     * ***************************************************** ??
     * ?????ISO8859_1????????GBK???? ????????param strvalue ??????????????? ????????? ?? ???return
     * String ????????????? ???????
     * ******************************************************
     */
    public static String ISO2GBK(String strvalue) {
        try {
            if (strvalue == null)
                return null;
            else {
                strvalue = new String(strvalue.getBytes("ISO8859_1"), "GBK");
                return strvalue;
            }
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * ***************************************************** ??
     * ?????????????????????��?????? ????????param str ??????????????? ????????? ?? ???return String
     * ????????????? ??????? ******************************************************
     */
    public static String cnCodeTrans(String str) {
        String s = "";
        try {
            s = new String(str.getBytes("GB2312"), "8859_1");
        } catch (UnsupportedEncodingException a) {
            System.out.print("chinese thansform exception");
        }
        return s;
    }
    /**
     * ***************************************************** ??
     * ????��?????????????????STaaaa????ST****** ????????param strSource???????????????param
     * strRule???? ????????? ?? ???return false:???????????true:????????? ???????
     * ******************************************************
     */
    public static boolean judgeMatch(String strSource, String strRule) {
        int i = 0;
        // ????????��?
        if ((null == strSource) || (strSource.length() == 0))
            return false;
        // ????????��?
        if ((null == strRule) || (strRule.length() == 0))
            return false;
        // ??????????
        if (strSource.length() > strRule.length())
            return false;
        // ??��???��?
        for (i = 0; i < strRule.length(); i++) {
            // ?????????
            if (strSource.length() < i + 1) {
                break;
            }
            if ((strRule.charAt(i) != '*')
                    && (strSource.charAt(i) != strRule.charAt(i))) {
                return false;
            }
        }
        // ??????????????????????????????'*'?????????
        for (; i < strRule.length(); i++) {
            if (strRule.charAt(i) != '*')
                return false;
        }
        return true;
    }
    public static String column2Property(String column) {
        column = column.toLowerCase();
        int i = column.indexOf("_");
        while (i != -1) {
            if (i != column.length() - 1) {
                char temp = column.charAt(i + 1);
                String strTemp = String.valueOf(temp);
                column = column.replaceFirst("_" + strTemp, strTemp
                        .toUpperCase());
                i = column.indexOf("_");
            } else {
                break;
            }
        }
        return column;
    }
    public static String strArrayToStr(String[] strs, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (strs == null)
            return "";
        if (separator == null)
            separator = "";
        for (int i = 0; i < strs.length; i++) {
            returnstr.append(strs[i]);
            if (i < strs.length - 1)
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String objectArrayToStr(Object[] objects, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (objects == null)
            return "";
        if (separator == null)
            separator = "";
        for (int i = 0; i < objects.length; i++) {
            returnstr.append(String.valueOf(objects[i]));
            if (i < objects.length - 1)
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String listToStr(List element, String separator) {
        StringBuffer returnstr = new StringBuffer("");
        if (element == null)
            return "";
        if (separator == null)
            separator = "";
        Iterator it = element.iterator();
        while (it.hasNext()) {
            returnstr.append(String.valueOf(it.next()));
            if (it.hasNext())
                returnstr.append(separator);
        }
        return returnstr.toString();
    }
    public static String[] listToStrArray(List element) {
        if (element == null || element.size() == 0)
            return null;
        Iterator it = element.iterator();
        String[] strArray = new String[element.size()];
        int i = 0;
        while (it.hasNext()) {
            strArray[i] = String.valueOf(it.next());
            i++;
        }
        return strArray;
    }
    public static List strToList(String str, String separator) {
        if (str == null || str.equals(""))
            return null;
        if (separator == null)
            separator = "";
        String[] strArr = str.split(separator);
        int size = strArr.length;
        List list = new ArrayList();
        for (int i = 0; i < size; i++) {
            list.add(strArr[i]);
        }
        return list;
    }
    public static StringBuffer populate(StringBuffer bf, String value,
                                        boolean isNotLast) {
        if (value == null) {
            return bf;
        }
        // ???????????????????�I??????????????????????????????SQL???????????
        System.out.println(value.replaceAll("'", "''"));
        bf.append("'").append(value.replaceAll("'", "''")).append("'");
        if (isNotLast)
            bf.append(",");
        return bf;
    }
    public static boolean isExist(String str, String substr, String sepatator) {
        if (str == null || str.trim().equals(""))
            return false;
        if (substr == null || substr.trim().equals(""))
            return false;
        String[] strArr = str.split(sepatator);
        int size = strArr.length;
        for (int i = 0; i < size; i++) {
            if (strArr[i].equals(substr))
                return true;
        }
        return false;
    }
    public static boolean isExist(String str, String substr) {
        return isExist(str, substr, ",");
    }
    public static String leftInclude(String str) {
        if (str == null || str.equals(""))
            return str;
        return str + "%";
    }
    public static String rightInclude(String str) {
        if (str == null || str.equals(""))
            return str;
        return "%" + str;
    }
    public static String include(String str) {
        if (str == null || str.equals(""))
            return str;
        return "%" + str + "%";
    }
    /**
     * ???????????????????????????????
     *
     * @param source String ?????
     * @param target String ????????
     * @return String ???
     */
    public static String nvl(Object source, Object target) {
        return source != null ? String.valueOf(source)
                : (target != null ? String.valueOf(target) : null);
    }
    /**
     * ??clob??????????????
     *
     * @param clobValue
     * @return
     * @throws SQLException
     */
    public static String clob2Str(Object clobValue) throws SQLException {
        return ((Clob) clobValue).getSubString(1, (int) ((Clob) clobValue)
                .length());
    }
    /**
     * ???web????????Ip
     *
     * @param request
     * @return
     */
    public static String getRemoteAddr(HttpServletRequest request) {
        String ip = request.getHeader("x-forwarded-for");
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getHeader("WL-Proxy-Client-IP");
        }
        if (ip == null || ip.length() == 0 || "unknown".equalsIgnoreCase(ip)) {
            ip = request.getRemoteAddr();
        }
        return ip;
    }
    public static String hideFlowStr(String str, int maxLen) {
        if (str == null || maxLen == 0) {
            return "";
        }
        if (str.length() > maxLen) {
            str = str.substring(0, maxLen) + "...";
        }
        return str;
    }
    /**
     * ???????????????
     *
     * @param str
     * @return
     */
    public static String escapeLuceneSpecialCharacters(String str) {
        if (str == null) {
            return null;
        }
        try {
            StringWriter writer = new StringWriter(str.length() * 2);
            escapeLuceneSpecialCharacterString(writer, str);
            return writer.toString();
        } catch (IOException ex) {
            //LogService.getLogger(StringUtil.class).error(ex.getMessage());
            return null;
        }
    }
    private static void escapeLuceneSpecialCharacterString(Writer out,
                                                           String str) throws IOException {
        if (str == null) {
            return;
        }
        int sz = str.length();
        for (int i = 0; i < sz; i++) {
            char ch = str.charAt(i);
            /*
             * Reference link:
			 * http://lucene.apache.org/java/docs/queryparsersyntax.html Lucene
			 * supports escaping special characters that are part of the query
			 * syntax. The current list special characters are: + - && || ! ( ) { } [ ] ^ " ~ * ? : \
			 * To escape these character use the \ before the character.
			 */
            switch (ch) {
                case '+':
                case '-':
                case '!':
                case '(':
                case ')':
                case '{':
                case '}':
                case '[':
                case ']':
                case '^':
                case '\"':
                case '~':
                case '*':
                case '?':
                case ':':
                case '\\':
                    out.write('\\');
                    out.write(ch);
                    break;
                case '&':
                case '|':
                    // check if it is '&&' or '||' ~ check if the next char is '&'
                    // or '|'
                    if ((i + 1) < sz && str.charAt(i + 1) == ch) {
                        out.write('\\');
                        out.write(ch);
                        i++;
                    }
                    out.write(ch);
                    break;
                default:
                    out.write(ch);
                    break;
            }
        }
    }
    /**
     * ???????????????????????
     */
    public static String getFirstLetter(String chinese) {
        /**
         * ???
         */
        final int[] li_SecPosValue = {1601, 1637, 1833, 2078, 2274, 2302,
                2433, 2594, 2787, 3106, 3212, 3472, 3635, 3722, 3730, 3858,
                4027, 4086, 4390, 4558, 4684, 4925, 5249, 5590};
        final String[] lc_FirstLetter = {"A", "B", "C", "D", "E", "F", "G",
                "H", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T",
                "W", "X", "Y", "Z"};
        if (chinese == null || chinese.trim().length() == 0) {
            return "";
        }
        chinese = conversionStr(chinese, "GB2312", "ISO8859-1");
        if (chinese.length() > 1) { // ?��?????????
            int li_SectorCode = (int) chinese.charAt(0); // ????????
            int li_PositionCode = (int) chinese.charAt(1); // ????��??
            li_SectorCode = li_SectorCode - 160;
            li_PositionCode = li_PositionCode - 160;
            int li_SecPosCode = li_SectorCode * 100 + li_PositionCode;// ??????��??
            if (li_SecPosCode > 1600 && li_SecPosCode < 5590) {
                for (int i = 0; i < 23; i++) {
                    if (li_SecPosCode >= li_SecPosValue[i]
                            && li_SecPosCode < li_SecPosValue[i + 1]) {
                        chinese = lc_FirstLetter[i];
                        break;
                    }
                }
            } else {
                chinese = conversionStr(chinese, "ISO8859-1", "GB2312");
                chinese = chinese.substring(0, 1);
            }
        }
        return chinese;
    }
    private static String conversionStr(String str, String charsetName,
                                        String toCharsetName) {
        try {
            str = new String(str.getBytes(charsetName), toCharsetName);
        } catch (UnsupportedEncodingException ex) {
            System.out.println("????????????????" + ex.getMessage());
        }
        return str;
    }
    /**
     * ????????????
     *
     * @param html
     * @return
     */
    public static String checkStr(String html) {
        try {
            html = html.replaceAll("\r", "");
            html = html.replaceAll("\n", "");
            html = html.replaceAll("\"", "'");
            html = html.replaceAll("\t", " ");
            Pattern p_script;
            Matcher m_script;
            Pattern p_href;
            Matcher m_href;
            Pattern p_a;
            Matcher m_a;
            Pattern p_on;
            Matcher m_on;
            Pattern p_iframe;
            Matcher m_iframe;
            Pattern p_frameset;
            Matcher m_frameset;
            Pattern p_img;
            Matcher m_img;
            Pattern p_p1;
            Matcher m_p1;
            Pattern p_p2;
            Matcher m_p2;
            String stript_str = "<script[\\s\\S]+</script *>";
            String href_str = " href *= *[\\s\\S]*script *:";
            String on_str = " on[\\s\\S]*=";
            String iframe_str = "<iframe[\\s\\S]+</iframe *>";
            String frameset_str = "<frameset[\\s\\S]+</frameset *>";
            String a_str = "<a ([^>])*>.*?</a([^>])*>";
            //String img_str = "\\<img[^\\>]+\\>";
            String p_str1 = "</p>";
            String p_str2 = "<p>";
            p_script = Pattern.compile(stript_str, Pattern.CASE_INSENSITIVE);
            m_script = p_script.matcher(html);
            html = m_script.replaceAll(""); // ????script???
            p_href = Pattern.compile(href_str, Pattern.CASE_INSENSITIVE);
            m_href = p_href.matcher(html);
            html = m_href.replaceAll(""); // ????script???
            p_a = Pattern.compile(a_str, Pattern.CASE_INSENSITIVE);
            m_a = p_a.matcher(html);
            html = m_a.replaceAll(""); // ????script???
            p_on = Pattern.compile(on_str, Pattern.CASE_INSENSITIVE);
            m_on = p_on.matcher(html);
            html = m_on.replaceAll(""); // ????script???
            p_iframe = Pattern.compile(iframe_str, Pattern.CASE_INSENSITIVE);
            m_iframe = p_iframe.matcher(html);
            html = m_iframe.replaceAll(""); // ????script???
            p_frameset = Pattern
                    .compile(frameset_str, Pattern.CASE_INSENSITIVE);
            m_frameset = p_frameset.matcher(html);
            html = m_frameset.replaceAll(""); // ????script???
            // p_img = Pattern.compile(img_str, Pattern.CASE_INSENSITIVE);
            // m_img = p_img.matcher(html);
            // html = m_img.replaceAll(""); // ????script???
            p_p1 = Pattern.compile(p_str1, Pattern.CASE_INSENSITIVE);
            m_p1 = p_p1.matcher(html);
            html = m_p1.replaceAll(""); // ????script???
            p_p2 = Pattern.compile(p_str2, Pattern.CASE_INSENSITIVE);
            m_p2 = p_p2.matcher(html);
            html = m_p2.replaceAll(""); // ????script???
        } catch (Exception e) {
            System.err.println("Html2Text: " + e.getMessage());
        }
        return html;
    }
    public static String substr(String value, int maxlength, String postfix) {
        int k = 0;
        int l = 0;
        for (int i = 0; i < value.length() && maxlength > l * 2 + k; i++) {
            if (value.charAt(i) > '\200') {
                l++;
            } else {
                k++;
            }
        }
        // value????????????????????
        if (l + k >= value.length()) {
            return value;
        } else if (maxlength >= l * 2 + k && l + k > 0) {
            value = value.substring(0, l + k);
        } else if (l + k > 0) {
            value = value.substring(0, (l + k) - 1);
        } else {
            return value;
        }
        // ????????????????????????????????????????
        if (!StringUtils.isEmpty(postfix)) {
            value += postfix;
        }
        return value;
    }
    /**
     * ***************************************************** ??
     * ??????��??????????null???????????????????? ????????param Content:???????????? ????????? ??
     * ?????????????null???????????????????? <p/> ??��?????20051220 ???????
     * ******************************************************
     */
    public String nullToSpace(String Content) {
        if (Content == null) {
            Content = "";
        }
        return Content;
    }
    /**
     * ***************************************************** ??
     * ?????GBK????????ISO8859_1???? ????????param strvalue ??????????????? ????????? ?? ???return
     * String ????????????? ???????
     * ******************************************************
     */
    public String GBK2ISO(String strvalue) throws Exception {
        try {
            if (strvalue == null)
                return null;
            else {
                strvalue = new String(strvalue.getBytes("GBK"), "ISO8859_1");
                return strvalue;
            }
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 去除换行符
     * @param str
     * @return
     */
    public static   String replaceBlank(String str) {
        String dest = "";
        if (str!=null) {
            Pattern p = Pattern.compile("\\s*|\t|\r|\n");
            Matcher m = p.matcher(str);
            dest = m.replaceAll("");
        }
        return dest;
    }
}

+ 0 - 29
app/app-iot-server/src/main/java/com/yihu/iot/util/spring/SpringContextHolder.java

@ -1,29 +0,0 @@
package com.yihu.iot.util.spring;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.annotation.Configuration;
@Configuration
public class SpringContextHolder implements ApplicationContextAware {
    @Autowired
    private static ApplicationContext context;
    @Override
    public void setApplicationContext(ApplicationContext context) throws BeansException {
        SpringContextHolder.context = context;
    }
    public static Object getSpringBean(String beanName) {
        return context == null ? null : context.getBean(beanName);
    }
    public static String[] getBeanDefinitionNames() {
        return context.getBeanDefinitionNames();
    }
}

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

@ -1,165 +0,0 @@
server:
  contextPath: /iot
  port: 9099
  sessionTimeout: 30000000
spring:
  redis:
    database: 0 # Database index used by the connection factory.
    port: 6379 # Redis server port.
    password: # Login password of the redis server.
    timeout: 0 # Connection timeout in milliseconds.
    #sentinel:
    #  master: # Name of Redis server.
    #  nodes: # Comma-separated list of host:port pairs.
    pool:
      max-active: 8 # Max number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
      max-idle: 8 # Max number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
      max-wait: -1 # Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
      min-idle: 1  # Target for the minimum number of idle connections to maintain in the pool. This settings only has an effect if it is positive.
  application:
    name: app-iot-server
    message: App IOT Server
  resources:
    static-locations: classpath:/META-INF/resources/,classpath:/resources/,classpath:/front/,classpath:/
#    cache-period: 0
permissions:
  info: admin
app:
  clientId: Qz2yA1MOD0 # 【物联网】应用
fast-dfs:
  tracker-server: 172.19.103.54:22122 #服务器地址
  connect-timeout: 2 #链接超时时间
  network-timeout: 30
  charset: ISO8859-1 #编码
  http:
    tracker-http-port: 80
    anti-steal-token: no
    secret-key: FastDFS1234567890
  pool: #连接池大小
    init-size: 5
    max-size: 20
    wait-time: 500
---
spring:
  profiles: jwdev
  loginVaild: true
  redis:
    host: 172.19.103.47 # Redis server host.
    port: 6379
    password: redis!@456
app:
#  oauth2InnerUrl: http://172.19.103.44:10260/  # 物联网环境
  oauth2InnerUrl: http://172.19.103.73:10260/   # 认证中心,获取token ehr环境
  oauth2OuterUrl: http://27.154.233.186:10260/  # 上饶-授权外网映射
service-gateway:
  iotUrl: http://192.168.131.24:8088/svr-iot/
  profileInnerUrl: http://172.19.103.73:10000/api/v1.0/admin
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
third:
  wlyy:
    url: http://172.19.103.88:9092/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
ehr:
  user:
    roleId: 10268
  metadata:
    version: 59083976eebd
    reference: 000000065a965615966b3a40c86ceba7
fast-dfs:
  tracker-server: 172.19.103.54:22122
  public-server: http://172.19.103.54:80/
#logging:
#  path: /data/logger
#  file: app-iot-server
##如果是外网项目就是flase 内网是true
neiwang:
  enable: true
  wlyy: http://localhost:9099/iot/
---
spring:
  profiles: jwtest
  loginVaild: true
  redis:
    host: 172.19.103.47 # Redis server host.
    port: 6379
    password: redis!@456
app:
  oauth2InnerUrl: http://172.19.103.73:10260/
  oauth2OuterUrl: http://27.154.233.186:10260/
service-gateway:
  iotUrl: http://172.19.103.33:8088/svr-iot/
  profileInnerUrl: http://172.19.103.73:10000/api/v1.0/admin
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
third:
  wlyy:
    url: http://172.19.103.88:9092/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
ehr:
  user:
    roleId: 10268
  metadata:
    version: 59083976eebd
    reference: 000000065a965615966b3a40c86ceba7
fast-dfs:
  tracker-server: 172.19.103.54:22122
  public-server: http://172.19.103.54:80/
#logging:
#  path: /data/logger
#  file: app-iot-server
##如果是外网项目就是flase,false会调用内网http接口项目提交  内网是true直接上传fastDfs
neiwang:
  enable: true
  wlyy: http://172.19.103.88:9099/iot/
---
spring:
  profiles: jwprod
  loginVaild: true
  redis:
    host: 172.19.103.47 # Redis server host.
    port: 6379
    password: redis!@456
app:
  oauth2InnerUrl: http://172.19.103.73:10260/
  oauth2OuterUrl: http://27.154.233.186:10260/
service-gateway:
  profileInnerUrl: http://172.19.103.73:10000/api/v1.0/admin
  profileOuterUrl: http://27.154.233.186:10000/api/v1.0/admin
  portalInnerUrl: http://172.19.103.73:10280/api/v1.0/portal
  portalOuterUrl: http://27.154.233.186:10280/api/v1.0/portal
third:
  wlyy:
    url: http://www.yihu.com/wlyy/
    appid: 915d0345-5b1d-11e6-8344-fa163e8aee61
    appsecret: 915d0345-5b1d-11e6-8344-fa163e8aee57
ehr:
  user:
    roleId: 10268
  metadata:
    version: 59083976eebd
    reference: 000000065a965615966b3a40c86ceba7
fast-dfs:
  tracker-server: 11.1.2.9:22122
  accessUrl: http://11.1.2.9
#logging:
#  path: /data/logger
#  file: app-iot-server
##如果是外网项目就是flase 内网是true
neiwang:
  enable: false
  wlyy: http://59.61.92.90:9099/iot/
#单点登录
#GET http://172.19.103.73:10260/oauth/sso?response_type=token&client_id=uzs5G0HgTp&state=sxy&scope=read&redirect_uri=http://192.168.1.221:8010/ehr/browser/common/login/signin?idCardNo=362321200108017313&user=admin

+ 0 - 178
app/app-iot-server/src/main/resources/logback.xml.bak

@ -1,178 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 从高到地低 OFF 、 FATAL 、 ERROR 、 WARN 、 INFO 、 DEBUG 、 TRACE 、 ALL -->
<!-- 日志输出规则  根据当前ROOT 级别,日志输出时,级别高于root默认的级别时  会输出 -->
<!-- 以下  每个配置的 filter 是过滤掉输出文件里面,会出现高级别文件,依然出现低级别的日志信息,通过filter 过滤只记录本级别的日志-->
<!-- 属性描述 scan:性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒。当scan为true时,此属性生效。默认的时间间隔为1分钟。
	debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
    <!-- 定义日志文件 输入位置 -->
    <property name="log_dir" value="/home/dev-admin/logs"/>
    <!-- 日志最大的历史 30天 -->
    <property name="maxHistory" value="30"/>
    <!-- ConsoleAppender 控制台输出日志 -->
    <appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
        <!-- 对日志进行格式化 -->
        <encoder>
            <pattern>%d %level %C.%M %m%n</pattern> <!-- %C.%M 可能会影响效率-->
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <!-- ERROR级别日志 -->
    <!-- 滚动记录文件,先将日志记录到指定文件,当符合某个条件时,将日志记录到其他文件 RollingFileAppender-->
    <appender name="ERROR" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!-- 过滤器,只记录WARN级别的日志 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>INFO</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <!-- 最常用的滚动策略,它根据时间来制定滚动策略.既负责滚动也负责出发滚动 -->
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!--日志输出位置  可相对、和绝对路径 -->
            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/error-log.log</fileNamePattern>
            <!-- 可选节点,控制保留的归档文件的最大数量,超出数量就删除旧文件假设设置每个月滚动,且<maxHistory>是6,
            则只保存最近6个月的文件,删除之前的旧文件。注意,删除旧文件是,那些为了归档而创建的目录也会被删除-->
            <maxHistory>${maxHistory}</maxHistory>
        </rollingPolicy>
        <!-- 按照固定窗口模式生成日志文件,当文件大于20MB时,生成新的日志文件。窗口大小是1到3,当保存了3个归档文件后,将覆盖最早的日志。
        <rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
          <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/.log.zip</fileNamePattern>
          <minIndex>1</minIndex>
          <maxIndex>3</maxIndex>
           </rollingPolicy>   -->
        <!-- 查看当前活动文件的大小,如果超过指定大小会告知RollingFileAppender 触发当前活动文件滚动
        <triggeringPolicy class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
              <maxFileSize>5MB</maxFileSize>
           </triggeringPolicy>   -->
        <encoder>
            <pattern>%d %level %C.%M %m%n</pattern> <!-- %C.%M 可能会影响效率-->
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <!-- WARN级别日志 appender -->
    <appender name="WARN" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!-- 过滤器,只记录WARN级别的日志 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>WARN</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 按天回滚 daily -->
            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/warn-log.log
            </fileNamePattern>
            <!-- 日志最大的历史 60天 -->
            <maxHistory>${maxHistory}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%d %level %C.%M %m%n</pattern> <!-- %C.%M 可能会影响效率-->
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <!-- INFO级别日志 appender -->
    <appender name="INFO" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!-- 过滤器,只记录INFO级别的日志 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>INFO</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 按天回滚 daily -->
            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/info-log.log
            </fileNamePattern>
            <!-- 日志最大的历史 60天 -->
            <maxHistory>${maxHistory}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%d %level %C.%M %m%n</pattern> <!-- %C.%M 可能会影响效率-->
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <!-- DEBUG级别日志 appender -->
    <appender name="DEBUG" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!-- 过滤器,只记录DEBUG级别的日志 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>DEBUG</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 按天回滚 daily -->
            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/debug-log.log
            </fileNamePattern>
            <!-- 日志最大的历史 60天 -->
            <maxHistory>${maxHistory}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%d %level %C.%M %m%n</pattern> <!-- %C.%M 可能会影响效率-->
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <!-- TRACE级别日志 appender -->
    <appender name="TRACE" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <!-- 过滤器,只记录ERROR级别的日志 -->
        <filter class="ch.qos.logback.classic.filter.LevelFilter">
            <level>TRACE</level>
            <onMatch>ACCEPT</onMatch>
            <onMismatch>DENY</onMismatch>
        </filter>
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <!-- 按天回滚 daily -->
            <fileNamePattern>${log_dir}/%d{yyyy-MM-dd}/trace-log.log
            </fileNamePattern>
            <!-- 日志最大的历史 60天 -->
            <maxHistory>${maxHistory}</maxHistory>
        </rollingPolicy>
        <encoder>
            <pattern>%d %level %C.%M %m%n</pattern> <!-- %C.%M 可能会影响效率-->
            <charset class="java.nio.charset.Charset">UTF-8</charset>
        </encoder>
    </appender>
    <logger name="java.sql.PreparedStatement" value="DEBUG" />
    <logger name="java.sql.Connection" value="DEBUG" />
    <logger name="java.sql.Statement" value="DEBUG" />
    <logger name="com.ibatis" value="DEBUG" />
    <logger name="com.ibatis.common.jdbc.SimpleDataSource" value="DEBUG" />
    <logger name="com.ibatis.common.jdbc.ScriptRunner" level="DEBUG"/>
    <logger name="com.ibatis.sqlmap.engine.impl.SqlMapClientDelegate" value="DEBUG" />
    <!-- root级别   DEBUG -->
    <root level="INFO">
        <!-- 控制台输出 -->
        <appender-ref ref="STDOUT" />
        <!-- 文件输出 -->
        <appender-ref ref="ERROR" />
        <appender-ref ref="INFO" />
        <appender-ref ref="WARN" />
        <appender-ref ref="DEBUG" />
        <appender-ref ref="TRACE" />
    </root>
</configuration>

文件差异内容过多而无法显示
+ 0 - 12
app/app-iot-server/src/main/webapp/front/css/animate.min.css


文件差异内容过多而无法显示
+ 0 - 6
app/app-iot-server/src/main/webapp/front/css/bootstrap.min.css


文件差异内容过多而无法显示
+ 0 - 6
app/app-iot-server/src/main/webapp/front/css/bootstrap.min14ed.css


文件差异内容过多而无法显示
+ 0 - 1
app/app-iot-server/src/main/webapp/front/css/demo/webuploader-demo.min.css


文件差异内容过多而无法显示
+ 0 - 4
app/app-iot-server/src/main/webapp/front/css/font-awesome.min93e3.css


+ 0 - 389
app/app-iot-server/src/main/webapp/front/css/index.css

@ -1,389 +0,0 @@
html, body{height: 100%;}
a {
    outline: 0;
    cursor: pointer;
}
a:hover{
    text-decoration:none;
}
ul{
    padding: 0;
    margin: 0;
}
li {
    list-style: none;
}
p{
    margin: 0;
}
.overflow{
    overflow: hidden;
}
.pr-10{
    padding-right: 10px;
}
.mb-7{
    margin-bottom: 7px;
}
.mb-10{
    margin-bottom: 10px;
}
.mb-16{
    margin-bottom: 16px;
}
.f-fs12{
    font-size: 12px;
}
.f-fs14{
    font-size: 14px;
}
.f-fs16{
    font-size: 16px;
}
.main-color{
    color:#1FA2FF;
}
.color1{
    color: #333;
}
.color2{
    color: #00CF92;
}
.color3{
    color: #F54336;
}
.color4{
    color: #999;
}
.bg-color1{
    background-color: #F6F6F6;
}
.items {
    display: -webkit-box;
    display: -webkit-flex;
    display: flex;
    align-items: center
}
.item{
    -webkit-box-flex: 1;
    -webkit-flex: 1;
    flex: 1;
}
.map-content {
    background: #fff;
    overflow-y: auto;
    overflow-x: auto;
    height: 100%;
    position: relative;
    overflow: hidden;
}
.left{
    float: left;
    width: 426px;
    overflow: hidden;
    height: 100%;
    position: relative;
    border-right: 1px solid #ddd;
    box-sizing: border-box;
}
.car{
    padding: 10px 20px;
    position: relative;
    overflow: hidden;
}
li.car{
    border-bottom: 1px solid #ddd;
}
.car-img{
    float: left;
    padding-right: 20px;
}
.item-left{
    display: inline-block;
    width: 100px;
    color: #999;
}
.dingwei{
    background: url(../images/weizhidingwei_btn.png) no-repeat 0;
    display: inline-block;
    width: 65px;
    text-align: right;
}
.weizhi{
    background: url(../images/weizhi_icon.png) no-repeat 0;
    width: 15px;
    height: 14px;
    display: inline-block;
}
.weizhi-bg{
    background-color: #1FA2FF;
    color: #fff;
    height: 60px;
    overflow: hidden;
}
.nav-tabs {
    text-align: center;
    padding: 10px;
    font-size: 0;
    position: absolute;
    top: 0;
    width: 100%;
}
.nav>li{
    display: inline-block;
}
.nav-tabs>li {
    float: none;
}
.nav-tabs>li:first-child a{
    border-radius: 5px 0 0 5px;
}
.nav-tabs>li:last-child a{
    border-radius: 0 5px 5px 0;
}
.nav-tabs>li>a{
    color:#1FA2FF;
    padding: 9px 37px;
    margin-right: 0;
    border: 1px solid #1FA2FF;
    background-color: transparent;
    font-size: 16px;
}
.nav-tabs>li.active>a, .nav-tabs>li.active>a:focus, .nav-tabs>li.active>a:hover{
    color: #fff;
    cursor: default;
    background-color: #1FA2FF;
    border: 1px solid #1FA2FF;
}
.nav-tabs>li>a:focus, .nav-tabs>li>a:hover{
    border: 1px solid #1FA2FF;
    background-color: #fff;
}
.tab-content{
    margin-top: 60px;
    overflow: auto;
    height: 100%;
}
.dislpay-arrow a {
    background: url(../images/shouhui_btn_pre.png) no-repeat;
}
.dislpay-arrow a.zhankai {
    background: url(../images/zhankai_btn_pre.png) no-repeat;
}
.dislpay-arrow a:hover{
    background: url(../images/shouhui_btn.png) no-repeat;
}
.dislpay-arrow a.zhankai:hover{
    background: url(../images/zhankai_btn.png) no-repeat;
}
.dislpay-arrow a {
    position: absolute;
    display: block;
    width: 26px;
    height: 124px;
    top: 50%;
    margin-top: -62px;
    outline: none;
}
#left-panel {
    position: absolute;
    left: 40px;
    top: 20px;
    pointer-events: none;
    overflow: hidden;
}
#searchbox {
    width: 483px;
    position: relative;
    z-index: 5;
    border-radius: 2px;
}
.clearfix {
    zoom: 1;
}
.clearfix::before, .clearfix::after {
    display: table;
    content: "";
}
#searchbox #searchbox-container {
    position: relative;
    z-index: 2;
    pointer-events: auto;
    width: 426px;
    float: left;
    box-sizing: border-box;
    box-shadow: rgba(0, 0, 0, 0.15) 1px 2px 1px;
}
#sole-searchbox-content {
    position: relative;
}
.searchbox-content {
    width: 426px;
    border-radius: 2px 0 0 2px;
    background: #fff;
}
#sole-searchbox-content #sole-input {
    box-sizing: border-box;
    border-top-style: initial;
    border-bottom-style: initial;
    border-top-color: initial;
    border-bottom-color: initial;
    line-height: 20px;
    font-size: 14px;
    height: 38px;
    color: rgb(51, 51, 51);
    position: relative;
    border-width: 0px 27px 0px 10px;
    border-image: initial;
    padding: 9px 0px;
    border-left: 10px solid transparent;
    border-right: 27px solid transparent;
    border-radius: 2px 0px 0px 2px;
}
input:focus{
    outline: 0;
    -webkit-box-shadow: none;
    box-shadow: none;
}
.searchbox-content .searchbox-content-common {
    box-sizing: border-box;
    float: left;
    width: 426px;
    height: 38px;
}
#search-button {
    pointer-events: auto;
    width: 57px;
    height: 38px;
    float: left;
    cursor: pointer;
    box-shadow: rgba(0, 0, 0, 0.15) 1px 2px 1px;
    border-width: 0px;
    border-style: initial;
    border-color: initial;
    border-image: initial;
    padding: 0px;
    border-radius: 0px 2px 2px 0px;
    background: url(../images/sousuo_icon.png) no-repeat center #1FA2FF;
    color: #fff;
}
.searchbox-content .input-clear {
    cursor: pointer;
    position: absolute;
    width: 27px;
    height: 38px;
    right: 0;
    top: 0;
    background: url(../images/searchbox.png) no-repeat 0 -114px #fff;
    display: none;
}
.ui3-suggest-wrap {
    position: absolute;
    background-color: #fff;
    display: none;
    box-shadow: 1px 2px 1px rgba(0,0,0,.15);
    border-radius: 0 0 2px 2px;
    top: 58px;
    left: 40px;
    z-index: 1000;
    width: 426px;
}
.list-scroll {
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    width: 426px;
    height: 350px;
}
.ui3-suggest-wrap .ui3-suggest-item a {
    display: block;
    height: 35px;
    line-height: 35px;
    padding-right: 10px;
    text-decoration: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.ui3-suggest-wrap .ui3-suggest-item a:hover{
    background-color: #ddd;
}
.ui3-suggest-wrap .ui3-suggest-item i.default {
    background: url(../images/p.png) no-repeat 12px;
    background-size: contain;
}
.ui3-suggest-wrap .ui3-suggest-item i {
    padding-left: 39px;
    font-style: normal;
    color: #666;
    position: relative;
    z-index: 1;
    padding-top: 1px;
}
.ui3-suggest-wrap .ui3-suggest-item em {
    margin-left: 10px;
    margin-right: 20px;
    font-style: normal;
    color: #999;
}
#addr-list{
    border-top: 1px solid #E4E6E7;
}
#car-list{
    top:128px;
}
#car-back{
    top: 78px;
    padding: 10px 20px;
}
.btn-primary {
    color: #fff;
    background-color: #1fa2ff;
    border-color: #1fa2ff;
}
.btn-primary:hover {
    color: #fff;
    background-color: #1c8ddd;
    border-color: #1c8ddd;
}
.btn-primary:focus {
    color: #fff;
    background-color: #1c8ddd;
    border-color: #1c8ddd;
}
.btn-primary:active,
.btn-primary.active,
.open > .dropdown-toggle.btn-primary {
    color: #fff;
    background-color: #1c8ddd;
    border-color: #1c8ddd;
}
.btn-primary:active:hover,
.btn-primary.active:hover,
.open > .dropdown-toggle.btn-primary:hover,
.btn-primary:active:focus,
.btn-primary.active:focus,
.open > .dropdown-toggle.btn-primary:focus,
.btn-primary:active.focus,
.btn-primary.active.focus,
.open > .dropdown-toggle.btn-primary.focus {
    color: #fff;
    background-color: #1c8ddd;
    border-color: #1c8ddd;
}
.query-attendance{
    position: fixed;
    top: 20px;
    right: 20px;
    width: 100px;
    height: 100px;
    background-color: #fff;
    text-align: center;
    padding: 20px;
    box-shadow: rgba(0, 0, 0, 0.15) 1px 2px 1px;
    cursor: pointer;
}

+ 0 - 46
app/app-iot-server/src/main/webapp/front/css/login.css

@ -1,46 +0,0 @@
.l-body{position: fixed;left: 0;bottom: 0;right: 0;top: 0;min-width: 790px;min-height: 700px;min-width:1160px;background-color: #fff;}
.l-header{position: relative;width: 100%;height: 100px;}
.l-l{ display: inline-block;*display:inline;*zoom:1;width: 210px;height: 100px;background: url(../images/logo.png) center no-repeat;background-size: cover;margin-left: 200px;text-indent: -9999px;}
.l-s{float: right;margin-right: 220px;}
.l-s li{position:relative;display: inline-block;height: 100px;line-height: 100px;font-size: 16px;}
/*.l-s li:first-child{margin-right: 60px;}*/
.l-s li a{display: block;color: #333;font-weight: 600;}
.l-s li a:hover{color: #0c93e4}
.l-main{position: relative;width: 100%;height: 500px;background: url(../images/login_bg.png) center no-repeat;background-size: contain;background-color: #0c93e4;}
.l-form{position: absolute;width: 341px;height: 360px;top: 70px;right: 220px;padding: 0 40px;background-color: #fff;-webkit-border-radius: 5px;border-radius: 5px; }
.l-tab{border-bottom: 1px solid #dcdcdc;}
.l-t-item{position:relative;display: inline-block;width: 49%;height: 60px;text-align: center;line-height: 60px;font-size: 20px;font-weight: 400;}
.l-t-item:first-child::before{content: " ";position:absolute;width: 1px;height: 12px;background: #dcdcdc;right: 0;top: 24px}
.l-t-item a{display: block;color: #999;width: 60px;height: 59px;margin: 0 auto;}
.l-t-item a.l-active{border-bottom: 2px solid #0c93e4;}
.l-f-tit{height: 60px;line-height: 60px;font-size: 16px;color: #a9a9a9;}
.l-f-input{width: 260px;height: 38px;line-height: 38px;border: 1px solid #dcdcdc;margin-bottom: 20px;-webkit-border-radius: 2px;border-radius: 2px;font-size: 14px;color: #333;padding-left: 39px;padding-right: 12px;}
.l-f-input[type=password]{margin-bottom: 12px;}
.l-f-c>div{position: relative;}
.l-f-icon{position: absolute;display: block;width: 15px;height: 15px;left: 12px;top: 12px;cursor: pointer/* padding: 0 12px; */}
.i-an{background: url(../images/zhanghao_icon.png) center no-repeat;}
.i-pwd{background: url(../images/mima_icon.png) center no-repeat;}
.l-f-radio{display: inline-block;width: 16px;height: 16px;background: url(../images/gouxuan_btn.png) center no-repeat;vertical-align: middle;/* -webkit-appearance: none; *//*appearance: none;*/margin-right: 10px;}
.l-f-radio.active{background: url(../images/gouxuan_btn_pre.png) center no-repeat;}
.l-f-radio input[type="checkbox"]{opacity: 0;}
.i-an,.i-pwd{background-size: cover;}
.f-p{display: inline-block;vertical-align: middle;color: #555;font-size: 14px}
.f-l{display: block;float: right;font-size: 14px;color: #0c93e4}
.l-btn{width: 260px;height: 40px;line-height: 40px;margin-top: 32px;/* margin-bottom: 12px; */text-align: center;background: #0c93e4;color: #fff;font-size: 14px;-webkit-border-radius: 2px;border-radius: 2px;cursor: pointer;-webkit-box-shadow: 0 0 3px 2px #dcdcdc;-moz-box-shadow: 0 0 3px 2px #dcdcdc;box-shadow: 0 0 3px 2px #dcdcdc;border: none;}
.l-btn:hover{background:#4db2ee }
.l-f-footer{height: 35px;line-height: 35px;font-size: 14px;color: #555;}
.l-f-footer>a{color: #0c93e4}
.l-footer{width: 100%;position: absolute;bottom: 40px;left: 0;text-align: center;color: #999;font-size: 14px;}
.header-xz-wrap {
    height: 97px;
    line-height: 97px;
    background-color: #ffffff;
}
.header-xz-logo {
    /* background-color: #259ee7; */
    background: url(../images/xz-logo.png) center no-repeat;
    width: 355px;
    height: 38px;
    margin-top: 30px;
    margin-left: 30px;
}

文件差异内容过多而无法显示
+ 0 - 1
app/app-iot-server/src/main/webapp/front/css/login.min.css


二进制
app/app-iot-server/src/main/webapp/front/css/patterns/header-profile-skin-1.png


二进制
app/app-iot-server/src/main/webapp/front/css/patterns/header-profile-skin-3.png


二进制
app/app-iot-server/src/main/webapp/front/css/patterns/header-profile.png


二进制
app/app-iot-server/src/main/webapp/front/css/patterns/shattered.png


+ 0 - 251
app/app-iot-server/src/main/webapp/front/css/plugins/awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css

@ -1,251 +0,0 @@
.checkbox {
  padding-left: 20px;
}
.checkbox label {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  padding-left: 5px;
}
.checkbox label::before {
  content: "";
  display: inline-block;
  position: absolute;
  width: 17px;
  height: 17px;
  left: 0;
  margin-left: -20px;
  border: 1px solid #cccccc;
  border-radius: 3px;
  background-color: #fff;
  -webkit-transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
  -o-transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
  transition: border 0.15s ease-in-out, color 0.15s ease-in-out;
}
.checkbox label::after {
  display: inline-block;
  position: absolute;
  width: 16px;
  height: 16px;
  left: 0;
  top: 0;
  margin-left: -20px;
  padding-left: 3px;
  padding-top: 1px;
  font-size: 11px;
  color: #555555;
}
.checkbox input[type="checkbox"],
.checkbox input[type="radio"] {
  opacity: 0;
  z-index: 1;
}
.checkbox input[type="checkbox"]:focus + label::before,
.checkbox input[type="radio"]:focus + label::before {
  outline: thin dotted;
  outline: 5px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}
.checkbox input[type="checkbox"]:checked + label::after,
.checkbox input[type="radio"]:checked + label::after {
  font-family: "FontAwesome";
  content: "\f00c";
}
.checkbox input[type="checkbox"]:disabled + label,
.checkbox input[type="radio"]:disabled + label {
  opacity: 0.65;
}
.checkbox input[type="checkbox"]:disabled + label::before,
.checkbox input[type="radio"]:disabled + label::before {
  background-color: #eeeeee;
  cursor: not-allowed;
}
.checkbox.checkbox-circle label::before {
  border-radius: 50%;
}
.checkbox.checkbox-inline {
  margin-top: 0;
}
.checkbox-primary input[type="checkbox"]:checked + label::before,
.checkbox-primary input[type="radio"]:checked + label::before {
  background-color: #337ab7;
  border-color: #337ab7;
}
.checkbox-primary input[type="checkbox"]:checked + label::after,
.checkbox-primary input[type="radio"]:checked + label::after {
  color: #fff;
}
.checkbox-danger input[type="checkbox"]:checked + label::before,
.checkbox-danger input[type="radio"]:checked + label::before {
  background-color: #d9534f;
  border-color: #d9534f;
}
.checkbox-danger input[type="checkbox"]:checked + label::after,
.checkbox-danger input[type="radio"]:checked + label::after {
  color: #fff;
}
.checkbox-info input[type="checkbox"]:checked + label::before,
.checkbox-info input[type="radio"]:checked + label::before {
  background-color: #5bc0de;
  border-color: #5bc0de;
}
.checkbox-info input[type="checkbox"]:checked + label::after,
.checkbox-info input[type="radio"]:checked + label::after {
  color: #fff;
}
.checkbox-warning input[type="checkbox"]:checked + label::before,
.checkbox-warning input[type="radio"]:checked + label::before {
  background-color: #f0ad4e;
  border-color: #f0ad4e;
}
.checkbox-warning input[type="checkbox"]:checked + label::after,
.checkbox-warning input[type="radio"]:checked + label::after {
  color: #fff;
}
.checkbox-success input[type="checkbox"]:checked + label::before,
.checkbox-success input[type="radio"]:checked + label::before {
  background-color: #5cb85c;
  border-color: #5cb85c;
}
.checkbox-success input[type="checkbox"]:checked + label::after,
.checkbox-success input[type="radio"]:checked + label::after {
  color: #fff;
}
.radio {
  padding-left: 20px;
}
.radio label {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  padding-left: 5px;
}
.radio label::before {
  content: "";
  display: inline-block;
  position: absolute;
  width: 17px;
  height: 17px;
  left: 0;
  margin-left: -20px;
  border: 1px solid #cccccc;
  border-radius: 50%;
  background-color: #fff;
  -webkit-transition: border 0.15s ease-in-out;
  -o-transition: border 0.15s ease-in-out;
  transition: border 0.15s ease-in-out;
}
.radio label::after {
  display: inline-block;
  position: absolute;
  content: " ";
  width: 11px;
  height: 11px;
  left: 3px;
  top: 3px;
  margin-left: -20px;
  border-radius: 50%;
  background-color: #555555;
  -webkit-transform: scale(0, 0);
  -ms-transform: scale(0, 0);
  -o-transform: scale(0, 0);
  transform: scale(0, 0);
  -webkit-transition: -webkit-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33);
  -moz-transition: -moz-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33);
  -o-transition: -o-transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33);
  transition: transform 0.1s cubic-bezier(0.8, -0.33, 0.2, 1.33);
}
.radio input[type="radio"] {
  opacity: 0;
  z-index: 1;
}
.radio input[type="radio"]:focus + label::before {
  outline: thin dotted;
  outline: 5px auto -webkit-focus-ring-color;
  outline-offset: -2px;
}
.radio input[type="radio"]:checked + label::after {
  -webkit-transform: scale(1, 1);
  -ms-transform: scale(1, 1);
  -o-transform: scale(1, 1);
  transform: scale(1, 1);
}
.radio input[type="radio"]:disabled + label {
  opacity: 0.65;
}
.radio input[type="radio"]:disabled + label::before {
  cursor: not-allowed;
}
.radio.radio-inline {
  margin-top: 0;
}
.radio-primary input[type="radio"] + label::after {
  background-color: #337ab7;
}
.radio-primary input[type="radio"]:checked + label::before {
  border-color: #337ab7;
}
.radio-primary input[type="radio"]:checked + label::after {
  background-color: #337ab7;
}
.radio-danger input[type="radio"] + label::after {
  background-color: #d9534f;
}
.radio-danger input[type="radio"]:checked + label::before {
  border-color: #d9534f;
}
.radio-danger input[type="radio"]:checked + label::after {
  background-color: #d9534f;
}
.radio-info input[type="radio"] + label::after {
  background-color: #5bc0de;
}
.radio-info input[type="radio"]:checked + label::before {
  border-color: #5bc0de;
}
.radio-info input[type="radio"]:checked + label::after {
  background-color: #5bc0de;
}
.radio-warning input[type="radio"] + label::after {
  background-color: #f0ad4e;
}
.radio-warning input[type="radio"]:checked + label::before {
  border-color: #f0ad4e;
}
.radio-warning input[type="radio"]:checked + label::after {
  background-color: #f0ad4e;
}
.radio-success input[type="radio"] + label::after {
  background-color: #5cb85c;
}
.radio-success input[type="radio"]:checked + label::before {
  border-color: #5cb85c;
}
.radio-success input[type="radio"]:checked + label::after {
  background-color: #5cb85c;
}
input[type="checkbox"].styled:checked + label:after,
input[type="radio"].styled:checked + label:after {
  font-family: 'FontAwesome';
  content: "\f00c";
}
input[type="checkbox"] .styled:checked + label::before,
input[type="radio"] .styled:checked + label::before {
  color: #fff;
}
input[type="checkbox"] .styled:checked + label::after,
input[type="radio"] .styled:checked + label::after {
  color: #fff;
}

文件差异内容过多而无法显示
+ 0 - 1
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/css/blueimp-gallery.min.css


二进制
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/error.png


+ 0 - 5
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/error.svg

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="64" height="64">
	<circle cx="32" cy="32" r="25" stroke="red" stroke-width="7" fill="black" fill-opacity="0.2"/>
	<rect x="28" y="7" width="8" height="50" fill="red" transform="rotate(45, 32, 32)"/>
</svg>

二进制
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/loading.gif


二进制
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/play-pause.png


+ 0 - 6
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/play-pause.svg

@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="30" height="15">
	<polygon points="2,1 2,14 13,7" stroke="black" stroke-width="1" fill="white"/>
	<rect x="17" y="2" width="4" height="11" stroke="black" stroke-width="1" fill="white"/>
	<rect x="24" y="2" width="4" height="11" stroke="black" stroke-width="1" fill="white"/>
</svg>

二进制
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/video-play.png


+ 0 - 5
app/app-iot-server/src/main/webapp/front/css/plugins/blueimp/img/video-play.svg

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="64" height="64">
	<circle cx="32" cy="32" r="25" stroke="white" stroke-width="7" fill="black" fill-opacity="0.2"/>
	<polygon points="26,22 26,42 43,32" fill="white"/>
</svg>

文件差异内容过多而无法显示
+ 0 - 1
app/app-iot-server/src/main/webapp/front/css/plugins/bootstrap-table/bootstrap-table.min.css


二进制
app/app-iot-server/src/main/webapp/front/css/plugins/chosen/chosen-sprite.png


二进制
app/app-iot-server/src/main/webapp/front/css/plugins/chosen/chosen-sprite@2x.png


+ 0 - 423
app/app-iot-server/src/main/webapp/front/css/plugins/chosen/chosen.css

@ -1,423 +0,0 @@
/*!
Chosen, a Select Box Enhancer for jQuery and Prototype
by Patrick Filler for Harvest, http://getharvest.com
Version 1.1.0
Full source at https://github.com/harvesthq/chosen
Copyright (c) 2011 Harvest http://getharvest.com
MIT License, https://github.com/harvesthq/chosen/blob/master/LICENSE.md
This file is generated by `grunt build`, do not edit it by hand.
*/
/* @group Base */
.chosen-container {
    position: relative;
    display: inline-block;
    vertical-align: middle;
    font-size: 13px;
    zoom: 1;
    *display: inline;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
}
.chosen-container .chosen-drop {
    position: absolute;
    top: 100%;
    left: -9999px;
    z-index: 1010;
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    width: 100%;
    border: 1px solid #aaa;
    border-top: 0;
    background: #fff;
    box-shadow: 0 4px 5px rgba(0, 0, 0, 0.15);
}
.chosen-container.chosen-with-drop .chosen-drop {
    left: 0;
}
.chosen-container a {
    cursor: pointer;
}
/* @end */
/* @group Single Chosen */
.chosen-container-single .chosen-single {
    position: relative;
    display: block;
    overflow: hidden;
    padding: 0 0 0 8px;
    height: 23px;
    border: 1px solid #aaa;
    border-radius: 5px;
    background-color: #fff;
    background: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #ffffff), color-stop(50%, #f6f6f6), color-stop(52%, #eeeeee), color-stop(100%, #f4f4f4));
    background: -webkit-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    background: -moz-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    background: -o-linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    background: linear-gradient(top, #ffffff 20%, #f6f6f6 50%, #eeeeee 52%, #f4f4f4 100%);
    background-clip: padding-box;
    box-shadow: 0 0 3px white inset, 0 1px 1px rgba(0, 0, 0, 0.1);
    color: #444;
    text-decoration: none;
    white-space: nowrap;
    line-height: 24px;
}
.chosen-container-single .chosen-default {
    color: #999;
}
.chosen-container-single .chosen-single span {
    display: block;
    overflow: hidden;
    margin-right: 26px;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.chosen-container-single .chosen-single-with-deselect span {
    margin-right: 38px;
}
.chosen-container-single .chosen-single abbr {
    position: absolute;
    top: 6px;
    right: 26px;
    display: block;
    width: 12px;
    height: 12px;
    background: url('chosen-sprite.png') -42px 1px no-repeat;
    font-size: 1px;
}
.chosen-container-single .chosen-single abbr:hover {
    background-position: -42px -10px;
}
.chosen-container-single.chosen-disabled .chosen-single abbr:hover {
    background-position: -42px -10px;
}
.chosen-container-single .chosen-single div {
    position: absolute;
    top: 0;
    right: 0;
    display: block;
    width: 18px;
    height: 100%;
}
.chosen-container-single .chosen-single div b {
    display: block;
    width: 100%;
    height: 100%;
    background: url('chosen-sprite.png') no-repeat 0px 7px;
}
.chosen-container-single .chosen-search {
    position: relative;
    z-index: 1010;
    margin: 0;
    padding: 3px 4px;
    white-space: nowrap;
}
.chosen-container-single .chosen-search input[type="text"] {
    -webkit-box-sizing: border-box;
    -moz-box-sizing: border-box;
    box-sizing: border-box;
    margin: 1px 0;
    padding: 4px 20px 4px 5px;
    width: 100%;
    height: auto;
    outline: 0;
    border: 1px solid #aaa;
    background: white url('chosen-sprite.png') no-repeat 100% -20px;
    background: url('chosen-sprite.png') no-repeat 100% -20px;
    font-size: 1em;
    font-family: sans-serif;
    line-height: normal;
    border-radius: 0;
}
.chosen-container-single .chosen-drop {
    margin-top: -1px;
    border-radius: 0 0 4px 4px;
    background-clip: padding-box;
}
.chosen-container-single.chosen-container-single-nosearch .chosen-search {
    position: absolute;
    left: -9999px;
}
/* @end */
/* @group Results */
.chosen-container .chosen-results {
    position: relative;
    overflow-x: hidden;
    overflow-y: auto;
    margin: 0 4px 4px 0;
    padding: 0 0 0 4px;
    max-height: 240px;
    -webkit-overflow-scrolling: touch;
}
.chosen-container .chosen-results li {
    display: none;
    margin: 0;
    padding: 5px 6px;
    list-style: none;
    line-height: 15px;
    -webkit-touch-callout: none;
}
.chosen-container .chosen-results li.active-result {
    display: list-item;
    cursor: pointer;
}
.chosen-container .chosen-results li.disabled-result {
    display: list-item;
    color: #ccc;
    cursor: default;
}
.chosen-container .chosen-results li.highlighted {
    background-color: #3875d7;
    background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #3875d7), color-stop(90%, #2a62bc));
    background-image: -webkit-linear-gradient(#3875d7 20%, #2a62bc 90%);
    background-image: -moz-linear-gradient(#3875d7 20%, #2a62bc 90%);
    background-image: -o-linear-gradient(#3875d7 20%, #2a62bc 90%);
    background-image: linear-gradient(#3875d7 20%, #2a62bc 90%);
    color: #fff;
}
.chosen-container .chosen-results li.no-results {
    display: list-item;
    background: #f4f4f4;
}
.chosen-container .chosen-results li.group-result {
    display: list-item;
    font-weight: bold;
    cursor: default;
}
.chosen-container .chosen-results li.group-option {
    padding-left: 15px;
}
.chosen-container .chosen-results li em {
    font-style: normal;
    text-decoration: underline;
}
/* @end */
/* @group Multi Chosen */
.chosen-container-multi .chosen-choices {
    -moz-box-sizing: border-box;
    background-color: #FFFFFF;
    border: 1px solid #CBD5DD;
    border-radius: 2px;
    cursor: text;
    height: auto !important;
    margin: 0;
    min-height: 30px;
    overflow: hidden;
    padding: 2px;
    position: relative;
    width: 100%;
}
.chosen-container-multi .chosen-choices li {
    float: left;
    list-style: none;
}
.chosen-container-multi .chosen-choices li.search-field {
    margin: 0;
    padding: 0;
    white-space: nowrap;
}
.chosen-container-multi .chosen-choices li.search-field input[type="text"] {
    margin: 1px 0;
    padding: 5px;
    height: 25px;
    outline: 0;
    border: 0 !important;
    background: transparent !important;
    box-shadow: none;
    color: #666;
    font-size: 100%;
    font-family: sans-serif;
    line-height: normal;
    border-radius: 0;
}
.chosen-container-multi .chosen-choices li.search-field .default {
    color: #999;
}
.chosen-container-multi .chosen-choices li.search-choice {
    position: relative;
    margin: 3px 0 3px 5px;
    padding: 3px 20px 3px 5px;
    border: 1px solid #aaa;
    border-radius: 3px;
    background-color: #e4e4e4;
    background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
    background-image: -webkit-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-image: -moz-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-image: -o-linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-image: linear-gradient(#f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-clip: padding-box;
    box-shadow: 0 0 2px white inset, 0 1px 0 rgba(0, 0, 0, 0.05);
    color: #333;
    line-height: 13px;
    cursor: default;
}
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close {
    position: absolute;
    top: 4px;
    right: 3px;
    display: block;
    width: 12px;
    height: 12px;
    background: url('chosen-sprite.png') -42px 1px no-repeat;
    font-size: 1px;
}
.chosen-container-multi .chosen-choices li.search-choice .search-choice-close:hover {
    background-position: -42px -10px;
}
.chosen-container-multi .chosen-choices li.search-choice-disabled {
    padding-right: 5px;
    border: 1px solid #ccc;
    background-color: #e4e4e4;
    background-image: -webkit-gradient(linear, 50% 0%, 50% 100%, color-stop(20%, #f4f4f4), color-stop(50%, #f0f0f0), color-stop(52%, #e8e8e8), color-stop(100%, #eeeeee));
    background-image: -webkit-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-image: -moz-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-image: -o-linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    background-image: linear-gradient(top, #f4f4f4 20%, #f0f0f0 50%, #e8e8e8 52%, #eeeeee 100%);
    color: #666;
}
.chosen-container-multi .chosen-choices li.search-choice-focus {
    background: #d4d4d4;
}
.chosen-container-multi .chosen-choices li.search-choice-focus .search-choice-close {
    background-position: -42px -10px;
}
.chosen-container-multi .chosen-results {
    margin: 0;
    padding: 0;
}
.chosen-container-multi .chosen-drop .result-selected {
    display: list-item;
    color: #ccc;
    cursor: default;
}
/* @end */
/* @group Active  */
.chosen-container-active .chosen-single {
    border: 1px solid #5897fb;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active.chosen-with-drop .chosen-single {
    border: 1px solid #aaa;
    -moz-border-radius-bottomright: 0;
    border-bottom-right-radius: 0;
    -moz-border-radius-bottomleft: 0;
    border-bottom-left-radius: 0;
}
.chosen-container-active.chosen-with-drop .chosen-single div {
    border-left: none;
    background: transparent;
}
.chosen-container-active.chosen-with-drop .chosen-single div b {
    background-position: -18px 7px;
}
.chosen-container-active .chosen-choices {
    border: 1px solid #5897fb;
    box-shadow: 0 0 5px rgba(0, 0, 0, 0.3);
}
.chosen-container-active .chosen-choices li.search-field input[type="text"] {
    color: #111 !important;
}
/* @end */
/* @group Disabled Support */
.chosen-disabled {
    opacity: 0.5 !important;
    cursor: default;
}
.chosen-disabled .chosen-single {
    cursor: default;
}
.chosen-disabled .chosen-choices .search-choice .search-choice-close {
    cursor: default;
}
/* @end */
/* @group Right to Left */
.chosen-rtl {
    text-align: right;
}
.chosen-rtl .chosen-single {
    overflow: visible;
    padding: 0 8px 0 0;
}
.chosen-rtl .chosen-single span {
    margin-right: 0;
    margin-left: 26px;
    direction: rtl;
}
.chosen-rtl .chosen-single-with-deselect span {
    margin-left: 38px;
}
.chosen-rtl .chosen-single div {
    right: auto;
    left: 3px;
}
.chosen-rtl .chosen-single abbr {
    right: auto;
    left: 26px;
}
.chosen-rtl .chosen-choices li {
    float: right;
}
.chosen-rtl .chosen-choices li.search-field input[type="text"] {
    direction: rtl;
}
.chosen-rtl .chosen-choices li.search-choice {
    margin: 3px 5px 3px 0;
    padding: 3px 5px 3px 19px;
}
.chosen-rtl .chosen-choices li.search-choice .search-choice-close {
    right: auto;
    left: 4px;
}
.chosen-rtl.chosen-container-single-nosearch .chosen-search,
.chosen-rtl .chosen-drop {
    left: 9999px;
}
.chosen-rtl.chosen-container-single .chosen-results {
    margin: 0 0 4px 4px;
    padding: 0 4px 0 0;
}
.chosen-rtl .chosen-results li.group-option {
    padding-right: 15px;
    padding-left: 0;
}
.chosen-rtl.chosen-container-active.chosen-with-drop .chosen-single div {
    border-right: none;
}
.chosen-rtl .chosen-search input[type="text"] {
    padding: 4px 5px 4px 20px;
    background: white url('chosen-sprite.png') no-repeat -30px -20px;
    background: url('chosen-sprite.png') no-repeat -30px -20px;
    direction: rtl;
}
.chosen-rtl.chosen-container-single .chosen-single div b {
    background-position: 6px 2px;
}
.chosen-rtl.chosen-container-single.chosen-with-drop .chosen-single div b {
    background-position: -12px 2px;
}
/* @end */
/* @group Retina compatibility */
@media only screen and (-webkit-min-device-pixel-ratio: 2), only screen and (min-resolution: 144dpi) {
    .chosen-rtl .chosen-search input[type="text"],
    .chosen-container-single .chosen-single abbr,
    .chosen-container-single .chosen-single div b,
    .chosen-container-single .chosen-search input[type="text"],
    .chosen-container-multi .chosen-choices .search-choice .search-choice-close,
    .chosen-container .chosen-results-scroll-down span,
    .chosen-container .chosen-results-scroll-up span {
        background-image: url('chosen-sprite%402x.png') !important;
        background-size: 52px 37px !important;
        background-repeat: no-repeat !important;
    }
}
/* @end */

+ 0 - 168
app/app-iot-server/src/main/webapp/front/css/plugins/clockpicker/clockpicker.css

@ -1,168 +0,0 @@
/*!
 * ClockPicker v{package.version} for Bootstrap (http://weareoutman.github.io/clockpicker/)
 * Copyright 2014 Wang Shenwei.
 * Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
 */
.clockpicker .input-group-addon {
	cursor: pointer;
}
.clockpicker-moving {
	cursor: move;
}
.clockpicker-align-left.popover > .arrow {
	left: 25px;
}
.clockpicker-align-top.popover > .arrow {
	top: 17px;
}
.clockpicker-align-right.popover > .arrow {
	left: auto;
	right: 25px;
}
.clockpicker-align-bottom.popover > .arrow {
	top: auto;
	bottom: 6px;
}
.clockpicker-popover .popover-title {
	background-color: #fff;
	color: #999;
	font-size: 24px;
	font-weight: bold;
	line-height: 30px;
	text-align: center;
}
.clockpicker-popover .popover-title span {
	cursor: pointer;
}
.clockpicker-popover .popover-content {
	background-color: #f8f8f8;
	padding: 12px;
}
.popover-content:last-child {
	border-bottom-left-radius: 5px;
	border-bottom-right-radius: 5px;
}
.clockpicker-plate {
	background-color: #fff;
	border: 1px solid #ccc;
	border-radius: 50%;
	width: 200px;
	height: 200px;
	overflow: visible;
	position: relative;
	/* Disable text selection highlighting. Thanks to Hermanya */
	-webkit-touch-callout: none;
	-webkit-user-select: none;
	-khtml-user-select: none;
	-moz-user-select: none;
	-ms-user-select: none;
	user-select: none;
}
.clockpicker-canvas,
.clockpicker-dial {
	width: 200px;
	height: 200px;
	position: absolute;
	left: -1px;
	top: -1px;
}
.clockpicker-minutes {
	visibility: hidden;
}
.clockpicker-tick {
	border-radius: 50%;
	color: #666;
	line-height: 26px;
	text-align: center;
	width: 26px;
	height: 26px;
	position: absolute;
	cursor: pointer;
}
.clockpicker-tick.active,
.clockpicker-tick:hover {
	background-color: rgb(192, 229, 247);
	background-color: rgba(0, 149, 221, .25);
}
.clockpicker-button {
	background-image: none;
	background-color: #fff;
	border-width: 1px 0 0;
	border-top-left-radius: 0;
	border-top-right-radius: 0;
	margin: 0;
	padding: 10px 0;
}
.clockpicker-button:hover {
	background-image: none;
	background-color: #ebebeb;
}
.clockpicker-button:focus {
	outline: none!important;
}
.clockpicker-dial {
	-webkit-transition: -webkit-transform 350ms, opacity 350ms;
	-moz-transition: -moz-transform 350ms, opacity 350ms;
	-ms-transition: -ms-transform 350ms, opacity 350ms;
	-o-transition: -o-transform 350ms, opacity 350ms;
	transition: transform 350ms, opacity 350ms;
}
.clockpicker-dial-out {
	opacity: 0;
}
.clockpicker-hours.clockpicker-dial-out {
	-webkit-transform: scale(1.2, 1.2);
	-moz-transform: scale(1.2, 1.2);
	-ms-transform: scale(1.2, 1.2);
	-o-transform: scale(1.2, 1.2);
	transform: scale(1.2, 1.2);
}
.clockpicker-minutes.clockpicker-dial-out {
	-webkit-transform: scale(.8, .8);
	-moz-transform: scale(.8, .8);
	-ms-transform: scale(.8, .8);
	-o-transform: scale(.8, .8);
	transform: scale(.8, .8);
}
.clockpicker-canvas {
	-webkit-transition: opacity 175ms;
	-moz-transition: opacity 175ms;
	-ms-transition: opacity 175ms;
	-o-transition: opacity 175ms;
	transition: opacity 175ms;
}
.clockpicker-canvas-out {
	opacity: 0.25;
}
.clockpicker-canvas-bearing,
.clockpicker-canvas-fg {
	stroke: none;
	fill: rgb(0, 149, 221);
}
.clockpicker-canvas-bg {
	stroke: none;
	fill: rgb(192, 229, 247);
}
.clockpicker-canvas-bg-trans {
	fill: rgba(0, 149, 221, .25);
}
.clockpicker-canvas line {
	stroke: rgb(0, 149, 221);
	stroke-width: 1;
	stroke-linecap: round;
	/*shape-rendering: crispEdges;*/
}
.clockpicker-button.am-button {
	margin: 1px;
	padding: 5px;
	border: 1px solid rgba(0, 0, 0, .2);
	border-radius: 4px;
}
.clockpicker-button.pm-button {
	margin: 1px 1px 1px 136px;
	padding: 5px;
	border: 1px solid rgba(0, 0, 0, .2);
	border-radius: 4px;
}

文件差异内容过多而无法显示
+ 0 - 77
app/app-iot-server/src/main/webapp/front/css/plugins/codemirror/ambiance.css


+ 0 - 0
app/app-iot-server/src/main/webapp/front/css/plugins/codemirror/codemirror.css


部分文件因为文件数量过多而无法显示