瀏覽代碼

物联网相关

yeshijie 7 年之前
父節點
當前提交
05ff4c48f2
共有 23 個文件被更改,包括 1296 次插入23 次删除
  1. 1 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/CommonContants.java
  2. 1 1
      svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java
  3. 2 1
      web-gateway/src/main/java/com/yihu/jw/aspect/LogAspect.java
  4. 23 0
      web-gateway/src/main/java/com/yihu/jw/commnon/iot/IotCommonContants.java
  5. 0 20
      web-gateway/src/main/java/com/yihu/jw/commnon/iot/SupplierContants.java
  6. 67 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/common/FileUploadController.java
  7. 41 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/common/IotSystemDictController.java
  8. 139 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/company/IotCompanyController.java
  9. 98 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotDeviceController.java
  10. 81 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotDeviceOrderController.java
  11. 83 0
      web-gateway/src/main/java/com/yihu/jw/controller/iot/product/IotProductController.java
  12. 54 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/common/IotFileUploadFallbackFactory.java
  13. 35 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/common/IotSystemDictFallbackFactory.java
  14. 114 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/company/IotCompanyFallbackFactory.java
  15. 100 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/device/IotDeviceFallbackFactory.java
  16. 84 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/device/IotDeviceOrderFallbackFactory.java
  17. 86 0
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/product/IotProductFallbackFactory.java
  18. 38 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/common/IotFileUploadFeign.java
  19. 27 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/common/IotSystemDictFeign.java
  20. 64 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/company/IotCompanyFeign.java
  21. 57 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/device/IotDeviceFeign.java
  22. 49 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/device/IotDeviceOrderFeign.java
  23. 52 0
      web-gateway/src/main/java/com/yihu/jw/feign/iot/product/IotProductFeign.java

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

