Browse Source

物联网相关

yeshijie 7 years ago
parent
commit
25db69c13d
53 changed files with 2967 additions and 560 deletions
  1. 1 1
      base/common-data-mysql/pom.xml
  2. 17 0
      base/common-data-mysql/src/main/java/com/yihu/base/mysql/query/BaseJpaService.java
  3. 1 1
      common/common-entity/src/main/java/com/yihu/jw/iot/company/IotCompanyCertificateChangeRecordDO.java
  4. 8 5
      common/common-entity/src/main/java/com/yihu/jw/iot/company/IotCompanyCertificateDO.java
  5. 21 1
      common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductBaseInfoDO.java
  6. 0 20
      common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductExtendInfoDO.java
  7. 30 20
      common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductMeasuredDataDO.java
  8. 1 1
      common/common-exception/pom.xml
  9. 31 31
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  10. 1 1
      common/common-rest-model/pom.xml
  11. 14 2
      svr/svr-iot/src/main/java/com/yihu/iot/vo/common/UploadVO.java
  12. 3 9
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyCertificateVO.java
  13. 2 2
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyTypeVO.java
  14. 0 10
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java
  15. 55 29
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceOrderVO.java
  16. 0 145
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDevicePurchaseVO.java
  17. 54 68
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceQualityInspectionPlanVO.java
  18. 84 74
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceVO.java
  19. 122 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotOrderPurchaseVO.java
  20. 109 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java
  21. 103 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotQualityRecordVO.java
  22. 38 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/dict/IotSystemDictVO.java
  23. 38 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductAttachmentVO.java
  24. 243 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java
  25. 39 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductDataTransmissionVO.java
  26. 99 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductExtendInfoVO.java
  27. 58 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductMeasuredDataVO.java
  28. 47 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductVO.java
  29. 1014 1
      common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java
  30. 1 1
      svr-lib-parent-pom/pom.xml
  31. 1 1
      svr/svr-base/pom.xml
  32. 1 1
      svr/svr-iot/pom.xml
  33. 43 3
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/FileUploadController.java
  34. 12 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java
  35. 85 7
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  36. 4 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java
  37. 0 99
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDevicePurchaseController.java
  38. 166 0
      svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java
  39. 8 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyCertificateDao.java
  40. 4 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java
  41. 6 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java
  42. 6 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductAttachmentDao.java
  43. 4 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoDao.java
  44. 6 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductDataTransmissionDao.java
  45. 4 1
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductExtendInfoDao.java
  46. 6 0
      svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductMeasuredDataDao.java
  47. 73 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java
  48. 111 7
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  49. 3 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  50. 6 7
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  51. 182 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java
  52. 1 1
      svr/svr-manage/pom.xml
  53. 1 1
      svr/svr-wlyy/pom.xml

+ 1 - 1
base/common-data-mysql/pom.xml

@ -16,7 +16,7 @@
    <dependencies>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>

+ 17 - 0
base/common-data-mysql/src/main/java/com/yihu/base/mysql/query/BaseJpaService.java

@ -69,6 +69,23 @@ public class BaseJpaService<T, R> {
        return targets;
    }
    /**
     * 将实体转换为模型。
     *
     * @param source
     * @param targetCls
     * @param <T>
     * @return
     */
    public <T> T convertToModel(Object source, Class<T> targetCls) {
        if (source == null) {
            return null;
        }
        T target = BeanUtils.instantiate(targetCls);
        BeanUtils.copyProperties(source, target);
        return target;
    }
    public String getCode() {
        return UUID.randomUUID().toString().replaceAll("-", "");
    }

+ 1 - 1
common/common-entity/src/main/java/com/yihu/jw/iot/company/IotCompanyCertificateChangeRecordDO.java

@ -22,7 +22,7 @@ public class IotCompanyCertificateChangeRecordDO extends IdEntityWithOperation i
    @Column(name = "company_id")
    private String companyId;//企业id
    @Column(name = "type")
    private String type;//类型
    private String type;//类型(1营业执照,2组织机构代码证,3税务登记证)
    @Column(name = "license_old")
    private String licenseOld;//原证书号码
    @Column(name = "certificate_old")

+ 8 - 5
common/common-entity/src/main/java/com/yihu/jw/iot/company/IotCompanyCertificateDO.java

@ -1,5 +1,6 @@
package com.yihu.jw.iot.company;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.yihu.jw.IdEntityWithOperation;
import javax.persistence.Column;
@ -17,7 +18,7 @@ import java.util.Date;
public class IotCompanyCertificateDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saas_id;//
    private String saasId;//
    @Column(name = "name")
    private String name;//证书名称
    @Column(name = "manufacturer_name")
