Browse Source

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

chenweida 7 years ago
parent
commit
76f8500961
29 changed files with 15 additions and 1265 deletions
  1. 0 0
      base/common-mq/src/main/resources/template.yml
  2. 0 63
      web-gateway/src/main/java/com/yihu/jw/commnon/base/base/BaseVersionContants.java
  3. 0 14
      web-gateway/src/main/java/com/yihu/jw/config/mvc/MvcConfig.java
  4. 2 6
      web-gateway/src/main/java/com/yihu/jw/controller/PatientController.java
  5. 2 2
      web-gateway/src/main/java/com/yihu/jw/controller/base/FunctionController.java
  6. 2 2
      web-gateway/src/main/java/com/yihu/jw/controller/base/ModuleController.java
  7. 2 4
      web-gateway/src/main/java/com/yihu/jw/controller/base/SaasController.java
  8. 0 139
      web-gateway/src/main/java/com/yihu/jw/controller/base/version/ServerUrlVersionController.java
  9. 0 142
      web-gateway/src/main/java/com/yihu/jw/controller/base/version/ServerVersionController.java
  10. 0 105
      web-gateway/src/main/java/com/yihu/jw/controller/base/version/ServerVersionLogController.java
  11. 0 81
      web-gateway/src/main/java/com/yihu/jw/controller/base/version/UserUrlVersionController.java
  12. 0 109
      web-gateway/src/main/java/com/yihu/jw/controller/base/version/WlyyVersionController.java
  13. 1 1
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatAccessTokenController.java
  14. 1 8
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatConfigController.java
  15. 1 9
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatGraphicMessageController.java
  16. 1 4
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatMenuController.java
  17. 3 9
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatTemplateControlle.java
  18. 0 2
      web-gateway/src/main/java/com/yihu/jw/controller/login/LoginController.java
  19. 0 45
      web-gateway/src/main/java/com/yihu/jw/feign/base/version/ServerUrlVersionFeign.java
  20. 0 46
      web-gateway/src/main/java/com/yihu/jw/feign/base/version/ServerVersionFeign.java
  21. 0 49
      web-gateway/src/main/java/com/yihu/jw/feign/base/version/UserUrlVersionFeign.java
  22. 0 44
      web-gateway/src/main/java/com/yihu/jw/feign/base/version/WlyyVersionFeign.java
  23. 0 70
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/ServerUrlVersionFeignFallbackFactory.java
  24. 0 72
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/ServerVersionFeignFallbackFactory.java
  25. 0 82
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/UserUrlVersionFeignFallbackFactory.java
  26. 0 54
      web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/WlyyVersionFeignFallbackFactory.java
  27. 0 21
      web-gateway/src/main/java/com/yihu/jw/version/ApiVersion.java
  28. 0 51
      web-gateway/src/main/java/com/yihu/jw/version/ApiVesrsionCondition.java
  29. 0 31
      web-gateway/src/main/java/com/yihu/jw/version/JWRequestMappingHandlerMapping.java

+ 0 - 0
base/common-mq/src/main/resources/template.yml


+ 0 - 63
web-gateway/src/main/java/com/yihu/jw/commnon/base/base/BaseVersionContants.java

@ -1,63 +0,0 @@
package com.yihu.jw.commnon.base.base;
/**
 * Created by chenweida on 2017/6/16.
 */
public class BaseVersionContants {
    public static final String api_common = "/version";
    public static class BaseServerVersion {
        public static final String api_create = "/serverVersion";
        public static final String api_update = "/serverVersion";
        public static final String api_delete = "/serverVersion/{codes}";
        public static final String api_getByCode = "/serverVersion/{code}";
        public static final String api_getList="/serverVersion/list";
        public static final String api_getListNoPage="/serverVersion/listNoPage";
    }
    public static class BaseServerUrlVersion {
        public static final String api_create = "/serverUrl";
        public static final String api_update = "/serverUrl";
        public static final String api_delete = "/serverUrl/{codes}";
        public static final String api_getByCode = "/serverUrl/{code}";
        public static final String api_getList="/serverUrl/list";
        public static final String api_getListNoPage="/serverUrl/listNoPage";
    }
    public static class BaseServerVersionLog {
        public static final String api_create = "/serverVersionLog";
        public static final String api_update = "/serverVersionLog";
        public static final String api_delete = "/serverVersionLog/{codes}";
        public static final String api_getByCode = "/serverVersionLog/{code}";
        public static final String api_getList="/serverVersionLog/list";
        public static final String api_getListNoPage="/serverVersionLog/listNoPage";
    }
    public static class WlyyVersion {
        public static final String api_create = "/wlyyVersion";
        public static final String api_update = "/wlyyVersion";
        public static final String api_delete = "/wlyyVersion/{codes}";
        public static final String api_getByCode = "/wlyyVersion/{code}";
        public static final String api_getList="/wlyyVersion/list";
        public static final String api_getListNoPage="/wlyyVersion/listNoPage";
    }
    public class UserUrlVersion {
        public static final String api_create = "/userUrlVersion";
        public static final String api_update = "/userUrlVersion";
        public static final String api_delete = "/userUrlVersion/{codes}";
        public static final String api_getByCode = "/userUrlVersion/{code}";
        public static final String api_getList="/userUrlVersion/list";
        public static final String api_getListNoPage="/userUrlVersion/listNoPage";
        public static final String api_changeUserVersion="/userUrlVersion/userVersion";
                ;
    }
}

+ 0 - 14
web-gateway/src/main/java/com/yihu/jw/config/mvc/MvcConfig.java