@ -7,7 +7,7 @@ public class CommonContants {
    //微服务的id start
    public static final String svr_base = "svr-base";
    public static final String svr_iot = "svr-iot";
    public static final String svr_iot = "svr-iot-ysj";
    public static final String svr_wlyy = "svr-wlyy";
    public static final String svr_gateway = "svr-gateway";

+ 1 - 1
svr/svr-iot/src/main/java/com/yihu/iot/controller/device/IotDeviceController.java

@ -223,7 +223,7 @@ public class IotDeviceController extends EnvelopRestController{
    @GetMapping(value = IotRequestMapping.Device.queryImportRecordPage)
    @ApiOperation(value = "分页查找导入记录", notes = "分页查找导入记录")
    public Envelop<IotDeviceImportRecordVO> findProductPageByCompanyId(@ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
    public Envelop<IotDeviceImportRecordVO> queryImportRecordPage(@ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                                           @RequestParam(value = "purcharseId", required = true) String purcharseId,
                                                                       @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                           @RequestParam(value = "page", required = false) Integer page,

+ 2 - 1
web-gateway/src/main/java/com/yihu/jw/aspect/LogAspect.java

@ -38,7 +38,8 @@ public class LogAspect {
            tracer.getCurrentSpan().tag(GatewayContanrts.ZipkinElasticKey.gateway_input_params,new JSONObject(request.getParameterMap()).toString());
            o = point.proceed();
            //访问后日志
            tracer.getCurrentSpan().tag(GatewayContanrts.ZipkinElasticKey.gateway_out_params,new JSONObject(o).toString());
            String after = o==null?null:new JSONObject(o).toString();
            tracer.getCurrentSpan().tag(GatewayContanrts.ZipkinElasticKey.gateway_out_params,after);
        } catch (Exception ex) {
            ex.printStackTrace();
        }

+ 23 - 0
web-gateway/src/main/java/com/yihu/jw/commnon/iot/IotCommonContants.java

@ -0,0 +1,23 @@
package com.yihu.jw.commnon.iot;
/**
 * @author yeshijie on 2018/1/20.
 */
public class IotCommonContants {
    public static final String api_iot_common = "svr-iot";
    public static final Integer api_iot_fail = -1;
    /**
     * 公共模块
     */
    public static class Common{
        public static final String company = api_iot_common + "/wg/company";
        public static final String system_dict = api_iot_common + "/wg/systemDict";
        public static final String file_upload = api_iot_common + "/wg/fileUpload";
        public static final String product = api_iot_common + "/wg/product";
        public static final String order = api_iot_common + "/wg/order";
        public static final String device = api_iot_common + "/wg/device";
    }
}

+ 0 - 20
web-gateway/src/main/java/com/yihu/jw/commnon/iot/SupplierContants.java

@ -1,20 +0,0 @@
package com.yihu.jw.commnon.iot;
/**
 * @author yeshijie on 2017/12/5.
 */
public class SupplierContants {
    public static final String iot = "iot";
    //设备供应商常量
    public static class DeviceSupplier {
        public static final String api_common = iot + "/deviceSupplier";
        public static final String api_create = "create";
        public static final String api_update = "update";
        public static final String api_delete = "delete";
        public static final String api_getByCode = "getByCode";
        public static final String api_queryPage = "queryPage";
        public static final String api_getList = "getList";
    }
}

+ 67 - 0
web-gateway/src/main/java/com/yihu/jw/controller/iot/common/FileUploadController.java

@ -0,0 +1,67 @@
package com.yihu.jw.controller.iot.common;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.iot.IotCommonContants;
import com.yihu.jw.feign.iot.common.IotFileUploadFeign;
import com.yihu.jw.restmodel.common.Envelop;
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.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2017/12/7.
 */
@RestController
@RequestMapping(IotCommonContants.Common.file_upload)
@Api(tags = "文件上传相关操作", description = "文件上传相关操作")
public class FileUploadController {
    @Autowired
    private IotFileUploadFeign iotFileUploadFeign;
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream_img)
    @ApiOperation(value = "文件流上传图片", notes = "文件流上传图片")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<UploadVO> uploadImg(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file){
        return iotFileUploadFeign.uploadImg(file);
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream_attachment)
    @ApiOperation(value = "文件流上传附件", notes = "文件流上传附件")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<UploadVO> uploadAttachment(@ApiParam(value = "文件", required = true)
                                       @RequestParam(value = "file", required = true) MultipartFile file){
        return iotFileUploadFeign.uploadAttachment(file);
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream)
    @ApiOperation(value = "文件流上传文件", notes = "文件流上传文件")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<UploadVO> uploadStream(@ApiParam(value = "文件", required = true) @RequestParam(value = "file", required = true) MultipartFile file) {
        return iotFileUploadFeign.uploadStream(file);
    }
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_string)
    @ApiOperation(value = "base64上传图片",notes = "base64上传图片")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<UploadVO> uploadImages(@ApiParam(name = "jsonData", value = "头像转化后的输入流") @RequestBody String jsonData) throws Exception {
        return iotFileUploadFeign.uploadImages(jsonData);
    }
}

+ 41 - 0
web-gateway/src/main/java/com/yihu/jw/controller/iot/common/IotSystemDictController.java

@ -0,0 +1,41 @@
package com.yihu.jw.controller.iot.common;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.iot.IotCommonContants;
import com.yihu.jw.feign.iot.common.IotSystemDictFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
/**
 * @author yeshijie on 2018/1/16.
 */
@RestController
@RequestMapping(IotCommonContants.Common.system_dict)
@Api(tags = "系统字典相关操作", description = "系统字典相关操作")
public class IotSystemDictController {
    @Autowired
    private IotSystemDictFeign iotSystemDictFeign;
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    @ApiOperation(value = "获取字典列表(不分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotSystemDictVO> getList(
            @ApiParam(name = "dictName", value = "字典名称", defaultValue = "COMPANY_TYPE")
            @RequestParam(value = "dictName", required = true) String dictName) throws Exception {
        return iotSystemDictFeign.getList(dictName);
    }
}

+ 139 - 0
web-gateway/src/main/java/com/yihu/jw/controller/iot/company/IotCompanyController.java

@ -0,0 +1,139 @@
package com.yihu.jw.controller.iot.company;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.iot.IotCommonContants;
import com.yihu.jw.feign.iot.company.IotCompanyFeign;
import com.yihu.jw.restmodel.common.Envelop;
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;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/1/20.
 */
@RestController
@RequestMapping(IotCommonContants.Common.company)
@Api(tags = "企业管理相关操作", description = "企业管理相关操作")
public class IotCompanyController extends EnvelopRestController {
    @Autowired
    private IotCompanyFeign iotCompanyFeign;
    @GetMapping(value = IotRequestMapping.Company.findCompanyPage)
    @ApiOperation(value = "分页查找企业", notes = "分页查找企业")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyVO> findCompanyPage(@ApiParam(name = "name", value = "供应商名称或联系人姓名", defaultValue = "")
                                       @RequestParam(value = "name", required = false) String name,
                                                 @ApiParam(name = "status", value = "审核状态", defaultValue = "")
                                       @RequestParam(value = "status", required = false) String status,
                                                 @ApiParam(name = "type", value = "企业类型", defaultValue = "")
                                       @RequestParam(value = "type", required = false) String type,
                                                 @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                       @RequestParam(value = "page", required = false) Integer page,
                                                 @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                       @RequestParam(value = "size", required = false) Integer size){
        return iotCompanyFeign.findCompanyPage(name,status,type,page,size);
    }
    @PostMapping(value = IotRequestMapping.Company.addCompany)
    @ApiOperation(value = "创建企业", notes = "创建企业")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyVO> addCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                  @RequestParam(value = "jsonData", required = false)String jsonData) {
        return iotCompanyFeign.addCompany(jsonData);
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyById)
    @ApiOperation(value = "根据id查找企业", notes = "根据id查找企业")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyVO> findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id) {
        return iotCompanyFeign.findByCode(id);
    }
    @GetMapping(value = IotRequestMapping.Company.findByBusinessLicense)
    @ApiOperation(value = "根据营业执照号查找企业", notes = "根据营业执照号查找企业")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyVO> findByBusinessLicense(@ApiParam(name = "businessLicense", value = "businessLicense")
                                            @RequestParam(value = "businessLicense", required = true) String businessLicense) {
        return iotCompanyFeign.findByBusinessLicense(businessLicense);
    }
    @PostMapping(value = IotRequestMapping.Company.delCompany)
    @ApiOperation(value = "删除企业", notes = "删除企业")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyVO> delCompany(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id) {
        return iotCompanyFeign.delCompany(id);
    }
    @PostMapping(value = IotRequestMapping.Company.updCompany)
    @ApiOperation(value = "修改企业信息", notes = "修改企业信息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyVO> updCompany(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                  @RequestParam(value = "jsonData", required = false)String jsonData) {
        return iotCompanyFeign.updCompany(jsonData);
    }
    @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){
        return iotCompanyFeign.findCompanyCertPage(name,page,size);
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertById)
    @ApiOperation(value = "根据id查找企业证书", notes = "根据id查找企业证书")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyCertificateVO> findCompanyCertById(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        return iotCompanyFeign.findCompanyCertById(id);
    }
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertByCompanyId)
    @ApiOperation(value = "根据企业id查找企业证书", notes = "根据企业id查找企业证书")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyCertificateVO> findCompanyCertByCompanyId(@ApiParam(name = "companyId", value = "companyId")
                                                                @RequestParam(value = "companyId", required = true) String companyId) {
        return iotCompanyFeign.findCompanyCertByCompanyId(companyId);
    }
    @PostMapping(value = IotRequestMapping.Company.addCompanyCert)
    @ApiOperation(value = "创建企业证书", notes = "创建企业证书")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop<IotCompanyCertificateVO> addCompanyCert(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        return iotCompanyFeign.addCompanyCert(jsonData);
    }
}