@ -33,20 +34,22 @@ public class IotCompanyCertificateDO extends IdEntityWithOperation implements Se
    @Column(name = "company_business_license")
    private String companyBusinessLicense;//发起企业营业执照号
    @Column(name = "start_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;//有效期开始时间
    @Column(name = "end_time")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime;//有效结束时间
    @Column(name = "certificate_of_authorization_img")
    private String certificateOfAuthorizationImg;//授权书扫描件
    @Column(name = "del")
    private Integer del;//删除标志
    public String getSaas_id() {
        return saas_id;
    public String getSaasId() {
        return saasId;
    }
    public void setSaas_id(String saas_id) {
        this.saas_id = saas_id;
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getName() {

+ 21 - 1
common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductBaseInfoDO.java

@ -21,7 +21,7 @@ public class IotProductBaseInfoDO extends IdEntityWithOperation implements Seria
    @Column(name = "parent_id")
    private String parentId;//父类ID
    @Column(name = "product_classify")
    private String productClassify;//产品分类
    private String productClassify;//产品分类(1自由产品,2代理产品)
    @Column(name = "supplier_name")
    private String supplierName;//厂商名称
    @Column(name = "supplier_id")
@ -56,6 +56,10 @@ public class IotProductBaseInfoDO extends IdEntityWithOperation implements Seria
    private Integer originType;//产地类型
    @Column(name = "is_cold_chain")
    private Integer isColdChain;//是否需要冷链
    @Column(name = "certificate_id")
    private String certificateId;//授权id
    @Column(name = "certificate_name")
    private String certificateName;//授权书名称
    @Column(name = "del")
    private Integer del;//删除标志
@ -219,6 +223,22 @@ public class IotProductBaseInfoDO extends IdEntityWithOperation implements Seria
        this.isColdChain = isColdChain;
    }
    public String getCertificateId() {
        return certificateId;
    }
    public void setCertificateId(String certificateId) {
        this.certificateId = certificateId;
    }
    public String getCertificateName() {
        return certificateName;
    }
    public void setCertificateName(String certificateName) {
        this.certificateName = certificateName;
    }
    public Integer getDel() {
        return del;
    }

+ 0 - 20
common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductExtendInfoDO.java

@ -33,10 +33,6 @@ public class IotProductExtendInfoDO extends IdEntityWithOperation implements Ser
    private String contraindication;//禁忌症
    @Column(name = "specification")
    private String specification;//产品说明书
    @Column(name = "certificate_id")
    private String certificateId;//授权id
    @Column(name = "certificate_name")
    private String certificateName;//授权书名称
    @Column(name = "del")
    private Integer del;//删除标志
@ -112,22 +108,6 @@ public class IotProductExtendInfoDO extends IdEntityWithOperation implements Ser
        this.specification = specification;
    }
    public String getCertificateId() {
        return certificateId;
    }
    public void setCertificateId(String certificateId) {
        this.certificateId = certificateId;
    }
    public String getCertificateName() {
        return certificateName;
    }
    public void setCertificateName(String certificateName) {
        this.certificateName = certificateName;
    }
    public Integer getDel() {
        return del;
    }

+ 30 - 20
common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductMeasuredDataDO.java

@ -16,13 +16,15 @@ import java.io.Serializable;
public class IotProductMeasuredDataDO extends IdEntityWithOperation implements Serializable {
    @Column(name = "saas_id")
    private String saas_id;//
    private String saasId;//
    @Column(name = "product_id")
    private String product_id;//产品ID
    private String productId;//产品ID
    @Column(name = "company_id")
    private String company_id;//企业id
    private String companyId;//企业id
    @Column(name = "data_code")
    private String data_code;//编码
    private String dataCode;//编码
    @Column(name = "name")
    private String name;
    @Column(name = "type")
    private String type;//类型
    @Column(name = "instruction")
@ -30,36 +32,36 @@ public class IotProductMeasuredDataDO extends IdEntityWithOperation implements S
    @Column(name = "del")
    private Integer del;//删除标志
    public String getSaas_id() {
        return saas_id;
    public String getSaasId() {
        return saasId;
    }
    public void setSaas_id(String saas_id) {
        this.saas_id = saas_id;
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getProduct_id() {
        return product_id;
    public String getProductId() {
        return productId;
    }
    public void setProduct_id(String product_id) {
        this.product_id = product_id;
    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getCompany_id() {
        return company_id;
    public String getCompanyId() {
        return companyId;
    }
    public void setCompany_id(String company_id) {
        this.company_id = company_id;
    public void setCompanyId(String companyId) {
        this.companyId = companyId;
    }
    public String getData_code() {
        return data_code;
    public String getDataCode() {
        return dataCode;
    }
    public void setData_code(String data_code) {
        this.data_code = data_code;
    public void setDataCode(String dataCode) {
        this.dataCode = dataCode;
    }
    public String getType() {
@ -78,6 +80,14 @@ public class IotProductMeasuredDataDO extends IdEntityWithOperation implements S
        this.instruction = instruction;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public Integer getDel() {
        return del;
    }

+ 1 - 1
common/common-exception/pom.xml

@ -16,7 +16,7 @@
    <dependencies>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>

+ 31 - 31
common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java

@ -15,6 +15,22 @@ public class IotRequestMapping {
        public static final String company = api_iot_common + "/company";
        public static final String system_dict = api_iot_common + "/systemDict";
        public static final String file_upload = api_iot_common + "/fileUpload";
        public static final String product = api_iot_common + "/product";
        public static final String message_success_update = "update success";
        public static final String message_success_delete = "delete success";
        public static final String message_success_find = "find success";
        public static final String message_success_create = "create success";
        public static final String message_success_find_functions = "find success";
        public static final String message_fail_name_is_null = "name is null";
        public static final String message_fail_is_no_exist = "is no exist";
        public static final String message_fail_id_no_exist = "id no exist";
        public static final String message_fail_status_is_null = "status is null";
        public static final String message_fail_id_is_null = "id is null";
        public static final String message_fail_id_exist = "id exist";
        public static final String message_fail_saasId_is_null = "saasId is null";
    }
    public static class System{
@ -26,10 +42,12 @@ public class IotRequestMapping {
     */
    public static class FileUpload{
        public static final String api_upload_stream = "uploadStream";//文件流上传
        public static final String api_upload_stream_img = "uploadImg";//文件流上传图片
        public static final String api_upload_string = "uploadString";//base64字符串上传
        public static final String message_success_upload = "上传成功";
        public static final String message_fail_upload = "上传失败";
        public static final String message_fail_upload_format = "不支持该文件格式上传";
        public static final String message_fail_jsonData_is_null = "jsonData is null";
    }
@ -40,9 +58,14 @@ public class IotRequestMapping {
        public static final String findCompanyPage = "findCompanyPage";
        public static final String addCompany = "addCompany";
        public static final String findCompanyById = "findCompanyById";
        public static final String findByBusinessLicense = "findByBusinessLicense";
        public static final String updCompany = "updCompany";
        public static final String delCompany = "delCompany";
        public static final String findCompanyCertPage = "findCompanyCertPage";
        public static final String findCompanyCertById = "findCompanyCertById";
        public static final String findCompanyCertByCompanyId = "findCompanyCertByCompanyId";
        public static final String addCompanyCert = "addCompanyCert";
        public static final String api_create = "company";
        public static final String api_delete = "company";
@ -67,39 +90,16 @@ public class IotRequestMapping {
    }
    /**
     * 供应商模块常量
     * 产品模块常量
     */
    public static class DeviceSupplier {
        public static final String api_create = "deviceSupplier";
        public static final String api_delete = "deviceSupplier";
        public static final String api_getById = "getDeviceSupplierById";
        public static final String api_update = "deviceSupplier";
        public static final String api_queryPage = "queryDeviceSupplierPage";
        public static final String api_getList = "getDeviceSupplierList";
        public static final String message_success_update = "deviceSupplier update success";
        public static final String message_success_delete = "deviceSupplier delete success";
        public static final String message_success_find = "deviceSupplier find success";
        public static final String message_success_create = "deviceSupplier create success";
        public static final String message_success_find_functions = "deviceSupplier find success";
        public static final String message_fail_name_is_null = "name is null";
        public static final String message_fail_iotDeviceSupplier_is_no_exist = "iotDeviceSupplier is no exist";
        public static final String message_fail_id_no_exist = "id no exist";
        public static final String message_fail_status_is_null = "status is null";
        public static final String message_fail_id_is_null = "id is null";
        public static final String message_fail_id_exist = "id exist";
        public static final String message_fail_saasId_is_null = "saasId is null";
    public static class Product {
        public static final String findProductPage = "findProductPage";
        public static final String findProductPageByCompanyId = "findProductPageByCompanyId";
        public static final String addProduct = "addProduct";
        public static final String findProductById = "findProductById";
        public static final String updProduct= "updProduct";
        public static final String delProduct= "delProduct";
        public static final String message_fail_supplierName_is_null = "供应商名称不能为空";
        public static final String message_fail_organizationCode_is_null = "组织机构代码/统一社会信用代码不能为空";
        public static final String message_fail_contactsName_is_null = "联系人姓名不能为空";
        public static final String message_fail_contactsMobile_is_null = "联系人手机号码不能为空";
        public static final String message_fail_contactsPhone_is_null = "联系人座机不能为空";
        public static final String message_fail_contactsIdcard_is_null = "联系人身份证号不能为空";
        public static final String message_fail_type_is_null = "请选择供应商类型";
        public static final String message_fail_organizationCodeImg_is_null = "请上传组织机构代码证照片";
        public static final String message_fail_contactsIdcardImg_is_null = "请上传联系人身份证照片";
    }
    /**

+ 1 - 1
common/common-rest-model/pom.xml

@ -20,7 +20,7 @@
            <artifactId>common-swagger</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>

+ 14 - 2
svr/svr-iot/src/main/java/com/yihu/iot/vo/common/UploadVO.java

@ -1,13 +1,25 @@
package com.yihu.iot.vo.common;
package com.yihu.jw.restmodel.iot.common;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * @author yeshijie on 2017/12/7.
 */
public class UploadVO {
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "文件上传返回")
public class UploadVO implements Serializable{
    @ApiModelProperty("文件名字")
    private String fileName; //文件名字
    @ApiModelProperty("文件类型")
    private String fileType; //文件类型
    @ApiModelProperty("完整的url(包含http)")
    private String fullUrl; //完整的url http://172.19.103.13/healthArchiveGroup/M00/00/24/rBFuH1XdQC6AP3CDAAzodQCbVVc052.jpg
    @ApiModelProperty("完整的uri(不包含http)")
    private String fullUri; //完整的uri healthArchiveGroup/M00/00/24/rBFuH1XdQC6AP3CDAAzodQCbVVc052.jpg
    public String getFullUrl() {

+ 3 - 9
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyCertificateVO.java

@ -1,5 +1,6 @@
package com.yihu.jw.restmodel.iot.company;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
@ -30,13 +31,13 @@ public class IotCompanyCertificateVO implements Serializable {
    @ApiModelProperty("发起企业营业执照号")
    private String companyBusinessLicense;
    @ApiModelProperty("有效期开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;
    @ApiModelProperty("有效结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime;
    @ApiModelProperty("授权书扫描件")
    private String certificateOfAuthorizationImg;
    @ApiModelProperty("删除标志")
    private Integer del;
    public String getName() {
        return name;
@ -118,11 +119,4 @@ public class IotCompanyCertificateVO implements Serializable {
        this.certificateOfAuthorizationImg = certificateOfAuthorizationImg;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 2 - 2
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyTypeVO.java

@ -10,8 +10,8 @@ import java.io.Serializable;
 * 企业类型表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@ApiModel(value = "企业三证变更记录", description = "企业三证变更记录")
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "企业类型表", description = "企业类型表")
public class IotCompanyTypeVO implements Serializable {
    @ApiModelProperty("企业类型code")

+ 0 - 10
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java

@ -54,8 +54,6 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    private String contactsIdcardImg;
    @ApiModelProperty("账号")
    private String account;
    @ApiModelProperty("删除标志(1有效,0删除)")
    private Integer del;
    @ApiModelProperty("类型")
    private List<IotCompanyTypeVO> typeList;
@ -196,14 +194,6 @@ public class IotCompanyVO extends BaseVO implements Serializable {
        this.account = account;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
    public List<IotCompanyTypeVO> getTypeList() {
        return typeList;
    }

+ 55 - 29
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceOrderVO.java

@ -1,36 +1,53 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 设备订单表
 * @author yeshijie on 2017/12/1.
 */
public class IotDeviceOrderVO implements Serializable{
    private String saasId;
    private String orderNo;//订单编号
    private String orderStatus;//订单状态
    private Date purchaseTime;//采购时间
    private String orderContractName;//订单合同名称
    private String orderContractUrl;//订单合同链接
    private String purchaseUnitCode;//采购单位编码
    private String purchaseUnitName;//采购单位名称
    private String purchaserName;//采购负责人
    private String purchaserPhone;//采购负责人联系方式
    private String supplierCode;//供应商code
    private String supplierName;//供应商名称
    private String supplierType;//供应商类型
    private String supplierLeader;//供应商负责人
    private String supplierLeaderPhone;//供应商负责人联系方式
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备订单表", description = "设备订单表")
public class IotDeviceOrderVO extends BaseVO implements Serializable{
    @ApiModelProperty("订单编号")
    private String orderNo;
    @ApiModelProperty("订单状态")
    private String orderStatus;
    @ApiModelProperty("采购时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date purchaseTime;
    @ApiModelProperty("订单合同名称")
    private String orderContractName;
    @ApiModelProperty("订单合同链接")
    private String orderContractUrl;
    @ApiModelProperty("采购单位编码")
    private String purchaseUnitCode;
    @ApiModelProperty("采购单位名称")
    private String purchaseUnitName;
    @ApiModelProperty("采购负责人")
    private String purchaserName;
    @ApiModelProperty("采购负责人联系方式")
    private String purchaserPhone;
    @ApiModelProperty("供应商id")
    private String supplierId;
    @ApiModelProperty("供应商名称")
    private String supplierName;
    @ApiModelProperty("供应商类型")
    private String supplierType;
    @ApiModelProperty("供应商负责人")
    private String supplierLeader;
    @ApiModelProperty("供应商负责人联系方式")
    private String supplierLeaderPhone;
    @ApiModelProperty("订单说明")
    private String instruction;
    public String getOrderNo() {
        return orderNo;
@ -104,12 +121,12 @@ public class IotDeviceOrderVO implements Serializable{
        this.purchaserPhone = purchaserPhone;
    }
    public String getSupplierCode() {
        return supplierCode;
    public String getSupplierId() {
        return supplierId;
    }
    public void setSupplierCode(String supplierCode) {
        this.supplierCode = supplierCode;
    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }
    public String getSupplierName() {
@ -143,4 +160,13 @@ public class IotDeviceOrderVO implements Serializable{
    public void setSupplierLeaderPhone(String supplierLeaderPhone) {
        this.supplierLeaderPhone = supplierLeaderPhone;
    }
    public String getInstruction() {
        return instruction;
    }
    public void setInstruction(String instruction) {
        this.instruction = instruction;
    }
    
}

+ 0 - 145
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDevicePurchaseVO.java

@ -1,145 +0,0 @@
package com.yihu.jw.restmodel.iot.device;
import java.io.Serializable;
/**
 * @author yeshijie on 2017/12/1.
 */
public class IotDevicePurchaseVO implements Serializable{
    private String saasId;
    private String orderCode;//订单code
    private String orderNo;//订单编号
    private String supplierCode;//供应商code
    private String supplierName;//供应商名称
    private String deviceName;//采购设备名称
    private String deviceModel;//采购设备型号
    private String deviceType;//设备种类
    private String manufacturerCode;//厂商code
    private String manufacturerName;//厂商名称
    private Long purchaseNum;//采购数量
    private String qualityCycle;//质检周期
    private Long associatedNum;//已关联设备数量
    private Long unassociatedNum;//未关联设备数量
    private Integer del;//删除标志
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getOrderCode() {
        return orderCode;
    }
    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public String getSupplierCode() {
        return supplierCode;
    }
    public void setSupplierCode(String supplierCode) {
        this.supplierCode = supplierCode;
    }
    public String getSupplierName() {
        return supplierName;
    }
    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public String getDeviceModel() {
        return deviceModel;
    }
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    public String getManufacturerCode() {
        return manufacturerCode;
    }
    public void setManufacturerCode(String manufacturerCode) {
        this.manufacturerCode = manufacturerCode;
    }
    public String getManufacturerName() {
        return manufacturerName;
    }
    public void setManufacturerName(String manufacturerName) {
        this.manufacturerName = manufacturerName;
    }
    public Long getPurchaseNum() {
        return purchaseNum;
    }
    public void setPurchaseNum(Long purchaseNum) {
        this.purchaseNum = purchaseNum;
    }
    public String getQualityCycle() {
        return qualityCycle;
    }
    public void setQualityCycle(String qualityCycle) {
        this.qualityCycle = qualityCycle;
    }
    public Long getAssociatedNum() {
        return associatedNum;
    }
    public void setAssociatedNum(Long associatedNum) {
        this.associatedNum = associatedNum;
    }
    public Long getUnassociatedNum() {
        return unassociatedNum;
    }
    public void setUnassociatedNum(Long unassociatedNum) {
        this.unassociatedNum = unassociatedNum;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 54 - 68
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceQualityInspectionPlanVO.java

@ -1,51 +1,61 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 设备质检计划表
 * @author yeshijie on 2017/12/1.
 */
public class IotDeviceQualityInspectionPlanVO implements Serializable{
    private String saasId;
    private String purchaseCode;//采购code
    private String orderCode;//订单code
    private String orderNo;//订单编号
    private String deviceCode;//设备code
    private String deviceName;//设备名称
    private String deviceModel;//设备型号
    private String deviceType;//设备种类
    private Long purchaseNum;//采购数量
    private String qualityLeader;//质检负责人
    private String qualityLeaderPhone;//质检负责人联系方式
    private Date planTime;//计划质检时间
    private Date actualTime;//实际质检时间
    private String status;//质检状态(1未检,2已检)
    private Integer del;//删除标志
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getPurchaseCode() {
        return purchaseCode;
    }
    public void setPurchaseCode(String purchaseCode) {
        this.purchaseCode = purchaseCode;
    }
    public String getOrderCode() {
        return orderCode;
    }
    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备质检计划表", description = "设备质检计划表")
public class IotDeviceQualityInspectionPlanVO extends BaseVO implements Serializable{
    @ApiModelProperty("采购id")
    private String purchaseId;
    @ApiModelProperty("订单id")
    private String orderId;
    @ApiModelProperty("订单编号")
    private String orderNo;
    @ApiModelProperty("设备id")
    private String deviceId;
    @ApiModelProperty("设备名称")
    private String deviceName;
    @ApiModelProperty("采购数量")
    private Long purchaseNum;
    @ApiModelProperty("质检负责人")
    private String qualityLeader;
    @ApiModelProperty("质检负责人联系方式")
    private String qualityLeaderPhone;
    @ApiModelProperty("计划质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date planTime;
    @ApiModelProperty("实际质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date actualTime;
    @ApiModelProperty("质检状态(1未检,2已检)")
    private String status;
    public String getPurchaseId() {
        return purchaseId;
    }
    public void setPurchaseId(String purchaseId) {
        this.purchaseId = purchaseId;
    }
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getOrderNo() {
@ -56,12 +66,12 @@ public class IotDeviceQualityInspectionPlanVO implements Serializable{
        this.orderNo = orderNo;
    }
    public String getDeviceCode() {
        return deviceCode;
    public String getDeviceId() {
        return deviceId;
    }
    public void setDeviceCode(String deviceCode) {
        this.deviceCode = deviceCode;
    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }
    public String getDeviceName() {
@ -72,22 +82,6 @@ public class IotDeviceQualityInspectionPlanVO implements Serializable{
        this.deviceName = deviceName;
    }
    public String getDeviceModel() {
        return deviceModel;
    }
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    public Long getPurchaseNum() {
        return purchaseNum;
    }
@ -135,12 +129,4 @@ public class IotDeviceQualityInspectionPlanVO implements Serializable{
    public void setStatus(String status) {
        this.status = status;
    }
    public Integer getDel() {
        return del;
    }
    public void setDel(Integer del) {
        this.del = del;
    }
}

+ 84 - 74
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceVO.java

@ -1,49 +1,59 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 设备表
 * @author yeshijie on 2017/12/1.
 */
public class IotDeviceVO implements Serializable {
    private String saasId;
    private String code;
    private String name;//设备名称
    private String deviceModel;//设备型号
    private String deviceSn;//设备sn码
    private Integer isComposite;//是否复合型(1是,0否即设备为单一功能)
    private Integer isPlatform;//是否平台型(1是,0否)
    private String deviceType;//设备种类
    private String deviceSource;//设备来源(1采购订单关联,2居民绑定,3管理员新增)
    private String supplierCode;//供应商code
    private String supplierName;//供应商名称
    private String manufacturerCode;//厂商code
    private String manufacturerName;//厂商名称
    private String orderCode;//订单code
    private String orderNo;//订单编号
    private String status;//设备状态(正常、报废、检修)
    private Date nextQualityTime;//下次质检时间
    private String purchaseCode;//采购code
    private String simNo;//sim卡号
    private Integer del;//删除标志(1有效,0删除)
    public String getSaasId() {
        return saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备表", description = "设备表")
public class IotDeviceVO extends BaseVO implements Serializable {
    @ApiModelProperty("产品id")
    private String productId;
    @ApiModelProperty("设备名称")
    private String name;
    @ApiModelProperty("设备sn码")
    private String deviceSn;
    @ApiModelProperty("是否复合型(1是,0否即设备为单一功能)")
    private Integer isComposite;
    @ApiModelProperty("是否平台型(1是,0否)")
    private Integer isPlatform;
    @ApiModelProperty("设备来源(1采购订单关联,2居民绑定,3管理员新增)")
    private String deviceSource;
    @ApiModelProperty("供应商code")
    private String supplierId;
    @ApiModelProperty("供应商名称")
    private String supplierName;
    @ApiModelProperty("厂商code")
    private String manufacturerId;
    @ApiModelProperty("厂商名称")
    private String manufacturerName;
    @ApiModelProperty("归属社区")
    private String hospital;
    @ApiModelProperty("归属社区名称")
    private String hospital_name;
    @ApiModelProperty("订单id")
    private String orderId;
    @ApiModelProperty("订单编号")
    private String orderNo;
    @ApiModelProperty("设备状态(1正常、2报废、3检修)")
    private String status;
    @ApiModelProperty("下次质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date nextQualityTime;
    @ApiModelProperty("采购id")
    private String purchaseId;
    @ApiModelProperty("sim卡号")
    private String simNo;
    public String getName() {
        return name;
@ -53,14 +63,6 @@ public class IotDeviceVO implements Serializable {
        this.name = name;
    }
    public String getDeviceModel() {
        return deviceModel;
    }
    public void setDeviceModel(String deviceModel) {
        this.deviceModel = deviceModel;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
@ -85,14 +87,6 @@ public class IotDeviceVO implements Serializable {
        this.isPlatform = isPlatform;
    }
    public String getDeviceType() {
        return deviceType;
    }
    public void setDeviceType(String deviceType) {
        this.deviceType = deviceType;
    }
    public String getDeviceSource() {
        return deviceSource;
    }
@ -101,12 +95,12 @@ public class IotDeviceVO implements Serializable {
        this.deviceSource = deviceSource;
    }
    public String getSupplierCode() {
        return supplierCode;
    public String getSupplierId() {
        return supplierId;
    }
    public void setSupplierCode(String supplierCode) {
        this.supplierCode = supplierCode;
    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }
    public String getSupplierName() {
@ -117,12 +111,12 @@ public class IotDeviceVO implements Serializable {
        this.supplierName = supplierName;
    }
    public String getManufacturerCode() {
        return manufacturerCode;
    public String getManufacturerId() {
        return manufacturerId;
    }
    public void setManufacturerCode(String manufacturerCode) {
        this.manufacturerCode = manufacturerCode;
    public void setManufacturerId(String manufacturerId) {
        this.manufacturerId = manufacturerId;
    }
    public String getManufacturerName() {
@ -133,12 +127,12 @@ public class IotDeviceVO implements Serializable {
        this.manufacturerName = manufacturerName;
    }
    public String getOrderCode() {
        return orderCode;
    public String getOrderId() {
        return orderId;
    }
    public void setOrderCode(String orderCode) {
        this.orderCode = orderCode;
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getOrderNo() {
@ -165,12 +159,12 @@ public class IotDeviceVO implements Serializable {
        this.nextQualityTime = nextQualityTime;
    }
    public String getPurchaseCode() {
        return purchaseCode;
    public String getPurchaseId() {
        return purchaseId;
    }
    public void setPurchaseCode(String purchaseCode) {
        this.purchaseCode = purchaseCode;
    public void setPurchaseId(String purchaseId) {
        this.purchaseId = purchaseId;
    }
    public String getSimNo() {
@ -181,11 +175,27 @@ public class IotDeviceVO implements Serializable {
        this.simNo = simNo;
    }
    public Integer getDel() {
        return del;
    public String getProductId() {
        return productId;
    }
    public void setProductId(String productId) {
        this.productId = productId;
    }
    public String getHospital() {
        return hospital;
    }
    public void setHospital(String hospital) {
        this.hospital = hospital;
    }
    public String getHospital_name() {
        return hospital_name;
    }
    public void setDel(Integer del) {
        this.del = del;
    public void setHospital_name(String hospital_name) {
        this.hospital_name = hospital_name;
    }
}

+ 122 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotOrderPurchaseVO.java

@ -0,0 +1,122 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 采购清单表
 * @author yeshijie on 2017/12/1.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备质检计划表", description = "设备质检计划表")
public class IotOrderPurchaseVO extends BaseVO implements Serializable{
    @ApiModelProperty("订单id")
    private String orderId;
    @ApiModelProperty("订单编号")
    private String orderNo;
    @ApiModelProperty("供应商id")
    private String supplierId;
    @ApiModelProperty("供应商名称")
    private String supplierName;
    @ApiModelProperty("采购设备名称")
    private String deviceName;
    @ApiModelProperty("厂商id")
    private String manufacturerId;
    @ApiModelProperty("厂商名称")
    private String manufacturerName;
    @ApiModelProperty("采购数量")
    private Long purchaseNum;
    @ApiModelProperty("下次质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date nextQualityTime;
    @ApiModelProperty("质检状态")
    private String qualityStatus;
    public String getOrderId() {
        return orderId;
    }
    public void setOrderId(String orderId) {
        this.orderId = orderId;
    }
    public String getOrderNo() {
        return orderNo;
    }
    public void setOrderNo(String orderNo) {
        this.orderNo = orderNo;
    }
    public String getSupplierId() {
        return supplierId;
    }
    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }
    public String getSupplierName() {
        return supplierName;
    }
    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public String getManufacturerId() {
        return manufacturerId;
    }
    public void setManufacturerId(String manufacturerId) {
        this.manufacturerId = manufacturerId;
    }
    public String getManufacturerName() {
        return manufacturerName;
    }
    public void setManufacturerName(String manufacturerName) {
        this.manufacturerName = manufacturerName;
    }
    public Long getPurchaseNum() {
        return purchaseNum;
    }
    public void setPurchaseNum(Long purchaseNum) {
        this.purchaseNum = purchaseNum;
    }
    public Date getNextQualityTime() {
        return nextQualityTime;
    }
    public void setNextQualityTime(Date nextQualityTime) {
        this.nextQualityTime = nextQualityTime;
    }
    public String getQualityStatus() {
        return qualityStatus;
    }
    public void setQualityStatus(String qualityStatus) {
        this.qualityStatus = qualityStatus;
    }
    
}

+ 109 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotPatientDeviceVO.java

@ -0,0 +1,109 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 居民设备绑定表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "设备质检计划表", description = "设备质检计划表")
public class IotPatientDeviceVO extends BaseVO implements Serializable {
    @ApiModelProperty("居民code")
    private String patient;
    @ApiModelProperty("居民姓名")
    private String patientName;
    @ApiModelProperty("居民身份证")
    private String idcard;
    @ApiModelProperty("设备id")
    private String deviceId;
    @ApiModelProperty("设备名称")
    private String deviceName;
    @ApiModelProperty("设备sn码")
    private String deviceSn;
    @ApiModelProperty("质检负责人")
    private String doctor;
    @ApiModelProperty("质检负责人联系方式")
    private String agent;
    @ApiModelProperty("质检状态")
    private String userType;
    public String getPatient() {
        return patient;
    }
    public void setPatient(String patient) {
        this.patient = patient;
    }
    public String getPatientName() {
        return patientName;
    }
    public void setPatientName(String patientName) {
        this.patientName = patientName;
    }
    public String getIdcard() {
        return idcard;
    }
    public void setIdcard(String idcard) {
        this.idcard = idcard;
    }
    public String getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public String getDeviceSn() {
        return deviceSn;
    }
    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn;
    }
    public String getDoctor() {
        return doctor;
    }
    public void setDoctor(String doctor) {
        this.doctor = doctor;
    }
    public String getAgent() {
        return agent;
    }
    public void setAgent(String agent) {
        this.agent = agent;
    }
    public String getUserType() {
        return userType;
    }
    public void setUserType(String userType) {
        this.userType = userType;
    }
}

+ 103 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotQualityRecordVO.java

@ -0,0 +1,103 @@
package com.yihu.jw.restmodel.iot.device;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 质检记录表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(value = "质检记录表", description = "质检记录表")
public class IotQualityRecordVO extends BaseVO implements Serializable {
    @ApiModelProperty("设备id")
    private String deviceId;
    @ApiModelProperty("设备名称")
    private String deviceName;
    @ApiModelProperty("采购数量")
    private Long purchaseNum;
    @ApiModelProperty("质检负责人")
    private String qualityLeader;
    @ApiModelProperty("质检负责人联系方式")
    private String qualityLeaderPhone;
    @ApiModelProperty("计划质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date planTime;
    @ApiModelProperty("实际质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date actualTime;
    @ApiModelProperty("质检状态")
    private String status;
    public String getDeviceId() {
        return deviceId;
    }
    public void setDeviceId(String deviceId) {
        this.deviceId = deviceId;
    }
    public String getDeviceName() {
        return deviceName;
    }
    public void setDeviceName(String deviceName) {
        this.deviceName = deviceName;
    }
    public Long getPurchaseNum() {
        return purchaseNum;
    }
    public void setPurchaseNum(Long purchaseNum) {
        this.purchaseNum = purchaseNum;
    }
    public String getQualityLeader() {
        return qualityLeader;
    }
    public void setQualityLeader(String qualityLeader) {
        this.qualityLeader = qualityLeader;
    }
    public String getQualityLeaderPhone() {
        return qualityLeaderPhone;
    }
    public void setQualityLeaderPhone(String qualityLeaderPhone) {
        this.qualityLeaderPhone = qualityLeaderPhone;
    }
    public Date getPlanTime() {
        return planTime;
    }
    public void setPlanTime(Date planTime) {
        this.planTime = planTime;
    }
    public Date getActualTime() {
        return actualTime;
    }
    public void setActualTime(Date actualTime) {
        this.actualTime = actualTime;
    }
    public String getStatus() {
        return status;
    }
    public void setStatus(String status) {
        this.status = status;
    }
    
}

+ 38 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/dict/IotSystemDictVO.java

@ -0,0 +1,38 @@
package com.yihu.jw.restmodel.iot.dict;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 系统字典表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "系统字典表")
public class IotSystemDictVO implements Serializable {
    @ApiModelProperty("字典项代码")
    private String code;//
    @ApiModelProperty("字典项值")
    private String value;//
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public String getValue() {
        return value;
    }
    public void setValue(String value) {
        this.value = value;
    }
}

+ 38 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductAttachmentVO.java

@ -0,0 +1,38 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 产品附件表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品附件表")
public class IotProductAttachmentVO extends BaseVO implements Serializable {
    @ApiModelProperty("附件类型(1产品说明书,2其他附件)")
    private String type;
    @ApiModelProperty("附件链接")
    private String attachment;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getAttachment() {
        return attachment;
    }
    public void setAttachment(String attachment) {
        this.attachment = attachment;
    }
}

+ 243 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java

@ -0,0 +1,243 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
 * 产品基本信息表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品基本信息表")
public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    @ApiModelProperty("父类ID")
    private String parentId;
    @ApiModelProperty("产品分类")
    private String productClassify;
    @ApiModelProperty("厂商名称")
    private String supplierName;
    @ApiModelProperty("厂商id")
    private String supplierId;
    @ApiModelProperty("代理商名称")
    private String agentName;
    @ApiModelProperty("代理商id")
    private String agentId;
    @ApiModelProperty("产品类型")
    private String type;
    @ApiModelProperty("产品小类")
    private String productSubclass;
    @ApiModelProperty("68分类/器械分类")
    private String instrumentClassify;
    @ApiModelProperty("注册证号")
    private String registerCertificate;
    @ApiModelProperty("注册证扫描件")
    private String registerCertificateImg;
    @ApiModelProperty("有效期开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;
    @ApiModelProperty("有效期结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime;
    @ApiModelProperty("产品名称")
    private String name;
    @ApiModelProperty("别名")
    private String alias;
    @ApiModelProperty("品牌名称")
    private String brandName;
    @ApiModelProperty("产地")
    private String originPlace;
    @ApiModelProperty("产地类型(1国产,2进口)")
    private Integer originType;
    @ApiModelProperty("是否需要冷链(1是,0否)")
    private Integer isColdChain;
    @ApiModelProperty("授权id")
    private String certificateId;
    @ApiModelProperty("授权书名称")
    private String certificateName;
    @ApiModelProperty("数据传输方式")
    private List<IotProductDataTransmissionVO> dataTransmissionVOList;
    public String getParentId() {
        return parentId;
    }
    public void setParentId(String parentId) {
        this.parentId = parentId;
    }
    public String getProductClassify() {
        return productClassify;
    }
    public void setProductClassify(String productClassify) {
        this.productClassify = productClassify;
    }
    public String getSupplierName() {
        return supplierName;
    }
    public void setSupplierName(String supplierName) {
        this.supplierName = supplierName;
    }
    public String getSupplierId() {
        return supplierId;
    }
    public void setSupplierId(String supplierId) {
        this.supplierId = supplierId;
    }
    public String getAgentName() {
        return agentName;
    }
    public void setAgentName(String agentName) {
        this.agentName = agentName;
    }
    public String getAgentId() {
        return agentId;
    }
    public void setAgentId(String agentId) {
        this.agentId = agentId;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getProductSubclass() {
        return productSubclass;
    }
    public void setProductSubclass(String productSubclass) {
        this.productSubclass = productSubclass;
    }
    public String getInstrumentClassify() {
        return instrumentClassify;
    }
    public void setInstrumentClassify(String instrumentClassify) {
        this.instrumentClassify = instrumentClassify;
    }
    public String getRegisterCertificate() {
        return registerCertificate;
    }
    public void setRegisterCertificate(String registerCertificate) {
        this.registerCertificate = registerCertificate;
    }
    public String getRegisterCertificateImg() {
        return registerCertificateImg;
    }
    public void setRegisterCertificateImg(String registerCertificateImg) {
        this.registerCertificateImg = registerCertificateImg;
    }
    public Date getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
        this.endTime = endTime;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getAlias() {
        return alias;
    }
    public void setAlias(String alias) {
        this.alias = alias;
    }
    public String getBrandName() {
        return brandName;
    }
    public void setBrandName(String brandName) {
        this.brandName = brandName;
    }
    public String getOriginPlace() {
        return originPlace;
    }
    public void setOriginPlace(String originPlace) {
        this.originPlace = originPlace;
    }
    public Integer getOriginType() {
        return originType;
    }
    public void setOriginType(Integer originType) {
        this.originType = originType;
    }
    public Integer getIsColdChain() {
        return isColdChain;
    }
    public void setIsColdChain(Integer isColdChain) {
        this.isColdChain = isColdChain;
    }
    public String getCertificateId() {
        return certificateId;
    }
    public void setCertificateId(String certificateId) {
        this.certificateId = certificateId;
    }
    public String getCertificateName() {
        return certificateName;
    }
    public void setCertificateName(String certificateName) {
        this.certificateName = certificateName;
    }
    public List<IotProductDataTransmissionVO> getDataTransmissionVOList() {
        return dataTransmissionVOList;
    }
    public void setDataTransmissionVOList(List<IotProductDataTransmissionVO> dataTransmissionVOList) {
        this.dataTransmissionVOList = dataTransmissionVOList;
    }
}

+ 39 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductDataTransmissionVO.java

@ -0,0 +1,39 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 设备数据传输方式表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "设备数据传输方式表")
public class IotProductDataTransmissionVO extends BaseVO implements Serializable {
    @ApiModelProperty("传输协议类型")
    private String type;
    @ApiModelProperty("传输协议类型名称")
    private String typeName;
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
}

+ 99 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductExtendInfoVO.java

@ -0,0 +1,99 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
/**
 * 产品扩展信息表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品基本信息表")
public class IotProductExtendInfoVO extends BaseVO implements Serializable {
    @ApiModelProperty("产品图片")
    private String productImg;
    @ApiModelProperty("产品说明")
    private String description;
    @ApiModelProperty("适用范围")
    private String useRange;
    @ApiModelProperty("版本")
    private String version;
    @ApiModelProperty("产品标准")
    private String standard;
    @ApiModelProperty("禁忌症")
    private String contraindication;
    @ApiModelProperty("产品说明书")
    private String specification;
    @ApiModelProperty("附件列表")
    private List<IotProductAttachmentVO> attachmentVOList;
    public String getProductImg() {
        return productImg;
    }
    public void setProductImg(String productImg) {
        this.productImg = productImg;
    }
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    public String getUseRange() {
        return useRange;
    }
    public void setUseRange(String useRange) {
        this.useRange = useRange;
    }
    public String getVersion() {
        return version;
    }
    public void setVersion(String version) {
        this.version = version;
    }
    public String getStandard() {
        return standard;
    }
    public void setStandard(String standard) {
        this.standard = standard;
    }
    public String getContraindication() {
        return contraindication;
    }
    public void setContraindication(String contraindication) {
        this.contraindication = contraindication;
    }
    public String getSpecification() {
        return specification;
    }
    public void setSpecification(String specification) {
        this.specification = specification;
    }
    public List<IotProductAttachmentVO> getAttachmentVOList() {
        return attachmentVOList;
    }
    public void setAttachmentVOList(List<IotProductAttachmentVO> attachmentVOList) {
        this.attachmentVOList = attachmentVOList;
    }
}

+ 58 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductMeasuredDataVO.java

@ -0,0 +1,58 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.yihu.jw.restmodel.iot.common.BaseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
 * 设备测量数据表
 * @author yeshijie on 2018/1/16.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品附件表")
public class IotProductMeasuredDataVO extends BaseVO implements Serializable {
    @ApiModelProperty("名称")
    private String name;
    @ApiModelProperty("编码")
    private String dataCode;
    @ApiModelProperty("类型")
    private String type;
    @ApiModelProperty("说明")
    private String instruction;
    public String getDataCode() {
        return dataCode;
    }
    public void setDataCode(String dataCode) {
        this.dataCode = dataCode;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public String getInstruction() {
        return instruction;
    }
    public void setInstruction(String instruction) {
        this.instruction = instruction;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
}

+ 47 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductVO.java

@ -0,0 +1,47 @@
package com.yihu.jw.restmodel.iot.product;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.List;
/**
 * @author yeshijie on 2018/1/17.
 */
@JsonInclude(JsonInclude.Include.ALWAYS)
@ApiModel(description = "产品信息表")
public class IotProductVO implements Serializable{
    @ApiModelProperty("产品基础信息")
    private IotProductBaseInfoVO iotProductBaseInfo;
    @ApiModelProperty("产品扩展信息")
    private IotProductExtendInfoVO iotProductExtendInfo;
    @ApiModelProperty("测量数据")
    private List<IotProductMeasuredDataVO> measuredDataVOList;
    public IotProductBaseInfoVO getIotProductBaseInfo() {
        return iotProductBaseInfo;
    }
    public void setIotProductBaseInfo(IotProductBaseInfoVO iotProductBaseInfo) {
        this.iotProductBaseInfo = iotProductBaseInfo;
    }
    public IotProductExtendInfoVO getIotProductExtendInfo() {
        return iotProductExtendInfo;
    }
    public void setIotProductExtendInfo(IotProductExtendInfoVO iotProductExtendInfo) {
        this.iotProductExtendInfo = iotProductExtendInfo;
    }
    public List<IotProductMeasuredDataVO> getMeasuredDataVOList() {
        return measuredDataVOList;
    }
    public void setMeasuredDataVOList(List<IotProductMeasuredDataVO> measuredDataVOList) {
        this.measuredDataVOList = measuredDataVOList;
    }
}

+ 1014 - 1
common/common-util/src/main/java/com/yihu/jw/util/date/DateUtil.java

@ -1,16 +1,1029 @@
package com.yihu.jw.util.date;
import org.springframework.util.StringUtils;
import java.math.BigDecimal;
import java.sql.Time;
import java.sql.Timestamp;
import java.text.DateFormat;
import java.text.ParseException;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.*;
/**
 * Created by chenweida on 2017/5/19.
 */
public class DateUtil {
    public static final String yyyy_MM_dd_HH_mm_ss="yyyy-MM-dd HH:mm:ss";
    public static final String HH_MM = "HH:mm";
    public static final String HH_MM_SS = "HH:mm:ss";
    public static final String YY = "yy";
    public static final String YYYYMM = "yyyyMM";
    public static final String YYYYMMDD = "yyyyMMdd";
    public static final String YYYY_MM_DD = "yyyy-MM-dd";
    public static final String YYYYMMDDHHMMSS = "yyyyMMddHHmmss";
    public static final String YYYY_MM_DD_HH = "yyyy-MM-dd HH";
    public static final String YYYY_MM_DD_HH_MM = "yyyy-MM-dd HH:mm";
    public static final String YYYY_MM_DD_HH_MM_SS = "yyyy-MM-dd HH:mm:ss";
    public static final String YYYY_M_D_HH_MM_SS = "yyyy/M/d HH:mm:ss";
    public static final String YYYYMMddHHmmssSSS  = "yyyyMMddHHmmssSSS";
    public static final String YYYY_MM ="yyyy-MM";
    public static Date dateTimeParse(String date) throws ParseException {
        return new SimpleDateFormat(yyyy_MM_dd_HH_mm_ss).parse(date);
    }
    /**
     * 时间格式转中文格式
     */
    public static String dateToChinese(Date date) {
        SimpleDateFormat formatter =   new SimpleDateFormat( "yyyy年MM月dd日 EEEEaaaa hh:mm", Locale.CHINA);
        return formatter.format(date);
    }
    /**
     * 字符串转时间格式
     */
    public static Date strToDate(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
        }
        else{
            int length = strDate.length();
            if(strDate.contains("/"))
            {
                strDate = strDate.replace("/","-");
            }
            if(strDate.contains("-"))
            {
                if(length == 10)
                {
                    return strToDate(strDate,YYYY_MM_DD);
                }
                else if(length == 19)
                {
                    return strToDate(strDate,YYYY_MM_DD_HH_MM_SS);
                }
            }
            else{
                if(length == 8)
                {
                    return strToDate(strDate,YYYYMMDD);
                }
                else if(length == 14)
                {
                    return strToDate(strDate,YYYYMMDDHHMMSS);
                }
            }
        }
        return null;
    }
    /**
     * 获取现在时间
     *
     * @return 返回时间类型 yyyy-MM-dd HH:mm:ss
     */
    public static Date getNowDate() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        String dateString = formatter.format(currentTime);
        ParsePosition pos = new ParsePosition(0);
        return formatter.parse(dateString, pos);
    }
    /**
     * 获取现在时间
     *
     * @return返回短时间格式 yyyy-MM-dd
     */
    public static Date getNowDateShort() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD);
        String dateString = formatter.format(currentTime);
        return strToDate(dateString, YYYY_MM_DD);
    }
    /**
     * 获取现在时间
     *
     * @return返回字符串格式 yyyy-MM-dd HH:mm:ss
     */
    public static String getStringDate() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        return formatter.format(currentTime);
    }
    /**
     * 获取现在时间
     *
     * @return返回字符串格式 yyyy-MM-dd HH:mm:ss
     */
    public static String getStringDate(String format) {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(currentTime);
    }
    /**
     * 获取现在时间
     *
     * @return 返回短时间字符串格式yyyy-MM-dd
     */
    public static String getStringDateShort() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD);
        return formatter.format(currentTime);
    }
    /**
     * 获取时间 小时:分;秒 HH:mm:ss
     *
     * @return
     */
    public static String getTimeShort() {
        SimpleDateFormat formatter = new SimpleDateFormat(HH_MM_SS);
        Date currentTime = new Date();
        return formatter.format(currentTime);
    }
    /**
     * 将长时间格式字符串转换为时间 yyyy-MM-dd HH:mm:ss
     *
     * @param strDate
     * @return
     */
    public static Date strToDateLong(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        ParsePosition pos = new ParsePosition(0);
        return formatter.parse(strDate, pos);
    }
    public static Date strToDateShort(String strDate) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD);
        ParsePosition pos = new ParsePosition(0);
        return formatter.parse(strDate, pos);
    }
    /**
     * 将长时间格式时间转换为字符串 yyyy-MM-dd HH:mm:ss
     *
     * @param dateDate
     * @return
     */
    public static String dateToStrLong(java.util.Date dateDate) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        return formatter.format(dateDate);
    }
    public static String dateToStrNoSecond(java.util.Date dateDate) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM);
        return formatter.format(dateDate);
    }
    /**
     * 将长时间格式时间转换为字符串 yyyy-MM-dd
     *
     * @param dateDate
     * @return
     */
    public static String dateToStrShort(java.util.Date dateDate) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD);
        return formatter.format(dateDate);
    }
    /**
     * 将短时间格式时间转换为字符串 yyyy-MM-dd
     */
    public static String dateToStr(java.util.Date dateDate, String format) {
        if (dateDate == null) {
            return "";
        }
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        return formatter.format(dateDate);
    }
    /**
     * 将短时间格式字符串转换为时间
     *
     * @param strDate
     * @return
     */
    public static Date strToDate(String strDate, String format) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
        }
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        ParsePosition pos = new ParsePosition(0);
        return formatter.parse(strDate, pos);
    }
    public static Date strToDateAppendNowTime(String strDate, String format) {
        if (StringUtils.isEmpty(strDate)) {
            return null;
        }
        strDate += " " + getTimeShort();
        SimpleDateFormat formatter = new SimpleDateFormat(format);
        ParsePosition pos = new ParsePosition(0);
        return formatter.parse(strDate, pos);
    }
    /**
     * 得到现在时间
     *
     * @return
     */
    public static Date getNow() {
        Date currentTime = new Date();
        return currentTime;
    }
    /**
     * 提取一个月中的最后一天
     *
     * @param day
     * @return
     */
    public static Date getLastDate(long day) {
        Date date = new Date();
        long date_3_hm = date.getTime() - 3600000 * 34 * day;
        Date date_3_hm_date = new Date(date_3_hm);
        return date_3_hm_date;
    }
    /**
     * 得到现在时间
     *
     * @return 字符串 yyyyMMdd HHmmss
     */
    public static String getStringToday() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat("yyyyMMdd HHmmss");
        String dateString = formatter.format(currentTime);
        return dateString;
    }
    /**
     * 得到现在小时
     */
    public static String getHour() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        String dateString = formatter.format(currentTime);
        String hour;
        hour = dateString.substring(11, 13);
        return hour;
    }
    /**
     * 得到现在分钟
     *
     * @return
     */
    public static String getTime() {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        String dateString = formatter.format(currentTime);
        String min;
        min = dateString.substring(14, 16);
        return min;
    }
    /**
     * 根据用户传入的时间表示格式,返回当前时间的格式 如果是yyyyMMdd,注意字母y不能大写。
     *
     * @param sformat
     *            yyyyMMddhhmmss
     * @return
     */
    public static String getUserDate(String sformat) {
        Date currentTime = new Date();
        SimpleDateFormat formatter = new SimpleDateFormat(sformat);
        String dateString = formatter.format(currentTime);
        return dateString;
    }
    /**
     * 得到二个日期间的间隔天数
     */
    public static String getTwoDay(String sj1, String sj2) {
        SimpleDateFormat myFormatter = new SimpleDateFormat(YYYY_MM_DD);
        long day = 0;
        try {
            java.util.Date date = myFormatter.parse(sj1);
            java.util.Date mydate = myFormatter.parse(sj2);
            day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
        } catch (Exception e) {
            return "";
        }
        return day + "";
    }
    /**
     * 时间前推或后推分钟,其中JJ表示分钟.
     */
    public static String getPreTime(String sj1, String jj) {
        SimpleDateFormat format = new SimpleDateFormat(YYYY_MM_DD_HH_MM_SS);
        String mydate1 = "";
        try {
            Date date1 = format.parse(sj1);
            long Time = (date1.getTime() / 1000) + Integer.parseInt(jj) * 60;
            date1.setTime(Time * 1000);
            mydate1 = format.format(date1);
        } catch (Exception e) {
        }
        return mydate1;
    }
    /**
     * 时间前推或后推天数(负数前推正数后推)
     * date 基准时间
     */
    public static Date getPreDays(Date date, int days) {
        Date day = null;
        try {
            Calendar c = Calendar.getInstance();
            c.setTime(date);
            c.add(Calendar.DATE, days);
            day = c.getTime();
        } catch (Exception e) {
        }
        return day;
    }
    /**
     * 得到一个时间延后或前移几分钟的时间,nowdate为时间,delay为前移或后延的分钟数
     */
    public static Date getNextMin(Date date, int delay) {
        try {
            Calendar cal = Calendar.getInstance();
            cal.setTime(date);
            cal.add(Calendar.MINUTE, delay);
            return cal.getTime();
        } catch (Exception e) {
            return null;
        }
    }
    /**
     * 得到一个时间延后或前移几天的时间,nowdate为时间,delay为前移或后延的天数
     */
    public static String getNextDay(String nowdate, int delay) {
        try {
            SimpleDateFormat format = new SimpleDateFormat(YYYY_MM_DD);
            String mdate = "";
            Date d = strToDate(nowdate, YYYY_MM_DD);
            long myTime = (d.getTime() / 1000) + delay * 24 * 60 * 60;
            d.setTime(myTime * 1000);
            mdate = format.format(d);
            return mdate;
        } catch (Exception e) {
            return "";
        }
    }
    public static String getNextDay(Date d, int days) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);
        c.add(Calendar.DATE, days);
        return dateToStrShort(c.getTime());
    }
    public static String getNextMonth(Date d, int months) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);
        c.add(Calendar.MONTH, months);
        return dateToStrShort(c.getTime());
    }
    public static Date getNextMonthReturnDate(Date d, int months) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);
        c.add(Calendar.MONTH, months);
        return c.getTime();
    }
    public static String getNextYear(Date d, int year) {
        Calendar c = Calendar.getInstance();
        c.setTime(d);
        c.add(Calendar.YEAR, year);
        return dateToStrShort(c.getTime());
    }
    /**
     * 获取本月第一天
     * @return
     */
    public static String getCurMonthFirstDayShort(){
        Calendar c = Calendar.getInstance();
        c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
        return dateToStrShort(c.getTime());
    }
    /**
     * 判断是否润年
     *
     * @param ddate
     * @return
     */
    public static boolean isLeapYear(String ddate) {
        /**
         * 详细设计: 1.被400整除是闰年,否则: 2.不能被4整除则不是闰年 3.能被4整除同时不能被100整除则是闰年
         * 3.能被4整除同时能被100整除则不是闰年
         */
        Date d = strToDate(ddate, YYYY_MM_DD);
        GregorianCalendar gc = (GregorianCalendar) Calendar.getInstance();
        gc.setTime(d);
        int year = gc.get(Calendar.YEAR);
        if ((year % 400) == 0){
            return true;
        } else if ((year % 4) == 0) {
            if ((year % 100) == 0){
                return false;
            } else{
                return true;
            }
        } else{
            return false;
        }
    }
    /**
     * 返回美国时间格式 26 Apr 2006
     *
     * @param str
     * @return
     */
    public static String getEDate(String str) {
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD);
        ParsePosition pos = new ParsePosition(0);
        Date strtodate = formatter.parse(str, pos);
        String j = strtodate.toString();
        String[] k = j.split(" ");
        return k[2] + k[1].toUpperCase() + k[5].substring(2, 4);
    }
    /**
     * 获取一个月的最后一天
     *
     * @param dat
     * @return
     */
    public static String getEndDateOfMonth(String dat) {// yyyy-MM-dd
        String str = dat.substring(0, 8);
        String month = dat.substring(5, 7);
        int mon = Integer.parseInt(month);
        if (mon == 1 || mon == 3 || mon == 5 || mon == 7 || mon == 8 || mon == 10 || mon == 12) {
            str += "31";
        } else if (mon == 4 || mon == 6 || mon == 9 || mon == 11) {
            str += "30";
        } else {
            if (isLeapYear(dat)) {
                str += "29";
            } else {
                str += "28";
            }
        }
        return str;
    }
    /**
     * 产生周序列,即得到当前时间所在的年度是第几周
     *
     * @return
     */
    public static String getSeqWeek() {
        Calendar c = Calendar.getInstance(Locale.CHINA);
        String week = Integer.toString(c.get(Calendar.WEEK_OF_YEAR));
        if (week.length() == 1){
            week = "0" + week;
        }
        String year = Integer.toString(c.get(Calendar.YEAR));
        return year + week;
    }
    /**
     * 获得一个日期所在的周的星期几的日期,如要找出2002年2月3日所在周的星期一是几号
     *
     * @param sdate
     * @param num
     * @return
     */
    public static String getWeek(String sdate, String num) {
        // 再转换为时间
        Date dd = DateUtil.strToDate(sdate, YYYY_MM_DD);
        Calendar c = Calendar.getInstance();
        c.setTime(dd);
        if (num.equals("1")){ // 返回星期一所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.MONDAY);
        }
        else if (num.equals("2")){ // 返回星期二所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.TUESDAY);
        }
        else if (num.equals("3")){ // 返回星期三所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.WEDNESDAY);
        }
        else if (num.equals("4")){ // 返回星期四所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.THURSDAY);
        }
        else if (num.equals("5")){ // 返回星期五所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.FRIDAY);
        }
        else if (num.equals("6")){ // 返回星期六所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.SATURDAY);
        }
        else if (num.equals("0")){ // 返回星期日所在的日期
            c.set(Calendar.DAY_OF_WEEK, Calendar.SUNDAY);
        }
        return new SimpleDateFormat("yyyy-MM-dd").format(c.getTime());
    }
    /**
     * 根据一个日期,返回是星期几的字符串
     *
     * @param sdate
     * @return
     */
    public static String getWeek(String sdate) {
        // 再转换为时间
        Date date = DateUtil.strToDate(sdate, YYYY_MM_DD);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        // int hour=c.get(Calendar.DAY_OF_WEEK);
        // hour中存的就是星期几了,其范围 1~7
        // 1=星期日 7=星期六,其他类推
        return new SimpleDateFormat("EEEE").format(c.getTime());
    }
    public static String getWeekStr(String sdate) {
        String str = "";
        str = DateUtil.getWeek(sdate);
        if ("1".equals(str)) {
            str = "星期日";
        } else if ("2".equals(str)) {
            str = "星期一";
        } else if ("3".equals(str)) {
            str = "星期二";
        } else if ("4".equals(str)) {
            str = "星期三";
        } else if ("5".equals(str)) {
            str = "星期四";
        } else if ("6".equals(str)) {
            str = "星期五";
        } else if ("7".equals(str)) {
            str = "星期六";
        }
        return str;
    }
    /**
     * 两个时间之间的天数
     *
     * @param date1
     * @param date2
     * @return
     */
    public static long getDays(String date1, String date2) {
        if(date1 == null || date1.equals("")){
            return 0;
        }
        if(date2 == null || date2.equals("")){
            return 0;
        }
        // 转换为标准时间
        SimpleDateFormat myFormatter = new SimpleDateFormat(YYYY_MM_DD);
        java.util.Date date = null;
        java.util.Date mydate = null;
        try {
            date = myFormatter.parse(date1);
            mydate = myFormatter.parse(date2);
        } catch (Exception e) {
        }
        long day = (date.getTime() - mydate.getTime()) / (24 * 60 * 60 * 1000);
        return day;
    }
    /**
     * 返回两个日期相差的天数
     * @param date1
     * @param date2
     * @return
     */
    public static long getDays(Date date1, Date date2) {
        if (date1 == null || date2 == null){
            return 0;
        }
        long day = (date1.getTime() - date2.getTime()) / (24 * 60 * 60 * 1000);
        return day;
    }
    /**
     * 返回两个日期相差的小时数(保留2位小数)
     * @param date1
     * @param date2
     * @return
     */
    public static float getHours(Date date1, Date date2) {
        if (date1 == null || date2 == null){
            return 0;
        }
        float hours = (date1.getTime() - date2.getTime()) / (float)(60 * 60 * 1000);
        BigDecimal decimal = new BigDecimal(hours);
        float hour = decimal.setScale(2, BigDecimal.ROUND_HALF_UP).floatValue();
        return hour;
    }
    /**
     * 形成如下的日历 , 根据传入的一个时间返回一个结构 星期日 星期一 星期二 星期三 星期四 星期五 星期六 下面是当月的各个时间
     * 此函数返回该日历第一行星期日所在的日期
     *
     * @param sdate
     * @return
     */
    public static String getNowMonth(String sdate) {
        // 取该时间所在月的一号
        sdate = sdate.substring(0, 8) + "01";
        // 得到这个月的1号是星期几
        Date date = DateUtil.strToDate(sdate, YYYY_MM_DD);
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        int u = c.get(Calendar.DAY_OF_WEEK);
        String newday = DateUtil.getNextDay(sdate, 1 - u);
        return newday;
    }
    /**
     * 取得数据库主键 生成格式为yyyymmddhhmmss+k位随机数
     *
     * @param k 表示是取几位随机数,可以自己定
     */
    public static String getNo(int k) {
        return getUserDate("yyyyMMddhhmmss") + getRandom(k);
    }
    /**
     * 取得流水号 生成格式为yyyymmddhhmmss+k位随机UUID
     *
     * @param k 表示是取几位随机数,可以自己定
     */
    public static String getUidNo(int k) {
        return getUserDate("yyyyMMddhhmmss") + UUID.randomUUID().toString().replaceAll("-", "").substring(0, k);
    }
    /**
     * 返回一个随机数
     *
     * @param i
     * @return
     */
    public static String getRandom(int i) {
        Random jjj = new Random();
        if(i == 0){
            return "";
        }
        String jj = "";
        for (int k = 0; k < i; k++) {
            jj = jj + jjj.nextInt(9);
        }
        return jj;
    }
    /**
     * 根据用户生日计算年龄
     */
    public static int getAgeByBirthday(Date birthday) {
        try {
            int age = 0;
            if (birthday == null) {
                return age;
            }
            String birth = new SimpleDateFormat("yyyyMMdd").format(birthday);
            int year = Integer.valueOf(birth.substring(0, 4));
            int month = Integer.valueOf(birth.substring(4, 6));
            int day = Integer.valueOf(birth.substring(6));
            Calendar cal = Calendar.getInstance();
            age = cal.get(Calendar.YEAR) - year;
            //周岁计算
            if (cal.get(Calendar.MONTH) < (month - 1) || (cal.get(Calendar.MONTH) == (month - 1) && cal.get(Calendar.DATE) < day)) {
                age--;
            }
            return age;
        } catch (Exception e) {
            return 0;
        }
    }
    /**
     *  字符串转时间
     * @param str 时间字符串
     * @param eg 格式
     * @return
     */
    public static Date stringToDate(String str, String eg) {
        DateFormat format = new SimpleDateFormat(eg);
        Date date = null;
        if (str != null && !"".equals(str)) {
            try {
                date = format.parse(str);
            } catch (Exception e) {
                return null;
            }
        }
        return date;
    }
    public static int getNowMonth(){
        Calendar cal = Calendar.getInstance();
        return cal.get(Calendar.MONTH)+1;
    }
    public static int getNowYear(){
        Calendar cal = Calendar.getInstance();
        return cal.get(Calendar.YEAR);
    }
    /**
     * 获取周一
     * @return
     */
    public static String getMondayOfThisWeek() {
        SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
        if (day_of_week == 0){
            day_of_week = 7;
        }
        c.add(Calendar.DATE, -day_of_week + 1);
        return df2.format(c.getTime());
    }
    /**
     * 得到本周周日
     *
     * @return yyyy-MM-dd
     */
    public static String getSundayOfThisWeek() {
        SimpleDateFormat df2 = new SimpleDateFormat("yyyy-MM-dd");
        Calendar c = Calendar.getInstance();
        int day_of_week = c.get(Calendar.DAY_OF_WEEK) - 1;
        if (day_of_week == 0){
            day_of_week = 7;
        }
        c.add(Calendar.DATE, -day_of_week + 7);
        return df2.format(c.getTime());
    }
    /**
     * 获取当月第一天
     * @return
     */
    public static String getFristDayOfMonth() {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        // 获取前月的第一天
        Calendar c = Calendar.getInstance();
        c.add(Calendar.MONTH, 0);
        c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
        String first = format.format(c.getTime());
        return format.format(c.getTime());
    }
    /**
     * 获取当月最后一天
     */
    public static String getLastDayOfMonth(){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        // 获取前月的第一天
        Calendar ca = Calendar.getInstance();
        ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
        return format.format(ca.getTime());
    }
    public static int getSignYear(){
        Calendar ca = Calendar.getInstance();
        if(getNowMonth()>=4){
            return getNowYear();
        }
        return getNowYear()-1;
    }
    /**
     * 计算预产期
     * 末次月经开始日期(第一天),月份+9,日期+7
     * @param date
     * @return
     */
    public static Date getDueDate(Date date){
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.MONTH,9);
        cal.add(Calendar.DAY_OF_YEAR,7);
        return cal.getTime();
    }
    /**
     * 计算产检时间
     * @param date
     * @param day
     * @return
     */
    public static Date getPrenatalInspectorDate(Date date,Integer day){
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        cal.add(Calendar.DAY_OF_YEAR,day);
        return cal.getTime();
    }
    /**
     * 将HH:MM格式的字符串转TIME
     * @param hhmm
     * @return
     */
    public static Time hhmmStrToTime(String hhmm){
        Time time = null;
        DateFormat sdf = new SimpleDateFormat("HH:mm");
        try {
            Date date = sdf.parse(hhmm);
            time = new Time(date.getTime());
        } catch (Exception e) {
            e.printStackTrace();
        }
        return time;
    }
    /**
     * 获取当前时间的Timestamp
     * @return
     */
    public static Timestamp getNowTimestamp(){
        Date date = new Date();
        Timestamp nousedate = new Timestamp(date.getTime());
        return nousedate;
    }
    /**
     *  日期加减天数
     * @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();
    }
    /**
     * 获取去年日期
     * @return
     */
    public static String getLastYear(){
        Calendar cal = Calendar.getInstance();
        cal.add(Calendar.YEAR,-1);
        return dateToStrLong(cal.getTime());
    }
    /**
     * 获取儿童的年龄
     * @param date
     * @return
     */
    public static String getChildAge(Date date){
        Calendar now = Calendar.getInstance();
        Calendar cal = Calendar.getInstance();
        cal.setTime(date);
        int year = now.get(Calendar.YEAR)-cal.get(Calendar.YEAR);
        int month = now.get(Calendar.MONTH)-cal.get(Calendar.MONTH);
        if(month<0){
            year--;
            month+=12;
        }
        int day = now.get(Calendar.DAY_OF_MONTH)-cal.get(Calendar.DAY_OF_MONTH);
        if(day<0){
            month--;
            Calendar temp = Calendar.getInstance();
            temp.setTime(date);
            temp.add(Calendar.MONTH,1);
            temp.set(Calendar.DAY_OF_MONTH,1);
            temp.add(Calendar.DAY_OF_MONTH,-1);
            day = temp.get(Calendar.DAY_OF_MONTH)+now.get(Calendar.DAY_OF_MONTH)-cal.get(Calendar.DAY_OF_MONTH);
        }
        String y = year>0? year+"岁":"";
        String m = month>0? month+"月":"";
        String d = day>0? day+"天":"";
        return y+m+d;
    }
    public static int getWeekOfMonth(String dateString){
        Date date = strToDate(dateString);
        return getWeekOfMonth(date);
    }
    public static int getWeekOfMonth(Date date){
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        int weekOfMonth = calendar.get(Calendar.WEEK_OF_MONTH);
        return weekOfMonth;
    }
    //将时间维度查出来的quotaDate转成yyyy-MM
    public static String changeQuotaDate(Date quotaDate){
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM");
        String  date = sdf.format(quotaDate);
        return date;
    }
    public static String getYear(String strDate, String format){
        Date date = strToDate(strDate,format);
        Calendar calendar = Calendar.getInstance();
        calendar.setTime(date);
        return calendar.get(Calendar.YEAR)+"";
    }
    public static String getMonth(String dateString){
        Date date = strToDate(dateString);
        return new SimpleDateFormat(YYYY_MM).format(date);
    }
    /**
     * 获取某个时间
     *
     * @return返回短时间格式 yyyy-MM-dd
     */
    public static Date getDateShort(Date date) {
        SimpleDateFormat formatter = new SimpleDateFormat(YYYY_MM_DD);
        String dateString = formatter.format(date);
        return strToDate(dateString, YYYY_MM_DD);
    }
    /**
     * 获取当月第一天
     * @return
     */
    public static String getFristDayOfMonthThisDate(Date date) {
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        // 获取前月的第一天
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        c.add(Calendar.MONTH, 0);
        c.set(Calendar.DAY_OF_MONTH,1);//设置为1号,当前日期既为本月第一天
        String first = format.format(c.getTime());
        return format.format(c.getTime());
    }
    /**
     * 获取当月最后一天
     */
    public static String getLastDayOfMonthThisDate(Date date){
        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");
        // 获取前月的第一天
        Calendar ca = Calendar.getInstance();
        ca.setTime(date);
        ca.set(Calendar.DAY_OF_MONTH, ca.getActualMaximum(Calendar.DAY_OF_MONTH));
        return format.format(ca.getTime());
    }
    /**
     * 根据日期对象返回星期几
     * @param date
     * @return
     */
    public static int getWeekByDate(Date date){
        Calendar c = Calendar.getInstance();
        c.setTime(date);
        int week = c.get(Calendar.DAY_OF_WEEK);
        return week;
    }
}

+ 1 - 1
svr-lib-parent-pom/pom.xml

@ -134,7 +134,7 @@
                <version>${version.myCommon}</version>
            </dependency>
            <dependency>
                <groupId>com.yihu.base</groupId>
                <groupId>com.yihu.jw</groupId>
                <artifactId>common-util</artifactId>
                <version>${version.myCommon}</version>
            </dependency>

+ 1 - 1
svr/svr-base/pom.xml

@ -29,7 +29,7 @@
            <artifactId>common-exception</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>

+ 1 - 1
svr/svr-iot/pom.xml

@ -42,7 +42,7 @@
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>

+ 43 - 3
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/FileUploadController.java

@ -2,15 +2,16 @@ package com.yihu.iot.controller.common;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.yihu.base.fastdfs.FastDFSHelper;
import com.yihu.iot.vo.common.UploadVO;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.exception.code.ExceptionCode;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
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.*;
@ -34,9 +35,48 @@ public class FileUploadController extends EnvelopRestController{
    @Value("${fastDFS.fastdfs_file_url}")
    private String fastdfs_file_url;
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    public Envelop<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 Envelop.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 Envelop.getError(IotRequestMapping.FileUpload.message_fail_upload_format,IotRequestMapping.api_iot_fail);
            }
            long size = file.getSize();
            long max = 5*1024*1024;
            if(size>max){
                return Envelop.getError("文件大小不超过5M",IotRequestMapping.api_iot_fail);
            }
            String fileName = fullName.substring(0, fullName.lastIndexOf("."));
            //上传到fastdfs
            ObjectNode objectNode = fastDFSHelper.upload(file.getInputStream(), fileType, "");
            //解析返回的objectNode
            UploadVO uploadVO = new UploadVO();
            uploadVO.setFileName(fileName);
            uploadVO.setFileType(fileType);
            uploadVO.setFullUri(objectNode.get("fid").toString().replaceAll("\"", ""));
            uploadVO.setFullUrl(fastdfs_file_url + objectNode.get("fid").toString().replaceAll("\"", ""));
            return Envelop.getSuccess(IotRequestMapping.DeviceSupplier.message_success_create, uploadVO);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError(IotRequestMapping.FileUpload.message_fail_upload, IotRequestMapping.api_iot_fail);
        }
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    public Envelop uploadStream(@ApiParam(value = "文件", required = true) @RequestParam(value = "file", required = true) MultipartFile file) {
    public Envelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true) @RequestParam(value = "file", required = true) MultipartFile file) {
        try {
            // 得到文件的完整名称  xxx.txt
            String fullName = file.getOriginalFilename();
@ -60,7 +100,7 @@ public class FileUploadController extends EnvelopRestController{
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_string)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    public Envelop uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流") @RequestBody String jsonData) throws Exception {
    public Envelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流") @RequestBody String jsonData) throws Exception {
        try {
            if(jsonData == null){
                return Envelop.getError(IotRequestMapping.FileUpload.message_fail_jsonData_is_null, ExceptionCode.common_error_params_code);

+ 12 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/common/IotSystemDictController.java

@ -1,8 +1,11 @@
package com.yihu.iot.controller.common;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.jw.iot.dict.IotSystemDictDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
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;
@ -13,6 +16,9 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
@ -23,14 +29,18 @@ public class IotSystemDictController extends EnvelopRestController {
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @Autowired
    private IotSystemDictDao iotSystemDictDao;
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    @ApiOperation(value = "获取字典列表(不分页)")
    public Envelop getList(
    public Envelop<IotSystemDictVO> getList(
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
            @RequestParam(value = "dictName", required = true) String dictName) throws Exception {
        try {
            return Envelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,iotSystemDictService.findByDictName(dictName));
            List<IotSystemDictDO> doList = iotSystemDictDao.findByDictName(dictName);
            List<IotSystemDictVO> voList = convertToModels(doList,new ArrayList<IotSystemDictVO>(doList.size()),IotSystemDictVO.class);
            return Envelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,voList);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("查询失败");

+ 85 - 7
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -1,11 +1,13 @@
package com.yihu.iot.controller.company;
import com.yihu.iot.service.company.IotCompanyCertificateService;
import com.yihu.iot.service.company.IotCompanyService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.iot.company.IotCompanyCertificateDO;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopObj;
import com.yihu.jw.restmodel.common.EnvelopRestController;
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;
@ -15,6 +17,9 @@ import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
@ -25,6 +30,8 @@ public class IotCompanyController extends EnvelopRestController {
    @Autowired
    private IotCompanyService iotCompanyService;
    @Autowired
    private IotCompanyCertificateService iotCompanyCertificateService;
    @GetMapping(value = IotRequestMapping.Company.findCompanyPage)
    @ApiOperation(value = "分页查找企业", notes = "分页查找企业")
@ -71,16 +78,27 @@ public class IotCompanyController extends EnvelopRestController {
    @GetMapping(value = IotRequestMapping.Company.findCompanyById)
    @ApiOperation(value = "根据id查找企业", notes = "根据id查找企业")
    public EnvelopObj<IotCompanyVO> findByCode(@ApiParam(name = "id", value = "id")
    public Envelop<IotCompanyVO> findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id) {
        try {
            IotCompanyDO iotCompanyDO = iotCompanyService.findById(id);
            IotCompanyVO vo = convertToModel(iotCompanyDO,IotCompanyVO.class);
            EnvelopObj<IotCompanyVO> obj = new EnvelopObj<IotCompanyVO>();
            obj.setObj(vo);
            return obj;
            IotCompanyVO vo = iotCompanyService.convertToModelVO(iotCompanyDO);
            return Envelop.getSuccess(IotRequestMapping.Company.message_success_find, vo);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findByBusinessLicense)
    @ApiOperation(value = "根据营业执照号查找企业", notes = "根据营业执照号查找企业")
    public Envelop<IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "businessLicense")
                                            @RequestParam(value = "businessLicense", required = true) String businessLicense) {
        try {
            IotCompanyDO iotCompanyDO = iotCompanyService.findByBusinessLicense(businessLicense);
            IotCompanyVO vo = iotCompanyService.convertToModelVO(iotCompanyDO);
            return Envelop.getSuccess(IotRequestMapping.Company.message_success_find, vo);
        } catch (ApiException e) {
            return null;
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
@ -109,4 +127,64 @@ public class IotCompanyController extends EnvelopRestController {
        }
    }
    @PostMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    @ApiOperation(value = "分页获取企业证书", notes = "分页获取企业证书")
    public Envelop<IotCompanyCertificateVO> findCompanyCertPage
            (@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 iotCompanyCertificateService.queryPage(page,size,name);
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertById)
    @ApiOperation(value = "根据id查找企业证书", notes = "根据id查找企业证书")
    public Envelop<IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            IotCompanyCertificateDO iotCompanyCertificateDO = iotCompanyCertificateService.findById(id);
            IotCompanyCertificateVO vo = convertToModel(iotCompanyCertificateDO,IotCompanyCertificateVO.class);
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_find, vo);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertByCompanyId)
    @ApiOperation(value = "根据企业id查找企业证书", notes = "根据企业id查找企业证书")
    public Envelop<IotCompanyCertificateVO> findCompanyCertByCompanyId(@ApiParam(name = "companyId", value = "companyId")
                                                                @RequestParam(value = "companyId", required = true) String companyId) {
        try {
            List<IotCompanyCertificateDO> iotCompanyCertificateDOList = iotCompanyCertificateService.findByCompanyId(companyId);
            List<IotCompanyCertificateVO> voList = convertToModels(iotCompanyCertificateDOList,new ArrayList<>(iotCompanyCertificateDOList.size()),IotCompanyCertificateVO.class);
            return Envelop.getSuccessList(IotRequestMapping.Common.message_success_find, voList);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = IotRequestMapping.Company.addCompanyCert)
    @ApiOperation(value = "创建企业证书", notes = "创建企业证书")
    public Envelop<IotCompanyVO> addCompanyCert(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        try {
            IotCompanyCertificateDO iotCompanyCertificate = toEntity(jsonData, IotCompanyCertificateDO.class);
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_create, iotCompanyCertificateService.create(iotCompanyCertificate));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
}

+ 4 - 2
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceOrderController.java

@ -5,6 +5,7 @@ import com.yihu.jw.exception.ApiException;
import com.yihu.jw.iot.device.IotDeviceOrderDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -30,11 +31,12 @@ public class IotDeviceOrderController extends EnvelopRestController{
    @PostMapping(value = IotRequestMapping.DeviceOrder.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建设备订单", notes = "创建设备订单")
    public Envelop<IotDeviceOrderDO> create(@ApiParam(name = "json_data", value = "", defaultValue = "")
    public Envelop<IotDeviceOrderVO> create(@ApiParam(name = "json_data", value = "", defaultValue = "")
                          @RequestBody String jsonData) {
        try {
            IotDeviceOrderDO iotDeviceOrder = toEntity(jsonData, IotDeviceOrderDO.class);
            return Envelop.getSuccess(IotRequestMapping.DeviceOrder.message_success_create, iotDeviceOrderService.create(iotDeviceOrder));
            iotDeviceOrderService.create(iotDeviceOrder);
            return Envelop.getSuccess(IotRequestMapping.DeviceOrder.message_success_create);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }

+ 0 - 99
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDevicePurchaseController.java

@ -1,99 +0,0 @@
package com.yihu.iot.controller.device;
import com.yihu.iot.service.device.IotOrderPurchaseService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.iot.device.IotOrderPurchaseDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
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.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2017/12/8.
 */
@RestController
@RequestMapping(IotRequestMapping.api_iot_common)
@Api(tags = "设备采购管理相关操作", description = "设备采购管理相关操作")
public class IotDevicePurchaseController extends EnvelopRestController{
    @Autowired
    private IotOrderPurchaseService iotDevicePurchaseService;
    @PostMapping(value = IotRequestMapping.DevicePurchase.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建设备采购", notes = "创建设备采购")
    public Envelop create(@ApiParam(name = "json_data", value = "", defaultValue = "")
                          @RequestBody String jsonData) {
        try {
            IotOrderPurchaseDO iotDevicePurchase = toEntity(jsonData, IotOrderPurchaseDO.class);
            return Envelop.getSuccess(IotRequestMapping.DevicePurchase.message_success_create, iotDevicePurchaseService.create(iotDevicePurchase));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = IotRequestMapping.DevicePurchase.api_getById)
    @ApiOperation(value = "根据code查找设备采购", notes = "根据code查找设备采购")
    public Envelop findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id
    ) {
        try {
            return Envelop.getSuccess(IotRequestMapping.DevicePurchase.message_success_find, iotDevicePurchaseService.findById(id));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = IotRequestMapping.DevicePurchase.api_queryPage, method = RequestMethod.GET)
    @ApiOperation(value = "分页获取设备采购")
    public Envelop queryPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段(id,supplierName,type,contactsName,contactsMobile)", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件(supplierName?中 g1;contactsName?中 g1)")
            @RequestParam(value = "filters", required = false,defaultValue = "") String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "-createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) Integer size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) Integer page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        //得到list数据
        List<IotOrderPurchaseDO> list = iotDevicePurchaseService.search(fields, filters, sorts, page, size);
        //获取总数
        long count=iotDevicePurchaseService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<IotOrderPurchaseDO> iotDevicePurchases = convertToModels(list, new ArrayList<>(list.size()), IotOrderPurchaseDO.class, fields);
        return Envelop.getSuccessListWithPage(IotRequestMapping.DevicePurchase.message_success_find_functions,iotDevicePurchases, page, size,count);
    }
    @GetMapping(value = IotRequestMapping.DevicePurchase.api_getList)
    @ApiOperation(value = "获取设备采购列表(不分页)")
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段(id,supplierName,type,contactsName,contactsMobile)", defaultValue = "")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "-createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        //得到list数据
        List<IotOrderPurchaseDO> list = iotDevicePurchaseService.search(fields,filters,sorts);
        //封装返回格式
        List<IotOrderPurchaseDO> iotDevicePurchases = convertToModels(list, new ArrayList<>(list.size()), IotOrderPurchaseDO.class, fields);
        return Envelop.getSuccessList(IotRequestMapping.DevicePurchase.message_success_find_functions,iotDevicePurchases);
    }
}

+ 166 - 0
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -0,0 +1,166 @@
package com.yihu.iot.controller.product;
import com.yihu.iot.service.product.IotProductBaseInfoService;
import com.yihu.jw.exception.ApiException;
import com.yihu.jw.iot.product.IotProductBaseInfoDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
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.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2018/1/17.
 */
@RestController
@RequestMapping(IotRequestMapping.Common.product)
@Api(tags = "产品管理相关操作", description = "产品管理相关操作")
public class IotProductController extends EnvelopRestController {
    @Autowired
    private IotProductBaseInfoService iotProductBaseInfoService;
    @GetMapping(value = IotRequestMapping.Product.findProductPage)
    @ApiOperation(value = "分页查找产品", notes = "分页查找产品")
    public Envelop<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 = "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;
            }
            String filters = "";
            String semicolon = "";
            if(StringUtils.isNotBlank(name)){
                filters = "name?"+name+" g1;registerCertificate?"+name+" g1";
                semicolon = ";";
            }
            if(StringUtils.isNotBlank(classify)){
                filters += semicolon +"productClassify="+classify;
                semicolon = ";";
            }
            if(StringUtils.isBlank(filters)){
                filters+= semicolon + "del=1";
            }
            String sorts = "-updateTime";
            //得到list数据
            List<IotProductBaseInfoDO> list = iotProductBaseInfoService.search(null, filters, sorts, page, size);
            //获取总数
            long count = iotProductBaseInfoService.getCount(filters);
            //DO转VO
            List<IotProductBaseInfoVO> iotCompanyVOList = convertToModels(list,new ArrayList<>(list.size()),IotProductBaseInfoVO.class);
            return Envelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @GetMapping(value = IotRequestMapping.Product.findProductPageByCompanyId)
    @ApiOperation(value = "分页查找产品(按企业id)", notes = "分页查找产品")
    public Envelop<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;
            }
            String filters = "supplierId = "+companyId+";productClassify=1;del=1";
            String semicolon = ";";
            if(StringUtils.isNotBlank(name)){
                filters += semicolon + "name?"+name;
            }
            String sorts = "-updateTime";
            //得到list数据
            List<IotProductBaseInfoDO> list = iotProductBaseInfoService.search(null, filters, sorts, page, size);
            //获取总数
            long count = iotProductBaseInfoService.getCount(filters);
            //DO转VO
            List<IotProductBaseInfoVO> iotCompanyVOList = convertToModels(list,new ArrayList<>(list.size()),IotProductBaseInfoVO.class);
            return Envelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
        } catch (Exception e) {
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.addProduct)
    @ApiOperation(value = "创建产品", notes = "创建产品")
    public Envelop<IotProductVO> addProduct(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        try {
            IotProductVO iotProductVO = toEntity(jsonData, IotProductVO.class);
            iotProductBaseInfoService.addProduct(iotProductVO);
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_create);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = IotRequestMapping.Product.findProductById)
    @ApiOperation(value = "根据id查找产品", notes = "根据id查找产品")
    public Envelop<IotProductVO> findByCode(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            IotProductVO vo = iotProductBaseInfoService.findProductById(id);
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_find, vo);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public Envelop<IotProductVO> delCompany(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        try {
            iotProductBaseInfoService.delProduct(id);
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_find);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.updProduct)
    @ApiOperation(value = "修改产品信息", notes = "修改产品信息")
    public Envelop<IotProductVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        try {
            IotProductVO iotProductVO = toEntity(jsonData, IotProductVO.class);
            iotProductBaseInfoService.updProduct(iotProductVO);
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_find);
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
}

+ 8 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyCertificateDao.java

@ -1,14 +1,22 @@
package com.yihu.iot.dao.company;
import com.yihu.jw.iot.company.IotCompanyCertificateDO;
import com.yihu.jw.iot.company.IotCompanyDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotCompanyCertificateDao extends PagingAndSortingRepository<IotCompanyCertificateDO, String>,
        JpaSpecificationExecutor<IotCompanyCertificateDO>{
    @Query("from IotCompanyCertificateDO w where w.id =?1 and w.del=1")
    IotCompanyCertificateDO findById(String id);
    @Query("from IotCompanyCertificateDO w where w.companyId =?1 and w.del=1")
    List<IotCompanyCertificateDO> findByCompanyId(String companyId);
}

+ 4 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/company/IotCompanyDao.java

@ -13,6 +13,9 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotCompanyDao extends PagingAndSortingRepository<IotCompanyDO, String>,
        JpaSpecificationExecutor<IotCompanyDO> {
    @Query("from IotCompanyDO w where w.id =?1")
    @Query("from IotCompanyDO w where w.id =?1 and w.del=1 ")
    IotCompanyDO findById(String id);
    @Query("from IotCompanyDO w where w.businessLicense =?1 and w.del=1")
    IotCompanyDO findByBusinessLicense(String businessLicense);
}

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/dict/IotSystemDictDao.java

@ -1,14 +1,20 @@
package com.yihu.iot.dao.dict;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.dict.IotSystemDictDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotSystemDictDao extends PagingAndSortingRepository<IotSystemDictDO,String>,
        JpaSpecificationExecutor<IotSystemDictDO> {
    @Query("from IotSystemDictDO w where w.dictName =?1 and w.del = 1 ORDER BY sort")
    List<IotSystemDictDO> findByDictName(String dictName);
    
}

+ 6 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductAttachmentDao.java

@ -1,14 +1,19 @@
package com.yihu.iot.dao.product;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.product.IotProductAttachmentDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotProductAttachmentDao extends PagingAndSortingRepository<IotProductAttachmentDO,String>,
        JpaSpecificationExecutor<IotProductAttachmentDO> {
    @Query("from IotProductAttachmentDO w where w.productId =?1")
    List<IotProductAttachmentDO> findByProductId(String productId);
}

+ 4 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductBaseInfoDao.java

@ -1,7 +1,9 @@
package com.yihu.iot.dao.product;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.product.IotProductBaseInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -10,5 +12,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotProductBaseInfoDao extends PagingAndSortingRepository<IotProductBaseInfoDO,String>,
        JpaSpecificationExecutor<IotProductBaseInfoDO> {
    @Query("from IotProductBaseInfoDO w where w.id =?1")
    IotProductBaseInfoDO findById(String id);
}

+ 6 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductDataTransmissionDao.java

@ -1,14 +1,19 @@
package com.yihu.iot.dao.product;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.product.IotProductDataTransmissionDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotProductDataTransmissionDao extends PagingAndSortingRepository<IotProductDataTransmissionDO,String>,
        JpaSpecificationExecutor<IotProductDataTransmissionDO> {
    @Query("from IotProductDataTransmissionDO w where w.productId =?1")
    List<IotProductDataTransmissionDO> findByProductId(String productId);
}

+ 4 - 1
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductExtendInfoDao.java

@ -1,7 +1,9 @@
package com.yihu.iot.dao.product;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.product.IotProductExtendInfoDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
@ -10,5 +12,6 @@ import org.springframework.data.repository.PagingAndSortingRepository;
public interface IotProductExtendInfoDao extends PagingAndSortingRepository<IotProductExtendInfoDO,String>,
        JpaSpecificationExecutor<IotProductExtendInfoDO> {
    @Query("from IotProductExtendInfoDO w where w.productId =?1 and w.del=1")
    IotProductExtendInfoDO findByProductId(String productId);
}

+ 6 - 0
svr/svr-iot/src/main/java/com/yihu/iot/dao/product/IotProductMeasuredDataDao.java

@ -1,14 +1,20 @@
package com.yihu.iot.dao.product;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.product.IotProductMeasuredDataDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
public interface IotProductMeasuredDataDao extends PagingAndSortingRepository<IotProductMeasuredDataDO,String>,
        JpaSpecificationExecutor<IotProductMeasuredDataDO> {
    @Query("from IotProductMeasuredDataDO w where w.productId =?1 and w.del=1")
    List<IotProductMeasuredDataDO> findByProductId(String productId);
}

+ 73 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java

@ -3,13 +3,86 @@ package com.yihu.iot.service.company;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.company.IotCompanyCertificateDao;
import com.yihu.jw.iot.company.IotCompanyCertificateDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
@Service
public class IotCompanyCertificateService extends BaseJpaService<IotCompanyCertificateDO,IotCompanyCertificateDao> {
    @Autowired
    private IotCompanyCertificateDao iotCompanyCertificateDao;
    /**
     * 根据id查找
     * @param id
     * @return
     */
    public IotCompanyCertificateDO findById(String id){
        return iotCompanyCertificateDao.findById(id);
    }
    /**
     * 根据id查找
     * @param companyId
     * @return
     */
    public List<IotCompanyCertificateDO> findByCompanyId(String companyId){
        return iotCompanyCertificateDao.findByCompanyId(companyId);
    }
    /**
     * 分页查找
     * @param page
     * @param size
     * @param name
     * @return
     * @throws ParseException
     */
    public Envelop<IotCompanyCertificateVO> queryPage(Integer page, Integer size,String name) throws ParseException {
        String filters = "";
        String semicolon = "";
        if(StringUtils.isNotBlank(name)){
            filters = "name?"+name;
            semicolon = ";";
        }
        if(StringUtils.isBlank(filters)){
            filters+= semicolon + "del=1";
        }
        String sorts = "-updateTime";
        //得到list数据
        List<IotCompanyCertificateDO> list = search(null, filters, sorts, page, size);
        //获取总数
        long count = getCount(filters);
        //DO转VO
        List<IotCompanyCertificateVO> iotCompanyCertificateVOList = convertToModels(list,new ArrayList<>(list.size()),IotCompanyCertificateVO.class);
        return Envelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotCompanyCertificateVOList, page, size,count);
    }
    /**
     * 新增
     * @param iotCompanyCertificateDO
     * @return
     */
    public IotCompanyCertificateDO create(IotCompanyCertificateDO iotCompanyCertificateDO) {
        iotCompanyCertificateDO.setSaasId(getCode());
        iotCompanyCertificateDO.setDel(1);
        iotCompanyCertificateDao.save(iotCompanyCertificateDO);
        return iotCompanyCertificateDO;
    }
}

+ 111 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -1,14 +1,18 @@
package com.yihu.iot.service.company;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.company.IotCompanyCertificateChangeRecordDao;
import com.yihu.iot.dao.company.IotCompanyDao;
import com.yihu.iot.dao.company.IotCompanyTypeDao;
import com.yihu.jw.iot.company.IotCompanyCertificateChangeRecordDO;
import com.yihu.jw.iot.company.IotCompanyDO;
import com.yihu.jw.iot.company.IotCompanyTypeDO;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyTypeVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
@ -16,9 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.text.ParseException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.*;
/**
 * @author yeshijie on 2018/1/15.
@ -33,6 +35,8 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    private IotCompanyTypeDao iotCompanyTypeDao;
    @Autowired
    private JdbcTemplate jdbcTempalte;
    @Autowired
    private IotCompanyCertificateChangeRecordDao iotCompanyCertificateChangeRecordDao;
    /**
     * 分页查找
@ -43,7 +47,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @return
     * @throws ParseException
     */
    public Envelop queryPage(Integer page,Integer size,String status,String name) throws ParseException {
    public Envelop<IotCompanyVO> queryPage(Integer page,Integer size,String status,String name) throws ParseException {
        String filters = "";
        String semicolon = "";
        if(StringUtils.isNotBlank(name)){
@ -67,11 +71,40 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        long count = getCount(filters);
        //DO转VO
        List<IotCompanyVO> iotCompanyVOList = convertToModels(list,new ArrayList<>(list.size()),IotCompanyVO.class);
        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
        return Envelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
    /**
     * 转换
     * @param sources
     * @param targets
     * @return
     */
    public List<IotCompanyVO> convertToModelVOs(Collection sources, List<IotCompanyVO> targets){
        sources.forEach(one -> {
            IotCompanyVO target = new IotCompanyVO();
            BeanUtils.copyProperties(one, target);
            List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
            target.setTypeList(voList);
            targets.add(target);
        });
        return targets;
    }
    /**
     * 单个转换
     * @return
     */
    public IotCompanyVO convertToModelVO(IotCompanyDO iotCompanyDO){
        IotCompanyVO target = new IotCompanyVO();
        BeanUtils.copyProperties(iotCompanyDO, target);
        List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
        target.setTypeList(voList);
        return target;
    }
    /**
     * 按类型分页查找
     * @param page
@ -111,7 +144,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        long count = Long.valueOf(countList.get(0).get("count").toString());
        //DO转VO
        List<IotCompanyVO> iotCompanyVOList = convertToModels(list,new ArrayList<>(list.size()),IotCompanyVO.class);
        List<IotCompanyVO> iotCompanyVOList = convertToModelVOs(list,new ArrayList<>(list.size()));
        return Envelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
    }
@ -122,7 +155,7 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
     * @return
     */
    public IotCompanyDO create(IotCompanyDO iotCompany) {
        iotCompany.setStatus("1");
        iotCompany.setSaasId(getCode());
        iotCompany.setDel(1);
        List<IotCompanyTypeDO> list = iotCompany.getTypeList();
@ -154,6 +187,15 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        return company;
    }
    /**
     * 按营业执照号查询
     * @param businessLincense
     * @return
     */
    public IotCompanyDO findByBusinessLicense(String businessLincense){
        return iotCompanyDao.findByBusinessLicense(businessLincense);
    }
    /**
     * 添加类型
     * @param company
@ -204,6 +246,68 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
        iotCompanyTypeDao.save(companyTypes);
        //记录三证变更记录
        IotCompanyDO iotCompanyOld = iotCompanyDao.findById(iotCompany.getId());
        List<IotCompanyCertificateChangeRecordDO> recordDOList = new ArrayList<>(3);
        if(compare(iotCompany.getBusinessLicense(),iotCompanyOld.getBusinessLicense())||
                compare(iotCompany.getBusinessLicenseImg(),iotCompanyOld.getBusinessLicenseImg())){
            //营业执照
            IotCompanyCertificateChangeRecordDO recordDO = new IotCompanyCertificateChangeRecordDO();
            recordDO.setCompanyId(iotCompany.getId());
            recordDO.setSaasId(getCode());
            recordDO.setType("1");
            recordDO.setCreateTime(new Date());
            recordDO.setCertificateNew(iotCompany.getBusinessLicenseImg());
            recordDO.setLicenseNew(iotCompany.getBusinessLicense());
            recordDO.setCertificateOld(iotCompanyOld.getBusinessLicenseImg());
            recordDO.setLicenseOld(iotCompanyOld.getBusinessLicense());
            recordDO.setCompanyName(iotCompany.getName());
            recordDOList.add(recordDO);
        }
        if(compare(iotCompany.getOrganizationCodeImg(),iotCompanyOld.getOrganizationCodeImg())){
            //组织机构代码
            IotCompanyCertificateChangeRecordDO recordDO = new IotCompanyCertificateChangeRecordDO();
            recordDO.setCompanyId(iotCompany.getId());
            recordDO.setSaasId(getCode());
            recordDO.setType("2");
            recordDO.setCreateTime(new Date());
            recordDO.setCertificateNew(iotCompany.getOrganizationCodeImg());
            recordDO.setCertificateOld(iotCompanyOld.getOrganizationCodeImg());
            recordDO.setCompanyName(iotCompany.getName());
            recordDOList.add(recordDO);
        }
        if(compare(iotCompany.getTaxRegistrationImg(),iotCompanyOld.getTaxRegistrationImg())){
            //税务登记证
            IotCompanyCertificateChangeRecordDO recordDO = new IotCompanyCertificateChangeRecordDO();
            recordDO.setCompanyId(iotCompany.getId());
            recordDO.setSaasId(getCode());
            recordDO.setType("3");
            recordDO.setCreateTime(new Date());
            recordDO.setCertificateNew(iotCompany.getTaxRegistrationImg());
            recordDO.setCertificateOld(iotCompanyOld.getTaxRegistrationImg());
            recordDO.setCompanyName(iotCompany.getName());
            recordDOList.add(recordDO);
        }
        if(recordDOList.size()>0){
            iotCompanyCertificateChangeRecordDao.save(recordDOList);
        }
        iotCompanyDao.save(iotCompany);
    }
    /**
     * 判断三证是否修改
     * @param newStr
     * @param oldStr
     * @return
     */
    public Boolean compare(String newStr,String oldStr){
        if(newStr!=null){
            return newStr.equals(oldStr);
        }else if(oldStr!=null){
            return oldStr.equals(newStr);
        }else {
            return true;
        }
    }
}

+ 3 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -3,6 +3,7 @@ package com.yihu.iot.service.device;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.device.IotDeviceOrderDao;
import com.yihu.jw.iot.device.IotDeviceOrderDO;
import com.yihu.jw.util.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -22,7 +23,9 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
     */
    public IotDeviceOrderDO create(IotDeviceOrderDO iotDeviceOrder) {
        String time = DateUtil.yyyy_MM_dd_HH_mm_ss;
        iotDeviceOrder.setSaasId(getCode());
        iotDeviceOrder.setDel(1);
        return iotDeviceOrderDao.save(iotDeviceOrder);
    }

+ 6 - 7
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -1,6 +1,5 @@
package com.yihu.iot.service.dict;
import com.alibaba.fastjson.JSONObject;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.dict.IotSystemDictDao;
import com.yihu.iot.service.common.MyJdbcTemplate;
@ -8,8 +7,6 @@ import com.yihu.jw.iot.dict.IotSystemDictDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
@ -26,10 +23,12 @@ public class IotSystemDictService extends BaseJpaService<IotSystemDictDO,IotSyst
     * @param dictName
     * @return
     */
    public List<JSONObject> findByDictName(String dictName){
        String sql = "SELECT code,value from iot_system_dict WHERE dict_name = ? and del = 1 ORDER BY sort";
        return myJdbcTemplate.queryJson(sql,new Object[]{dictName});
    }
//    public List<JSONObject> findByDictName(String dictName){
//        String sql = "SELECT code,value from iot_system_dict WHERE dict_name = ? and del = 1 ORDER BY sort";
//        return myJdbcTemplate.queryJson(sql,new Object[]{dictName});
//    }
}

+ 182 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java

@ -1,15 +1,195 @@
package com.yihu.iot.service.product;
import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.product.IotProductBaseInfoDao;
import com.yihu.jw.iot.product.IotProductBaseInfoDO;
import com.yihu.iot.dao.product.*;
import com.yihu.jw.iot.product.*;
import com.yihu.jw.restmodel.iot.product.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2018/1/16.
 */
@Service
@Transactional(rollbackFor = Exception.class)
public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfoDO,IotProductBaseInfoDao> {
    @Autowired
    private IotProductBaseInfoDao iotProductBaseInfoDao;
    @Autowired
    private IotProductMeasuredDataDao iotProductMeasuredDataDao;
    @Autowired
    private IotProductAttachmentDao iotProductAttachmentDao;
    @Autowired
    private IotProductDataTransmissionDao iotProductDataTransmissionDao;
    @Autowired
    private IotProductExtendInfoDao iotProductExtendInfoDao;
    /**
     * 按id查找产品详情
     * @param id
     * @return
     */
    public IotProductVO findProductById(String id){
        IotProductVO iotProductVO = new IotProductVO();
        IotProductBaseInfoDO baseInfoDO = iotProductBaseInfoDao.findById(id);
        IotProductExtendInfoDO extendInfoDO = iotProductExtendInfoDao.findByProductId(id);
        List<IotProductAttachmentDO> attachmentDOList = iotProductAttachmentDao.findByProductId(id);
        List<IotProductMeasuredDataDO> measuredDataDOList = iotProductMeasuredDataDao.findByProductId(id);
        List<IotProductDataTransmissionDO> dataTransmissionDOList = iotProductDataTransmissionDao.findByProductId(id);
        //数据转换
        IotProductBaseInfoVO baseInfoVO = convertToModel(baseInfoDO,IotProductBaseInfoVO.class);
        IotProductExtendInfoVO extendInfoVO = convertToModel(extendInfoDO,IotProductExtendInfoVO.class);
        List<IotProductAttachmentVO> attachmentVOList =
                convertToModels(attachmentDOList,new ArrayList<>(attachmentDOList.size()),IotProductAttachmentVO.class);
        List<IotProductMeasuredDataVO> measuredDataVOList =
                convertToModels(measuredDataDOList,new ArrayList<>(measuredDataDOList.size()),IotProductMeasuredDataVO.class);
        List<IotProductDataTransmissionVO> dataTransmissionVOList =
                convertToModels(dataTransmissionDOList,new ArrayList<>(dataTransmissionDOList.size()),IotProductDataTransmissionVO.class);
        baseInfoVO.setDataTransmissionVOList(dataTransmissionVOList);
        extendInfoVO.setAttachmentVOList(attachmentVOList);
        iotProductVO.setIotProductBaseInfo(baseInfoVO);
        iotProductVO.setIotProductExtendInfo(extendInfoVO);
        iotProductVO.setMeasuredDataVOList(measuredDataVOList);
        return iotProductVO;
    }
    /**
     * 删除产品
     * @param id
     */
    public void delProduct(String id){
        IotProductBaseInfoDO baseInfoDO = iotProductBaseInfoDao.findById(id);
        IotProductExtendInfoDO extendInfoDO = iotProductExtendInfoDao.findByProductId(id);
        baseInfoDO.setDel(0);
        extendInfoDO.setDel(0);
        iotProductBaseInfoDao.save(baseInfoDO);
        iotProductExtendInfoDao.save(extendInfoDO);
    }
    /**
     * 修改产品
     * @param iotProductVO
     */
    public void updProduct(IotProductVO iotProductVO){
        IotProductBaseInfoVO baseInfoVO = iotProductVO.getIotProductBaseInfo();
        IotProductExtendInfoVO extendInfoVO = iotProductVO.getIotProductExtendInfo();
        List<IotProductAttachmentVO> attachmentVOList = extendInfoVO.getAttachmentVOList();
        List<IotProductMeasuredDataVO> measuredDataVOList = iotProductVO.getMeasuredDataVOList();
        List<IotProductDataTransmissionVO> dataTransmissionVOList = baseInfoVO.getDataTransmissionVOList();
        //数据转换
        IotProductBaseInfoDO baseInfoDO = convertToModel(baseInfoVO,IotProductBaseInfoDO.class);
        IotProductExtendInfoDO extendInfoDO = convertToModel(extendInfoVO,IotProductExtendInfoDO.class);
        List<IotProductAttachmentDO> attachmentDOList =
                convertToModels(attachmentVOList,new ArrayList<>(attachmentVOList.size()),IotProductAttachmentDO.class);
        List<IotProductMeasuredDataDO> measuredDataDOList =
                convertToModels(measuredDataVOList,new ArrayList<>(measuredDataVOList.size()),IotProductMeasuredDataDO.class);
        List<IotProductDataTransmissionDO> dataTransmissionDOList =
                convertToModels(dataTransmissionVOList,new ArrayList<>(dataTransmissionVOList.size()),IotProductDataTransmissionDO.class);
        //基础信息
        String productId = baseInfoDO.getId();
        IotProductBaseInfoDO baseInfoDOOld = iotProductBaseInfoDao.findById(productId);
        baseInfoDO.setDel(1);
        baseInfoDO.setSaasId(baseInfoDOOld.getSaasId());
        iotProductBaseInfoDao.save(baseInfoDO);
        //扩展信息
        IotProductExtendInfoDO extendInfoDOOld = iotProductExtendInfoDao.findByProductId(productId);
        extendInfoDO.setSaasId(extendInfoDOOld.getSaasId());
        extendInfoDO.setDel(1);
        extendInfoDO.setProductId(productId);
        iotProductExtendInfoDao.save(extendInfoDO);
        //附件
        List<IotProductAttachmentDO> attachmentDOOldList = iotProductAttachmentDao.findByProductId(productId);
        iotProductAttachmentDao.delete(attachmentDOOldList);
        String extendId = extendInfoDO.getId();
        attachmentDOList.forEach(one->{
            one.setProductId(productId);
            one.setSaasId(getCode());
            one.setDel(1);
            one.setProductExtendId(extendId);
        });
        iotProductAttachmentDao.save(attachmentDOList);
        //测量数据
        List<IotProductMeasuredDataDO> measuredDataDOOldList = iotProductMeasuredDataDao.findByProductId(productId);
        iotProductMeasuredDataDao.delete(measuredDataDOOldList);
        measuredDataDOList.forEach(one->{
            one.setProductId(productId);
            one.setSaasId(getCode());
            one.setDel(1);
        });
        iotProductMeasuredDataDao.save(measuredDataDOList);
        //数据传输方式
        List<IotProductDataTransmissionDO> dataTransmissionDOOldList = iotProductDataTransmissionDao.findByProductId(productId);
        iotProductDataTransmissionDao.delete(dataTransmissionDOOldList);
        dataTransmissionDOList.forEach(one->{
            one.setDel(1);
            one.setSaasId(getCode());
            one.setProductId(productId);
        });
        iotProductDataTransmissionDao.save(dataTransmissionDOList);
    }
    /**
     * 新增产品
     * @param iotProductVO
     */
    public void addProduct(IotProductVO iotProductVO){
        IotProductBaseInfoVO baseInfoVO = iotProductVO.getIotProductBaseInfo();
        IotProductExtendInfoVO extendInfoVO = iotProductVO.getIotProductExtendInfo();
        List<IotProductAttachmentVO> attachmentVOList = extendInfoVO.getAttachmentVOList();
        List<IotProductMeasuredDataVO> measuredDataVOList = iotProductVO.getMeasuredDataVOList();
        List<IotProductDataTransmissionVO> dataTransmissionVOList = baseInfoVO.getDataTransmissionVOList();
        //数据转换
        IotProductBaseInfoDO baseInfoDO = convertToModel(baseInfoVO,IotProductBaseInfoDO.class);
        IotProductExtendInfoDO extendInfoDO = convertToModel(extendInfoVO,IotProductExtendInfoDO.class);
        List<IotProductAttachmentDO> attachmentDOList =
                convertToModels(attachmentVOList,new ArrayList<>(attachmentVOList.size()),IotProductAttachmentDO.class);
        List<IotProductMeasuredDataDO> measuredDataDOList =
                convertToModels(measuredDataVOList,new ArrayList<>(measuredDataVOList.size()),IotProductMeasuredDataDO.class);
        List<IotProductDataTransmissionDO> dataTransmissionDOList =
                convertToModels(dataTransmissionVOList,new ArrayList<>(dataTransmissionVOList.size()),IotProductDataTransmissionDO.class);
        baseInfoDO.setDel(1);
        baseInfoDO.setSaasId(getCode());
        iotProductBaseInfoDao.save(baseInfoDO);
        String productId = baseInfoDO.getId();
        extendInfoDO.setSaasId(getCode());
        extendInfoDO.setDel(1);
        extendInfoDO.setProductId(productId);
        iotProductExtendInfoDao.save(extendInfoDO);
        String extendId = extendInfoDO.getId();
        attachmentDOList.forEach(one->{
            one.setProductId(productId);
            one.setSaasId(getCode());
            one.setDel(1);
            one.setProductExtendId(extendId);
        });
        iotProductAttachmentDao.save(attachmentDOList);
        measuredDataDOList.forEach(one->{
            one.setProductId(productId);
            one.setSaasId(getCode());
            one.setDel(1);
        });
        iotProductMeasuredDataDao.save(measuredDataDOList);
        dataTransmissionDOList.forEach(one->{
            one.setDel(1);
            one.setSaasId(getCode());
            one.setProductId(productId);
        });
        iotProductDataTransmissionDao.save(dataTransmissionDOList);
    }
}

+ 1 - 1
svr/svr-manage/pom.xml

@ -30,7 +30,7 @@
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>

+ 1 - 1
svr/svr-wlyy/pom.xml

@ -36,7 +36,7 @@
            <artifactId>common-rest-model</artifactId>
        </dependency>
        <dependency>
            <groupId>com.yihu.base</groupId>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-util</artifactId>
        </dependency>
        <dependency>