chenyongxing 7 rokov pred
rodič
commit
f6bc1cd810
25 zmenil súbory, kde vykonal 1869 pridanie a 23 odobranie
  1. 5 5
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WechatController.java
  2. 4 4
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxWechat.java
  3. 14 9
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java
  4. 8 0
      svr/svr-manage/pom.xml
  5. 23 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/config/BeanConfig.java
  6. 67 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/GraphicMessageController.java
  7. 94 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/WechatConfigController.java
  8. 167 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/GraphicMessage.java
  9. 197 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/Template.java
  10. 224 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/WechatConfig.java
  11. 49 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/GraphicMessageService.java
  12. 88 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/WechatConfigService.java
  13. 8 2
      svr/svr-manage/src/main/resources/webapp/common/js/util/util.js
  14. 91 0
      svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/html/graphicMessageList.html
  15. 38 0
      svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/js/graphicMessageList.js
  16. 82 0
      svr/svr-manage/src/main/resources/webapp/html/wechat/template/html/templateList.html
  17. 29 0
      svr/svr-manage/src/main/resources/webapp/html/wechat/template/js/templateList.js
  18. 204 0
      svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/html/wechatConfigList.html
  19. 364 0
      svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/js/wechatConfigList.js
  20. 5 0
      web-gateway/pom.xml
  21. 49 0
      web-gateway/src/main/java/com/yihu/jw/controller/base/SaasController.java
  22. 14 2
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatController.java
  23. 22 0
      web-gateway/src/main/java/com/yihu/jw/fegin/base/SaasFegin.java
  24. 2 1
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatFegin.java
  25. 21 0
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/SaasFeginFallbackFactory.java

+ 5 - 5
svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WechatController.java