+ 98 - 0
web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotDeviceController.java

@ -0,0 +1,98 @@
package com.yihu.jw.controller.iot.device;
import com.yihu.jw.commnon.iot.IotCommonContants;
import com.yihu.jw.feign.iot.device.IotDeviceFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.iot.common.ExistVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2017/12/8.
 */
@RestController
@RequestMapping(IotCommonContants.Common.device)
@Api(tags = "设备管理相关操作", description = "设备管理相关操作")
public class IotDeviceController extends EnvelopRestController{
    @Autowired
    private IotDeviceFeign iotDeviceFeign;
    @PostMapping(value = IotRequestMapping.Device.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建设备", notes = "创建设备")
    public Envelop<IotDeviceVO> create(@ApiParam(name = "json_data", value = "", defaultValue = "")
                          @RequestBody String jsonData) {
        return iotDeviceFeign.create(jsonData);
    }
    @GetMapping(value = IotRequestMapping.Device.api_getById)
    @ApiOperation(value = "根据code查找设备", notes = "根据code查找设备")
    public Envelop<IotDeviceVO> findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id
    ) {
        return iotDeviceFeign.findByCode(id);
    }
    @GetMapping(value = IotRequestMapping.Device.isSnExist)
    @ApiOperation(value = "sn码是否存在", notes = "sn码是否存在")
    public Envelop<ExistVO> isSnExist(@ApiParam(name = "sn", value = "sn")
                                           @RequestParam(value = "sn", required = true) String sn
    ) {
        return iotDeviceFeign.isSnExist(sn);
    }
    @GetMapping(value = IotRequestMapping.Device.isSimExist)
    @ApiOperation(value = "sim卡号是否存在", notes = "sim卡号是否存在")
    public Envelop<ExistVO> isSimExist(@ApiParam(name = "sim", value = "sim")
                                           @RequestParam(value = "sim", required = true) String sim
    ) {
        return iotDeviceFeign.isSimExist(sim);
    }
    @GetMapping(value = IotRequestMapping.Device.api_queryPage)
    @ApiOperation(value = "分页查找设备", notes = "分页查找设备")
    public Envelop<IotDeviceVO> findProductPageByCompanyId(@ApiParam(name = "sn", value = "SN码或SIM卡号", defaultValue = "")
                                                           @RequestParam(value = "sn", required = false) String sn,
                                                           @ApiParam(name = "hospital", value = "社区医院", defaultValue = "")
                                                           @RequestParam(value = "hospital", required = false) String hospital,
                                                           @ApiParam(name = "orderId", value = "订单id", defaultValue = "")
                                                           @RequestParam(value = "orderId", required = false) String orderId,
                                                           @ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                                           @RequestParam(value = "purcharseId", required = true) String purcharseId,
                                                           @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                           @RequestParam(value = "page", required = false) Integer page,
                                                           @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                           @RequestParam(value = "size", required = false) Integer size){
        return iotDeviceFeign.findProductPageByCompanyId(sn,hospital,orderId,purcharseId,page,size);
    }
    @PostMapping(value = IotRequestMapping.Device.importDevice)
    @ApiOperation(value = "设备导入", notes = "设备导入")
    public Envelop<IotDeviceImportRecordVO> uploadStream(@ApiParam(value = "文件", required = true)
                                          @RequestParam(value = "file", required = true) MultipartFile file,
                                          @ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                          @RequestParam(value = "purcharseId", required = true) String purcharseId) {
        return iotDeviceFeign.uploadStream(file,purcharseId);
    }
    @GetMapping(value = IotRequestMapping.Device.queryImportRecordPage)
    @ApiOperation(value = "分页查找导入记录", notes = "分页查找导入记录")
    public Envelop<IotDeviceImportRecordVO> queryImportRecordPage(@ApiParam(name = "purcharseId", value = "采购id", defaultValue = "")
                                                           @RequestParam(value = "purcharseId", required = true) String purcharseId,
                                                                       @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                           @RequestParam(value = "page", required = false) Integer page,
                                                                       @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                           @RequestParam(value = "size", required = false) Integer size){
        return iotDeviceFeign.queryImportRecordPage(purcharseId,page,size);
    }
}

