Browse Source

Merge branch 'dev' of yeshijie/jw2.0 into dev

yeshijie 7 years ago
parent
commit
53336d8b87
29 changed files with 549 additions and 73 deletions
  1. 1 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/constant/ServiceApi.java
  2. 1 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/company/IotCompanyController.java
  3. 48 8
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/controller/product/IotProductController.java
  4. 152 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/model/ehr/MRsMetadata.java
  5. 2 1
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/company/CompanyService.java
  6. 59 0
      app/app-iot-server/src/main/java/com/yihu/ehr/iot/service/product/ProductService.java
  7. 6 8
      common/common-entity/src/main/java/com/yihu/jw/iot/device/LocationDataDO.java
  8. 1 1
      common/common-entity/src/main/java/com/yihu/jw/iot/product/IotProductBaseInfoDO.java
  9. 4 2
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/iot/IotRequestMapping.java
  10. 1 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/Envelop.java
  11. 8 9
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyCertificateVO.java
  12. 8 9
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/company/IotCompanyVO.java
  13. 3 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotDeviceOrderVO.java
  14. 3 4
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/device/IotOrderPurchaseVO.java
  15. 36 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotMaintenanceUnitVO.java
  16. 38 9
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/iot/product/IotProductBaseInfoVO.java
  17. 21 4
      svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java
  18. 2 2
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotPatientDeviceController.java
  19. 38 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java
  20. 18 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java
  21. 24 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java
  22. 2 1
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java
  23. 3 2
      svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java
  24. 14 4
      svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java
  25. 34 0
      svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java
  26. 9 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/product/IotProductController.java
  27. 8 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/product/IotProductFallbackFactory.java
  28. 1 1
      web-gateway/src/main/java/com/yihu/jw/feign/iot/company/IotCompanyFeign.java
  29. 4 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/product/IotProductFeign.java

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