@ -1,6 +1,5 @@
package com.yihu.jw.config.mvc;
import com.yihu.jw.version.JWRequestMappingHandlerMapping;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
@ -12,19 +11,6 @@ import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandl
 */
@Configuration
public class MvcConfig extends WebMvcConfigurationSupport {
    /**
     * 重写springMVC的Mapping 版本控制用
     * @return
     */
    @Override
    @Bean
    public RequestMappingHandlerMapping requestMappingHandlerMapping() {
        RequestMappingHandlerMapping handlerMapping = new JWRequestMappingHandlerMapping();
        handlerMapping.setOrder(0);//顺序是第一
        handlerMapping.setInterceptors(getInterceptors());
        return handlerMapping;
    }
    /**
     * 全局异常定义
     * @return

+ 2 - 6
web-gateway/src/main/java/com/yihu/jw/controller/PatientController.java

@ -6,7 +6,6 @@ import com.yihu.jw.exception.SystemException;
import com.yihu.jw.exception.business.ManageException;
import com.yihu.jw.feign.PatientFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -26,8 +25,8 @@ import javax.servlet.http.HttpServletRequest;
@RequestMapping("/{version}/patient")
@Api(description = "患者")
@RefreshScope
public class PatientController {
    private Logger logger = LoggerFactory.getLogger(PatientController.class);
public class DemoController {
    private Logger logger = LoggerFactory.getLogger(DemoController.class);
    @Autowired
    private PatientFeign patientFegin;
    @Autowired
@ -36,7 +35,6 @@ public class PatientController {
    private String aaaa;
    @GetMapping("/hello")
    @ApiVersion(1)
    @ResponseBody
    public Envelop hello1(@RequestParam(name = "id") Integer id,
                          @RequestParam(name = "name") String name,
@ -62,7 +60,6 @@ public class PatientController {
    }
    @GetMapping("/hello")
    @ApiVersion(2)
    @ResponseBody
    public String hello2(String id) throws Exception {
        System.out.println("haha2.........");
@ -70,7 +67,6 @@ public class PatientController {
    }
    @GetMapping("/refresh")
    @ApiVersion(0)
    @ResponseBody
    public String refresh(HttpServletRequest request) throws Exception {
        return aaaa;

+ 2 - 2
web-gateway/src/main/java/com/yihu/jw/controller/base/FunctionController.java

@ -1,4 +1,4 @@
package com.yihu.jw.controller.base;
package com.yihu.jw.controller.base.base;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletResponse;
 */
@RestController
@RequestMapping("{version}/"+ BaseContants.api_common)
@RequestMapping(BaseContants.api_common)
@Api(value = "功能管理", description = "功能管理")
public class FunctionController extends EnvelopRestController {

+ 2 - 2
web-gateway/src/main/java/com/yihu/jw/controller/base/ModuleController.java

@ -1,4 +1,4 @@
package com.yihu.jw.controller.base;
package com.yihu.jw.controller.base.base;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
@ -25,7 +25,7 @@ import javax.servlet.http.HttpServletResponse;
 */
@RestController
@RequestMapping("{version}/"+ BaseContants.api_common)
@RequestMapping( BaseContants.api_common)
@Api(value = "模块管理", description = "模块相关接口管理")
public class ModuleController extends EnvelopRestController {

+ 2 - 4
web-gateway/src/main/java/com/yihu/jw/controller/base/SaasController.java

@ -1,11 +1,10 @@
package com.yihu.jw.controller.base;
package com.yihu.jw.controller.base.base;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.base.base.BaseContants;
import com.yihu.jw.feign.base.base.SaasFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -20,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("{version}/"+ BaseContants.Saas.api_common)
@RequestMapping( BaseContants.Saas.api_common)
@Api(description = "saas相关")
public class SaasController {
@ -32,7 +31,6 @@ public class SaasController {
    private Tracer tracer;
    @ApiVersion(1)
    @GetMapping(value = BaseContants.Saas.api_getSaassNoPage)
    @ApiOperation(value = "获取saas,不分页")
    @HystrixCommand(commandProperties = {

+ 0 - 139
web-gateway/src/main/java/com/yihu/jw/controller/base/version/ServerUrlVersionController.java

@ -1,139 +0,0 @@
package com.yihu.jw.controller.base.version;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.base.base.BaseVersionContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.version.ServerUrlVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * Created by chenweida on 2017/6/20.
 */
@RestController
@RequestMapping("{version}"+ BaseVersionContants.api_common)
@Api(value = "服务器URL版本模块", description = "服务器URL版本模块接口管理")
public class ServerUrlVersionController {
    @Autowired
    private ServerUrlVersionFeign serverUrlVersionFegin;
    @Autowired
    private Tracer tracer;
    @ApiVersion(1)
    @ApiOperation(value = "创建服务器URL版本")
    @PostMapping(value = BaseVersionContants.BaseServerUrlVersion.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("创建服务器URL版本:jsonData="+jsonData);
        return serverUrlVersionFegin.create(jsonData);
    }
    @ApiVersion(1)
    @ApiOperation(value = "更新服务器URL版本")
    @PutMapping(value =  BaseVersionContants.BaseServerUrlVersion.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop update(
            @ApiParam(name = "jsonData", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("更新服务器URL版本:jsonData="+jsonData);
        return serverUrlVersionFegin.update(jsonData);
    }
    @ApiVersion(1)
    @DeleteMapping(value =BaseVersionContants.BaseServerUrlVersion.api_delete)
    @ApiOperation(value = "删除服务器URL版本", notes = "删除服务器URL版本")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        return serverUrlVersionFegin.delete(codes,userCode,userName);
    }
    @ApiVersion(1)
    @GetMapping(value = BaseVersionContants.BaseServerUrlVersion.api_getByCode)
    @ApiOperation(value = "根据code查找服务器URL版本", notes = "根据code查找服务器URL版本")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @PathVariable(value = "code", required = true) String code
    ) throws JiWeiException {
        return serverUrlVersionFegin.findByCode(code);
    }
    @ApiVersion(1)
    @RequestMapping(value = BaseVersionContants.BaseServerUrlVersion.api_getList, method = RequestMethod.GET)
    @ApiOperation(value = "获取服务器URL版本列表(分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getList(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception {
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("name")){
                filterStr+="name?"+jsonResult.get("name")+";";
            }
        }
        return serverUrlVersionFegin.getList(fields, filterStr, sorts, size, page);
    }
    @ApiVersion(1)
    @GetMapping(value = BaseVersionContants.BaseServerUrlVersion.api_getListNoPage)
    @ApiOperation(value = "获取服务器URL版本,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getListNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("serverCode")){
                filterStr+="serverCode="+jsonResult.get("serverCode")+";";
            }
        }
        return serverUrlVersionFegin.getListNoPage(fields, filterStr, sorts);
    }
}

+ 0 - 142
web-gateway/src/main/java/com/yihu/jw/controller/base/version/ServerVersionController.java

@ -1,142 +0,0 @@
package com.yihu.jw.controller.base.version;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.base.base.BaseVersionContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.version.ServerVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
 * Created by chenweida on 2017/5/19.
 */
@RestController
@RequestMapping("{version}/"+BaseVersionContants.api_common)
@Api(value = "服务器版本模块", description = "服务器版本模块接口管理")
public class ServerVersionController extends EnvelopRestController {
    @Autowired
    private ServerVersionFeign serverVersionFegin;
    @Autowired
    private Tracer tracer;
    @PostMapping(value = BaseVersionContants.BaseServerVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建服务器版本", notes = "创建单个服务器版本")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop create(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("创建服务器版本:jsonData="+jsonData);
        return serverVersionFegin.create(jsonData);
    }
    @PutMapping(value = BaseVersionContants.BaseServerVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改服务器版本", notes = "修改服务器版本")
    public Envelop update(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("修改服务器版本:jsonData="+jsonData);
        return serverVersionFegin.update(jsonData);
    }
    @DeleteMapping(value = BaseVersionContants.BaseServerVersion.api_delete)
    @ApiOperation(value = "删除服务器版本", notes = "删除服务器版本")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("删除服务器版本:codes="+codes);
        return serverVersionFegin.delete(codes,userCode,userName);
    }
    @GetMapping(value = BaseVersionContants.BaseServerVersion.api_getByCode)
    @ApiOperation(value = "根据code查找服务器版本", notes = "根据code查找服务器版本")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @PathVariable(value = "code", required = true) String code
    ) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("根据code查找服务器版本:code="+code);
        return serverVersionFegin.findByCode(code);
    }
    @RequestMapping(value = BaseVersionContants.BaseServerVersion.api_getList, method = RequestMethod.GET)
    @ApiOperation(value = "获取服务器版本列表(分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWlyyVersions(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            //code like 1,name大于aa ,code 等于1 , defaultValue = "code?1;name>aa;code=1"
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("name")){
                filterStr+="name?"+jsonResult.get("name")+";";
            }
            if(jsonResult.has("saasId")){
                filterStr+="saasId="+jsonResult.get("saasId")+";";
            }
        }
        return serverVersionFegin.getList(fields, filterStr, sorts, size, page);
    }
    @GetMapping(value = BaseVersionContants.BaseServerVersion.api_getListNoPage)
    @ApiOperation(value = "获取服务器版本列表,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getListNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("saasId")){
                filterStr+="saasId="+jsonResult.get("saasId")+";";
            }
        }
        return serverVersionFegin.getListNoPage(fields, filterStr, sorts);
    }
}

