Browse Source

新增网关

chenyongxing 8 years ago
parent
commit
fec71aa9a6
17 changed files with 906 additions and 35 deletions
  1. 1 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/WxContants.java
  2. 45 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatAccessTokenController.java
  3. 61 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatContants.java
  4. 20 8
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatController.java
  5. 129 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatGraphicMessageController.java
  6. 128 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatMenuController.java
  7. 135 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatTemplateControlle.java
  8. 25 0
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/AccessTokenFegin.java
  9. 57 0
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/GraphicMessageFegin.java
  10. 5 4
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatFegin.java
  11. 53 0
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatMenuFegin.java
  12. 64 0
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatTemplateFegin.java
  13. 0 22
      web-gateway/src/main/java/com/yihu/jw/fegin/fallback/base/wx/WechatFeginFallback.java
  14. 24 0
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/AccessTokenFeginFallbackFactory.java
  15. 54 0
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/GraphicMessageFeginFallbackFactory.java
  16. 52 0
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatMenuFeginFallbackFactory.java
  17. 53 0
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatTemplateFeginFallbackFactory.java

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

@ -111,9 +111,9 @@ public class WxContants {
        public static final String api_delete="delete";
        public static final String api_getWxGraphicMessageNoPage="getWxGraphicMessageNoPage";
        public static final String api_sendGraphicMessages="sendGraphicMessages";
        public static final String api_getWxGraphicMessages="getWxGraphicMessages";
        public static final String api_getByCode="getByCode";
        public static final String message_success_create="wxGraphicMessage create success";
        public static final String message_success_update="wxGraphicMessage update success";
        public static final String message_success_find="wxGraphicMessage find success";

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

@ -0,0 +1,45 @@
package com.yihu.jw.controller.base.wx;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.fegin.base.wx.AccessTokenFegin;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping(WechatContants.AccessToken.api_common)
@Api(description = "微信token相关")
public class WechatAccessTokenController {
    private Logger logger= LoggerFactory.getLogger(WechatAccessTokenController.class);
    @Autowired
    private AccessTokenFegin accessTokenFegin;
    @Autowired
    private Tracer tracer;
    @GetMapping(value = WechatContants.AccessToken.api_get)
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWxAccessToken(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @RequestParam(value = "wechatCode") String wechatCode) {
        return accessTokenFegin.getWxAccessToken(wechatCode);
    }
}

+ 61 - 0
web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatContants.java

@ -0,0 +1,61 @@
package com.yihu.jw.controller.base.wx;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
public class WechatContants {
    //微信token模块常量
    public static class AccessToken{
        public static final String message_success_get="wxAccessToken get success";
        public static final String api_common="accessToken";
        public static final String api_create="create";
        public static final String api_get="get";
    }
    //微信按钮模块常量
    public static class Menu{
        public static final String api_common="menu";
        public static final String api_create="create";
        public static final String api_delete="delete";
        public static final String api_getByCode="getByCode";
        public static final String api_update="update";
        public static final String api_getWxMenus="getWxMenus";
        public static final String api_getWxMenuNoPage="getWxMenuNoPage";
        public static final String api_createMenu="createMenu";
    }
    //微信模板消息
    public static class Template {
        public static final String api_common="template";
        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_getWxTemplates="getWxTemplates";
        public static final String api_getWxTemplatesNoPage="getWxTemplatesNoPage";
        public static final String api_sendTemplateMessage="sendTemplateMessage";
    }
    //微信配置表
    public static class Config {
        public static final String api_common="wechatConfig";
        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_getWechatNoPage="getWechatNoPage";
        public static final String api_getWechats="getWechats";
        public static final String api_getByCode="getByCode";
    }
    //微信图文消息
    public static class GraphicMessage {
        public static final String api_common="graphicMessage";
        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_getWxGraphicMessageNoPage="getWxGraphicMessageNoPage";
        public static final String api_sendGraphicMessages="sendGraphicMessages";
        public static final String api_getWxGraphicMessages="getWxGraphicMessages";
        public static final String api_getByCode="getByCode";
    }
}

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

@ -4,7 +4,6 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.fegin.base.wx.WechatFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,8 +18,10 @@ import javax.servlet.http.HttpServletResponse;
@RestController
@RequestMapping(WechatContants.Config.api_common)
@Api(description = "微信配置")
public class WechatController{
    private Logger logger= LoggerFactory.getLogger(WechatController.class);
    @Autowired
    private WechatFegin wechatFegin;
@ -29,7 +30,7 @@ public class WechatController{
    private Tracer tracer;
    @ApiOperation(value = "创建微信配置")
    @PostMapping(value = "/"+WxContants.Wechat.api_common+"/"+WxContants.Wechat.api_create)
    @PostMapping(value = WechatContants.Config.api_create)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -42,7 +43,7 @@ public class WechatController{
    }
    @ApiOperation(value = "更新微信配置")
    @PutMapping(value = "/"+WxContants.Wechat.api_common+"/"+WxContants.Wechat.api_update)
    @PutMapping(value = WechatContants.Config.api_update)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -53,8 +54,11 @@ public class WechatController{
        return wechat;
    }
    @DeleteMapping(value = "/"+WxContants.Wechat.api_common+"/"+WxContants.Wechat.api_delete)
    @DeleteMapping(value = WechatContants.Config.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWechat(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
@ -62,8 +66,11 @@ public class WechatController{
        return wechat;
    }
    @GetMapping(value = "/"+WxContants.Wechat.api_common+"/"+WxContants.Wechat.api_getByCode)
    @GetMapping(value = WechatContants.Config.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")
            @RequestParam(value = "code", required = true) String code
@ -71,8 +78,11 @@ public class WechatController{
       return wechatFegin.findByCode(code);
    }
    @RequestMapping(value = "/"+WxContants.Wechat.api_common+"/"+WxContants.Wechat.api_getWechats, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.Config.api_getWechats, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信配置列表(分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWechats(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @RequestParam(value = "fields", required = false) String fields,
@ -90,9 +100,11 @@ public class WechatController{
        return envelop;
    }
    @GetMapping(value = "/"+WxContants.Wechat.api_common+"/"+WxContants.Wechat.api_getWechatNoPage)
    @GetMapping(value = WechatContants.Config.api_getWechatNoPage)
    @ApiOperation(value = "获取微信列表配置,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWechatNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @RequestParam(value = "fields", required = false) String fields,

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

@ -0,0 +1,129 @@
package com.yihu.jw.controller.base.wx;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.fegin.base.wx.GraphicMessageFegin;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping(WechatContants.GraphicMessage.api_common)
@Api(description = "微信图文相关")
public class WechatGraphicMessageController {
    private Logger logger= LoggerFactory.getLogger(WechatGraphicMessageController.class);
    @Autowired
    private GraphicMessageFegin graphicMessageFegin;
    @Autowired
    private Tracer tracer;
    @PostMapping(value = WechatContants.GraphicMessage.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 createWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return graphicMessageFegin.createWxGraphicMessage(jsonData);
    }
    @PutMapping(value = WechatContants.GraphicMessage.api_update, 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 updateWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return graphicMessageFegin.updateWxGraphicMessage(jsonData);
    }
    @DeleteMapping(value = WechatContants.GraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWxGraphicMessage(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        return graphicMessageFegin.deleteWxGraphicMessage(code);
    }
    @GetMapping(value = WechatContants.GraphicMessage.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")
            @RequestParam(value = "code", required = true) String code
    ) {
        return graphicMessageFegin.findByCode(code);
    }
    //@RequestMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    //@ApiOperation(value = "获取微信图文消息列表(分页)")
    //public Envelop getWxGraphicMessages(
    //        @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
    //        @RequestParam(value = "fields", required = false) String fields,
    //        @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
    //        @RequestParam(value = "filters", required = false) String filters,
    //        @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+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 {
    //    return graphicMessageFegin.getWxGraphicMessages(fields,filters,sorts,size,page,request,response);
    //}
    @GetMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessageNoPage)
    @ApiOperation(value = "获取图文消息列表,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWxGraphicMessageNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        return graphicMessageFegin.getWxGraphicMessageNoPage(fields,filters,sorts);
    }
    @GetMapping(value = WechatContants.GraphicMessage.api_sendGraphicMessages)
    @ApiOperation(value = "发送图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @ResponseBody
    public String sendGraphicMessages(
            @ApiParam(name = "codes", value = "根据code发送微信图文消息,多个code用,分割")
            @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "fromUserName", value = "用户openid")
            @RequestParam(value = "fromUserName", required = true) String fromUserName,
            @ApiParam(name = "toUserName", value = "公众号")
            @RequestParam(value = "toUserName", required = true) String toUserName
    ) throws Exception {
        return graphicMessageFegin.sendGraphicMessages(codes,fromUserName,toUserName);
    }
}

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

@ -0,0 +1,128 @@
package com.yihu.jw.controller.base.wx;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.fegin.base.wx.WechatMenuFegin;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping(WechatContants.Menu.api_common)
@Api(description = "微信菜单配置")
public class WechatMenuController {
    private Logger logger= LoggerFactory.getLogger(WechatMenuController.class);
    @Autowired
    private WechatMenuFegin wechatMenuFegin;
    @Autowired
    private Tracer tracer;
    @PostMapping(value = WechatContants.Menu.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 createWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return wechatMenuFegin.createWxMenu(jsonData);
    }
    @PutMapping(value = WechatContants.Menu.api_update, 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 updateWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return wechatMenuFegin.updateWxMenu(jsonData);
    }
    @DeleteMapping(value = WechatContants.Menu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWxMenu(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        return wechatMenuFegin.deleteWxMenu(code);
    }
    @GetMapping(value = WechatContants.Menu.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")
            @RequestParam(value = "code", required = true) String code
    ) {
        return wechatMenuFegin.findByCode(code);
    }
    //@RequestMapping(value = WechatContants.Menu.api_getWxMenus, method = RequestMethod.GET)
    //@ApiOperation(value = "获取微信菜单列表(分页)")
    //public Envelop getWxMenus(
    //        @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,
    //        HttpServletRequest request,
    //        HttpServletResponse response) throws Exception {
    //    return wechatMenuFegin.getWxMenus(fields,filters,sorts,size,page,request,response);
    //}
    @GetMapping(value = WechatContants.Menu.api_getWxMenuNoPage)
    @ApiOperation(value = "获取微信菜单列表,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWxMenuNoPage(
            @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 {
        return wechatMenuFegin.getWxMenuNoPage(fields,filters,sorts);
    }
    /**
     * 创建微信公众号菜单
     *
     * @return
     */
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @RequestMapping(value = WechatContants.Menu.api_createMenu ,method = RequestMethod.GET)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop createWechatMenu(
            @ApiParam(name = "wechatCode", value = "", defaultValue = "")
            @RequestParam(value = "wechatCode", required = true)String wechatCode){
        return wechatMenuFegin.createWechatMenu(wechatCode);
    }
}

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

@ -0,0 +1,135 @@
package com.yihu.jw.controller.base.wx;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.fegin.base.wx.WechatTemplateFegin;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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 Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping(WechatContants.Template.api_common)
@Api(description = "微信模板消息相关")
public class WechatTemplateControlle {
    private Logger logger= LoggerFactory.getLogger(WechatTemplateControlle.class);
    @Autowired
    private WechatTemplateFegin wechatTemplateFegin;
    @Autowired
    private Tracer tracer;
    @PostMapping(value = WechatContants.Template.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 createWxTemplate(
            @ApiParam(name = "json_data", value = "微信模版json字符串")
            @RequestBody String jsonData) {
        return wechatTemplateFegin.createWxTemplate(jsonData);
    }
    @PutMapping(value = WechatContants.Template.api_update, 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 updateWxTemplate(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        return wechatTemplateFegin.updateWxTemplate(jsonData);
    }
    @DeleteMapping(value = WechatContants.Template.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWxTemplate(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        return wechatTemplateFegin.deleteWxTemplate(code);
    }
    @GetMapping(value = WechatContants.Template.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")
            @RequestParam(value = "code", required = true) String code
    ) {
        return wechatTemplateFegin.findByCode(code);
    }
    //@RequestMapping(value = WechatContants.Template.api_getWxTemplates, method = RequestMethod.GET)
    //@ApiOperation(value = "获取微信模版列表(分页)")
    //public Envelop getWechats(
    //        @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
    //        @RequestParam(value = "fields", required = false) String fields,
    //        @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
    //        @RequestParam(value = "filters", required = false) String filters,
    //        @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+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 {
    //    return wechatTemplateFegin.getWechats(fields,filters,sorts,size,page,request,response);
    //}
    @GetMapping(value = WechatContants.Template.api_getWxTemplatesNoPage)
    @ApiOperation(value = "获取微信模版列表(不分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getWechatNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+title,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        return wechatTemplateFegin.getWechatNoPage(fields,filters,sorts);
    }
    @GetMapping(value = WechatContants.Template.api_sendTemplateMessage)
    @ApiOperation(value = "发送微信模板消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    @ResponseBody
    public Envelop sendTemplateMessage(
            @ApiParam(name="openid",value="微信用户的openid")
            @RequestParam String openid,
            @ApiParam(name="templateCode",value = "模板code")
            @RequestParam String templateCode,
            @ApiParam(name="url",value="模板跳转链接")
            @RequestParam(required = false) String url,
            @ApiParam(name="appid",value="所需跳转到的小程序appid(该小程序appid必须与发模板消息的公众号是绑定关联关系)")
            @RequestParam(required = false) String appid,
            @ApiParam(name="pagepath",value="所需跳转到小程序的具体页面路径,支持带参数,(示例index?foo=bar)")
            @RequestParam(required = false) String pagepath,
            @ApiParam(name="data",value="json字符串")
            @RequestParam String data
    ){
        return wechatTemplateFegin.sendTemplateMessage(openid,templateCode,url,appid,pagepath,data);
    }
}

+ 25 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/AccessTokenFegin.java

@ -0,0 +1,25 @@
package com.yihu.jw.fegin.base.wx;
import com.yihu.jw.fegin.fallbackfactory.base.wx.AccessTokenFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = AccessTokenFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxAccessToken.api_common)
public interface AccessTokenFegin {
    @RequestMapping(value = WxContants.WxAccessToken.api_get, method = RequestMethod.GET)
    Envelop getWxAccessToken(@RequestParam(value = "wechatCode") String wechatCode) ;
}

+ 57 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/GraphicMessageFegin.java

@ -0,0 +1,57 @@
package com.yihu.jw.fegin.base.wx;
import com.yihu.jw.fegin.fallbackfactory.base.wx.GraphicMessageFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = GraphicMessageFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxGraphicMessage.api_common)
public interface GraphicMessageFegin {
    @RequestMapping(value = WxContants.WxGraphicMessage.api_create, method = RequestMethod.POST)
    Envelop createWxGraphicMessage( @RequestBody String jsonData);
    @RequestMapping(value = WxContants.WxGraphicMessage.api_update,method = RequestMethod.PUT)
    Envelop updateWxGraphicMessage( @RequestBody String jsonData);
    @RequestMapping(value = WxContants.WxGraphicMessage.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWxGraphicMessage(String code);
    @RequestMapping(value = WxContants.WxGraphicMessage.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(String code);
    //@RequestMapping(value = WxContants.WxGraphicMessage.api_getWxGraphicMessages,method = RequestMethod.GET)
    //Envelop getWxGraphicMessages(
    //        @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,
    //        HttpServletRequest request,
    //        HttpServletResponse response);
    @RequestMapping(value = WxContants.WxGraphicMessage.api_getWxGraphicMessageNoPage,method = RequestMethod.GET)
    Envelop getWxGraphicMessageNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts);
    @RequestMapping(value = WxContants.WxGraphicMessage.api_sendGraphicMessages,method = RequestMethod.GET)
    String sendGraphicMessages(
            @RequestParam(value = "codes", required = true) String codes,
            @RequestParam(value = "fromUserName", required = true) String fromUserName,
            @RequestParam(value = "toUserName", required = true) String toUserName
    );
}

+ 5 - 4
web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatFegin.java

@ -8,6 +8,7 @@ import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(
@ -24,14 +25,14 @@ public interface WechatFegin {
    Envelop updateWechat(String jsonData);
    @RequestMapping(value = WxContants.Wechat.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWechat(String code);
    Envelop deleteWechat(@RequestParam(value = "code") String code);
    @RequestMapping(value = WxContants.Wechat.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(String code);
    Envelop findByCode(@RequestParam(value = "code") String code);
    @RequestMapping(value = WxContants.Wechat.api_getWechats ,method = RequestMethod.GET)
    Envelop getWechats(String fields, String filters, String sorts, int page, int size);
    Envelop getWechats(@RequestParam(value = "fields")String fields, @RequestParam(value = "filters") String filters, @RequestParam(value = "sorts")String sorts, @RequestParam(value = "page")int page,@RequestParam(value = "size") int size);
    @RequestMapping(value = WxContants.Wechat.api_getWechatNoPage,method = RequestMethod.GET )
    Envelop getWechatNoPage(String fields, String filters, String sorts);
    Envelop getWechatNoPage(@RequestParam(value = "code")String fields,@RequestParam(value = "code") String filters,@RequestParam(value = "code") String sorts);
}

+ 53 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatMenuFegin.java

@ -0,0 +1,53 @@
package com.yihu.jw.fegin.base.wx;
import com.yihu.jw.fegin.fallbackfactory.base.wx.WechatMenuFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  =WechatMenuFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxMenu.api_common)
public interface WechatMenuFegin {
    @RequestMapping(value = WxContants.WxMenu.api_create,method = RequestMethod.POST)
    Envelop createWxMenu( @RequestBody String jsonData) ;
    @RequestMapping(value = WxContants.WxMenu.api_update,method = RequestMethod.PUT)
    Envelop updateWxMenu( @RequestBody String jsonData);
    @RequestMapping(value = WxContants.WxMenu.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWxMenu(@RequestParam(value="code")String code);
    @RequestMapping(value = WxContants.WxMenu.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(@RequestParam(value="code")String code);
    @RequestMapping(value = WxContants.WxMenu.api_getWxMenuNoPage,method = RequestMethod.GET)
    Envelop getWxMenuNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts);
    //@RequestMapping(value = WxContants.WxMenu.api_getWxMenus,method = RequestMethod.GET)
    //Envelop getWxMenus(
    //        @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,
    //        HttpServletRequest request,
    //        HttpServletResponse response);
    @RequestMapping(value = WxContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    Envelop createWechatMenu(@RequestParam(value = "wechatCode", required = true)String wechatCode);
}

+ 64 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatTemplateFegin.java

@ -0,0 +1,64 @@
package com.yihu.jw.fegin.base.wx;
import com.yihu.jw.fegin.fallbackfactory.base.wx.WechatTemplateFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  =WechatTemplateFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxTemplate.api_common)
public interface WechatTemplateFegin {
    //@PostMapping(value = WxContants.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WxContants.WxTemplate.api_create ,method = RequestMethod.POST)
    Envelop createWxTemplate(@RequestBody String jsonData);
    //@PutMapping(value = WxContants.WxTemplate.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WxContants.WxTemplate.api_update ,method = RequestMethod.PUT)
    Envelop updateWxTemplate(@RequestBody String jsonData);
    //@DeleteMapping(value = WxContants.WxTemplate.api_delete)
    @RequestMapping(value = WxContants.WxTemplate.api_delete ,method = RequestMethod.DELETE)
    Envelop deleteWxTemplate( @RequestParam(value = "code", required = true) String code);
    //@GetMapping(value = WxContants.WxTemplate.api_getByCode)
    @RequestMapping(value = WxContants.WxTemplate.api_getByCode ,method = RequestMethod.GET)
    Envelop findByCode( @RequestParam(value = "code", required = true) String code);
    //@GetMapping(value = WxContants.WxTemplate.api_getWxTemplatesNoPage)
    @RequestMapping(value = WxContants.WxTemplate.api_getWxTemplatesNoPage ,method = RequestMethod.GET)
    Envelop getWechatNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts);
    //@RequestMapping(value = WxContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    //Envelop getWechats(
    //        @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,
    //        HttpServletRequest request,
    //        HttpServletResponse response);
    //@GetMapping(value = WxContants.WxTemplate.api_sendTemplateMessage)
    @RequestMapping(value = WxContants.WxTemplate.api_sendTemplateMessage ,method = RequestMethod.GET)
    @ResponseBody
    Envelop sendTemplateMessage(
            @RequestParam(value="openid") String openid,
            @RequestParam(value="templateCode") String templateCode,
            @RequestParam(value="url",required = false) String url,
            @RequestParam(value="appid",required = false) String appid,
            @RequestParam(value="pagepath",required = false) String pagepath,
            @RequestParam(value="data") String data
    );
}

+ 0 - 22
web-gateway/src/main/java/com/yihu/jw/fegin/fallback/base/wx/WechatFeginFallback.java

@ -1,22 +0,0 @@
package com.yihu.jw.fegin.fallback.base.wx;
import com.yihu.jw.fegin.PatientFegin;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by chenweida on 2017/5/13.
 */
@Component
public class WechatFeginFallback implements PatientFegin {
    private Logger logger = LoggerFactory.getLogger(WechatFeginFallback.class);
    @Override
    public String findByCode( @RequestParam(value = "code", required = true) String code) {
        logger.info("进入断路器");
        return "断路器启动";
    }
}

+ 24 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/AccessTokenFeginFallbackFactory.java

@ -0,0 +1,24 @@
package com.yihu.jw.fegin.fallbackfactory.base.wx;
import com.yihu.jw.fegin.base.wx.AccessTokenFegin;
import com.yihu.jw.restmodel.common.Envelop;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@Component
public class AccessTokenFeginFallbackFactory implements FallbackFactory< AccessTokenFegin> {
    @Override
    public AccessTokenFegin create(Throwable throwable) {
        return new AccessTokenFegin() {
            @Override
            public Envelop getWxAccessToken(@RequestParam(value = "wechatCode") String wechatCode) {
                return null;
            }
        };
    }
}

+ 54 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/GraphicMessageFeginFallbackFactory.java

@ -0,0 +1,54 @@
package com.yihu.jw.fegin.fallbackfactory.base.wx;
import com.yihu.jw.fegin.base.wx.GraphicMessageFegin;
import com.yihu.jw.restmodel.common.Envelop;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@Component
public class GraphicMessageFeginFallbackFactory implements FallbackFactory<GraphicMessageFegin> {
    @Override
    public GraphicMessageFegin create(Throwable throwable) {
        return new GraphicMessageFegin() {
            @Override
            public Envelop createWxGraphicMessage(@RequestParam(value = "jsonData") String jsonData) {
                return null;
            }
            @Override
            public Envelop updateWxGraphicMessage(@RequestParam(value = "jsonData") String jsonData) {
                return null;
            }
            @Override
            public Envelop deleteWxGraphicMessage(String code) {
                return null;
            }
            @Override
            public Envelop findByCode(String code) {
                return null;
            }
            //@Override
            //public Envelop getWxGraphicMessages(@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, HttpServletRequest request, HttpServletResponse response) {
            //    return null;
            //}
            @Override
            public Envelop getWxGraphicMessageNoPage(@RequestParam(value = "fields", required = false) String fields, @RequestParam(value = "filters", required = false) String filters, @RequestParam(value = "sorts", required = false) String sorts) {
                return null;
            }
            @Override
            public String sendGraphicMessages(@RequestParam(value = "codes", required = true) String codes, @RequestParam(value = "fromUserName", required = true) String fromUserName, @RequestParam(value = "toUserName", required = true) String toUserName) {
                return null;
            }
        };
    }
}

+ 52 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatMenuFeginFallbackFactory.java

@ -0,0 +1,52 @@
package com.yihu.jw.fegin.fallbackfactory.base.wx;
import com.yihu.jw.fegin.base.wx.WechatMenuFegin;
import com.yihu.jw.restmodel.common.Envelop;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@Component
public class WechatMenuFeginFallbackFactory implements FallbackFactory<WechatMenuFegin> {
    @Override
    public WechatMenuFegin create(Throwable throwable) {
        return new WechatMenuFegin() {
            @Override
            public Envelop createWxMenu(String jsonData) {
                return null;
            }
            @Override
            public Envelop updateWxMenu(String jsonData) {
                return null;
            }
            @Override
            public Envelop deleteWxMenu(String code) {
                return null;
            }
            @Override
            public Envelop findByCode(String code) {
                return null;
            }
            @Override
            public Envelop getWxMenuNoPage(String fields, String filters, String sorts) {
                return null;
            }
            //@Override
            @Override
            public Envelop createWechatMenu(String wechatCode) {
                return null;
            }
            //public Envelop getWxMenus(String fields, String filters, String sorts, int size, int page, HttpServletRequest request, HttpServletResponse response) {
            //    return null;
            //}
        };
    }
}

+ 53 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatTemplateFeginFallbackFactory.java

@ -0,0 +1,53 @@
package com.yihu.jw.fegin.fallbackfactory.base.wx;
import com.yihu.jw.fegin.base.wx.WechatTemplateFegin;
import com.yihu.jw.restmodel.common.Envelop;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@Component
public class WechatTemplateFeginFallbackFactory implements FallbackFactory<WechatTemplateFegin>{
    @Override
    public WechatTemplateFegin create(Throwable throwable) {
        return new WechatTemplateFegin() {
            @Override
            public Envelop createWxTemplate(String jsonData) {
                return null;
            }
            @Override
            public Envelop updateWxTemplate(String jsonData) {
                return null;
            }
            @Override
            public Envelop deleteWxTemplate(String code) {
                return null;
            }
            @Override
            public Envelop findByCode(String code) {
                return null;
            }
            @Override
            public Envelop sendTemplateMessage(String openid, String templateCode, String url, String appid, String pagepath, String data) {
                return null;
            }
            @Override
            public Envelop getWechatNoPage(String fields, String filters, String sorts) {
                return null;
            }
            //@Override
            //public Envelop getWechats(String fields, String filters, String sorts, int size, int page, HttpServletRequest request, HttpServletResponse response) {
            //    return null;
            //}
        };
    }
}