+ 81 - 0
web-gateway/src/main/java/com/yihu/jw/controller/iot/device/IotDeviceOrderController.java

@ -0,0 +1,81 @@
package com.yihu.jw.controller.iot.device;
import com.yihu.jw.commnon.iot.IotCommonContants;
import com.yihu.jw.feign.iot.device.IotDeviceOrderFeign;
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.restmodel.iot.device.IotOrderPurchaseVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2017/12/8.
 */
@RestController
@RequestMapping(IotCommonContants.Common.order)
@Api(tags = "设备订单管理相关操作", description = "设备订单管理相关操作")
public class IotDeviceOrderController extends EnvelopRestController{
    @Autowired
    private IotDeviceOrderFeign iotDeviceOrderFeign;
    @PostMapping(value = IotRequestMapping.DeviceOrder.createOrder, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建设备订单", notes = "创建设备订单")
    public Envelop<IotOrderVO> create(@ApiParam(name = "json_data", value = "", defaultValue = "")
                          @RequestBody String jsonData) {
        return iotDeviceOrderFeign.create(jsonData);
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findById)
    @ApiOperation(value = "根据id查找设备订单", notes = "根据id查找设备订单")
    public Envelop<IotDeviceOrderVO>  findByCode(@ApiParam(name = "id", value = "id")
                              @RequestParam(value = "id", required = true) String id
    ) {
        return iotDeviceOrderFeign.findByCode(id);
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPage)
    @ApiOperation(value = "分页查找设备订单", notes = "分页查找设备订单")
    public Envelop<IotDeviceOrderVO> findPage(@ApiParam(name = "name", value = "供应商名称或负责人姓名", defaultValue = "")
                                                 @RequestParam(value = "name", required = false) String name,
                                                 @ApiParam(name = "type", value = "企业类型", defaultValue = "")
                                                 @RequestParam(value = "type", required = false) String type,
                                                 @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                 @RequestParam(value = "page", required = false) Integer page,
                                                 @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                 @RequestParam(value = "size", required = false) Integer size){
        return iotDeviceOrderFeign.findPage(name,type,page,size);
    }
    @PostMapping(value = IotRequestMapping.DeviceOrder.delOrder)
    @ApiOperation(value = "删除订单", notes = "删除订单")
    public Envelop<IotDeviceOrderVO> delOrder(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        return iotDeviceOrderFeign.delOrder(id);
    }
    @PostMapping(value = IotRequestMapping.DeviceOrder.updOrder)
    @ApiOperation(value = "修改订单", notes = "修改订单")
    public Envelop<IotOrderVO> updOrder(@ApiParam(name = "jsonData", value = "json", defaultValue = "")
                                            @RequestParam(value = "jsonData", required = false)String jsonData) {
        return iotDeviceOrderFeign.updOrder(jsonData);
    }
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPurcharsePage)
    @ApiOperation(value = "分页查找采购清单", notes = "分页查找采购清单")
    public Envelop<IotOrderPurchaseVO> findPurcharsePage(@ApiParam(name = "orderId", value = "订单id", defaultValue = "")
                                                     @RequestParam(value = "orderId", required = true) String orderId,
                                                         @ApiParam(name = "page", value = "第几页", defaultValue = "")
                                                     @RequestParam(value = "page", required = false) Integer page,
                                                         @ApiParam(name = "size", value = "每页记录数", defaultValue = "")
                                                     @RequestParam(value = "size", required = false) Integer size){
        return iotDeviceOrderFeign.findPurcharsePage(orderId,page,size);
    }
}

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

@ -0,0 +1,83 @@
package com.yihu.jw.controller.iot.product;
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.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/1/17.
 */
@RestController
@RequestMapping(IotCommonContants.Common.product)
@Api(tags = "产品管理相关操作", description = "产品管理相关操作")
public class IotProductController extends EnvelopRestController {
    @Autowired
    private IotProductFeign iotProductFeign;
    @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){
        return iotProductFeign.findCompanyPage(name,classify,page,size);
    }
    @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){
        return iotProductFeign.findProductPageByCompanyId(name,companyId,page,size);
    }
    @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) {
        return iotProductFeign.addProduct(jsonData);
    }
    @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) {
        return iotProductFeign.findByCode(id);
    }
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    @ApiOperation(value = "删除产品", notes = "删除产品")
    public Envelop<IotProductVO> delCompany(@ApiParam(name = "id", value = "id")
                                            @RequestParam(value = "id", required = true) String id) {
        return iotProductFeign.delCompany(id);
    }
    @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) {
        return iotProductFeign.updCompany(jsonData);
    }
}

+ 54 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/common/IotFileUploadFallbackFactory.java

@ -0,0 +1,54 @@
package com.yihu.jw.feign.fallbackfactory.iot.common;
import com.yihu.jw.feign.iot.common.IotFileUploadFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2018/01/20.
 */