+ 0 - 105
web-gateway/src/main/java/com/yihu/jw/controller/base/version/ServerVersionLogController.java

@ -1,105 +0,0 @@
package com.yihu.jw.controller.base.version;
import com.yihu.jw.commnon.base.base.BaseVersionContants;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
 * Created by chenweida on 2017/5/19.
 */
@RestController
@RequestMapping("{version}/"+ BaseVersionContants.api_common)
@Api(value = "服务器版本日志模块", description = "服务器版本日志模块接口管理")
public class ServerVersionLogController extends EnvelopRestController {
    /*@Autowired
    private ServerVersionLogService serverVersionLogService;*/
    /*@PostMapping(value = BaseVersionContants.BaseServerVersionLog.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建服务器版本日志", notes = "创建单个服务器版本日志")
    public Envelop createBaseServerVersionLog(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            BaseServerVersionLog baseServerVersionLog = toEntity(jsonData, BaseServerVersionLog.class);
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersionLog.message_success_create, serverVersionLogService.createBaseServerVersionLog(baseServerVersionLog));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = BaseVersionContants.BaseServerVersionLog.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "删除服务器版本日志", notes = "删除服务器版本日志")
    public Envelop deleteBaseServerVersionLog(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        try {
            serverVersionLogService.deleteBaseServerVersionLog(code);
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersionLog.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = BaseVersionContants.BaseServerVersionLog.api_getByCode, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "根据code查找服务器版本日志", notes = "根据code查找服务器版本日志")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersionLog.message_success_find, serverVersionLogService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }*/
   /* @RequestMapping(value = BaseVersionContants.BaseServerVersionLog.api_getBaseServerVersionLog, method = RequestMethod.GET)
    @ApiOperation(value = "获取服务器版本日志列表(分页)")
    public Envelop getBaseServerVersionLogs(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            //code like 1,name大于aa ,code 等于1 , defaultValue = "code?1;name>aa;code=1"
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        //得到list数据
        List<BaseServerVersionLog> list = serverVersionLogService.search(fields, filters, sorts, page, size);
        //获取总数
        long count=serverVersionLogService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<MBaseServerVersionLog> mBaseServerVersionLogs = convertToModels(list, new ArrayList<>(list.size()), MBaseServerVersionLog.class, fields);
        return Envelop.getSuccessListWithPage(BaseVersionContants.BaseServerVersionLog.message_success_find_BaseServerVersionLog,mBaseServerVersionLogs, page, size,count);
    }
    @GetMapping(value = BaseVersionContants.BaseServerVersionLog.api_getBaseServerVersionLogNoPage)
    @ApiOperation(value = "获取服务器版本日志列表,不分页")
    public Envelop getAppsNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        //得到list数据
        List<BaseServerVersionLog> list = serverVersionLogService.search(fields,filters,sorts);
        //封装返回格式
        List<MBaseServerVersionLog> mBaseServerVersionLogs = convertToModels(list, new ArrayList<>(list.size()), MBaseServerVersionLog.class, fields);
        return Envelop.getSuccessList(BaseVersionContants.BaseServerVersionLog.message_success_find_BaseServerVersionLog,mBaseServerVersionLogs);
    }
*/
}