@ -46,6 +46,7 @@ public class ServiceApi {
        public static final String FindProductPageByCompanyId = Base +"findProductPageByCompanyId";
        public static final String AddProduct = Base +"addProduct";
        public static final String FindProductById = Base +"findProductById";
        public static final String MaintenanceUnitById = Base +"maintenanceUnitById";
        public static final String UpdProduct= Base +"updProduct";
        public static final String DelProduct= Base + "delProduct";

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

@ -103,7 +103,7 @@ public class IotCompanyController extends BaseController {
        }
    }
    @PostMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    @ApiOperation(value = "分页获取企业证书", notes = "分页获取企业证书")
    public Envelop<IotCompanyCertificateVO> findCompanyCertPage
            (@ApiParam(name = "name", value = "证书名称", defaultValue = "")

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

@ -1,8 +1,10 @@
package com.yihu.ehr.iot.controller.product;
import com.yihu.ehr.iot.controller.common.BaseController;
import com.yihu.ehr.iot.model.ehr.MRsMetadata;
import com.yihu.ehr.iot.service.product.ProductService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -23,17 +25,42 @@ public class IotProductController extends BaseController {
    @Autowired
    private ProductService productService;
    @GetMapping(value = IotRequestMapping.Product.metadata)
    @ApiOperation(value = "测量数据", notes = "测量数据")
    public Envelop<MRsMetadata> metadata(@ApiParam(name = "name", value = "名称", defaultValue = "")
                                         @RequestParam(value = "name", required = false) String name,
                                         @ApiParam(name = "type", value = "类型", defaultValue = "")
                                         @RequestParam(value = "type", required = false) String type,
                                         @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                         @RequestParam(value = "page", required = false) Integer page,
                                         @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                         @RequestParam(value = "size", required = false) Integer size){
        try {
            if(page == null|| page < 0){
                page = 1;
            }
            if(size == null){
                size = 10;
            }
            return productService.metadata(page, size, type, name);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @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){
    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;
@ -97,6 +124,19 @@ public class IotProductController extends BaseController {
        }
    }
    @GetMapping(value = IotRequestMapping.Product.maintenanceUnitById)
    @ApiOperation(value = "根据id查找产品", notes = "根据id查找产品")
    public Envelop<IotMaintenanceUnitVO> maintenanceUnitById(@ApiParam(name = "productId", value = "productId")
                                            @RequestParam(value = "productId", required = true) String productId) {
        try {
            return productService.maintenanceUnitById(productId);
        } catch (Exception e) {
            e.printStackTrace();
            return Envelop.getError(e.getMessage());
        }
    }
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public Envelop<IotProductVO> delCompany(@ApiParam(name = "id", value = "id")

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

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

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

@ -61,7 +61,7 @@ public class CompanyService extends BaseService {
        IotCompanyVO iotCompany = toModel(jsonData, IotCompanyVO.class);
        envelop = userVerification(iotCompany,envelop);
        if(envelop.getStatus()==-1){
        if(envelop.getStatus()!=null&&envelop.getStatus()==-1){
            return envelop;
        }
        //验证账户
@ -173,6 +173,7 @@ public class CompanyService extends BaseService {
        userModel.setIdCardNo(iotCompany.getContactsIdcard());
        userModel.setLoginCode(iotCompany.getAccount());
        userModel.setTelephone(iotCompany.getContactsMobile());
        userModel.setRealName(iotCompany.getContactsName());
        userModel.setRole(roleId);
        Envelop envelop  = new Envelop();
        Map<String, Object> params = new HashMap<>();

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

@ -1,14 +1,19 @@
package com.yihu.ehr.iot.service.product;
import com.yihu.ehr.constants.ErrorCode;
import com.yihu.ehr.iot.constant.ServiceApi;
import com.yihu.ehr.iot.model.ObjectResult;
import com.yihu.ehr.iot.model.ehr.MRsMetadata;
import com.yihu.ehr.iot.service.common.BaseService;
import com.yihu.ehr.iot.util.http.HttpHelper;
import com.yihu.ehr.iot.util.http.HttpResponse;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.ApiOperation;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.PostMapping;
@ -22,6 +27,46 @@ import java.util.Map;
@Service
public class ProductService extends BaseService {
//    @Value("ehr.metadata.domain")
    private String metadataDomain;
    /**
     * 测量数据(ehr资源标准-数据元)
     * @return
     */
    public Envelop<MRsMetadata> metadata(Integer page, Integer size, String type, String name){
        String url = "/resources/metadata";
        Envelop<MRsMetadata> envelop = new Envelop<MRsMetadata>();
        Map<String, Object> params = new HashMap<>();
        String filters = "valid=1;domain="+metadataDomain+";";
        if(StringUtils.isNotBlank(name)){
            filters+="name?"+name+";";
        }
        if(StringUtils.isNotBlank(type)){
            filters+="columnType?"+type+";";
        }
        params.put("filters", filters);
        params.put("page", page);
        params.put("size", size);
        try {
            HttpResponse response = HttpHelper.get(profileInnerUrl + url, params);
            ObjectResult result =  objectMapper.readValue(response.getBody(),ObjectResult.class);
            if(result.isSuccessFlg()){
                envelop = objectMapper.readValue(response.getBody(),Envelop.class);
                envelop.setStatus(200);
            }else {
                envelop.setStatus(-1);
                envelop.setErrorMsg(result.getErrorMsg());
            }
            return envelop;
        } catch (Exception e) {
            e.printStackTrace();
            envelop.setStatus(-1);
            envelop.setErrorMsg(ErrorCode.SystemError.toString());
            return envelop;
        }
    }
    /**
     * 分页查找产品
@ -90,6 +135,20 @@ public class ProductService extends BaseService {
        return envelop;
    }
    /**
     * 根据产品id查找维护单位
     * @param productId
     * @return
     * @throws IOException
     */
    public Envelop<IotMaintenanceUnitVO> maintenanceUnitById(String productId) throws IOException {
        Map<String, Object> params = new HashMap<>();
        params.put("productId", productId);
        HttpResponse response = HttpHelper.get(iotUrl + ServiceApi.Product.MaintenanceUnitById, params);
        Envelop<IotMaintenanceUnitVO> envelop = objectMapper.readValue(response.getBody(),Envelop.class);
        return envelop;
    }
    /**
     * 删除产品
     * @param id

+ 6 - 8
common/common-entity/src/main/java/com/yihu/jw/iot/device/LocationDataDO.java

@ -6,8 +6,6 @@ import io.searchbox.annotations.JestId;
import org.springframework.data.elasticsearch.annotations.GeoPointField;
import org.springframework.data.elasticsearch.core.geo.GeoPoint;
import java.util.Date;
/**
 * Created by chenweida on 2018/2/12.
@ -29,11 +27,11 @@ public class LocationDataDO {
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssXX")
    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXX")
    private Date deviceTime;//设备绑定时间
    private String deviceTime;//设备绑定时间
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ssXX")
    @JSONField(format = "yyyy-MM-dd'T'HH:mm:ssXX")
    private Date createTime;  // 创建时间(ES:必填)
    private String createTime;  // 创建时间(ES:必填)
    public String getId() {
        return id;
@ -75,19 +73,19 @@ public class LocationDataDO {
        this.location = location;
    }
    public Date getDeviceTime() {
    public String getDeviceTime() {
        return deviceTime;
    }
    public void setDeviceTime(Date deviceTime) {
    public void setDeviceTime(String deviceTime) {
        this.deviceTime = deviceTime;
    }
    public Date getCreateTime() {
    public String getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

+ 1 - 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;//产品分类(1自由产品,2代理产品)
    private String productClassify;//产品分类(1自有产品,2代理产品)
    @Column(name = "supplier_name")
    private String supplierName;//厂商名称
    @Column(name = "supplier_id")

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

@ -94,11 +94,13 @@ public class IotRequestMapping {
     */
    public static class Product {
        public static final String findProductPage = "findProductPage";
        public static final String metadata = "metadata";
        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 updProduct = "updProduct";
        public static final String delProduct = "delProduct";
        public static final String maintenanceUnitById = "maintenanceUnitById";
    }

+ 1 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/common/Envelop.java

@ -101,6 +101,7 @@ public class Envelop<T> extends BaseEnvelop implements Serializable {
    public static Envelop getSuccess(String message) {
        Envelop envelop = new Envelop();
        envelop.setSuccessMsg(message);
        envelop.setStatus(200);
        return envelop;
    }

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

@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 企业证书表
@ -32,11 +31,11 @@ public class IotCompanyCertificateVO extends BaseVO implements Serializable {
    @ApiModelProperty("发起企业营业执照号")
    private String companyBusinessLicense;
    @ApiModelProperty("有效期开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private String startTime;
    @ApiModelProperty("有效结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private String endTime;
    @ApiModelProperty("授权书扫描件")
    private String certificateOfAuthorizationImg;
@ -96,19 +95,19 @@ public class IotCompanyCertificateVO extends BaseVO implements Serializable {
        this.companyBusinessLicense = companyBusinessLicense;
    }
    public Date getStartTime() {
    public String getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
    public String getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }

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

@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -27,11 +26,11 @@ public class IotCompanyVO extends BaseVO implements Serializable {
    @ApiModelProperty("统一社会信用代码/营业执照")
    private String businessLicense;
    @ApiModelProperty("营业开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date businessStartTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private String businessStartTime;
    @ApiModelProperty("营业结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date businessEndTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private String businessEndTime;
    @ApiModelProperty("机构地址")
    private String organizationAddress;
    @ApiModelProperty("办公电话")
@ -93,19 +92,19 @@ public class IotCompanyVO extends BaseVO implements Serializable {
        this.businessLicense = businessLicense;
    }
    public Date getBusinessStartTime() {
    public String getBusinessStartTime() {
        return businessStartTime;
    }
    public void setBusinessStartTime(Date businessStartTime) {
    public void setBusinessStartTime(String businessStartTime) {
        this.businessStartTime = businessStartTime;
    }
    public Date getBusinessEndTime() {
    public String getBusinessEndTime() {
        return businessEndTime;
    }
    public void setBusinessEndTime(Date businessEndTime) {
    public void setBusinessEndTime(String businessEndTime) {
        this.businessEndTime = businessEndTime;
    }

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

@ -8,7 +8,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -25,7 +24,7 @@ public class IotDeviceOrderVO extends BaseVO implements Serializable{
    private String orderStatus;
    @ApiModelProperty("采购时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date purchaseTime;
    private String purchaseTime;
    @ApiModelProperty("订单合同名称")
    private String orderContractName;
    @ApiModelProperty("订单合同链接")
@ -68,11 +67,11 @@ public class IotDeviceOrderVO extends BaseVO implements Serializable{
        this.orderStatus = orderStatus;
    }
    public Date getPurchaseTime() {
    public String getPurchaseTime() {
        return purchaseTime;
    }
    public void setPurchaseTime(Date purchaseTime) {
    public void setPurchaseTime(String purchaseTime) {
        this.purchaseTime = purchaseTime;
    }

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

@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
/**
 * 采购清单表
@ -37,7 +36,7 @@ public class IotOrderPurchaseVO extends BaseVO implements Serializable{
    private Long purchaseNum;
    @ApiModelProperty("下次质检时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date nextQualityTime;
    private String nextQualityTime;
    @ApiModelProperty("质检状态")
    private String qualityStatus;
    @ApiModelProperty("维护单位Id")
@ -113,11 +112,11 @@ public class IotOrderPurchaseVO extends BaseVO implements Serializable{
        this.purchaseNum = purchaseNum;
    }
    public Date getNextQualityTime() {
    public String getNextQualityTime() {
        return nextQualityTime;
    }
    public void setNextQualityTime(Date nextQualityTime) {
    public void setNextQualityTime(String nextQualityTime) {
        this.nextQualityTime = nextQualityTime;
    }

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

@ -0,0 +1,36 @@
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;
/**
 * @author yeshijie on 2018/2/27.
 */
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@ApiModel(description = "系统字典表")
public class IotMaintenanceUnitVO implements Serializable{
    @ApiModelProperty("维护单位Id")
    private String maintenanceUnitId;
    @ApiModelProperty("维护单位名称")
    private String maintenanceUnitName;
    public String getMaintenanceUnitId() {
        return maintenanceUnitId;
    }
    public void setMaintenanceUnitId(String maintenanceUnitId) {
        this.maintenanceUnitId = maintenanceUnitId;
    }
    public String getMaintenanceUnitName() {
        return maintenanceUnitName;
    }
    public void setMaintenanceUnitName(String maintenanceUnitName) {
        this.maintenanceUnitName = maintenanceUnitName;
    }
}

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

@ -7,7 +7,6 @@ import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
@ -32,20 +31,26 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    private String agentId;
    @ApiModelProperty("产品类型")
    private String type;
    @ApiModelProperty("产品类型名称")
    private String typeName;
    @ApiModelProperty("产品小类")
    private String productSubclass;
    @ApiModelProperty("产品小类名称")
    private String productSubclassName;
    @ApiModelProperty("68分类/器械分类")
    private String instrumentClassify;
    @ApiModelProperty("68分类/器械分类名称")
    private String instrumentClassifyName;
    @ApiModelProperty("注册证号")
    private String registerCertificate;
    @ApiModelProperty("注册证扫描件")
    private String registerCertificateImg;
    @ApiModelProperty("有效期开始时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date startTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private String startTime;
    @ApiModelProperty("有效期结束时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+08:00")
    private Date endTime;
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+08:00")
    private String endTime;
    @ApiModelProperty("产品名称")
    private String name;
    @ApiModelProperty("别名")
@ -153,19 +158,19 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
        this.registerCertificateImg = registerCertificateImg;
    }
    public Date getStartTime() {
    public String getStartTime() {
        return startTime;
    }
    public void setStartTime(Date startTime) {
    public void setStartTime(String startTime) {
        this.startTime = startTime;
    }
    public Date getEndTime() {
    public String getEndTime() {
        return endTime;
    }
    public void setEndTime(Date endTime) {
    public void setEndTime(String endTime) {
        this.endTime = endTime;
    }
@ -240,4 +245,28 @@ public class IotProductBaseInfoVO extends BaseVO implements Serializable {
    public void setDataTransmissionVOList(List<IotProductDataTransmissionVO> dataTransmissionVOList) {
        this.dataTransmissionVOList = dataTransmissionVOList;
    }
    public String getTypeName() {
        return typeName;
    }
    public void setTypeName(String typeName) {
        this.typeName = typeName;
    }
    public String getProductSubclassName() {
        return productSubclassName;
    }
    public void setProductSubclassName(String productSubclassName) {
        this.productSubclassName = productSubclassName;
    }
    public String getInstrumentClassifyName() {
        return instrumentClassifyName;
    }
    public void setInstrumentClassifyName(String instrumentClassifyName) {
        this.instrumentClassifyName = instrumentClassifyName;
    }
}

+ 21 - 4
svr/svr-iot/src/main/java/com/yihu/iot/controller/company/IotCompanyController.java

@ -9,6 +9,7 @@ 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 com.yihu.jw.util.date.DateUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -68,7 +69,8 @@ public class IotCompanyController extends EnvelopRestController {
    public Envelop<IotCompanyVO> addCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                  @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            IotCompanyDO iotCompany = toEntity(jsonData, IotCompanyDO.class);
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            return Envelop.getSuccess(IotRequestMapping.Company.message_success_create, iotCompanyService.create(iotCompany));
        } catch (Exception e) {
            e.printStackTrace();
@ -122,7 +124,8 @@ public class IotCompanyController extends EnvelopRestController {
    public Envelop<IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                  @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            IotCompanyDO iotCompany = toEntity(jsonData, IotCompanyDO.class);
            IotCompanyVO iotCompanyVO = toEntity(jsonData, IotCompanyVO.class);
            IotCompanyDO iotCompany = iotCompanyService.convertToModelDO(iotCompanyVO);
            iotCompanyService.updCompany(iotCompany);
            return Envelop.getSuccess(IotRequestMapping.Company.message_success_find);
        } catch (Exception e) {
@ -161,6 +164,12 @@ public class IotCompanyController extends EnvelopRestController {
        try {
            IotCompanyCertificateDO iotCompanyCertificateDO = iotCompanyCertificateService.findById(id);
            IotCompanyCertificateVO vo = convertToModel(iotCompanyCertificateDO,IotCompanyCertificateVO.class);
            if(iotCompanyCertificateDO.getStartTime()!=null){
                vo.setStartTime(DateUtil.dateToStrLong(iotCompanyCertificateDO.getStartTime()));
            }
            if(iotCompanyCertificateDO.getEndTime()!=null){
                vo.setEndTime(DateUtil.dateToStrLong(iotCompanyCertificateDO.getEndTime()));
            }
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_find, vo);
        } catch (Exception e) {
            e.printStackTrace();
@ -174,7 +183,8 @@ public class IotCompanyController extends EnvelopRestController {
                                                                @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);
            List<IotCompanyCertificateVO> voList = iotCompanyCertificateService.convertToModels(iotCompanyCertificateDOList,new ArrayList<>(iotCompanyCertificateDOList.size()));
            return Envelop.getSuccessList(IotRequestMapping.Common.message_success_find, voList);
        } catch (Exception e) {
            e.printStackTrace();
@ -187,7 +197,14 @@ public class IotCompanyController extends EnvelopRestController {
    public Envelop<IotCompanyCertificateVO> addCompanyCert(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = true)String jsonData) {
        try {
            IotCompanyCertificateDO iotCompanyCertificate = toEntity(jsonData, IotCompanyCertificateDO.class);
            IotCompanyCertificateVO vo = toEntity(jsonData, IotCompanyCertificateVO.class);
            IotCompanyCertificateDO iotCompanyCertificate = convertToModel(vo, IotCompanyCertificateDO.class);
            if(StringUtils.isNotBlank(vo.getStartTime())){
                iotCompanyCertificate.setStartTime(DateUtil.strToDate(vo.getStartTime()));
            }
            if(StringUtils.isNotBlank(vo.getEndTime())){
                iotCompanyCertificate.setEndTime(DateUtil.strToDate(vo.getEndTime()));
            }
            return Envelop.getSuccess(IotRequestMapping.Common.message_success_create, iotCompanyCertificateService.create(iotCompanyCertificate));
        } catch (Exception e) {
            e.printStackTrace();

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

@ -35,10 +35,10 @@ public class IotPatientDeviceController extends EnvelopRestController{
                                       @RequestParam String jsonData) {
        try {
            //设备绑定
            IotPatientDeviceDO patientDevice = toEntity(jsonData, IotPatientDeviceDO.class);
            IotPatientDeviceVO deviceVO = toEntity(jsonData, IotPatientDeviceVO.class);
            IotPatientDeviceDO patientDevice = convertToModel(deviceVO, IotPatientDeviceDO.class);
            iotPatientDeviceService.create(patientDevice);
            //地址信息存入es
            IotPatientDeviceVO deviceVO = toEntity(jsonData, IotPatientDeviceVO.class);
            iotPatientDeviceService.deviceData2Es(deviceVO);
            return Envelop.getSuccess(IotRequestMapping.Device.message_success_create);
        } catch (Exception e) {

+ 38 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/product/IotProductController.java

@ -1,9 +1,11 @@
package com.yihu.iot.controller.product;
import com.yihu.iot.service.dict.IotSystemDictService;
import com.yihu.iot.service.product.IotProductBaseInfoService;
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.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -16,6 +18,7 @@ import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * @author yeshijie on 2018/1/17.
@ -27,6 +30,8 @@ public class IotProductController extends EnvelopRestController {
    @Autowired
    private IotProductBaseInfoService iotProductBaseInfoService;
    @Autowired
    private IotSystemDictService iotSystemDictService;
    @GetMapping(value = IotRequestMapping.Product.findProductPage)
@ -92,7 +97,7 @@ public class IotProductController extends EnvelopRestController {
            if(size == null){
                size = 10;
            }
            String filters = "supplierId = "+companyId+";productClassify=1;del=1";
            String filters = "supplierId="+companyId+";productClassify=1;del=1";
            String semicolon = ";";
            if(StringUtils.isNotBlank(name)){
                filters += semicolon + "name?"+name;
@ -100,11 +105,29 @@ public class IotProductController extends EnvelopRestController {
            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);
            if(iotCompanyVOList.size()>0){
                //字典翻译
                Map<String,String> product68Map = iotSystemDictService.findByDictName("PRODUCT_68_TYPE");
                Map<String,String> originMap = iotSystemDictService.findByDictName("ORIGIN_TYPE");
                Map<String,String> productSmallMap = iotSystemDictService.findByDictName("PRODUCT_SMALL_TYPE");
                iotCompanyVOList.forEach(infoVO->{
                    if(StringUtils.isNotBlank(infoVO.getType())){
                        infoVO.setTypeName(originMap.get(infoVO.getType()));
                    }
                    if(StringUtils.isNotBlank(infoVO.getInstrumentClassify())){
                        infoVO.setInstrumentClassifyName(product68Map.get(infoVO.getInstrumentClassify()));
                    }
                    if(StringUtils.isNotBlank(infoVO.getProductSubclass())){
                        infoVO.setProductSubclassName(productSmallMap.get(infoVO.getType()));
                    }
                });
            }
            return Envelop.getSuccessListWithPage(IotRequestMapping.Company.message_success_find_functions,iotCompanyVOList, page, size,count);
        } catch (Exception e) {
@ -141,6 +164,20 @@ public class IotProductController extends EnvelopRestController {
        }
    }
    @GetMapping(value = IotRequestMapping.Product.maintenanceUnitById)
    @ApiOperation(value = "获取维护单位")
    public Envelop<IotMaintenanceUnitVO> getList(
            @ApiParam(name = "productId", value = "产品", defaultValue = "1")
            @RequestParam(value = "productId", required = true) String productId) throws Exception {
        try {
            List<IotMaintenanceUnitVO> voList = iotProductBaseInfoService.maintenanceUnitById(productId);
            return Envelop.getSuccessList(IotRequestMapping.Company.message_success_find_functions,voList);
        }catch (Exception e){
            e.printStackTrace();
            return Envelop.getError("查询失败");
        }
    }
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public Envelop<IotProductVO> delCompany(@ApiParam(name = "id", value = "id")

+ 18 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyCertificateService.java

@ -6,7 +6,9 @@ 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 com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -66,7 +68,7 @@ public class IotCompanyCertificateService extends BaseJpaService<IotCompanyCerti
        long count = getCount(filters);
        //DO转VO
        List<IotCompanyCertificateVO> iotCompanyCertificateVOList = convertToModels(list,new ArrayList<>(list.size()),IotCompanyCertificateVO.class);
        List<IotCompanyCertificateVO> iotCompanyCertificateVOList = convertToModels(list,new ArrayList<>(list.size()));
        return Envelop.getSuccessListWithPage(IotRequestMapping.Common.message_success_find_functions,iotCompanyCertificateVOList, page, size,count);
    }
@ -85,4 +87,19 @@ public class IotCompanyCertificateService extends BaseJpaService<IotCompanyCerti
        return iotCompanyCertificateDO;
    }
    public List<IotCompanyCertificateVO> convertToModels(List<IotCompanyCertificateDO> iotCompanyCertificateDOList,List<IotCompanyCertificateVO> voList){
        iotCompanyCertificateDOList.forEach(one -> {
            IotCompanyCertificateVO target = new IotCompanyCertificateVO();
            BeanUtils.copyProperties(one, target);
            if(one.getStartTime()!=null){
                target.setStartTime(DateUtil.dateToStrLong(one.getStartTime()));
            }
            if(one.getEndTime()!=null){
                target.setEndTime(DateUtil.dateToStrLong(one.getEndTime()));
            }
            voList.add(target);
        });
        return voList;
    }
}

+ 24 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/company/IotCompanyService.java

@ -11,6 +11,7 @@ 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 com.yihu.jw.util.date.DateUtil;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -100,7 +101,29 @@ public class IotCompanyService extends BaseJpaService<IotCompanyDO,IotCompanyDao
    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.setBusinessEndTime(DateUtil.dateToStrShort(iotCompanyDO.getBusinessEndTime()));
        target.setBusinessStartTime(DateUtil.dateToStrShort(iotCompanyDO.getBusinessStartTime()));
        if(target.getTypeList()!=null){
            List<IotCompanyTypeVO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeVO.class);
            target.setTypeList(voList);
        }
        return target;
    }
    /**
     * 单个转换
     * @return
     */
    public IotCompanyDO convertToModelDO(IotCompanyVO iotCompanyVO){
        IotCompanyDO target = new IotCompanyDO();
        BeanUtils.copyProperties(iotCompanyVO, target);
        if(StringUtils.isNotBlank(iotCompanyVO.getBusinessEndTime())){
            target.setBusinessEndTime(DateUtil.strToDate(iotCompanyVO.getBusinessEndTime()));
        }
        if(StringUtils.isNotBlank(iotCompanyVO.getBusinessStartTime())){
            target.setBusinessStartTime(DateUtil.strToDate(iotCompanyVO.getBusinessStartTime()));
        }
        List<IotCompanyTypeDO> voList = convertToModels(target.getTypeList(),new ArrayList<>(target.getTypeList().size()),IotCompanyTypeDO.class);
        target.setTypeList(voList);
        return target;
    }

+ 2 - 1
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotDeviceOrderService.java

@ -59,6 +59,7 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
        List<IotOrderPurchaseVO> iotOrderPurchaseVOList = iotOrderVO.getPurchaseVOList();
        IotDeviceOrderDO iotDeviceOrderDO = convertToModel(iotDeviceOrderVO,IotDeviceOrderDO.class);
        iotDeviceOrderDO.setPurchaseTime(DateUtil.strToDate(iotDeviceOrderVO.getPurchaseTime()));
        List<IotOrderPurchaseDO> orderPurchaseDOList =
                convertToModels(iotOrderPurchaseVOList,new ArrayList<>(iotOrderPurchaseVOList.size()),IotOrderPurchaseDO.class);
@ -263,7 +264,7 @@ public class IotDeviceOrderService extends BaseJpaService<IotDeviceOrderDO,IotDe
            IotDeviceQualityInspectionPlanDO planDO = iotDeviceQualityInspectionPlanDao.findLastByPurchaseId(purchase.getId());
            if(planDO!=null){
                purchase.setQualityStatus(planDO.getStatus());//质检状态
                purchase.setNextQualityTime(planDO.getPlanTime());//下次质检时间
                purchase.setNextQualityTime(DateUtil.dateToStrLong(planDO.getPlanTime()));//下次质检时间
            }
        });

+ 3 - 2
svr/svr-iot/src/main/java/com/yihu/iot/service/device/IotPatientDeviceService.java

@ -9,6 +9,7 @@ import com.yihu.jw.iot.device.IotPatientDeviceDO;
import com.yihu.jw.iot.device.LocationDataDO;
import com.yihu.jw.restmodel.iot.device.IotPatientDeviceVO;
import com.yihu.jw.util.common.LatitudeUtils;
import com.yihu.jw.util.date.DateUtil;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -55,8 +56,8 @@ public class IotPatientDeviceService extends BaseJpaService<IotPatientDeviceDO,I
            }
//            List<LocationDataDO> dataDTOs = new ArrayList<>();
            LocationDataDO dataDTO = new LocationDataDO();
            dataDTO.setCreateTime(new Date());
            dataDTO.setDeviceTime(new Date());
            dataDTO.setCreateTime(DateUtil.dateToStrLong(new Date()));
            dataDTO.setDeviceTime(dataDTO.getCreateTime());
            dataDTO.setCategoryCode(deviceVO.getCategoryCode());
            dataDTO.setDeviceSn(deviceVO.getDeviceSn());
            dataDTO.setIdCard(deviceVO.getIdcard());

+ 14 - 4
svr/svr-iot/src/main/java/com/yihu/iot/service/dict/IotSystemDictService.java

@ -1,5 +1,6 @@
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;
@ -7,6 +8,10 @@ import com.yihu.jw.iot.dict.IotSystemDictDO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
 * @author yeshijie on 2018/1/16.
 */
@ -23,10 +28,15 @@ 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 Map<String,String> findByDictName(String dictName){
        String sql = "SELECT code,value from iot_system_dict WHERE dict_name = ? and del = 1 ORDER BY sort";
        Map<String,String> map = new HashMap<>();
        List<JSONObject> list = myJdbcTemplate.queryJson(sql,new Object[]{dictName});
        list.forEach(json->{
            map.put(json.get("code").toString(),json.getString("value"));
        });
        return map;
    }

+ 34 - 0
svr/svr-iot/src/main/java/com/yihu/iot/service/product/IotProductBaseInfoService.java

@ -4,6 +4,7 @@ import com.yihu.base.mysql.query.BaseJpaService;
import com.yihu.iot.dao.product.*;
import com.yihu.jw.iot.product.*;
import com.yihu.jw.restmodel.iot.product.*;
import com.yihu.jw.util.date.DateUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -44,6 +45,10 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        //数据转换
        IotProductBaseInfoVO baseInfoVO = convertToModel(baseInfoDO,IotProductBaseInfoVO.class);
        //日期单独处理
        baseInfoVO.setStartTime(DateUtil.dateToStrShort(baseInfoDO.getStartTime()));
        baseInfoVO.setEndTime(DateUtil.dateToStrShort(baseInfoDO.getEndTime()));
        IotProductExtendInfoVO extendInfoVO = convertToModel(extendInfoDO,IotProductExtendInfoVO.class);
        List<IotProductAttachmentVO> attachmentVOList =
                convertToModels(attachmentDOList,new ArrayList<>(attachmentDOList.size()),IotProductAttachmentVO.class);
@ -61,6 +66,28 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        return iotProductVO;
    }
    /**
     * 根据产品id查找维护单位
     * @param id
     */
    public List<IotMaintenanceUnitVO> maintenanceUnitById(String id){
        List<IotMaintenanceUnitVO> voList = new ArrayList<IotMaintenanceUnitVO>();
        IotProductBaseInfoDO baseInfoDO = iotProductBaseInfoDao.findById(id);
        //厂商
        IotMaintenanceUnitVO vo1 = new IotMaintenanceUnitVO();
        vo1.setMaintenanceUnitId(baseInfoDO.getSupplierId());
        vo1.setMaintenanceUnitName(baseInfoDO.getSupplierName());
        voList.add(vo1);
        if("2".equals(baseInfoDO.getProductClassify())){
            //代理产品
            IotMaintenanceUnitVO vo2 = new IotMaintenanceUnitVO();
            vo2.setMaintenanceUnitId(baseInfoDO.getAgentId());
            vo2.setMaintenanceUnitName(baseInfoDO.getAgentName());
            voList.add(vo2);
        }
        return voList;
    }
    /**
     * 删除产品
     * @param id
@ -89,6 +116,10 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        //数据转换
        IotProductBaseInfoDO baseInfoDO = convertToModel(baseInfoVO,IotProductBaseInfoDO.class);
        //日期单独处理
        baseInfoDO.setStartTime(DateUtil.strToDate(baseInfoVO.getStartTime()));
        baseInfoDO.setEndTime(DateUtil.strToDate(baseInfoVO.getEndTime()));
        IotProductExtendInfoDO extendInfoDO = convertToModel(extendInfoVO,IotProductExtendInfoDO.class);
        List<IotProductAttachmentDO> attachmentDOList =
                convertToModels(attachmentVOList,new ArrayList<>(attachmentVOList.size()),IotProductAttachmentDO.class);
@ -153,6 +184,9 @@ public class IotProductBaseInfoService extends BaseJpaService<IotProductBaseInfo
        //数据转换
        IotProductBaseInfoDO baseInfoDO = convertToModel(baseInfoVO,IotProductBaseInfoDO.class);
        //日期单独处理
        baseInfoDO.setStartTime(DateUtil.strToDate(baseInfoVO.getStartTime()));
        baseInfoDO.setEndTime(DateUtil.strToDate(baseInfoVO.getEndTime()));
        IotProductExtendInfoDO extendInfoDO = convertToModel(extendInfoVO,IotProductExtendInfoDO.class);
        List<IotProductAttachmentDO> attachmentDOList =
                convertToModels(attachmentVOList,new ArrayList<>(attachmentVOList.size()),IotProductAttachmentDO.class);

+ 9 - 0
web-gateway/src/main/java/com/yihu/jw/controller/iot/product/IotProductController.java

@ -4,6 +4,7 @@ import com.yihu.jw.commnon.iot.IotCommonContants;
import com.yihu.jw.feign.iot.product.IotProductFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -66,6 +67,14 @@ public class IotProductController extends EnvelopRestController {
        return iotProductFeign.findByCode(id);
    }
    @GetMapping(value = IotRequestMapping.Product.maintenanceUnitById)
    @ApiOperation(value = "获取维护单位")
    public Envelop<IotMaintenanceUnitVO> getList(
            @ApiParam(name = "productId", value = "产品", defaultValue = "1")
            @RequestParam(value = "productId", required = true) String productId) throws Exception {
        return iotProductFeign.getList(productId);
    }
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public Envelop<IotProductVO> delCompany(@ApiParam(name = "id", value = "id")

+ 8 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/product/IotProductFallbackFactory.java

@ -2,6 +2,7 @@ package com.yihu.jw.feign.fallbackfactory.iot.product;
import com.yihu.jw.feign.iot.product.IotProductFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import feign.hystrix.FallbackFactory;
@ -66,6 +67,13 @@ public class IotProductFallbackFactory implements FallbackFactory<IotProductFeig
                return null;
            }
            @Override
            public Envelop<IotMaintenanceUnitVO> getList(@RequestParam(value = "productId", required = true) String productId){
                tracer.getCurrentSpan().logEvent("获取维护单位失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("productId:" + productId);
                return null;
            }
            @Override
            public Envelop<IotProductVO> delCompany(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("删除产品失败:原因:" + e.getMessage());

+ 1 - 1
web-gateway/src/main/java/com/yihu/jw/feign/iot/company/IotCompanyFeign.java

@ -46,7 +46,7 @@ public interface IotCompanyFeign {
    @PostMapping(value = IotRequestMapping.Company.updCompany)
    public Envelop<IotCompanyVO> updCompany(@RequestParam(value = "jsonData", required = true)String jsonData);
    @PostMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    public Envelop<IotCompanyCertificateVO> findCompanyCertPage
            (@RequestParam(value = "name", required = false) String name,
             @RequestParam(value = "page", required = false) Integer page,

+ 4 - 0
web-gateway/src/main/java/com/yihu/jw/feign/iot/product/IotProductFeign.java

@ -3,6 +3,7 @@ package com.yihu.jw.feign.iot.product;
import com.yihu.jw.feign.fallbackfactory.iot.product.IotProductFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.product.IotMaintenanceUnitVO;
import com.yihu.jw.restmodel.iot.product.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
@ -43,6 +44,9 @@ public interface IotProductFeign{
    @GetMapping(value = IotRequestMapping.Product.findProductById)
    public Envelop<IotProductVO> findByCode(@RequestParam(value = "id", required = true) String id);
    @GetMapping(value = IotRequestMapping.Product.maintenanceUnitById)
    public Envelop<IotMaintenanceUnitVO> getList(@RequestParam(value = "productId", required = true) String productId);
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    public Envelop<IotProductVO> delCompany(@RequestParam(value = "id", required = true) String id);