@Component
public class IotFileUploadFallbackFactory implements FallbackFactory<IotFileUploadFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public IotFileUploadFeign create(Throwable e) {
        return new IotFileUploadFeign() {
            @Override
            public Envelop<UploadVO> uploadImg(@RequestParam(value = "file", required = true) MultipartFile file) {
                tracer.getCurrentSpan().logEvent("文件流上传图片失败:原因:" + e.getMessage());
                return null;
            }
            @Override
            public Envelop<UploadVO> uploadAttachment(@RequestParam(value = "file", required = true) MultipartFile file) {
                tracer.getCurrentSpan().logEvent("文件流上传附件失败:原因:" + e.getMessage());
                return null;
            }
            @Override
            public Envelop<UploadVO> uploadStream(@RequestParam(value = "file", required = true) MultipartFile file) {
                tracer.getCurrentSpan().logEvent("文件流上传文件失败:原因:" + e.getMessage());
                return null;
            }
            @Override
            public Envelop<UploadVO> uploadImages(@RequestBody String jsonData) {
                tracer.getCurrentSpan().logEvent("base64上传图片失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
        };
    }
}

+ 35 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/common/IotSystemDictFallbackFactory.java

@ -0,0 +1,35 @@
package com.yihu.jw.feign.fallbackfactory.iot.common;
import com.yihu.jw.feign.iot.common.IotSystemDictFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2018/1/20.
 */
@Component
public class IotSystemDictFallbackFactory implements FallbackFactory<IotSystemDictFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public IotSystemDictFeign create(Throwable e) {
        return new IotSystemDictFeign() {
            @Override
            public Envelop<IotSystemDictVO> getList(@RequestParam(value = "dictName", required = true) String dictName) throws Exception {
                tracer.getCurrentSpan().logEvent("获取字典失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("dictName:" + dictName);
                return null;
            }
        };
    }
}

+ 114 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/company/IotCompanyFallbackFactory.java

@ -0,0 +1,114 @@
package com.yihu.jw.feign.fallbackfactory.iot.company;
import com.yihu.jw.feign.iot.company.IotCompanyFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2018/1/20.
 */
@Component
public class IotCompanyFallbackFactory implements FallbackFactory<IotCompanyFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public IotCompanyFeign create(Throwable e) {
        return new IotCompanyFeign() {
            @Override
            public Envelop<IotCompanyVO> findCompanyPage(@RequestParam(value = "name", required = false) String name,
                                                         @RequestParam(value = "status", required = false) String status,
                                                         @RequestParam(value = "type", required = false) String type,
                                                         @RequestParam(value = "page", required = false) Integer page,
                                                         @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找企业失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("name:" + name);
                tracer.getCurrentSpan().logEvent("status:" + status);
                tracer.getCurrentSpan().logEvent("type:" + type);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<IotCompanyVO> addCompany(@RequestParam(value = "jsonData", required = false)String jsonData) {
                tracer.getCurrentSpan().logEvent("创建企业失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
            @Override
            public Envelop<IotCompanyVO> findByCode(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("根据id查找企业失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotCompanyVO> findByBusinessLicense(@RequestParam(value = "businessLicense", required = true) String businessLicense) {
                tracer.getCurrentSpan().logEvent("根据营业执照号查找企业失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("businessLicense:" + businessLicense);
                return null;
            }
            @Override
            public Envelop<IotCompanyVO> delCompany(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("删除企业失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotCompanyVO> updCompany(@RequestParam(value = "jsonData", required = false)String jsonData) {
                tracer.getCurrentSpan().logEvent("修改企业信息失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
            @Override
            public Envelop<IotCompanyCertificateVO> findCompanyCertPage
                    (@RequestParam(value = "name", required = false) String name,
                     @RequestParam(value = "page", required = false) Integer page,
                     @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页获取企业证书失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("name:" + name);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<IotCompanyCertificateVO> findCompanyCertById(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("根据id查找企业证书失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotCompanyCertificateVO> findCompanyCertByCompanyId(@RequestParam(value = "companyId", required = true) String companyId) {
                tracer.getCurrentSpan().logEvent("根据企业id查找企业证书失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("companyId:" + companyId);
                return null;
            }
            @Override
            public Envelop<IotCompanyCertificateVO> addCompanyCert(@RequestParam(value = "jsonData", required = false)String jsonData) {
                tracer.getCurrentSpan().logEvent("创建企业证书失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
        };
    }
}

+ 100 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/device/IotDeviceFallbackFactory.java

@ -0,0 +1,100 @@
package com.yihu.jw.feign.fallbackfactory.iot.device;
import com.yihu.jw.feign.iot.device.IotDeviceFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.common.ExistVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2017/12/8.
 */
@Component
public class IotDeviceFallbackFactory implements FallbackFactory<IotDeviceFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public IotDeviceFeign create(Throwable e) {
        return new IotDeviceFeign() {
            @Override
            public Envelop<IotDeviceVO> create(@RequestBody String jsonData) {
                tracer.getCurrentSpan().logEvent("创建设备失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
            @Override
            public Envelop<IotDeviceVO> findByCode(@RequestParam(value = "id", required = true) String id
            ) {
                tracer.getCurrentSpan().logEvent("根据id查找设备失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<ExistVO> isSnExist(@RequestParam(value = "sn", required = true) String sn
            ) {
                tracer.getCurrentSpan().logEvent("sn码是否存在失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("sn:" + sn);
                return null;
            }
            @Override
            public Envelop<ExistVO> isSimExist(@RequestParam(value = "sim", required = true) String sim
            ) {
                tracer.getCurrentSpan().logEvent("sim卡号是否存在失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("sim:" + sim);
                return null;
            }
            @Override
            public Envelop<IotDeviceVO> findProductPageByCompanyId(@RequestParam(value = "sn", required = false) String sn,
                                                                   @RequestParam(value = "hospital", required = false) String hospital,
                                                                   @RequestParam(value = "orderId", required = false) String orderId,
                                                                   @RequestParam(value = "purcharseId", required = true) String purcharseId,
                                                                   @RequestParam(value = "page", required = false) Integer page,
                                                                   @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找设备失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("sn:" + sn);
                tracer.getCurrentSpan().logEvent("hospital:" + hospital);
                tracer.getCurrentSpan().logEvent("orderId:" + orderId);
                tracer.getCurrentSpan().logEvent("purcharseId:" + purcharseId);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<IotDeviceImportRecordVO> uploadStream(@RequestParam(value = "file", required = true) MultipartFile file,
                                                                 @RequestParam(value = "purcharseId", required = true) String purcharseId) {
                tracer.getCurrentSpan().logEvent("设备导入失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("purcharseId:" + purcharseId);
                return null;
            }
            @Override
            public Envelop<IotDeviceImportRecordVO> queryImportRecordPage(@RequestParam(value = "purcharseId", required = true) String purcharseId,
                                                                               @RequestParam(value = "page", required = false) Integer page,
                                                                               @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找导入记录失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("purcharseId:" + purcharseId);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
        };
    }
}

+ 84 - 0
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/iot/device/IotDeviceOrderFallbackFactory.java

@ -0,0 +1,84 @@
package com.yihu.jw.feign.fallbackfactory.iot.device;
import com.yihu.jw.feign.iot.device.IotDeviceOrderFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2017/12/8.
 */
@Component
public class IotDeviceOrderFallbackFactory implements FallbackFactory<IotDeviceOrderFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public IotDeviceOrderFeign create(Throwable e) {
        return new IotDeviceOrderFeign() {
            @Override
            public Envelop<IotOrderVO> create(@RequestBody String jsonData) {
                tracer.getCurrentSpan().logEvent("创建设备订单失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
            @Override
            public Envelop<IotDeviceOrderVO>  findByCode(@RequestParam(value = "id", required = true) String id
            ) {
                tracer.getCurrentSpan().logEvent("根据id查找设备订单失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotDeviceOrderVO> findPage(@RequestParam(value = "name", required = false) String name,
                                                      @RequestParam(value = "type", required = false) String type,
                                                      @RequestParam(value = "page", required = false) Integer page,
                                                      @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找设备订单失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("name:" + name);
                tracer.getCurrentSpan().logEvent("type:" + type);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<IotDeviceOrderVO> delOrder(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("删除订单失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotOrderVO> updOrder(@RequestParam(value = "jsonData", required = false)String jsonData) {
                tracer.getCurrentSpan().logEvent("修改订单失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
            @Override
            public Envelop<IotOrderPurchaseVO> findPurcharsePage(@RequestParam(value = "orderId", required = true) String orderId,
                                                                 @RequestParam(value = "page", required = false) Integer page,
                                                                 @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找采购清单失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("orderId:" + orderId);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
        };
    }
}

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

@ -0,0 +1,86 @@
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.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2018/1/20.
 */
@Component
public class IotProductFallbackFactory implements FallbackFactory<IotProductFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public IotProductFeign create(Throwable e) {
        return new IotProductFeign() {
            @Override
            public Envelop<IotProductBaseInfoVO> findCompanyPage(
                    @RequestParam(value = "name", required = false) String name,
                    @RequestParam(value = "classify", required = false) String classify,
                    @RequestParam(value = "page", required = false) Integer page,
                    @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找产品失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("name:" + name);
                tracer.getCurrentSpan().logEvent("classify:" + classify);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<IotProductBaseInfoVO> findProductPageByCompanyId(
                    @RequestParam(value = "name", required = false) String name,
                    @RequestParam(value = "companyId", required = true) String companyId,
                    @RequestParam(value = "page", required = false) Integer page,
                    @RequestParam(value = "size", required = false) Integer size){
                tracer.getCurrentSpan().logEvent("分页查找产品(按企业id)失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("name:" + name);
                tracer.getCurrentSpan().logEvent("companyId:" + companyId);
                tracer.getCurrentSpan().logEvent("page:" + page);
                tracer.getCurrentSpan().logEvent("size:" + size);
                return null;
            }
            @Override
            public Envelop<IotProductVO> addProduct(@RequestParam(value = "jsonData", required = false)String jsonData) {
                tracer.getCurrentSpan().logEvent("创建产品失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
            @Override
            public Envelop<IotProductVO> findByCode(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("根据id查找产品失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotProductVO> delCompany(@RequestParam(value = "id", required = true) String id) {
                tracer.getCurrentSpan().logEvent("删除产品失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("id:" + id);
                return null;
            }
            @Override
            public Envelop<IotProductVO> updCompany(@RequestParam(value = "jsonData", required = false)String jsonData) {
                tracer.getCurrentSpan().logEvent("修改产品信息失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                return null;
            }
        };
    }
}

+ 38 - 0
web-gateway/src/main/java/com/yihu/jw/feign/iot/common/IotFileUploadFeign.java

@ -0,0 +1,38 @@
package com.yihu.jw.feign.iot.common;
import com.yihu.jw.feign.fallbackfactory.iot.common.IotFileUploadFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.common.UploadVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2018/01/20.
 */
@FeignClient(
        name = CommonContants.svr_iot // name值是eurika的实例名字
        ,fallbackFactory  = IotFileUploadFallbackFactory.class
)
@RequestMapping(IotRequestMapping.api_iot_common)
public interface IotFileUploadFeign {
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream_img)
    public Envelop<UploadVO> uploadImg(@RequestParam(value = "file", required = true) MultipartFile file);
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream_attachment)
    public Envelop<UploadVO> uploadAttachment(@RequestParam(value = "file", required = true) MultipartFile file);
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_stream)
    public Envelop<UploadVO> uploadStream(@RequestParam(value = "file", required = true) MultipartFile file);
    @PostMapping(value = IotRequestMapping.FileUpload.api_upload_string)
    public Envelop<UploadVO> uploadImages(@RequestBody String jsonData) throws Exception;
}

+ 27 - 0
web-gateway/src/main/java/com/yihu/jw/feign/iot/common/IotSystemDictFeign.java

@ -0,0 +1,27 @@
package com.yihu.jw.feign.iot.common;
import com.yihu.jw.feign.fallbackfactory.iot.common.IotSystemDictFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.dict.IotSystemDictVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2018/1/20.
 */
@FeignClient(
        name = CommonContants.svr_iot // name值是eurika的实例名字
        ,fallbackFactory  = IotSystemDictFallbackFactory.class
)
@RequestMapping(IotRequestMapping.Common.system_dict)
public interface IotSystemDictFeign {
    @GetMapping(value = IotRequestMapping.System.findDictByCode)
    public Envelop<IotSystemDictVO> getList(@RequestParam(value = "dictName", required = true) String dictName) throws Exception ;
}

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

@ -0,0 +1,64 @@
package com.yihu.jw.feign.iot.company;
import com.yihu.jw.feign.fallbackfactory.iot.company.IotCompanyFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.company.IotCompanyCertificateVO;
import com.yihu.jw.restmodel.iot.company.IotCompanyVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2018/1/16.
 */
@FeignClient(
        name = CommonContants.svr_iot // name值是eurika的实例名字
        ,fallbackFactory  = IotCompanyFallbackFactory.class
)
@RequestMapping(IotRequestMapping.Common.company)
public interface IotCompanyFeign {
    @GetMapping(value = IotRequestMapping.Company.findCompanyPage)
    public Envelop<IotCompanyVO> findCompanyPage(
                                       @RequestParam(value = "name", required = false) String name,
                                       @RequestParam(value = "status", required = false) String status,
                                       @RequestParam(value = "type", required = false) String type,
                                       @RequestParam(value = "page", required = false) Integer page,
                                       @RequestParam(value = "size", required = false) Integer size);
    @PostMapping(value = IotRequestMapping.Company.addCompany)
    public Envelop<IotCompanyVO> addCompany(@RequestParam(value = "jsonData", required = false)String jsonData);
    @GetMapping(value = IotRequestMapping.Company.findCompanyById)
    public Envelop<IotCompanyVO> findByCode(@RequestParam(value = "id", required = true) String id);
    @GetMapping(value = IotRequestMapping.Company.findByBusinessLicense)
    public Envelop<IotCompanyVO> findByBusinessLicense(@RequestParam(value = "businessLicense", required = true) String businessLicense);
    @PostMapping(value = IotRequestMapping.Company.delCompany)
    public Envelop<IotCompanyVO> delCompany(@RequestParam(value = "id", required = true) String id);
    @PostMapping(value = IotRequestMapping.Company.updCompany)
    public Envelop<IotCompanyVO> updCompany(@RequestParam(value = "jsonData", required = false)String jsonData);
    @PostMapping(value = IotRequestMapping.Company.findCompanyCertPage)
    public Envelop<IotCompanyCertificateVO> findCompanyCertPage
            (@RequestParam(value = "name", required = false) String name,
             @RequestParam(value = "page", required = false) Integer page,
             @RequestParam(value = "size", required = false) Integer size);
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertById)
    public Envelop<IotCompanyCertificateVO> findCompanyCertById(@RequestParam(value = "id", required = true) String id);
    @GetMapping(value = IotRequestMapping.Company.findCompanyCertByCompanyId)
    public Envelop<IotCompanyCertificateVO> findCompanyCertByCompanyId(@RequestParam(value = "companyId", required = true) String companyId);
    @PostMapping(value = IotRequestMapping.Company.addCompanyCert)
    public Envelop<IotCompanyCertificateVO> addCompanyCert(@RequestParam(value = "jsonData", required = false)String jsonData);
}

+ 57 - 0
web-gateway/src/main/java/com/yihu/jw/feign/iot/device/IotDeviceFeign.java

@ -0,0 +1,57 @@
package com.yihu.jw.feign.iot.device;
import com.yihu.jw.feign.fallbackfactory.iot.device.IotDeviceFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.common.ExistVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceImportRecordVO;
import com.yihu.jw.restmodel.iot.device.IotDeviceVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
/**
 * @author yeshijie on 2017/12/8.
 */
@FeignClient(
        name = CommonContants.svr_iot // name值是eurika的实例名字
        ,fallbackFactory  = IotDeviceFallbackFactory.class
)
@RequestMapping(IotRequestMapping.Common.device)
public interface IotDeviceFeign{
    @PostMapping(value = IotRequestMapping.Device.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop<IotDeviceVO> create(@RequestBody String jsonData);
    @GetMapping(value = IotRequestMapping.Device.api_getById)
    public Envelop<IotDeviceVO> findByCode(@RequestParam(value = "id", required = true) String id);
    @GetMapping(value = IotRequestMapping.Device.isSnExist)
    public Envelop<ExistVO> isSnExist(@RequestParam(value = "sn", required = true) String sn);
    @GetMapping(value = IotRequestMapping.Device.isSimExist)
    public Envelop<ExistVO> isSimExist(@RequestParam(value = "sim", required = true) String sim);
    @GetMapping(value = IotRequestMapping.Device.api_queryPage)
    public Envelop<IotDeviceVO> findProductPageByCompanyId(
            @RequestParam(value = "sn", required = false) String sn,
            @RequestParam(value = "hospital", required = false) String hospital,
            @RequestParam(value = "orderId", required = false) String orderId,
            @RequestParam(value = "purcharseId", required = true) String purcharseId,
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "size", required = false) Integer size);
    @PostMapping(value = IotRequestMapping.Device.importDevice)
    public Envelop<IotDeviceImportRecordVO> uploadStream(
            @RequestParam(value = "file", required = true) MultipartFile file,
            @RequestParam(value = "purcharseId", required = true) String purcharseId);
    @GetMapping(value = IotRequestMapping.Device.queryImportRecordPage)
    public Envelop<IotDeviceImportRecordVO> queryImportRecordPage(
           @RequestParam(value = "purcharseId", required = true) String purcharseId,
           @RequestParam(value = "page", required = false) Integer page,
           @RequestParam(value = "size", required = false) Integer size);
}

+ 49 - 0
web-gateway/src/main/java/com/yihu/jw/feign/iot/device/IotDeviceOrderFeign.java

@ -0,0 +1,49 @@
package com.yihu.jw.feign.iot.device;
import com.yihu.jw.feign.fallbackfactory.iot.device.IotDeviceOrderFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.iot.device.IotDeviceOrderVO;
import com.yihu.jw.restmodel.iot.device.IotOrderPurchaseVO;
import com.yihu.jw.restmodel.iot.device.IotOrderVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * @author yeshijie on 2018/01/20.
 */
@FeignClient(
        name = CommonContants.svr_iot // name值是eurika的实例名字
        ,fallbackFactory  = IotDeviceOrderFallbackFactory.class
)
@RequestMapping(IotRequestMapping.Common.order)
public interface IotDeviceOrderFeign {
    @PostMapping(value = IotRequestMapping.DeviceOrder.createOrder, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    public Envelop<IotOrderVO> create(@RequestBody String jsonData);
    @GetMapping(value = IotRequestMapping.DeviceOrder.findById)
    public Envelop<IotDeviceOrderVO> findByCode(@RequestParam(value = "id", required = true) String id);
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPage)
    public Envelop<IotDeviceOrderVO> findPage(
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "type", required = false) String type,
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "size", required = false) Integer size);
    @PostMapping(value = IotRequestMapping.DeviceOrder.delOrder)
    public Envelop<IotDeviceOrderVO> delOrder(@RequestParam(value = "id", required = true) String id);
    @PostMapping(value = IotRequestMapping.DeviceOrder.updOrder)
    public Envelop<IotOrderVO> updOrder(@RequestParam(value = "jsonData", required = false)String jsonData);
    @GetMapping(value = IotRequestMapping.DeviceOrder.findPurcharsePage)
    public Envelop<IotOrderPurchaseVO> findPurcharsePage(
            @RequestParam(value = "orderId", required = true) String orderId,
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "size", required = false) Integer size);
}

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

@ -0,0 +1,52 @@
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.IotProductBaseInfoVO;
import com.yihu.jw.restmodel.iot.product.IotProductVO;
import com.yihu.jw.rm.iot.IotRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * @author yeshijie on 2018/1/17.
 */
@FeignClient(
        name = CommonContants.svr_iot // name值是eurika的实例名字
        ,fallbackFactory  = IotProductFallbackFactory.class
)
@RequestMapping(IotRequestMapping.Common.product)
public interface IotProductFeign{
    @GetMapping(value = IotRequestMapping.Product.findProductPage)
    public Envelop<IotProductBaseInfoVO> findCompanyPage(
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "classify", required = false) String classify,
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "size", required = false) Integer size);
    @GetMapping(value = IotRequestMapping.Product.findProductPageByCompanyId)
    public Envelop<IotProductBaseInfoVO> findProductPageByCompanyId(
            @RequestParam(value = "name", required = false) String name,
            @RequestParam(value = "companyId", required = true) String companyId,
            @RequestParam(value = "page", required = false) Integer page,
            @RequestParam(value = "size", required = false) Integer size);
    @PostMapping(value = IotRequestMapping.Product.addProduct)
    public Envelop<IotProductVO> addProduct(@RequestParam(value = "jsonData", required = false)String jsonData);
    @GetMapping(value = IotRequestMapping.Product.findProductById)
    public Envelop<IotProductVO> findByCode(@RequestParam(value = "id", required = true) String id);
    @PostMapping(value = IotRequestMapping.Product.delProduct)
    public Envelop<IotProductVO> delCompany(@RequestParam(value = "id", required = true) String id);
    @PostMapping(value = IotRequestMapping.Product.updProduct)
    public Envelop<IotProductVO> updCompany(@RequestParam(value = "jsonData", required = false)String jsonData);
}