+ 0 - 81
web-gateway/src/main/java/com/yihu/jw/controller/base/version/UserUrlVersionController.java

@ -1,81 +0,0 @@
package com.yihu.jw.controller.base.version;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.base.base.BaseVersionContants;
import com.yihu.jw.feign.base.version.UserUrlVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
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;
/**
 * Created by chenweida on 2017/6/20.
 */
@RestController
@RequestMapping("{version}"+ BaseVersionContants.api_common)
@Api(value = "后台用户版本模块", description = "后台用户版本模块管理")
public class UserUrlVersionController {
    @Autowired
    private UserUrlVersionFeign userUrlVersionFegin;
    @Autowired
    private Tracer tracer;
    @GetMapping(value = BaseVersionContants.UserUrlVersion.api_getListNoPage)
    @ApiOperation(value = "获取用户版本列表,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getListNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("saasId")){
                filterStr+="saasId="+jsonResult.get("saasId")+";";
            }
            if(jsonResult.has("bsvCode")){
                filterStr+="bsvCode="+jsonResult.get("bsvCode")+";";
            }
        }
        return userUrlVersionFegin.getListNoPage(fields, filterStr, sorts);
    }
    @GetMapping(value = BaseVersionContants.UserUrlVersion.api_changeUserVersion)
    @ApiOperation(value = "更改后台用户版本")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop changeUserVersion(
            @ApiParam(name = "serverCode",value="后台版本code")
            @RequestParam(value = "serverCode") String serverCode,
            @ApiParam(name = "userCodes", value = "更改的用户codes")
            @RequestParam(value = "userCodes") String userCodes,
            @ApiParam(name = "userCode", value = "修改人code")
            @RequestParam(value = "userCode") String userCode,
            @ApiParam(name = "userName", value = "修改人")
            @RequestParam(value = "userName") String userName,
            @ApiParam(name = "saasId")
            @RequestParam(value = "saasId") String saasId
    ) throws Exception {
        return userUrlVersionFegin.changeUserVersion(serverCode, userCodes, userCode,userName,saasId);
    }
}

+ 0 - 109
web-gateway/src/main/java/com/yihu/jw/controller/base/version/WlyyVersionController.java

@ -1,109 +0,0 @@
package com.yihu.jw.controller.base.version;
import com.yihu.jw.commnon.base.base.BaseVersionContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.version.WlyyVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * Created by chenweida on 2017/6/16.
 */
@RestController
@RequestMapping("{version}/"+ BaseVersionContants.api_common)
@Api(value = "i健康APP版本模块", description = "i健康APP版本模块接口管理")
public class WlyyVersionController  extends EnvelopRestController {
    @Autowired
    private WlyyVersionFeign wlyyVersionFegin;
    @Autowired
    private Tracer tracer;
    @PostMapping(value = BaseVersionContants.WlyyVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建i健康APP版本", notes = "创建单个i健康APP版本")
    public Envelop createWlyyVersion(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return wlyyVersionFegin.create(jsonData);
    }
    @PutMapping(value = BaseVersionContants.WlyyVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改i健康APP版本", notes = "修改i健康APP版本")
    public Envelop updateWlyyVersion(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return wlyyVersionFegin.update(jsonData);
    }
    @DeleteMapping(value = BaseVersionContants.WlyyVersion.api_delete)
    @ApiOperation(value = "删除i健康APP版本", notes = "删除i健康APP版本")
    public Envelop deleteWlyyVersion(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        return wlyyVersionFegin.delete(codes,userCode,userName);
    }
    @GetMapping(value = BaseVersionContants.WlyyVersion.api_getByCode)
    @ApiOperation(value = "根据code查找i健康APP版本", notes = "根据code查找i健康APP版本")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @PathVariable(value = "code", required = true) String code
    ) {
        return wlyyVersionFegin.findByCode(code);
    }
    @RequestMapping(value = BaseVersionContants.WlyyVersion.api_getList, method = RequestMethod.GET)
    @ApiOperation(value = "获取i健康APP版本列表(分页)")
    public Envelop getWlyyVersions(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            //code like 1,name大于aa ,code 等于1 , defaultValue = "code?1;name>aa;code=1"
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception {
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("name")){
                filterStr+="name?"+jsonResult.get("name")+";";
            }
            if(jsonResult.has("saasId")){
                filterStr+="saasId="+jsonResult.get("saasId")+";";
            }
        }
        return wlyyVersionFegin.getList(fields, filterStr, sorts, size, page);
    }
    @GetMapping(value = BaseVersionContants.WlyyVersion.api_getListNoPage)
    @ApiOperation(value = "获取i健康APP版本列表,不分页")
    public Envelop getAppsNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        return wlyyVersionFegin.getListNoPage(fields, filters, sorts);
    }
}