@ -59,10 +59,10 @@ public class WechatController extends EnvelopRestController {
    @DeleteMapping(value = WxContants.Wechat.api_delete)
    @DeleteMapping(value = WxContants.Wechat.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    public Envelop deleteWechat(
    public Envelop deleteWechat(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
            @ApiParam(name = "codes", value = "codes")
            @RequestParam(value = "codes", required = true) String codes) {
        try {
        try {
            wechatService.deleteWechat(code);
            wechatService.deleteWechat(codes);
            return Envelop.getSuccess(WxContants.Wechat.message_success_delete );
            return Envelop.getSuccess(WxContants.Wechat.message_success_delete );
        } catch (ApiException e) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
@ -85,11 +85,11 @@ public class WechatController extends EnvelopRestController {
    @RequestMapping(value = WxContants.Wechat.api_getWechats, method = RequestMethod.GET)
    @RequestMapping(value = WxContants.Wechat.api_getWechats, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信配置列表(分页)")
    @ApiOperation(value = "获取微信配置列表(分页)")
    public Envelop getWechats(
    public Envelop getWechats(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档")
            @RequestParam(value = "sorts", required = false) String sorts,
            @RequestParam(value = "sorts", required = false) String sorts,
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @ApiParam(name = "size", value = "分页大小", defaultValue = "15")
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "size", required = false) int size,

+ 4 - 4
svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxWechat.java

@ -19,7 +19,7 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
    private String token;//token
    private String token;//token
    private String encodingAesKey;//加密密钥
    private String encodingAesKey;//加密密钥
    private Integer encType;//加密方式  0:明文模式   1:兼容模式   2:安全模式
    private Integer encType;//加密方式  0:明文模式   1:兼容模式   2:安全模式
    private String status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private Integer status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private String type;//'1:服务号 2 订阅号
    private String type;//'1:服务号 2 订阅号
    private String appId;//'微信app_id'
    private String appId;//'微信app_id'
    private String appSecret;//'微信app_secret'
    private String appSecret;//'微信app_secret'
@ -31,7 +31,7 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
    private String updateUserName;//'修改人名'
    private String updateUserName;//'修改人名'
    private Date updateTime;//'修改时间'
    private Date updateTime;//'修改时间'
    private String remark;//'备注'
    private String remark;//'备注'
    public WxWechat(String code, String saasId, String name, String token, String encodingAesKey, Integer encType, String status, String type, String appId, String appSecret, String baseUrl, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark) {
    public WxWechat(String code, String saasId, String name, String token, String encodingAesKey, Integer encType, Integer status, String type, String appId, String appSecret, String baseUrl, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark) {
        this.code = code;
        this.code = code;
        this.saasId = saasId;
        this.saasId = saasId;
        this.name = name;
        this.name = name;
@ -111,11 +111,11 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
    }
    }
    @Column(name = "status", precision = 2, scale = 0)
    @Column(name = "status", precision = 2, scale = 0)
    public String getStatus() {
    public Integer getStatus() {
        return this.status;
        return this.status;
    }
    }
    public void setStatus(String status) {
    public void setStatus(Integer status) {
        this.status = status;
        this.status = status;
    }
    }

+ 14 - 9
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java

@ -12,6 +12,7 @@ import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import javax.persistence.Transient;
import java.util.Date;
import java.util.Date;
import java.util.UUID;
/**
/**
 * Created by Administrator on 2017/5/20 0020.
 * Created by Administrator on 2017/5/20 0020.
@ -24,9 +25,8 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    @Transient
    @Transient
    public WxWechat createWechat(WxWechat wechat) {
    public WxWechat createWechat(WxWechat wechat) {
        if (StringUtils.isEmpty(wechat.getCode())) {
            throw new ApiException(WxContants.Wechat.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wechat.setCode(code);
        if (StringUtils.isEmpty(wechat.getSaasId())) {
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        }
@ -108,12 +108,17 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    }
    }
    @Transient
    @Transient
    public void deleteWechat(String code) {
        WxWechat wxWechat = wechatDao.findByCode(code);
        if (wxWechat == null) {
            throw new ApiException(WxContants.Wechat.message_fail_code_no_exist, CommonContants.common_error_params_code);
    public void deleteWechat(String codes) {
        if(!StringUtils.isEmpty(codes)){
            String[] codeArray = codes.split(",");
            for(String code:codeArray){
                WxWechat wxWechat = wechatDao.findByCode(code);
                if (wxWechat == null) {
                    throw new ApiException(WxContants.Wechat.message_fail_code_no_exist, CommonContants.common_error_params_code);
                }
                wxWechat.setStatus(-1);
                wechatDao.save(wxWechat);
            }
        }
        }
        wxWechat.setStatus("-1");
        wechatDao.save(wxWechat);
    }
    }
}
}

+ 8 - 0
svr/svr-manage/pom.xml

@ -96,6 +96,14 @@
            <groupId>org.springside</groupId>
            <groupId>org.springside</groupId>
            <artifactId>springside-core</artifactId>
            <artifactId>springside-core</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.apache.httpcomponents</groupId>
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>
    </dependencies>
    </dependencies>
    <build>
    <build>
        <finalName>svr-manage</finalName>
        <finalName>svr-manage</finalName>

+ 23 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/config/BeanConfig.java

@ -0,0 +1,23 @@
package com.yihu.jw.manage.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.client.RestTemplate;
/**
 * @author HZY
 * @vsrsion 1.0
 * Created at 2016/8/5.
 */
@Configuration
@EnableTransactionManagement
@ComponentScan("com.yihu.jw")
public class BeanConfig {
    @Bean
    public RestTemplate restTemplate() {
        return new RestTemplate();
    }
}

+ 67 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/GraphicMessageController.java

@ -0,0 +1,67 @@
package com.yihu.jw.manage.controller.wechat;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.service.wechat.GraphicMessageService;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
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/6/13 0013.
 */
@RestController
@RequestMapping("/graphicMessage")
@Api(description = "微信图文消息管理")
public class GraphicMessageController {
    @Autowired
    private GraphicMessageService graphicMessageService;
    @GetMapping("/list")
    @ApiOperation(value = "图文消息列表")
    public Envelop list(
            @ApiParam(name = "title", value = "标题", required = false) @RequestParam(required = false, name = "title") String title,
            @ApiParam(name = "description", value = "描述", required = false) @RequestParam(required = false, name = "description") String description,
            @ApiParam(name = "page", value = "当前页", required = false) @RequestParam(required = false, name = "page", defaultValue = "1") Integer page,
            @ApiParam(name = "pageSize", value = "每页显示条数", required = false) @RequestParam(required = false, name = "pageSize", defaultValue = "10") Integer pageSize
    ) {
        try {
            Page<ManageUser> users = graphicMessageService.list(title, description , pageSize, page);
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    users.getContent(),//数据内容
                    page, //当前页
                    pageSize,//每个显示条数
                    users.getTotalElements()//总数
            );
        } catch (Exception e) {
            return Envelop.getError("获取信息成功:" + e.getMessage(), -1);
        }
    }
    @GetMapping("/getByCode")
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        return graphicMessageService.findByCode(code);
    }
    @GetMapping("/getByCodea")
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    public Envelop findByCodea(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        return graphicMessageService.findByCodea(code);
    }
}

+ 94 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/WechatConfigController.java

@ -0,0 +1,94 @@
package com.yihu.jw.manage.controller.wechat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.wechat.WechatConfig;
import com.yihu.jw.manage.service.wechat.WechatConfigService;
import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
 * Created by Administrator on 2017/6/13 0013.
 */
@RestController
@RequestMapping("/wechatConfig")
@Api(description = "微信配置管理")
public class WechatConfigController {
    @Autowired
    private WechatConfigService wechatConfigService;
    @GetMapping("/list")
    @ApiOperation(value = "分页获取微信配置列表")
    public Envelop list(
            @ApiParam(name = "name", value = "微信名", required = false) @RequestParam(required = false, name = "name") String name,
            @ApiParam(name = "sorts", value = "排序", required = false) @RequestParam(required = false, name = "sorts") String sorts,
            @ApiParam(name = "start", value = "当前页", required = false) @RequestParam(required = false, name = "start", defaultValue = "1") Integer start,
            @ApiParam(name = "length", value = "每页显示条数", required = false) @RequestParam(required = false, name = "length", defaultValue = "10") Integer length
    ) {
        try {
            Envelop envelop = wechatConfigService.list(name, sorts,length, start);
            return envelop;
        } catch (Exception e) {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
        }
    }
    @DeleteMapping(value = "/wechat/{codes}")
    @ApiOperation(value = "通过codes删除,多个code用,分割", notes = "通过codes删除")
    public Envelop deleteByCodes(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable String codes
    ) {
        Envelop envelop = wechatConfigService.deleteByCode(codes);
        return envelop;
    }
    @GetMapping(value = "/wechat/{code}")
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
           @PathVariable String code
    ) {
        Envelop envelop = wechatConfigService.findByCode(code);
        return envelop;
    }
    @PostMapping(value = "/wechat")
    @ApiOperation(value = "保存微信配置", notes = "保存微信配置")
    public Envelop save(@ModelAttribute @Valid WechatConfig wechatConfig) throws JsonProcessingException {
        return wechatConfigService.save(wechatConfig);
    }
    @PutMapping(value = "/wechat")
    @ApiOperation(value = "更新微信配置", notes = "更新微信配置")
    public Envelop Update(@ModelAttribute @Valid WechatConfig wechatConfig){
        return wechatConfigService.update(wechatConfig);
    }
    /*@GetMapping("/getByCode")
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        return wechatConfigService.findByCode(code);
    }
    @GetMapping("/getByCodea")
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    public Envelop findByCodea(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        return wechatConfigService.findByCodea(code);
    }*/
}

+ 167 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/GraphicMessage.java

@ -0,0 +1,167 @@
package com.yihu.jw.manage.model.wechat;
import com.yihu.jw.manage.model.IdEntity;
import javax.persistence.*;
import java.util.Date;
/**
 * Created by Administrator on 2017/5/21 0021.
 */
@Entity
@Table(name = "wx_graphic_message")
public class GraphicMessage extends IdEntity implements java.io.Serializable {
    private String code;//业务code
    private String title;//标题
    private String description;//描述
    private String url;//图文消息url值
    private String picUrl;//图片地址
    private String createUser;//创建人
    private String createUserName;//创建人名
    private Date createTime;//创建时间
    private String updateUser;//修改人
    private String updateUserName;//修改人名称
    private Date updateTime;//修改时间
    private String remark;//备注
    private Integer status;  //状态 -1删除 0 冻结 1可用
    public GraphicMessage() {
    }
    public GraphicMessage(String code, String title, String description, String url, String picUrl, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark, Integer status) {
        this.code = code;
        this.title = title;
        this.description = description;
        this.url = url;
        this.picUrl = picUrl;
        this.createUser = createUser;
        this.createUserName = createUserName;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateUserName = updateUserName;
        this.updateTime = updateTime;
        this.remark = remark;
        this.status = status;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "title", length = 200)
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Column(name = "description", length = 2000)
    public String getDescription() {
        return description;
    }
    public void setDescription(String description) {
        this.description = description;
    }
    @Column(name = "url", length = 2000)
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
    @Column(name = "pic_url", length = 2000)
    public String getPicUrl() {
        return picUrl;
    }
    public void setPicUrl(String picUrl) {
        this.picUrl = picUrl;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_user", length = 200)
    public String getUpdateUser() {
        return updateUser;
    }
    @Column(name = "remark", length = 1000)
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", length = 0)
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
}

+ 197 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/Template.java

@ -0,0 +1,197 @@
package com.yihu.jw.manage.model.wechat;// default package
import com.yihu.jw.manage.model.IdEntity;
import javax.persistence.*;
import java.util.Date;
/**
 * Template entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "wx_template")
public class Template extends IdEntity implements java.io.Serializable {
    // Fields
    private String code;//模板code
    private String title;//模板标题
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String templateId;//微信模板id
    private String content;//模板内容
    private String createUser;//创建人
    private String createUserName;//创建人名
    private Date createTime;//创建时间
    private String updateUser;//修改人
    private String updateUserName;//修改人名称
    private Date updateTime;//修改时间
    private String remark;
    private Integer status;  //状态 -1删除 0 冻结 1可用
    public Template(String code, String title, String wechatCode, String templateId, String content, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark, Integer status) {
        this.code = code;
        this.title = title;
        this.wechatCode = wechatCode;
        this.templateId = templateId;
        this.content = content;
        this.createUser = createUser;
        this.createUserName = createUserName;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateUserName = updateUserName;
        this.updateTime = updateTime;
        this.remark = remark;
        this.status = status;
    }
    /**
     * default constructor
     */
    public Template() {
    }
    @Column(name = "title")
    public String getTitle() {
        return title;
    }
    public void setTitle(String title) {
        this.title = title;
    }
    @Column(name="wechat_code")
    public String getWechatCode() {
        return wechatCode;
    }
    public void setWechatCode(String wechatCode) {
        this.wechatCode = wechatCode;
    }
    @Column(name="template_id")
    public String getTemplateId() {
        return templateId;
    }
    public void setTemplateId(String templateId) {
        this.templateId = templateId;
    }
    @Column(name="content")
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getStatus() {
        return status;
    }
    // Constructors
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return this.createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", nullable = false, length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_user", length = 200)
    public String geUpdateUser() {
        return this.updateUser;
    }
    public void seUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String geUpdateUserName() {
        return this.updateUserName;
    }
    public void seUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", nullable = false, length = 0)
    public Date geUpdateTime() {
        return this.updateTime;
    }
    public void seUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
}

+ 224 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/WechatConfig.java

@ -0,0 +1,224 @@
package com.yihu.jw.manage.model.wechat;// default package
import com.yihu.jw.manage.model.IdEntity;
import javax.persistence.*;
import java.util.Date;
/**
 * WechatConfig entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "wx_wechat")
public class WechatConfig extends IdEntity implements java.io.Serializable {
    // Fields
    private String code;//业务code
    private String saasId;//'saas配置id'
    private String name;//名称
    private String token;//token
    private String encodingAesKey;//加密密钥
    private Integer encType;//加密方式  0:明文模式   1:兼容模式   2:安全模式
    private Integer status;//'类型 -1 已删除 0待审核 1审核通过 2 审核不通过'
    private String type;//'1:服务号 2 订阅号
    private String appId;//'微信app_id'
    private String appSecret;//'微信app_secret'
    private String baseUrl;//'微信base_url'
    private String createUser;//'创建人'
    private String createUserName;//'创建人名'
    private Date createTime;//'创建时间'
    private String updateUser;//'修改人
    private String updateUserName;//'修改人名'
    private Date updateTime;//'修改时间'
    private String remark;//'备注'
    public WechatConfig(String code, String saasId, String name, String token, String encodingAesKey, Integer encType, Integer status, String type, String appId, String appSecret, String baseUrl, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark) {
        this.code = code;
        this.saasId = saasId;
        this.name = name;
        this.token = token;
        this.encodingAesKey = encodingAesKey;
        this.encType = encType;
        this.status = status;
        this.type = type;
        this.appId = appId;
        this.appSecret = appSecret;
        this.baseUrl = baseUrl;
        this.createUser = createUser;
        this.createUserName = createUserName;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateUserName = updateUserName;
        this.updateTime = updateTime;
        this.remark = remark;
    }
    /**
     * default constructor
     */
    public WechatConfig() {
    }
    @Column(name = "enc_type")
    public Integer getEncType() {
        return encType;
    }
    public void setEncType(Integer encType) {
        this.encType = encType;
    }
    @Column(name = "token", length = 64)
    public String getToken() {
        return token;
    }
    public void setToken(String token) {
        this.token = token;
    }
    @Column(name="encoding_aes_key")
    public String getEncodingAesKey() {
        return encodingAesKey;
    }
    public void setEncodingAesKey(String encodingAesKey) {
        this.encodingAesKey = encodingAesKey;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "saas_id", length = 50)
    public String getSaasId() {
        return this.saasId;
    }
    public void setSaasId(String saasId) {
        this.saasId = saasId;
    }
    @Column(name = "name", length = 200)
    public String getName() {
        return this.name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return this.status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "type", length = 2)
    public String getType() {
        return this.type;
    }
    public void setType(String type) {
        this.type = type;
    }
    @Column(name = "app_id", length = 200)
    public String getAppId() {
        return this.appId;
    }
    public void setAppId(String appId) {
        this.appId = appId;
    }
    @Column(name = "app_secret", length = 200)
    public String getAppSecret() {
        return this.appSecret;
    }
    public void setAppSecret(String appSecret) {
        this.appSecret = appSecret;
    }
    @Column(name = "base_url", length = 200)
    public String getBaseUrl() {
        return this.baseUrl;
    }
    public void setBaseUrl(String baseUrl) {
        this.baseUrl = baseUrl;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return this.createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", nullable = false, length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "update_user", length = 200)
    public String getUpdateUser() {
        return this.updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String getUpdateUserName() {
        return this.updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", nullable = false, length = 0)
    public Date getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 49 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/GraphicMessageService.java

@ -0,0 +1,49 @@
package com.yihu.jw.manage.service.wechat;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.restmodel.common.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.domain.Page;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
/**
 * Created by Administrator on 2017/6/13 0013.
 */
@Service
public class GraphicMessageService {
    @Value("${spring.gateway}")
    private String url;
    @Autowired
    private RestTemplate template;
   public Page<ManageUser> list(String title, String description, Integer size, Integer page) {
       Object forObject = null;
       String fields = "id,code,title,description,url";
       String filters="";//&filters={filters}
       //forObject = template.getForObject(url + "/graphicMessage/getWxGraphicMessages?fields={fields}&filters={filters}&sorts={sorts}&size={size}&page={page}",
       //        Object.class,fields,null,null,size,page);
       forObject = template.getForObject(url + "/graphicMessage/getWxGraphicMessages?fields="+fields+"&size="+size+"&page="+page,//&filters="+null+"&sorts="+null+
                       Object.class);
       System.out.print(forObject.toString());
       System.out.print("-----------------------------");
       return null;
    }
    public Envelop findByCode(String code) {
        //Object forObject = template.getForObject(url + "/graphicMessage/getByCode?code=1", Object.class);
        Object forObject = template.getForObject(url + "/graphicMessage/getByCodea?code={code}", Object.class,code);
        System.out.print(forObject.toString());
        System.out.print("-----------------------------");
        return null;
    }
    public Envelop findByCodea(String code) {
        //Object forObject = template.getForObject(url + "/graphicMessage/getByCode?code=1", Object.class);
        Object forObject = template.getForObject(url + "/graphicMessage/getByCodea/{code}", Object.class,code);
        System.out.print(forObject.toString());
        System.out.print("-----------------------------");
        return null;
    }
}

+ 88 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/WechatConfigService.java

@ -0,0 +1,88 @@
package com.yihu.jw.manage.service.wechat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.wechat.WechatConfig;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.Map;
/**
 * Created by Administrator on 2017/6/13 0013.
 */
@Service
public class WechatConfigService {
    @Value("${spring.gateway}")
    private String url;
    @Autowired
    private RestTemplate template;
   public Envelop list(String name, String sorts ,Integer size, Integer page) {
       Map<String, Object> map = new HashMap<>();
       Map<String, Object> filters = new HashMap<>();
       map.put("size",size);
       map.put("page",page);
       map.put("sorts",sorts);
       map.put("filters","");
       if(StringUtils.isNotBlank(name)){
           name = name.replaceAll(" ","");
           filters.put("name",name);
           map.put("filters",filters);
       }
       Envelop forObject = template.getForObject(url + "/wechatConfig/getWechats?size={size}&page={page}&sorts={sorts}&filters={filters}",
               Envelop.class,map);
       return forObject;
    }
    public Envelop deleteByCode(String codes) {
        //delete 没有返回值....
        //template.delete(url + "/wechatConfig/delete?codes={codes}", codes);
        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
        map.add("codes", codes);
        String urlRequest = url + "/wechatConfig/delete?codes="+codes;
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class);
        return envelop;
    }
    public Envelop findByCode(String code) {
        Envelop envelop = template.getForObject(url + "/wechatConfig/getByCode?code={code}", Envelop.class,code);
        return envelop;
    }
    public Envelop save(WechatConfig wechatConfig) throws JsonProcessingException {
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        JSONObject jsonObj = JSONObject.fromObject(wechatConfig);
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        ResponseEntity<Envelop> responseEntity = template.postForEntity(url + "/wechatConfig/create", formEntity, Envelop.class);
        Envelop envelop = responseEntity.getBody();
        return envelop;
    }
    public Envelop update(WechatConfig wechatConfig) {
       /* ResponseEntity<Envelop> responseEntity = template.PUT(url + "/wechatConfig/create?jsonData={jsonData}", wechatConfig, Envelop.class);
        Envelop envelop = responseEntity.getBody();
        return envelop;*/
        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
        String urlRequest = url + "/wechatConfig/update?jsonData={jsonData}";
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.PUT, Envelop.class);
        return envelop;
    }
}

+ 8 - 2
svr/svr-manage/src/main/resources/webapp/common/js/util/util.js

@ -59,7 +59,7 @@ UrlParm = function () { // url参数
}();
}();
//get方法
//get方法
function do_get(url, data, success) {
function do_get(url, data, success,error) {
    //获取用户的code
    //获取用户的code
    var usercode = getUserCode();
    var usercode = getUserCode();
    data.userCode = usercode;
    data.userCode = usercode;
@ -68,6 +68,7 @@ function do_get(url, data, success) {
        url: url,
        url: url,
        data: data,
        data: data,
        success: success,
        success: success,
        error:error,
        dataType: "json"
        dataType: "json"
    });
    });
}
}
@ -75,7 +76,12 @@ function do_get(url, data, success) {
function do_post(url, data, success) {
function do_post(url, data, success) {
    //获取用户的code
    //获取用户的code
    var usercode = getUserCode();
    var usercode = getUserCode();
    data.userCode = usercode;
    //data.userCode = usercode;
    if(data==''){
        data="userCode="+usercode;
    }else{
        data+="&userCode="+usercode;
    }
    $.ajax({
    $.ajax({
        type: 'POST',
        type: 'POST',
        url: url,
        url: url,

+ 91 - 0
svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/html/graphicMessageList.html

@ -0,0 +1,91 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>图文消息管理页面</title>
    <link href="/common/css/bootstrap/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/common/css/bootstrap/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/common/css/bootstrap/animate.min.css" rel="stylesheet">
    <link href="/common/css/bootstrap/style.min.css?v=3.0.0" rel="stylesheet">
    <link href="/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <!-- Data Tables -->
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>
                        <small>图文消息列表</small>
                    </h5>
                    <!--<div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_data_tables.html#">选项1</a>
                            </li>
                            <li><a href="table_data_tables.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>-->
                </div>
                <input type="button" onclick="haha()"/>
                <div class="ibox-content">
                    <table id="graphicMessageList" class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th>标题</th>
                            <th>描述</th>
                            <th>创建时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        <tr>
                            <th>啊啊啊</th>
                            <th>不不不</th>
                            <th>充充充</th>
                        </tr>
                        </tbody>
                        <tfoot>
                        <tr>
                            <th>标题</th>
                            <th>描述</th>
                            <th>创建时间</th>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/common/js/content.min.js?v=1.0.0"></script>
<script type="text/javascript" src="/wechat/graphicMessage/js/graphicMessageList.js"></script>
</body>
</html>

+ 38 - 0
svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/js/graphicMessageList.js

@ -0,0 +1,38 @@
$(document).ready(function () {
    //初始化用户列表
    $("#graphicMessageList").dataTable({
        serverSide: true, //开启服务器模式
        paging: true,//是否显示分页栏,默认是true
        searching: false, //禁用搜索和排序 默认false
        ordering: false,//禁止排序 默认false
        ajax: {
            url: '/graphicMessage/list',
            type: 'GET',
            dataSrc: "detailModelList"
        },
        columns: [
            {data: 'detailModelList.name'},
            {data: 'detailModelList.code'},
            {data: 'detailModelList.mobile'}
        ],
        "columnDefs": [  //隐藏第几列  下标从0开始
            {
                "targets": [0, 2],
                "visible": false,
                "searchable": false
            }
        ],
        "order": [[1, 'asc']]  //索引行
    });
});
function haha(){
    $.ajax({
        url:"/graphicMessage/getByCode?code=1",
        success:function(data){
            debugger
        }
    });
}

+ 82 - 0
svr/svr-manage/src/main/resources/webapp/html/wechat/template/html/templateList.html

@ -0,0 +1,82 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>模板管理页面</title>
    <link href="/common/css/bootstrap/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/common/css/bootstrap/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/common/css/bootstrap/animate.min.css" rel="stylesheet">
    <link href="/common/css/bootstrap/style.min.css?v=3.0.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
</head>
<body class="gray-bg">
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>
                        <small>用户列表</small>
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_data_tables.html#">选项1</a>
                            </li>
                            <li><a href="table_data_tables.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <table id="templateList" class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th>名称</th>
                            <th>电话号码</th>
                            <th>创建时间</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                        <tfoot>
                        <tr>
                            <th>名称</th>
                            <th>电话号码</th>
                            <th>创建时间</th>
                        </tr>
                        </tfoot>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/wechat/graphicMessage/js/templateList.js"></script>
</body>
</html>

+ 29 - 0
svr/svr-manage/src/main/resources/webapp/html/wechat/template/js/templateList.js

@ -0,0 +1,29 @@
$(document).ready(function () {
    debugger
    $("#userlist").dataTable({
        serverSide: true, //开启服务器模式
        paging:true,//是否显示分页栏,默认是true
        searching: false, //禁用搜索和排序 默认false
        ordering:  false,//禁止排序 默认false
        ajax: {
            url: '/user/list',
            type: 'GET',
            dataSrc:"detailModelList"
        },
        columns: [
            { data: 'detailModelList.name' },
            { data: 'detailModelList.code' },
            { data: 'detailModelList.mobile' }
        ],
        "columnDefs": [  //隐藏第几列  下标从0开始
            {
                "targets": [ 0,2 ],
                "visible": false,
                "searchable": false
            }
        ],
        "order": [[1, 'asc']]  //索引行
});
alert(5555)
    //获取用户列表
});

+ 204 - 0
svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/html/wechatConfigList.html

@ -0,0 +1,204 @@
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>微信配置管理页面</title>
    <link href="/common/css/bootstrap/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/common/css/bootstrap/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/common/css/bootstrap/animate.min.css" rel="stylesheet">
    <link href="/common/css/bootstrap/style.min.css?v=3.0.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <style>
        .m-form-group:after { display: table; content: " "; clear: both; }
        .m-form-group{
            margin-top: 18px;;
        }
        select{
            width:250px !important;
        }
    </style>
</head>
<body class="gray-bg">
    <div class="panel panel-default">
        <div class="panel-body">
            <div class="col-md-12">
                <div class="form-horizontal">
                    <div class="form-group">
                        <label class="col-sm-2 control-label">微信名:</label>
                        <div class="col-sm-3">
                            <input type="text" class="form-control" id="name" name="name" style="width: 250px">
                        </div>
                        <div class="col-sm-2">
                            <button type="button" class="btn btn-success search" style="float: right;">查 询</button>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="wrapper wrapper-content animated fadeInRight">
        <div class="row">
            <div class="col-sm-12">
                <div class="ibox float-e-margins">
                    <div class="ibox-title">
                        <h5>
                            <small>用户列表</small>
                        </h5>
                    </div>
                    <div class="ibox-content">
                        <table id="wechatList" class="table table-striped table-bordered table-hover dataTables-example">
                            <thead>
                            <tr>
                                <th><input type="checkbox" name="checkAllWechat" /></th>
                                <th>微信名</th>
                                <th>appid</th>
                                <th>公众号类型</th>
                                <th>状态</th>
                                <th>创建时间</th>
                                <th>操作</th>
                            </tr>
                            </thead>
                            <tbody>
                            </tbody>
                        </table>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
         aria-labelledby="myModalLabel" aria-hidden="true">
        <div class="modal-dialog" style="width:1000px;height: 800px;">
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close"
                            data-dismiss="modal" aria-hidden="true">
                        &times;
                    </button>
                    <h4 class="modal-title" id="myModalLabel">
                        新 增
                    </h4>
                </div>
                <form class="form-horizontal" role="form" action="" method="post"  id="category_add" >
                    <input  id="id" type="hidden" name="id" :value="wechatConfig.id" />
                    <input  type="hidden" name="code" :value="wechatConfig.code" />
                    <input  type="hidden" name="createUser" :value="wechatConfig.createUser" />
                    <input  type="hidden" name="createUserName" :value="wechatConfig.createUserName" />
                    <!--<input  type="hidden" name="createTime" :value="wechatConfig.createTime" />-->
                    <!--<input  type="hidden" name="updateUser" :value="wechatConfig.updateUser" />
                    <input  type="hidden" name="updateUserName" :value="wechatConfig.updateUserName" />
                    <input  type="hidden" name="updateTime" :value="wechatConfig.updateTime" />-->
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >saasId: </label>
                        <div class="col-sm-2">
                            <select class="form-control m-b" name="saasId" id="saasList">
                               <!-- <option>&#45;&#45;请选择&#45;&#45;</option>-->
                                <option v-for="saas in saasList"  :value="saas.code" :selected="saas.code==wechatConfig.saasId ">{{saas.name}}</option>
                            </select>
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >公众号名: </label>
                        <div class="col-sm-5">
                            <input type="text"  class="form-control"  name="name" style="width: 250px" required="true" :value="wechatConfig.name" />
                        </div>
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >token: </label>
                        <div class="col-sm-2">
                            <input type="text"  class="form-control"  name="token" style="width: 250px"   :value="wechatConfig.token"/>
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >加密密钥: </label>
                        <div class="col-sm-5">
                            <input type="text"  class="form-control"  name="encodingAesKey" style="width: 250px" required="true" :value="wechatConfig.encodingAesKey"/>
                        </div>
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >加密类型: </label>
                        <div class="col-sm-2">
                            <input type="text"  class="form-control"  name="encType" style="width: 250px"   :value="wechatConfig.encType"/>
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >状态: </label>
                        <div class="col-sm-5">
                            <select class="form-control m-b" name="status">
                                <!--<option value="">&#45;&#45;请选择&#45;&#45;</option>-->
                                <option value="0" :selected="wechatConfig.status==0">待审核</option>
                                <option value="1" :selected="wechatConfig.status==1">审核通过</option>
                                <option value="2" :selected="wechatConfig.status==2">审核不通过</option>
                            </select>
                        </div>
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >appId:</label>
                        <div class="col-sm-2">
                            <input type="text"  class="form-control"  name="appId" style="width: 250px" :value="wechatConfig.appId"/>
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >appSecret:</label>
                        <div class="col-sm-5">
                            <input type="text"  class="form-control"  name="appSecret" style="width: 250px"  :value="wechatConfig.appSecret"/>
                        </div>
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >baseUrl:</label>
                        <div class="col-sm-2">
                            <input type="text"  class="form-control"  name="baseUrl" style="width: 250px" :value="wechatConfig.baseUrl"/>
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >备注:</label>
                        <div class="col-sm-5">
                            <input type="text"  class="form-control"  name="remark" style="width: 250px"  :value="wechatConfig.remark"/>
                        </div>
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >公众号类型</label>
                        <div class="col-sm-2">
                            <select class="form-control m-b" name="type">
                                <option value="1" :selected="wechatConfig.type==1">服务号</option>
                                <option value="2" :selected="wechatConfig.status==2">订阅号</option>
                            </select>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default"
                                data-dismiss="modal">关闭
                        </button>
                        <button type="button" class="btn btn-primary" id="btnsubmit">
                            提交
                        </button>
                    </div>
                </form>
            </div><!-- /.modal-content -->
        </div>
    </div>
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/common/js/util/util.js"></script>
<!--<script type="text/javascript" src="/common/js/vue/vue.js"></script>--><!--2.0-->
<script type="text/javascript" src="/common/js/vue.js"></script><!--1.0-->
<script type="text/javascript" src="/common/js/layer/layer.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/wechat/wechatConfig/js/wechatConfigList.js"></script>
</body>
</html>

+ 364 - 0
svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/js/wechatConfigList.js

@ -0,0 +1,364 @@
var table;
var usercode = window.localStorage.getItem("userCode");
$(function () {
    table = $("#wechatList").DataTable({
            "aLengthMenu": [1, 2, 30, 40],
            "searching": false,//禁用搜索
            "lengthChange": true,
            "paging": true,//开启表格分页
            "bProcessing": true,
            "bServerSide": true,
            "bAutoWidth": false,
            "sort": "position",
            "deferRender": true,//延迟渲染
            "bStateSave": false, //在第三页刷新页面,会自动到第一页
            "iDisplayLength": 10,//每页显示条数
            "iDisplayStart": 1, //当前页
            "dom": '<l<\'#topPlugin\'>f>rt<ip><"clear">',
            "ordering": false,//全局禁用排序
            "ajax": {
                url: '/wechatConfig/list',
                data: function (d) {
                    d.name = $("#name").val();
                    d.userCode = usercode;
                },
                type: 'GET',
                dataSrc: "detailModelList"
            },
            "aoColumns": [
                {
                    "mData": "code",
                    "orderable": false, // 禁用排序
                    "sDefaultContent": "",
                    "sWidth": "2%"
                },
                {
                    "mData": 'name',
                    "sWidth": "10%",
                    "orderable": false // 禁用排序
                },
                {
                    "mData": 'appId',
                    "sWidth": "10%",
                    "orderable": false // 禁用排序
                },
                {
                    "mData": 'type',
                    "sWidth": "10%",
                    "orderable": false, // 禁用排序
                    "render": function (data, type, full, meta) {
                        if (data == 1) {
                            data = "<a href='#' class='upOrderStatus' >服务号</a>";
                        } else {
                            data = "<a href='#' class='upOrderStatus' >订阅号</a>";
                        }
                        return data;
                    }
                },
                {
                    "mData": 'status',
                    "sWidth": "10%",
                    "orderable": false, // 禁用排序
                    "render": function (data, type, full, meta) {
                        if (data == -1) {//类型 -1 已删除 0待审核 1审核通过 2 审核不通过
                            data = "<a href='#' class='upOrderStatus' >已删除</a>";
                        } else if (data == 0) {
                            data = "<a href='#' class='upOrderStatus' >待审核</a>";
                        } else if (data == 1) {
                            data = "<a href='#' class='upOrderStatus'>审核通过</a>";
                        } else if (data == 2) {
                            data = "<a href='#' class='upOrderStatus' >审核不通过</a>";
                        }
                        return data;
                    }
                },
                {
                    "mData": 'createTime',
                    "sWidth": "10%",
                    "orderable": false, // 禁用排序
                    "render": function (data, type, full, meta) {
                        //时间格式化
                        return moment(data).format("YYYY-MM-DD HH:mm:ss");
                    }
                },
                {
                    "mData": "code",
                    "orderable": false, // 禁用排序
                    "sDefaultContent": '',
                    "sWidth": "10%",
                    "render": function (data, type, full, meta) {
                        return data = '<button id="findOne" class="btn btn-primary  btn-sm" data-id=' + data + ' onclick="show(\''+data+'\')">查 看</button>';/*<button id="deleteOne" class="btn btn-danger btn-sm" style="margin-left: 7px;" data-id=' + data + '>删 除</button>*/
                    }
                }
            ],
            "columnDefs": [{
                "orderable": false, // 禁用排序
                "targets": [0], // 指定的列
                "data": "code",
                "render": function (data, type, full, meta) {
                    return '<input type="checkbox" value="' + data + '" name="code"/>';
                }
            }],
            "oLanguage": { // 国际化配置
                "sProcessing": "正在获取数据,请稍后...",
                "sLengthMenu": "显示 _MENU_ 条",
                "sZeroRecords": "没有找到数据",
                "sInfo": "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
                "sInfoEmpty": "记录数为0",
                "sInfoFiltered": "(全部记录数 _MAX_ 条)",
                "sInfoPostFix": "",
                "sSearch": "搜索",
                "sUrl": "",
                "oPaginate": {
                    "sFirst": "第一页",
                    "sPrevious": "上一页",
                    "sNext": "下一页",
                    "sLast": "最后一页"
                }
            },
            initComplete: initComplete,
            drawCallback: function (settings) {
                $('input[name=checkAllWechat]')[0].checked = false;//取消全选状态
            }
        }
    );
    /**
     * 表格加载渲染完毕后执行的方法
     * @param data
     */
    function initComplete(data){
        //上方topPlugin DIV中追加HTML
        //var topPlugin='<button id="addButton" class="btn btn-success btn-sm" data-toggle="modal" data-target="#addUser" style="display:block;">' +
        // '<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>添加用户</button>';
        //删除用户按钮的HTMLDOM
        var topPlugin='<button   class="btn btn-danger btn-sm" id="deleteAll">批量删除</button> <button   class="btn btn-primary btn-sm addBtn" >新 增</button>       <button  class="btn btn-warning btn-sm" id="reset">重置搜索条件</button>' ;
        $("#topPlugin").append(topPlugin);//在表格上方topPlugin DIV中追加HTML
        //$("#expCsv").on("click", exp1);//给下方按钮绑定事件
    }
    /**
     * 多选选中和取消选中,同时选中第一个单元格单选框,并联动全选单选框
     */
    $('#wechatList tbody').on('click', 'tr', function(event) {
        var checkAllWechat=$('input[name=checkAllWechat]')[0];//关联全选单选框
        $($(this).children()[0]).children().each(function(){
            if(this.type=="checkbox" && (!$(event.target).is(":checkbox") && $(":checkbox",this).trigger("click"))){
                if(!this.checked){
                    this.checked = true;
                    addValue(this);
                    var selected=table.rows('.selected').data().length;//被选中的行数
                    //全选单选框的状态处理
                    var recordsDisplay=table.page.info().recordsDisplay;//搜索条件过滤后的总行数
                    var iDisplayStart=table.page.info().start;// 起始行数
                    if(selected === table.page.len()||selected === recordsDisplay||selected === (recordsDisplay - iDisplayStart)){
                        checkAllWechat.checked = true;
                    }
                }else{
                    this.checked = false;
                    cancelValue(this);
                    checkAllWechat.checked = false;
                }
            }
        });
        $(this).toggleClass('selected');//放在最后处理,以便给checkbox做检测
    });
    /**
     * 全选按钮被点击事件
     */
    $('input[name=checkAllWechat]').click(function(){
        if(this.checked){
            $('#wechatList tbody tr').each(function(){
                if(!$(this).hasClass('selected')){
                    $(this).click();
                }
            });
        }else{
            $('#wechatList tbody tr').click();
        }
    });
    /**
     * 单选框被选中时将它的value放入隐藏域
     */
    function addValue(para) {
        var wechatCodes = $("input[name=wechatCodes]");
        if(wechatCodes.val() === ""){
            wechatCodes.val($(para).val());
        }else{
            wechatCodes.val(wechatCodes.val()+","+$(para).val());
        }
    }
    /**
     * 单选框取消选中时将它的value移除隐藏域
     */
    function cancelValue(para){
        //取消选中checkbox要做的操作
        var wechatCodes = $("input[name=checkAllWechat]");
        var array = wechatCodes.val().split(",");
        wechatCodes.val("");
        for (var i = 0; i < array.length; i++) {
            if (array[i] === $(para).val()) {
                continue;
            }
            if (wechatCodes.val() === "") {
                wechatCodes.val(array[i]);
            } else {
                wechatCodes.val(wechatCodes.val() + "," + array[i]);
            }
        }
    }
//   function exp1(){
//	   $("#exp").attr("src",contextPath+"/department/export.do?t=" + new Date().getTime());
//   }
    $(document).delegate('#expCsv','click',function() {
        $("#exp").attr("src",contextPath+"/department/export.do?t=" + new Date().getTime());
    });
    $(document).delegate('.addBtn','click',function() {
        contentVM.wechatConfig='';
        $('#myModal-add-info').modal('show');
       setTimeout(function(){
           console.log($(':input','#myModal-add-info')
               .not(':button, :submit, :reset, :hidden').length)
           console.log("---------------------")
           $(':input','#myModal-add-info')
               .not(':button, :submit, :reset, :hidden')
               .val('')
               .removeAttr('checked');
        },200);
    });
    //批量删除
    $(document).delegate('#deleteAll','click',function() {
        var theArray=[];
        $("input[name=code]:checked").each(function() {
            theArray.push($(this).val());
        });
        if(theArray.length<1){
            alert("请至少选择一个");
        }else{
            var codes = theArray.join(",");
            del(codes);
        }
    });
    $(document).delegate('.upOrderStatus','click',function() {
        var id=$(this).data("id");
        //alert(id);
        $("#titleId").html(id);
        $('#editOrderStatus').modal("show");
    });
    //清空查询条件
    $(document).delegate('#reset','click',function() {
        $("#name").val("");
    });
    //重新查询
    $(document).delegate('.search', 'click', function () {
        table.ajax.reload();
    });
});
var contentVM = new Vue({
    el: '#category_add',
    data: {
        wechatConfig: '',//记录详情信息
        saasList:''//记录saas列表
    },
    replace:false
});
do_get("/base/saases",{},function(data){
    contentVM.saasList = data.detailModelList;
    console.log( data.detailModelList);
},function(data){
})
//查看配置
function show(code){
    $("#myModal-add-info").removeData("modal");
    var data={};
    do_get("/wechatConfig/wechat/"+code,data,function(data){
        contentVM.wechatConfig = data.obj;
        $('#myModal-add-info').modal('show');
        $("#myModalLabel").html("查看");
    },function(data){
    });
}
function del(codes){
    $.ajax({
        url: "/wechatConfig/deleteByCodes?codes="+codes+"&userCode="+usercode,
        type: 'DELETE',
        success: function(data){
            if(data.successFlg==true){
                alert("删除成功");
                table.ajax.reload();
            }else{
                alert("删除失败")
            }
        },
        error:function(data){
            console.log(data);
        }
    })
}
$("#btnsubmit").click(function(){
    var url = "";
    var id = $("#id").val();
    var data = $("#category_add").serialize();
    if(id==''){//说明是保存
        url = "/wechatConfig/wechat"
        do_post(url,data,function(data){
            console.log(data);
            if(data.successFlg){
                alert("保存成功");
                $('#myModal-add-info').modal('hide');
                table.ajax.reload();
                return;
            }
            alert(data.errorMsg);
        })
    }else{//说明是修改
        url="/wechatConfig/wechat"
        do_put(url,data,function(data){
            debugger
            console.log(data);
            if(data.successFlg){
                alert("修改成功");
                $('#myModal-add-info').modal('hide');
                table.ajax.reload();
                return;
            }
            alert(data.errorMsg);
        })
    }
})

+ 5 - 0
web-gateway/pom.xml

@ -96,5 +96,10 @@
            <groupId>com.fasterxml.jackson.core</groupId>
            <groupId>com.fasterxml.jackson.core</groupId>
            <artifactId>jackson-databind</artifactId>
            <artifactId>jackson-databind</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
        </dependency>
    </dependencies>
    </dependencies>
</project>
</project>

+ 49 - 0
web-gateway/src/main/java/com/yihu/jw/controller/base/SaasController.java

@ -0,0 +1,49 @@
package com.yihu.jw.controller.base;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.base.BaseContants;
import com.yihu.jw.fegin.base.SaasFegin;
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;
@RestController
@RequestMapping(BaseContants.base_common)
@Api(description = "saas相关")
public class SaasController {
    private Logger logger= LoggerFactory.getLogger(SaasController.class);
    @Autowired
    private SaasFegin saasFegin;
    @Autowired
    private Tracer tracer;
    @GetMapping(value = BaseContants.Saas.api_getList)
    @ApiOperation(value = "获取saas,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getSaasNoPage(
            @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) {
        return saasFegin.getList(fields, filters, sorts);
    }
}

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

@ -8,10 +8,13 @@ import com.yihu.jw.restmodel.common.Envelop;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
@ -28,13 +31,14 @@ public class WechatController{
    private Tracer tracer;
    private Tracer tracer;
    @ApiOperation(value = "创建微信配置")
    @ApiOperation(value = "创建微信配置")
    @PostMapping(value = WechatContants.Config.api_create)
    @PostMapping(value = WechatContants.Config.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop createWechat(
    public Envelop createWechat(
            @ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData) {
            @ApiParam(name = "json_data", value = "", defaultValue = "") @RequestBody String jsonData) {
        tracer.getCurrentSpan().logEvent("开始调用微服务创建微信配置");
        tracer.getCurrentSpan().logEvent("开始调用微服务创建微信配置");
        System.out.println(jsonData);//{"id":null,"code":"","saasId":"1","name":"aaaawefr","token":"","encodingAesKey":"","encType":null,"status":0,"type":"1","appId":"","appSecret":"","baseUrl":"","createUser":"","createUserName":"","createTime":null,"updateUser":null,"updateUserName":null,"updateTime":null,"remark":""}
        Envelop wechat =wechatFegin.createWechat(jsonData);
        Envelop wechat =wechatFegin.createWechat(jsonData);
        tracer.getCurrentSpan().logEvent("创建微信配置微服务结束");
        tracer.getCurrentSpan().logEvent("创建微信配置微服务结束");
        return wechat;
        return wechat;
@ -92,7 +96,15 @@ public class WechatController{
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception {
            @RequestParam(value = "page", required = false) int page) throws Exception {
        Envelop envelop = wechatFegin.getWechats(fields,filters,sorts,size,page);
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("name")){
                filterStr+="name?"+jsonResult.get("name")+";";
            }
        }
        Envelop envelop = wechatFegin.getWechats(fields,filterStr,sorts,size,page);
        return envelop;
        return envelop;
    }
    }

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

@ -0,0 +1,22 @@
package com.yihu.jw.fegin.base;
import com.yihu.jw.fegin.fallbackfactory.base.SaasFeginFallbackFactory;
import com.yihu.jw.restmodel.base.BaseContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = SaasFeginFallbackFactory.class
)
@RequestMapping(value = BaseContants.Saas.api_common)
public interface SaasFegin {
    @GetMapping(value = BaseContants.Saas.api_getSaassNoPage)
    Envelop getList(@RequestParam(value = "fields",required = false)String fields,@RequestParam(value = "filters",required = false) String filters,@RequestParam(value = "sorts",required = false) String sorts);
}

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

@ -5,6 +5,7 @@ import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod;
@ -18,7 +19,7 @@ import org.springframework.web.bind.annotation.RequestParam;
@RequestMapping(value = WxContants.Wechat.api_common)
@RequestMapping(value = WxContants.Wechat.api_common)
public interface WechatFegin {
public interface WechatFegin {
    @RequestMapping(value = WxContants.Wechat.api_create, method = RequestMethod.POST)
    @RequestMapping(value = WxContants.Wechat.api_create, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop createWechat( @RequestBody String jsonData);
    Envelop createWechat( @RequestBody String jsonData);
    @RequestMapping(value = WxContants.Wechat.api_update, method = RequestMethod.PUT)
    @RequestMapping(value = WxContants.Wechat.api_update, method = RequestMethod.PUT)

+ 21 - 0
web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/SaasFeginFallbackFactory.java

@ -0,0 +1,21 @@
package com.yihu.jw.fegin.fallbackfactory.base;
import com.yihu.jw.fegin.base.SaasFegin;
import com.yihu.jw.restmodel.common.Envelop;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
@Component
public class SaasFeginFallbackFactory implements FallbackFactory<SaasFegin> {
    @Override
    public SaasFegin create(Throwable throwable) {
        return  new SaasFegin() {
            @Override
            public Envelop getList(@RequestParam(value = "fields") String fields, @RequestParam(value = "filters") String filters, @RequestParam(value = "sorts") String sorts) {
                return null;
            }
        };
    }
}