+ 1 - 1
web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatAccessTokenController.java

@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}"+ WechatContants.api_common)
@RequestMapping(WechatContants.api_common)
@Api(description = "微信token相关")
public class WechatAccessTokenController {

+ 1 - 8
web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatConfigController.java

@ -6,7 +6,6 @@ import com.yihu.jw.commnon.base.wx.WechatContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.wx.WechatFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -21,7 +20,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("{version}"+ WechatContants.api_common)
@RequestMapping(WechatContants.api_common)
@Api(description = "微信配置")
public class WechatConfigController {
@ -32,7 +31,6 @@ public class WechatConfigController {
    @Autowired
    private Tracer tracer;
    @ApiVersion(1)
    @ApiOperation(value = "创建微信配置")
    @PostMapping(value = WechatContants.Config.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
@ -47,7 +45,6 @@ public class WechatConfigController {
        return wechat;
    }
    @ApiVersion(1)
    @ApiOperation(value = "更新微信配置")
    @PutMapping(value = WechatContants.Config.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
@ -61,7 +58,6 @@ public class WechatConfigController {
        return wechat;
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Config.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @HystrixCommand(commandProperties = {
@ -78,7 +74,6 @@ public class WechatConfigController {
        return wechat;
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Config.api_getByCode)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    @HystrixCommand(commandProperties = {
@ -91,7 +86,6 @@ public class WechatConfigController {
       return wechatFegin.findByCode(code);
    }
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.Config.api_getWechats, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信配置列表(分页)")
    @HystrixCommand(commandProperties = {
@ -122,7 +116,6 @@ public class WechatConfigController {
        return envelop;
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Config.api_getWechatNoPage)
    @ApiOperation(value = "获取微信列表配置,不分页")
    @HystrixCommand(commandProperties = {

+ 1 - 9
web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatGraphicMessageController.java

@ -6,7 +6,6 @@ import com.yihu.jw.commnon.base.wx.WechatContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.wx.GraphicMessageFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -23,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}"+ WechatContants.api_common)
@RequestMapping( WechatContants.api_common)
@Api(description = "微信图文相关")
public class WechatGraphicMessageController {
    private Logger logger= LoggerFactory.getLogger(WechatGraphicMessageController.class);
@ -34,7 +33,6 @@ public class WechatGraphicMessageController {
    @Autowired
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.GraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
    @HystrixCommand(commandProperties = {
@ -49,7 +47,6 @@ public class WechatGraphicMessageController {
    }
    @ApiVersion(1)
    @PutMapping(value = WechatContants.GraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
    @HystrixCommand(commandProperties = {
@ -62,7 +59,6 @@ public class WechatGraphicMessageController {
        return graphicMessageFegin.updateWxGraphicMessage(jsonData);
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.GraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    @HystrixCommand(commandProperties = {
@ -78,7 +74,6 @@ public class WechatGraphicMessageController {
        return graphicMessageFegin.deleteWxGraphicMessage(codes,userCode,userName);
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_getByCode)
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    @HystrixCommand(commandProperties = {
@ -91,7 +86,6 @@ public class WechatGraphicMessageController {
        return graphicMessageFegin.findByCode(code);
    }
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信图文消息列表(分页)")
    @HystrixCommand(commandProperties = {
@ -123,7 +117,6 @@ public class WechatGraphicMessageController {
        return graphicMessageFegin.getWxGraphicMessages(fields,filterStr,sorts,size,page);
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessageNoPage)
    @ApiOperation(value = "获取图文消息列表,不分页")
    @HystrixCommand(commandProperties = {
@ -139,7 +132,6 @@ public class WechatGraphicMessageController {
        return graphicMessageFegin.getWxGraphicMessageNoPage(fields,filters,sorts);
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_sendGraphicMessages)
    @ApiOperation(value = "发送图文消息")
    @HystrixCommand(commandProperties = {

+ 1 - 4
web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatMenuController.java

@ -6,7 +6,6 @@ import com.yihu.jw.commnon.base.wx.WechatContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.wx.WechatMenuFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -23,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}"+ WechatContants.api_common)
@RequestMapping( WechatContants.api_common)
@Api(description = "微信菜单配置")
public class WechatMenuController {
@ -35,7 +34,6 @@ public class WechatMenuController {
    @Autowired
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.Menu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    @HystrixCommand(commandProperties = {
@ -62,7 +60,6 @@ public class WechatMenuController {
        return wechatMenuFegin.updateWxMenu(jsonData);
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Menu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @HystrixCommand(commandProperties = {

+ 3 - 9
web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatTemplateControlle.java

@ -6,7 +6,6 @@ import com.yihu.jw.commnon.base.wx.WechatContants;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.wx.WechatTemplateFeign;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -23,7 +22,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}"+ WechatContants.api_common)
@RequestMapping(WechatContants.api_common)
@Api(description = "微信模板消息相关")
public class WechatTemplateControlle {
@ -35,7 +34,6 @@ public class WechatTemplateControlle {
    @Autowired
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.Template.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
    @HystrixCommand(commandProperties = {
@ -49,7 +47,7 @@ public class WechatTemplateControlle {
        return wechatTemplateFegin.createWxTemplate(jsonData);
    }
    @ApiVersion(1)
    @PutMapping(value = WechatContants.Template.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
    @HystrixCommand(commandProperties = {
@ -63,7 +61,7 @@ public class WechatTemplateControlle {
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Template.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @HystrixCommand(commandProperties = {
@ -79,7 +77,6 @@ public class WechatTemplateControlle {
        return wechatTemplateFegin.deleteWxTemplate(codes,userCode,userName);
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_getByCode)
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    @HystrixCommand(commandProperties = {
@ -92,7 +89,6 @@ public class WechatTemplateControlle {
        return wechatTemplateFegin.findByCode(code);
    }
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.Template.api_getWxTemplates, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信模版列表(分页)")
    @HystrixCommand(commandProperties = {
@ -122,7 +118,6 @@ public class WechatTemplateControlle {
        return wechatTemplateFegin.getWechats(fields,filterStr,sorts,size,page);
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_getWxTemplatesNoPage)
    @ApiOperation(value = "获取微信模版列表(不分页)")
    @HystrixCommand(commandProperties = {
@ -145,7 +140,6 @@ public class WechatTemplateControlle {
        return wechatTemplateFegin.getWechatNoPage(fields,filterStr,sorts);
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_sendTemplateMessage)
    @ApiOperation(value = "发送微信模板消息")
    @HystrixCommand(commandProperties = {

+ 0 - 2
web-gateway/src/main/java/com/yihu/jw/controller/login/LoginController.java

@ -1,8 +1,6 @@
package com.yihu.jw.controller.login;
import com.yihu.jw.commnon.wlyy.PatientContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;

+ 0 - 45
web-gateway/src/main/java/com/yihu/jw/feign/base/version/ServerUrlVersionFeign.java

@ -1,45 +0,0 @@
package com.yihu.jw.feign.base.version;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.fallbackfactory.base.version.ServerUrlVersionFeignFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.base.BaseVersionRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = ServerUrlVersionFeignFallbackFactory.class
)
@RequestMapping(value = BaseVersionRequestMapping.api_common)
public interface ServerUrlVersionFeign {
    @PostMapping(value = BaseVersionRequestMapping.BaseServerUrlVersion.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData ) throws JiWeiException;
    @PutMapping(value =  BaseVersionRequestMapping.BaseServerUrlVersion.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update( @RequestBody String jsonData) throws JiWeiException;
    @DeleteMapping(value =BaseVersionRequestMapping.BaseServerUrlVersion.api_delete)
    Envelop delete( @PathVariable(required = true,value="codes") String codes,@RequestParam(value="userCode") String userCode,@RequestParam(value="userName") String userName) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.BaseServerUrlVersion.api_getByCode)
    Envelop findByCode(@PathVariable(required = true,value="code")  String code) throws JiWeiException;
    @RequestMapping(value = BaseVersionRequestMapping.BaseServerUrlVersion.api_getList, method = RequestMethod.GET)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.BaseServerUrlVersion.api_getListNoPage)
    Envelop getListNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
}

+ 0 - 46
web-gateway/src/main/java/com/yihu/jw/feign/base/version/ServerVersionFeign.java

@ -1,46 +0,0 @@
package com.yihu.jw.feign.base.version;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.fallbackfactory.base.version.ServerVersionFeignFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.base.BaseVersionRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = ServerVersionFeignFallbackFactory.class
)
@RequestMapping(value = BaseVersionRequestMapping.api_common)
public interface ServerVersionFeign {
    @PostMapping(value = BaseVersionRequestMapping.BaseServerVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData) throws JiWeiException;
    @PutMapping(value = BaseVersionRequestMapping.BaseServerVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData) throws JiWeiException;
    @DeleteMapping(value = BaseVersionRequestMapping.BaseServerVersion.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop delete( @PathVariable(value = "codes")String codes,@RequestParam(value="userCode") String userCode,@RequestParam(value="userName") String userName) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.BaseServerVersion.api_getByCode, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop findByCode(@PathVariable(value = "code") String code) throws JiWeiException;
    @RequestMapping(value = BaseVersionRequestMapping.BaseServerVersion.api_getList, method = RequestMethod.GET)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.BaseServerVersion.api_getListNoPage)
    Envelop getListNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
}

+ 0 - 49
web-gateway/src/main/java/com/yihu/jw/feign/base/version/UserUrlVersionFeign.java

@ -1,49 +0,0 @@
package com.yihu.jw.feign.base.version;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.fallbackfactory.base.version.UserUrlVersionFeignFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.base.BaseVersionRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = UserUrlVersionFeignFallbackFactory.class
)
@RequestMapping(value = BaseVersionRequestMapping.api_common)
public interface UserUrlVersionFeign {
    @PostMapping(value = BaseVersionRequestMapping.UserUrlVersion.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData) throws JiWeiException;
    @PutMapping(value =  BaseVersionRequestMapping.UserUrlVersion.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData) throws JiWeiException;
    @DeleteMapping(value =BaseVersionRequestMapping.UserUrlVersion.api_delete)
    Envelop delete(@PathVariable(required = true, value = "codes") String codes, @RequestParam(value = "userCode") String userCode, @RequestParam(value = "userName") String userName) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.UserUrlVersion.api_getByCode)
    Envelop findByCode(@PathVariable(required = true, value = "code") String code) throws JiWeiException;
    @RequestMapping(value = BaseVersionRequestMapping.UserUrlVersion.api_getList, method = RequestMethod.GET)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.UserUrlVersion.api_getListNoPage)
    Envelop getListNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
    @GetMapping(value = BaseVersionRequestMapping.UserUrlVersion.api_changeUserVersion)
    Envelop changeUserVersion(@RequestParam(value="serverCode")String serverCode,@RequestParam(value="userCodes") String userCodes,@RequestParam(value="userCode") String userCode, @RequestParam(value="userName")String userName, @RequestParam(value="saasId")String saasId) throws JiWeiException;
}

+ 0 - 44
web-gateway/src/main/java/com/yihu/jw/feign/base/version/WlyyVersionFeign.java

@ -1,44 +0,0 @@
package com.yihu.jw.feign.base.version;
import com.yihu.jw.feign.fallbackfactory.base.version.WlyyVersionFeignFallbackFactory;
import com.yihu.jw.restmodel.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.rm.base.BaseVersionRequestMapping;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = WlyyVersionFeignFallbackFactory.class
)
@RequestMapping(value = BaseVersionRequestMapping.api_common)
public interface WlyyVersionFeign {
    @PostMapping(value = BaseVersionRequestMapping.WlyyVersion.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop create(@RequestBody String jsonData);
    @PutMapping(value =  BaseVersionRequestMapping.WlyyVersion.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop update(@RequestBody String jsonData);
    @DeleteMapping(value =BaseVersionRequestMapping.WlyyVersion.api_delete)
    Envelop delete(@PathVariable(value ="codes" ,required = true)  String codes, @RequestParam(value="userCode") String userCode, @RequestParam(value="userName") String userName);
    @GetMapping(value = BaseVersionRequestMapping.WlyyVersion.api_getByCode)
    Envelop findByCode(@PathVariable(value ="code",required = true)  String code);
    @RequestMapping(value = BaseVersionRequestMapping.WlyyVersion.api_getList, method = RequestMethod.GET)
    Envelop getList(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page);
    @GetMapping(value = BaseVersionRequestMapping.WlyyVersion.api_getListNoPage)
    Envelop getListNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts);
}

+ 0 - 70
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/ServerUrlVersionFeignFallbackFactory.java

@ -1,70 +0,0 @@
package com.yihu.jw.feign.fallbackfactory.base.version;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.version.ServerUrlVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
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;
@Component
public class ServerUrlVersionFeignFallbackFactory implements FallbackFactory<ServerUrlVersionFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public ServerUrlVersionFeign create(Throwable e) {
        return new ServerUrlVersionFeign() {
            @Override
            public Envelop create(@RequestBody String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("创建后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop update(@RequestBody String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("更新后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop delete(String codes, String userCode, String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:" + codes);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop findByCode(String code) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("code:" + code);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getList(String fields, String filterStr, String sorts, int size, int page) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("分页查找后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filterStr);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                tracer.getCurrentSpan().logEvent("size:" + size);
                tracer.getCurrentSpan().logEvent("page:" + page);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getListNoPage(String fields, String filters, String sorts) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找后台url版本列表失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filters);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                throw new JiWeiException(e);
            }
        };
    }
}

+ 0 - 72
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/ServerVersionFeignFallbackFactory.java

@ -1,72 +0,0 @@
package com.yihu.jw.feign.fallbackfactory.base.version;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.version.ServerVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
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;
@Component
public class ServerVersionFeignFallbackFactory implements FallbackFactory<ServerVersionFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public ServerVersionFeign create(Throwable e) {
        return new ServerVersionFeign() {
            @Override
            public Envelop create(@RequestBody String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("创建服务器版本失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:"+jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop update(@RequestBody String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("更新服务器版本失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:"+jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop delete(String codes,String userCode,String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除服务器版本失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:"+codes);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop findByCode(String code) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找服务器版本失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("code:"+code);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getList(String fields, String filterStr, String sorts, int size, int page) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("分页查找服务器版本失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filterStr);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                tracer.getCurrentSpan().logEvent("size:" + size);
                tracer.getCurrentSpan().logEvent("page:" + page);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getListNoPage(String fields, String filters, String sorts) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找服务器版本列表失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filters);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                throw new JiWeiException(e);
            }
        };
    }
}

+ 0 - 82
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/UserUrlVersionFeignFallbackFactory.java

@ -1,82 +0,0 @@
package com.yihu.jw.feign.fallbackfactory.base.version;
import com.yihu.jw.exception.business.JiWeiException;
import com.yihu.jw.feign.base.version.UserUrlVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
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;
@Component
public class UserUrlVersionFeignFallbackFactory implements FallbackFactory<UserUrlVersionFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public UserUrlVersionFeign create(Throwable e) {
        return new UserUrlVersionFeign() {
            @Override
            public Envelop create(@RequestBody String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("创建后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop update(@RequestBody String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("更新后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:" + jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop delete(String codes, String userCode, String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:" + codes);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop findByCode(String code) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("code:" + code);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getList(String fields, String filterStr, String sorts, int size, int page) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("分页查找后台url版本失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filterStr);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                tracer.getCurrentSpan().logEvent("size:" + size);
                tracer.getCurrentSpan().logEvent("page:" + page);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getListNoPage(String fields, String filters, String sorts) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找后台url版本列表失败:原因:" + e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filters);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop changeUserVersion(@RequestParam(value = "serverCode") String serverCode, @RequestParam(value = "userCodes") String userCodes, @RequestParam(value = "userCode") String userCode, @RequestParam(value = "userName") String userName,String saasId) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("更改用户版本失败,失败原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("serverCode:" + serverCode);
                tracer.getCurrentSpan().logEvent("userCodes:" + userCodes);
                tracer.getCurrentSpan().logEvent("userCode:" + userCode);
                tracer.getCurrentSpan().logEvent("userCode:" + userCode);
                tracer.getCurrentSpan().logEvent("userName:" + userName);
                throw new JiWeiException(e);
            }
        };
    }
}

+ 0 - 54
web-gateway/src/main/java/com/yihu/jw/feign/fallbackfactory/base/version/WlyyVersionFeignFallbackFactory.java

@ -1,54 +0,0 @@
package com.yihu.jw.feign.fallbackfactory.base.version;
import com.yihu.jw.feign.base.version.WlyyVersionFeign;
import com.yihu.jw.restmodel.common.Envelop;
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.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
@Component
public class WlyyVersionFeignFallbackFactory implements FallbackFactory<WlyyVersionFeign> {
    @Autowired
    private Tracer tracer;
    @Override
    public WlyyVersionFeign create(Throwable e) {
        return new WlyyVersionFeign() {
            @Override
            public Envelop create(@RequestBody String jsonData) {
                return null;
            }
            @Override
            public Envelop update(@RequestBody String jsonData) {
                return null;
            }
            @Override
            public Envelop delete(@PathVariable String codes, @RequestParam String userCode, @RequestParam String userName) {
                return null;
            }
            @Override
            public Envelop findByCode(String code) {
                return null;
            }
            @Override
            public Envelop getList(String fields, String filterStr, String sorts, int size, int page) {
                return null;
            }
            @Override
            public Envelop getListNoPage(String fields, String filters, String sorts) {
                return null;
            }
        };
    }
}

+ 0 - 21
web-gateway/src/main/java/com/yihu/jw/version/ApiVersion.java

@ -1,21 +0,0 @@
package com.yihu.jw.version;
import org.springframework.web.bind.annotation.Mapping;
import java.lang.annotation.*;
/**
 * 版本控制的注解
 * Created by chenweida on 2017/6/15.
 */
@Target({ElementType.METHOD, ElementType.TYPE})
@Retention(RetentionPolicy.RUNTIME)
@Documented
@Mapping
public @interface ApiVersion {
    /**
     * 版本号
     * @return
     */
    int value();
}

+ 0 - 51
web-gateway/src/main/java/com/yihu/jw/version/ApiVesrsionCondition.java

@ -1,51 +0,0 @@
package com.yihu.jw.version;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.condition.RequestCondition;
import javax.servlet.http.HttpServletRequest;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
/**
 * 版本控制的规则类
 * Created by chenweida on 2017/6/15.
 */
public class ApiVesrsionCondition implements RequestCondition<ApiVesrsionCondition> {
    // 路径中版本的前缀, 这里用 /v[1-9]/的形式
    private final static Pattern VERSION_PREFIX_PATTERN = Pattern.compile("v(\\d+)/");
    private int apiVersion;
    public ApiVesrsionCondition(int apiVersion){
        this.apiVersion = apiVersion;
    }
    public ApiVesrsionCondition combine(ApiVesrsionCondition other) {
        // 采用最后定义优先原则,则方法上的定义覆盖类上面的定义
        return new ApiVesrsionCondition(other.getApiVersion());
    }
    public ApiVesrsionCondition getMatchingCondition(HttpServletRequest request) {
        String path=request.getRequestURI();
        Matcher m = VERSION_PREFIX_PATTERN.matcher(path);
        if(m.find()){
            Integer version = Integer.valueOf(m.group(1));
            if(version >= this.apiVersion) // 如果请求的版本号大于配置版本号, 则满足
                return this;
        }
        return null;
    }
    public int compareTo(ApiVesrsionCondition other, HttpServletRequest request) {
        // 优先匹配最新的版本号
        return other.getApiVersion() - this.apiVersion;
    }
    public int getApiVersion() {
        return apiVersion;
    }
}

+ 0 - 31
web-gateway/src/main/java/com/yihu/jw/version/JWRequestMappingHandlerMapping.java

@ -1,31 +0,0 @@
package com.yihu.jw.version;
import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.stereotype.Component;
import org.springframework.web.servlet.mvc.condition.RequestCondition;
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
import java.lang.reflect.Method;
/**
 * Created by chenweida on 2017/6/15.
 * 扩展spring的RequestMappingHandlerMapping
 */
public class JWRequestMappingHandlerMapping extends RequestMappingHandlerMapping {
    @Override
    protected RequestCondition<ApiVesrsionCondition> getCustomTypeCondition(Class<?> handlerType) {
        ApiVersion apiVersion = AnnotationUtils.findAnnotation(handlerType, ApiVersion.class);
        return createCondition(apiVersion);
    }
    @Override
    protected RequestCondition<ApiVesrsionCondition> getCustomMethodCondition(Method method) {
        ApiVersion apiVersion = AnnotationUtils.findAnnotation(method, ApiVersion.class);
        return createCondition(apiVersion);
    }
    private RequestCondition<ApiVesrsionCondition> createCondition(ApiVersion apiVersion) {
        return apiVersion == null ? null : new ApiVesrsionCondition(apiVersion.value());
    }
}