瀏覽代碼

代码同步

chenweida 7 年之前
父節點
當前提交
55e7906f1a
共有 47 個文件被更改,包括 685 次插入483 次删除
  1. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxMenu.java
  2. 10 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxWechat.java
  3. 5 11
      common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java
  4. 8 0
      svr-lib-parent-pom/pom.xml
  5. 1 1
      svr/svr-base/src/main/java/com/yihu/jw/base/controller/base/SaasController.java
  6. 14 14
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WechatConfigController.java
  7. 4 4
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxAccessTokenController.java
  8. 15 15
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxGraphicMessageController.java
  9. 42 27
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxMenuController.java
  10. 15 15
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxTemplateController.java
  11. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/wx/dao/WxMenuDao.java
  12. 12 1
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxMenu.java
  13. 17 1
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxWechat.java
  14. 15 15
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java
  15. 4 4
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxAccessTokenService.java
  16. 8 8
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxGraphicMessageService.java
  17. 32 30
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxMenuService.java
  18. 15 15
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxTemplateService.java
  19. 4 0
      svr/svr-manage/pom.xml
  20. 8 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/base/SaasController.java
  21. 21 3
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/login/LoginController.java
  22. 26 25
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/MenuController.java
  23. 10 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/RoleController.java
  24. 1 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/MenuDao.java
  25. 25 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/interceptors/UserInterceptor.java
  26. 124 88
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageMenu.java
  27. 19 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageRole.java
  28. 28 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/base/SaasService.java
  29. 12 4
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/login/LoginService.java
  30. 42 5
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/MenuService.java
  31. 7 7
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/GraphicMessageService.java
  32. 8 11
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/WechatConfigService.java
  33. 19 1
      svr/svr-manage/src/main/resources/application.yml
  34. 1 1
      svr/svr-manage/src/main/resources/webapp/html/index/index.html
  35. 5 91
      svr/svr-manage/src/main/resources/webapp/html/system/menu/html/menuList.html
  36. 12 0
      svr/svr-manage/src/main/resources/webapp/html/system/role/html/roleList.html
  37. 4 2
      web-gateway/src/main/java/com/yihu/jw/controller/base/SaasController.java
  38. 3 3
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatAccessTokenController.java
  39. 8 8
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatConfigController.java
  40. 9 9
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatGraphicMessageController.java
  41. 11 11
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatMenuController.java
  42. 9 9
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatTemplateControlle.java
  43. 3 3
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/AccessTokenFegin.java
  44. 9 9
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/GraphicMessageFegin.java
  45. 8 8
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatFegin.java
  46. 11 11
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatMenuFegin.java
  47. 9 9
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatTemplateFegin.java

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxMenu.java

@ -1,6 +1,7 @@
package com.yihu.jw.restmodel.wx;
import java.util.Date;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
@ -28,6 +29,15 @@ public class MWxMenu {
    private String createUserName;//创建人
    private String remark;//备注
    private Integer status; //状态 -1删除 0 冻结 1可用
    private List<MWxMenu> children;
    public List<MWxMenu> getChildren() {
        return children;
    }
    public void setChildren(List<MWxMenu> children) {
        this.children = children;
    }
    public Long getId() {
        return id;

+ 10 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxWechat.java

@ -1,6 +1,7 @@
package com.yihu.jw.restmodel.wx;
import java.util.Date;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
@ -26,6 +27,15 @@ public class MWxWechat {
    private String updateUserName;//'修改人名'
    private Date updateTime;//'修改时间'
    private String remark;//'备注'
    private List<MWxMenu> children;
    public List<MWxMenu> getChildren() {
        return children;
    }
    public void setChildren(List<MWxMenu> children) {
        this.children = children;
    }
    public Long getId() {
        return id;

+ 5 - 11
common/common-swagger/src/main/java/com/yihu/jw/config/SwaggerConfig.java

@ -3,7 +3,7 @@ package com.yihu.jw.config;
import com.yihu.jw.restmodel.base.base.BaseContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
@ -35,11 +35,8 @@ public class SwaggerConfig {
                .paths(or(
                        regex("/patient/.*")
                        , regex("/"+ BaseContants.Function.api_common+"/.*")
                        ,regex("/"+ WxContants.Wechat.api_common+"/.*")
                        ,regex("/"+WxContants.WxAccessToken.api_common+"/.*")
                        ,regex("/"+WxContants.WxMenu.api_common+"/.*")
                        ,regex("/"+WxContants.WxTemplate.api_common+"/.*")
                        ,regex("/"+WxContants.WxGraphicMessage.api_common+"/.*")
                        ,regex("/"+ WechatContants.api_common+"/.*")
                        ,regex("/"+ WechatContants.WxAccessToken.api_common+"/.*")
                        ))
                .build()
                .apiInfo(publicApiInfo());
@ -103,11 +100,8 @@ public class SwaggerConfig {
                         regex("/"+ BaseContants.Function.api_common+"/.*")
                        ,regex("/"+ BaseContants.Saas.api_common+"/.*")
                        ,regex("/"+ BaseContants.Module.api_common+"/.*")
                        ,regex("/"+ WxContants.Wechat.api_common+"/.*")
                        ,regex("/"+ WxContants.WxTemplate.api_common+"/.*")
                        ,regex("/"+ WxContants.WxGraphicMessage.api_common+"/.*")
                        ,regex("/"+ WxContants.WxMenu.api_common+"/.*")
                        ,regex("/"+ WxContants.WxAccessToken.api_common+"/.*")
                        ,regex("/"+ WechatContants.api_common+"/.*")
                        ,regex("/"+ WechatContants.WxAccessToken.api_common+"/.*")
                ))
                .build()
                .apiInfo(jwBaseApiInfo());

+ 8 - 0
svr-lib-parent-pom/pom.xml

@ -73,6 +73,7 @@
        <version.springside>4.2.3-GA</version.springside>
        <version.common.lang3>3.1</version.common.lang3>
        <version.elasticsearch>2.4.4</version.elasticsearch>
        <version.redis>1.5.3.RELEASE</version.redis>
    </properties>
    <!--dependencyManagement作用子配置不写版本默认继承父配置-->
    <dependencyManagement>
@ -488,6 +489,13 @@
                <version>${version.common.lang3}</version>
            </dependency>
            <!--  redis -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-redis</artifactId>
                <version>${version.redis}</version>
            </dependency>
        </dependencies>

+ 1 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/controller/base/SaasController.java

@ -113,7 +113,7 @@ public class SaasController extends EnvelopRestController {
    @GetMapping(value = BaseContants.Saas.api_getSaassNoPage)
    @ApiOperation(value = "获取Saas配置列表,不分页")
    public Envelop getAppsNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,id,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,

+ 14 - 14
svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WechatConfigController.java

@ -4,7 +4,7 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxWechat;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.wx.model.WxWechat;
import com.yihu.jw.wx.service.WechatService;
import io.swagger.annotations.Api;
@ -24,40 +24,40 @@ import java.util.List;
 * Created by chenweida on 2017/5/11.
 */
@RestController
@RequestMapping(WxContants.Wechat.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信相关操作", description = "微信相关操作")
public class WechatConfigController extends EnvelopRestController {
    @Autowired
    private WechatService wechatService;
    @PostMapping(value = WxContants.Wechat.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxConfig.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信配置", notes = "创建微信配置")
    public Envelop createWechat(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxWechat wechat = toEntity(jsonData, WxWechat.class);
            return Envelop.getSuccess(WxContants.Wechat.message_success_create, wechatService.createWechat(wechat));
            return Envelop.getSuccess(WechatContants.WxConfig.message_success_create, wechatService.createWechat(wechat));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WxContants.Wechat.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxConfig.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信配置", notes = "修改微信配置")
    public Envelop updateWechat(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxWechat wechat = toEntity(jsonData, WxWechat.class);
            return Envelop.getSuccess(WxContants.Wechat.message_success_update, wechatService.updateWxchat(wechat));
            return Envelop.getSuccess(WechatContants.WxConfig.message_success_update, wechatService.updateWxchat(wechat));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = WxContants.Wechat.api_delete)
    @DeleteMapping(value = WechatContants.WxConfig.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    public Envelop deleteWechat(
            @ApiParam(name = "codes", value = "codes")
@ -69,26 +69,26 @@ public class WechatConfigController extends EnvelopRestController {
            ) {
        try {
            wechatService.deleteWechat(codes,userCode,userName);
            return Envelop.getSuccess(WxContants.Wechat.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxConfig.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = WxContants.Wechat.api_getByCode)
    @GetMapping(value = WechatContants.WxConfig.api_getByCode)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WxContants.Wechat.message_success_find, wechatService.findByCode(code));
            return Envelop.getSuccess(WechatContants.WxConfig.message_success_find, wechatService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = WxContants.Wechat.api_getWechats, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxConfig.api_getWechats, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信配置列表(分页)")
    public Envelop getWechats(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
@ -115,11 +115,11 @@ public class WechatConfigController extends EnvelopRestController {
        //封装返回格式
        List<MWxWechat> mWxWechats = convertToModels(list, new ArrayList<>(list.size()), MWxWechat.class, fields);
        return Envelop.getSuccessListWithPage(WxContants.Wechat.message_success_find_functions,mWxWechats, page, size,count);
        return Envelop.getSuccessListWithPage(WechatContants.WxConfig.message_success_find_functions,mWxWechats, page, size,count);
    }
    @GetMapping(value = WxContants.Wechat.api_getWechatNoPage)
    @GetMapping(value = WechatContants.WxConfig.api_getWechatNoPage)
    @ApiOperation(value = "获取微信列表配置,不分页")
    public Envelop getWechatNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
@ -132,7 +132,7 @@ public class WechatConfigController extends EnvelopRestController {
        List<WxWechat> list = wechatService.search(fields,filters,sorts);
        //封装返回格式
        List<MWxWechat> mWxWechats = convertToModels(list, new ArrayList<>(list.size()), MWxWechat.class, fields);
        return Envelop.getSuccessList(WxContants.Wechat.message_success_find_functions,mWxWechats);
        return Envelop.getSuccessList(WechatContants.WxConfig.message_success_find_functions,mWxWechats);
    }
}

+ 4 - 4
svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxAccessTokenController.java

@ -3,7 +3,7 @@ package com.yihu.jw.wx.controller;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.wx.model.WxAccessToken;
import com.yihu.jw.wx.service.WxAccessTokenService;
import io.swagger.annotations.Api;
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
 * Created by cyx on 2017/5/11.
 */
@RestController
@RequestMapping(WxContants.WxAccessToken.api_common)
@RequestMapping(WechatContants.WxAccessToken.api_common)
@Api(value = "微信token模块", description = "微信token模块接口管理")
public class WxAccessTokenController extends EnvelopRestController {
@ -32,14 +32,14 @@ public class WxAccessTokenController extends EnvelopRestController {
     * @return MWxAccessToken
     * @throws Exception
     */
    @GetMapping(value = WxContants.WxAccessToken.api_get)
    @GetMapping(value = WechatContants.WxAccessToken.api_get)
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    public Envelop getWxAccessToken(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @RequestParam(value = "wechatCode") String wechatCode) {
        try {
            WxAccessToken wxAccessToken = wxAccessTokenService.getWxAccessTokenByCode(wechatCode);
            return Envelop.getSuccess(WxContants.WxAccessToken.message_success_get, wxAccessToken);
            return Envelop.getSuccess(WechatContants.WxAccessToken.message_success_get, wxAccessToken);
        }catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }

+ 15 - 15
svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxGraphicMessageController.java

@ -4,7 +4,7 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxGraphicMessage;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.wx.model.WxGraphicMessage;
import com.yihu.jw.wx.service.WxGraphicMessageService;
import io.swagger.annotations.Api;
@ -24,41 +24,41 @@ import java.util.List;
 *   2017/5/11.
 */
@RestController
@RequestMapping(WxContants.WxGraphicMessage.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信图文相关操作", description = "微信图文相关操作")
public class WxGraphicMessageController extends EnvelopRestController {
    @Autowired
    private WxGraphicMessageService wxGraphicMessageService;
    @PostMapping(value = WxContants.WxGraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxGraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
    public Envelop createWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxGraphicMessage WxGraphicMessage = toEntity(jsonData, WxGraphicMessage.class);
            return Envelop.getSuccess(WxContants.WxGraphicMessage.message_success_create, wxGraphicMessageService.createWxGraphicMessage(WxGraphicMessage));
            return Envelop.getSuccess(WechatContants.WxGraphicMessage.message_success_create, wxGraphicMessageService.createWxGraphicMessage(WxGraphicMessage));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WxContants.WxGraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxGraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
    public Envelop updateWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxGraphicMessage WxGraphicMessage = toEntity(jsonData, WxGraphicMessage.class);
            return Envelop.getSuccess(WxContants.WxGraphicMessage.message_success_update, wxGraphicMessageService.updateWxGraphicMessage(WxGraphicMessage));
            return Envelop.getSuccess(WechatContants.WxGraphicMessage.message_success_update, wxGraphicMessageService.updateWxGraphicMessage(WxGraphicMessage));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = WxContants.WxGraphicMessage.api_delete)
    @DeleteMapping(value = WechatContants.WxGraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    public Envelop deleteWxGraphicMessage(
            @ApiParam(name = "codes", value = "codes")
@ -70,26 +70,26 @@ public class WxGraphicMessageController extends EnvelopRestController {
    ) {
        try {
            wxGraphicMessageService.deleteWxGraphicMessage(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxGraphicMessage.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxGraphicMessage.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = WxContants.WxGraphicMessage.api_getByCode)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getByCode)
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxGraphicMessage.message_success_find, wxGraphicMessageService.findByCode(code));
            return Envelop.getSuccess(WechatContants.WxGraphicMessage.message_success_find, wxGraphicMessageService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = WxContants.WxGraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信图文消息列表(分页)")
    public Envelop getWxGraphicMessages(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
@ -116,11 +116,11 @@ public class WxGraphicMessageController extends EnvelopRestController {
        //封装返回格式
        List<MWxGraphicMessage> mWxGraphicMessages = convertToModels(list, new ArrayList<>(list.size()), MWxGraphicMessage.class, fields);
        return Envelop.getSuccessListWithPage(WxContants.WxGraphicMessage.message_success_find_functions,mWxGraphicMessages, page, size,count);
        return Envelop.getSuccessListWithPage(WechatContants.WxGraphicMessage.message_success_find_functions,mWxGraphicMessages, page, size,count);
    }
    @GetMapping(value = WxContants.WxGraphicMessage.api_getWxGraphicMessageNoPage)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessageNoPage)
    @ApiOperation(value = "获取图文消息列表,不分页")
    public Envelop getWxGraphicMessageNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
@ -133,7 +133,7 @@ public class WxGraphicMessageController extends EnvelopRestController {
        List<WxGraphicMessage> list = wxGraphicMessageService.search(fields,filters,sorts);
        //封装返回格式
        List<MWxGraphicMessage> mWxGraphicMessages = convertToModels(list, new ArrayList<>(list.size()), MWxGraphicMessage.class, fields);
        return Envelop.getSuccessList(WxContants.WxGraphicMessage.message_success_find_functions,mWxGraphicMessages);
        return Envelop.getSuccessList(WechatContants.WxGraphicMessage.message_success_find_functions,mWxGraphicMessages);
    }
    //@GetMapping(value = WlyyContants.WxGraphicMessage.api_sendGraphicMessages)
@ -145,7 +145,7 @@ public class WxGraphicMessageController extends EnvelopRestController {
    //    return Envelop.getSuccess("成功",messages);
    //}
    @GetMapping(value = WxContants.WxGraphicMessage.api_sendGraphicMessages)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_sendGraphicMessages)
    @ApiOperation(value = "发送图文消息")
    @ResponseBody
    public String sendGraphicMessages(

+ 42 - 27
svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxMenuController.java

@ -4,7 +4,8 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxMenu;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.MWxWechat;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.wx.WechatResponse;
import com.yihu.jw.wx.model.WxMenu;
import com.yihu.jw.wx.model.WxWechat;
@ -29,7 +30,7 @@ import java.util.Map;
 * Created by Administrator on 2017/5/19 0019.
 */
@RestController
@RequestMapping(WxContants.WxMenu.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信菜单相关操作", description = "微信菜单相关操作")
public class WxMenuController extends EnvelopRestController {
@ -39,34 +40,34 @@ public class WxMenuController extends EnvelopRestController {
    @Autowired
    private WechatService wechatService;
    @PostMapping(value = WxContants.WxMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    public Envelop createWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxMenu wxMenu = toEntity(jsonData, WxMenu.class);
            return Envelop.getSuccess(WxContants.WxMenu.message_success_create, wxMenuService.createWxMenu(wxMenu));
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_create, wxMenuService.createWxMenu(wxMenu));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WxContants.WxMenu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxMenu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
    public Envelop updateWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxMenu wxMenu = toEntity(jsonData, WxMenu.class);
            return Envelop.getSuccess(WxContants.WxMenu.message_success_update, wxMenuService.updateWxMenu(wxMenu));
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_update, wxMenuService.updateWxMenu(wxMenu));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = WxContants.WxMenu.api_delete)
    @DeleteMapping(value = WechatContants.WxMenu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    public Envelop deleteWxMenu(
            @ApiParam(name = "codes", value = "codes")
@ -78,26 +79,26 @@ public class WxMenuController extends EnvelopRestController {
    ) {
        try {
            wxMenuService.deleteWxMenu(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxMenu.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = WxContants.WxMenu.api_getByCode)
    @GetMapping(value = WechatContants.WxMenu.api_getByCode)
    @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxMenu.message_success_find, wxMenuService.findByCode(code));
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_find, wxMenuService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = WxContants.WxMenu.api_getWxMenus, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getWxMenus, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信菜单列表(分页)")
    public Envelop getWxMenus(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
@ -115,23 +116,28 @@ public class WxMenuController extends EnvelopRestController {
        if(StringUtils.isBlank(sorts)){
            sorts = "-updateTime";
        }
        //得到list数据
        List<WxWechat> list = wxMenuService.search(fields, filters, sorts, page, size);
        //得到微信列表数据
        List<WxWechat> wechats = wechatService.search(fields, filters, sorts, page, size);
        for(WxWechat wechat:wechats){
            List<WxMenu> parentMenus = wxMenuService.findParentMenuByWechatCode(wechat.getCode());
            wechat.setChildren(parentMenus);
            for(WxMenu parentMenu:parentMenus){
                List<WxMenu> childMenus = wxMenuService.findChildMenus(parentMenu.getCode());
                parentMenu.setChildren(childMenus);
            }
        }
        //获取总数
        long count=wxMenuService.getCount(filters);
        long count=wechatService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<MWxMenu> mWxMenus = convertToModels(list, new ArrayList<>(list.size()), MWxMenu.class, fields);
        Map<String, String> map = wechatService.getAllWechatConfig();
        for(MWxMenu menu:mWxMenus){
            menu.setWechatName(map.get(menu.getWechatCode()));
        }
        return Envelop.getSuccessListWithPage(WxContants.WxMenu.message_success_find_functions,mWxMenus, page, size,count);
        List<MWxWechat> mwechats = convertToModels(wechats, new ArrayList<>(wechats.size()), MWxWechat.class, fields);
        return Envelop.getSuccessListWithPage(WechatContants.WxMenu.message_success_find_functions,mwechats, page, size,count);
    }
    @GetMapping(value = WxContants.WxMenu.api_getWxMenuNoPage)
    @GetMapping(value = WechatContants.WxMenu.api_getWxMenuNoPage)
    @ApiOperation(value = "获取微信菜单列表,不分页")
    public Envelop getWxMenuNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
@ -140,15 +146,24 @@ public class WxMenuController extends EnvelopRestController {
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        if(filters!=null){
            filters = "supMenucode=0;"+filters;
        }else{
            filters = "supMenucode=0;";
        }
        //得到list数据
        List<WxMenu> list = wxMenuService.search(fields,filters,sorts);
        for(WxMenu wxMenu:list){
            List<WxMenu> childMenus = wxMenuService.findChildMenus(wxMenu.getCode());
            wxMenu.setChildren(childMenus);
        }
        //封装返回格式
        List<MWxMenu> mWxMenus = convertToModels(list, new ArrayList<>(list.size()), MWxMenu.class, fields);
        Map<String, String> map = wechatService.getAllWechatConfig();
        for(MWxMenu menu:mWxMenus){
            menu.setWechatName(map.get(menu.getWechatCode()));
        }
        return Envelop.getSuccessList(WxContants.WxMenu.message_success_find_functions,mWxMenus);
        return Envelop.getSuccessList(WechatContants.WxMenu.message_success_find_functions,mWxMenus);
    }
    /**
@ -157,7 +172,7 @@ public class WxMenuController extends EnvelopRestController {
     * @return
     */
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @RequestMapping(value = WxContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    public Envelop createWechatMenu(
            @ApiParam(name = "wechatCode", value = "", defaultValue = "")
            @RequestParam(value = "wechatCode", required = true)String wechatCode){
@ -177,14 +192,14 @@ public class WxMenuController extends EnvelopRestController {
     * @param wechatCode
     * @return
     */
    @GetMapping(value = WxContants.WxMenu.api_getParentMenu)
    @GetMapping(value = WechatContants.WxMenu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    public Envelop getParentMenu(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @PathVariable(value = "wechatCode", required = true) String wechatCode
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxMenu.message_success_find, wxMenuService.findParentMenuByWechatCode(wechatCode));
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_find, wxMenuService.findParentMenuByWechatCode(wechatCode));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
@ -196,14 +211,14 @@ public class WxMenuController extends EnvelopRestController {
     * @param parentCode
     * @return
     */
    @GetMapping(value = WxContants.WxMenu.api_getChildMenus)
    @GetMapping(value = WechatContants.WxMenu.api_getChildMenus)
    @ApiOperation(value = "根据父级菜单code查找子菜单", notes = "根据父级菜单code查找子菜单")
    public Envelop getChildMenus(
            @ApiParam(name = "parentCode", value = "parentCode")
            @PathVariable(value = "parentCode", required = true) String parentCode
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxMenu.message_success_find, wxMenuService.findChildMenus(parentCode));
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_find, wxMenuService.findChildMenus(parentCode));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }

+ 15 - 15
svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxTemplateController.java

@ -4,7 +4,7 @@ import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxTemplate;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.wx.WechatResponse;
import com.yihu.jw.wx.model.Miniprogram;
import com.yihu.jw.wx.model.WxTemplate;
@ -29,7 +29,7 @@ import java.util.Map;
 * Created by Administrator on 2017/5/19 0019.
 */
@RestController
@RequestMapping(WxContants.WxTemplate.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信模版相关操作", description = "微信模版相关操作")
public class WxTemplateController extends EnvelopRestController {
    @Autowired
@ -38,33 +38,33 @@ public class WxTemplateController extends EnvelopRestController {
    @Autowired
    private WechatService wechatService;
    @PostMapping(value = WxContants.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
    public Envelop createWxTemplate(
            @ApiParam(name = "json_data", value = "微信模版json字符串")
            @RequestBody String jsonData) {
        try {
            WxTemplate WxTemplate = toEntity(jsonData, WxTemplate.class);
            return Envelop.getSuccess(WxContants.WxTemplate.message_success_create, wxTemplateService.createWxTemplate(WxTemplate));
            return Envelop.getSuccess(WechatContants.WxTemplate.message_success_create, wxTemplateService.createWxTemplate(WxTemplate));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = WxContants.WxTemplate.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxTemplate.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
    public Envelop updateWxTemplate(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            WxTemplate WxTemplate = toEntity(jsonData, WxTemplate.class);
            return Envelop.getSuccess(WxContants.WxTemplate.message_success_update, wxTemplateService.updateWxTemplate(WxTemplate));
            return Envelop.getSuccess(WechatContants.WxTemplate.message_success_update, wxTemplateService.updateWxTemplate(WxTemplate));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = WxContants.WxTemplate.api_delete)
    @DeleteMapping(value = WechatContants.WxTemplate.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    public Envelop deleteWxTemplate(
            @ApiParam(name = "codes", value = "codes")
@ -76,26 +76,26 @@ public class WxTemplateController extends EnvelopRestController {
    ) {
        try {
            wxTemplateService.deleteWxTemplate(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxTemplate.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxTemplate.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = WxContants.WxTemplate.api_getByCode)
    @GetMapping(value = WechatContants.WxTemplate.api_getByCode)
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxTemplate.message_success_find, wxTemplateService.findByCode(code));
            return Envelop.getSuccess(WechatContants.WxTemplate.message_success_find, wxTemplateService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = WxContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信模版列表(分页)")
    public Envelop getWechats(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
@ -126,11 +126,11 @@ public class WxTemplateController extends EnvelopRestController {
            template.setWechatName(map.get(template.getWechatCode()));
        }
        return Envelop.getSuccessListWithPage(WxContants.WxTemplate.message_success_find_functions,templates, page, size,count);
        return Envelop.getSuccessListWithPage(WechatContants.WxTemplate.message_success_find_functions,templates, page, size,count);
    }
    @GetMapping(value = WxContants.WxTemplate.api_getWxTemplatesNoPage)
    @GetMapping(value = WechatContants.WxTemplate.api_getWxTemplatesNoPage)
    @ApiOperation(value = "获取微信模版列表(不分页)")
    public Envelop getWechatNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
@ -147,10 +147,10 @@ public class WxTemplateController extends EnvelopRestController {
        for(MWxTemplate template:mMWxTemplates){
            template.setWechatName(map.get(template.getWechatCode()));
        }
        return Envelop.getSuccessList(WxContants.WxTemplate.message_success_find_functions,mMWxTemplates);
        return Envelop.getSuccessList(WechatContants.WxTemplate.message_success_find_functions,mMWxTemplates);
    }
    @GetMapping(value = WxContants.WxTemplate.api_sendTemplateMessage)
    @GetMapping(value = WechatContants.WxTemplate.api_sendTemplateMessage)
    @ApiOperation(value = "发送微信模板消息")
    @ResponseBody
    public Envelop sendTemplateMessage(

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/wx/dao/WxMenuDao.java

@ -32,7 +32,7 @@ public interface WxMenuDao  extends PagingAndSortingRepository<WxMenu, Long>, Jp
     * @param wechatCode
     * @param sort
     */
    @Query("from WxMenu m where m.wechatCode = ?1 and m.status =1 and m.sort =?2 and m.supMenucode is null and m.code != ?3")
    @Query("from WxMenu m where m.wechatCode = ?1 and m.status =1 and m.sort =?2 and m.supMenucode ='0' and m.code != ?3")
    WxMenu findByWechatCodeExcludeSortFromParent(String wechatCode, Integer sort,String code);
    /**
@ -43,7 +43,7 @@ public interface WxMenuDao  extends PagingAndSortingRepository<WxMenu, Long>, Jp
    @Query("from WxMenu m where m.wechatCode = ?1 and m.status =1 and m.sort =?2 and m.supMenucode =?3 and m.code != ?4")
    WxMenu findByWechatCodeExcludeSortFromChild(String wechatCode, Integer sort,String supMenucode,String code);
    @Query("from WxMenu m where m.wechatCode =?1 and m.status = 1 and (m.supMenucode is null or m.supMenucode = '') order by m.supMenucode ,m.sort")
    @Query("from WxMenu m where m.wechatCode =?1 and m.status = 1 and  m.supMenucode = '0' order by m.supMenucode ,m.sort")
    List<WxMenu> findParentMenuByWechatCode(String wechatCode);
}

+ 12 - 1
svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxMenu.java

@ -5,6 +5,8 @@ import com.yihu.jw.base.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
/**
 * 微信 菜单表
@ -13,7 +15,6 @@ import javax.persistence.Table;
@Table(name = "wx_menu")
public class WxMenu extends IdEntity implements java.io.Serializable {
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String supMenucode;//父菜单id 如果是一级菜单 此字段为空
    private String type;//菜单类型
@ -27,6 +28,9 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
    private String remark;//备注
    private Integer status; //状态 -1删除 0 冻结 1可用
    @Transient
    private List<WxMenu> children;
    /**
@ -35,6 +39,13 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
    public WxMenu() {
    }
    public List<WxMenu> getChildren() {
        return children;
    }
    public void setChildren(List<WxMenu> children) {
        this.children = children;
    }
    @Column(name="menu_key")
    public String getMenuKey() {

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

@ -2,8 +2,12 @@ package com.yihu.jw.wx.model;// default package
import com.yihu.jw.base.model.IdEntity;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.Date;
import java.util.List;
/**
 * WxWechat entity. @author MyEclipse Persistence Tools
@ -24,6 +28,9 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
    private String appSecret;//'微信app_secret'
    private String baseUrl;//'微信base_url'
    private String remark;//'备注'
    @Transient
    private List<WxMenu> children;
    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.saasId = saasId;
@ -49,6 +56,15 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
     */
    public WxWechat() {
    }
    public List<WxMenu> getChildren() {
        return children;
    }
    public void setChildren(List<WxMenu> children) {
        this.children = children;
    }
    @Column(name = "enc_type")
    public Integer getEncType() {
        return encType;

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

@ -3,7 +3,7 @@ package com.yihu.jw.wx.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.wx.dao.WechatDao;
import com.yihu.jw.wx.model.WxWechat;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,20 +27,20 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wechat.setCode(code);
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
            throw new ApiException(WxContants.Wechat.message_fail_status_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getType())) {
            throw new ApiException(WxContants.Wechat.message_fail_type_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getName())) {
            throw new ApiException(WxContants.Wechat.message_fail_name_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        WxWechat wechatTem = wechatDao.findByAppId(wechat.getAppId());
        if (wechatTem != null) {
            throw new ApiException(WxContants.Wechat.message_fail_appId_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_appId_exist, CommonContants.common_error_params_code);
        }
        return wechatDao.save(wechat);
    }
@ -48,31 +48,31 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    @Transient
    public WxWechat updateWxchat(WxWechat wechat) {
        if (StringUtils.isEmpty(wechat.getCode())) {
            throw new ApiException(WxContants.Wechat.message_fail_code_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
            throw new ApiException(WxContants.Wechat.message_fail_status_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getType())) {
            throw new ApiException(WxContants.Wechat.message_fail_type_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_type_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getName())) {
            throw new ApiException(WxContants.Wechat.message_fail_name_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        Long id = wechat.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WxContants.Wechat.message_fail_id_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        WxWechat wechat1 = findById(id);
        if(wechat1 == null){
            throw new ApiException(WxContants.Wechat.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
        }
        WxWechat wechatTem = wechatDao.findByAppIdExcludeCode(wechat.getAppId(),wechat.getCode());
        if(wechatTem!=null){
            throw new ApiException(WxContants.Wechat.message_fail_appId_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_appId_exist, CommonContants.common_error_params_code);
        }
        return wechatDao.save(wechat);
    }
@ -93,7 +93,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
            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);
                    throw new ApiException(WechatContants.WxConfig.message_fail_code_no_exist, CommonContants.common_error_params_code);
                }
                wxWechat.setStatus(-1);
                wxWechat.setUpdateUser(userCode);

+ 4 - 4
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxAccessTokenService.java

@ -3,7 +3,7 @@ package com.yihu.jw.wx.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.util.HttpUtil;
import com.yihu.jw.wx.dao.WechatDao;
import com.yihu.jw.wx.dao.WxAccessTokenDao;
@ -45,7 +45,7 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessToken, WxAccess
            //根据wechatCode查找出appid和appSecret
            WxWechat wxWechat = wechatDao.findByCode(wechatCode);
            if(wxWechat==null){
                throw new ApiException(WxContants.Wechat.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxConfig.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
            }
            List<WxAccessToken> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenByCode(wechatCode);
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
@ -64,10 +64,10 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessToken, WxAccess
            appId = wxWechat.getAppId();
            appSecret = wxWechat.getAppSecret();
            if (StringUtils.isEmpty(appId)){
                throw new ApiException(WxContants.Wechat.message_fail_appId_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxConfig.message_fail_appId_is_null, CommonContants.common_error_params_code);
            }
            if (StringUtils.isEmpty(appSecret)){
                throw new ApiException(WxContants.Wechat.message_fail_appSecret_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxConfig.message_fail_appSecret_is_null, CommonContants.common_error_params_code);
            }
            String params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
            String result = HttpUtil.sendGet(token_url, params);

+ 8 - 8
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxGraphicMessageService.java

@ -3,7 +3,7 @@ package com.yihu.jw.wx.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.util.MessageUtil;
import com.yihu.jw.wx.dao.WxGraphicMessageDao;
import com.yihu.jw.wx.model.WxGraphicMessage;
@ -29,14 +29,14 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxGraphicMessage.setCode(code);
        if (StringUtils.isEmpty(wxGraphicMessage.getStatus())) {
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_status_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxGraphicMessage.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxGraphicMessage.getTitle())) {
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_title_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxGraphicMessage.message_fail_title_is_null, CommonContants.common_error_params_code);
        }
        WxGraphicMessage wxGraphicMessageTem = wxGraphicMessageDao.findByCode(wxGraphicMessage.getCode());
        if (wxGraphicMessageTem != null) {
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_code_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxGraphicMessage.message_fail_code_exist, CommonContants.common_error_params_code);
        }
        return wxGraphicMessageDao.save(wxGraphicMessage);
    }
@ -44,19 +44,19 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
    @Transient
    public WxGraphicMessage updateWxGraphicMessage(WxGraphicMessage wxGraphicMessage) {
        if (StringUtils.isEmpty(wxGraphicMessage.getCode())) {
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_code_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxGraphicMessage.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxGraphicMessage.getStatus())) {
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_status_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxGraphicMessage.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        Long id = wxGraphicMessage.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WxContants.Wechat.message_fail_id_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        //根据id查找
        WxGraphicMessage wxGraphicMessage1 = findById(id);
        if(wxGraphicMessage1==null){
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_wxGraphicMessage_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxGraphicMessage.message_fail_wxGraphicMessage_is_no_exist, CommonContants.common_error_params_code);
        }
        return wxGraphicMessageDao.save(wxGraphicMessage);
    }

+ 32 - 30
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxMenuService.java

@ -3,7 +3,7 @@ package com.yihu.jw.wx.service;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.util.HttpUtil;
import com.yihu.jw.wx.dao.WxMenuDao;
import com.yihu.jw.wx.model.WxAccessToken;
@ -56,16 +56,16 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    @Transient
    public WxMenu updateWxMenu(WxMenu wxMenu) {
        if (StringUtils.isEmpty(wxMenu.getCode())) {
            throw new ApiException(WxContants.WxMenu.message_fail_code_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxMenu.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if(canSaveOrUpata(wxMenu)){
            Long id = wxMenu.getId();
            if (StringUtils.isEmpty(id)) {
                throw new ApiException(WxContants.Wechat.message_fail_id_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxConfig.message_fail_id_is_null, CommonContants.common_error_params_code);
            }
            WxMenu wxMenu1 = findById(id);
            if(wxMenu1==null){
                throw new ApiException(WxContants.WxMenu.message_fail_WxMenu_is_no_exist, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_WxMenu_is_no_exist, CommonContants.common_error_params_code);
            }
            return wxMenuDao.save(wxMenu);
        }
@ -164,12 +164,12 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    public JSONObject createWechatMenu(String wechatCode) {
        WxWechat wechat = wechatService.findByCode(wechatCode);
        if(wechat==null){
            throw new ApiException(WxContants.Wechat.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
        }
        //首先根据wechatCode获取菜单,然后封装成json字符串
        List<WxMenu> menus = wxMenuDao.findByWechatCode(wechatCode);
        if(menus==null){
            throw new ApiException(WxContants.WxMenu.message_fail_WxMenu_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxMenu.message_fail_WxMenu_is_no_exist, CommonContants.common_error_params_code);
        }
        String menuJsonString = getMenuToString(menus, wechatCode);
        logger.info("-----------------微信菜单json字符串:"+ menuJsonString+"--------------------");
@ -262,56 +262,58 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    private boolean canSaveOrUpata(WxMenu wxMenu){
        String wechatCode = wxMenu.getWechatCode();
        if (StringUtils.isEmpty(wechatCode)) {
            throw new ApiException(WxContants.WxMenu.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);
        String supMenucode = wxMenu.getSupMenucode();
        if(StringUtils.isEmpty(wechatCode)){
            WxMenu parentMenuCode = findByCode(supMenucode);
            wechatCode = parentMenuCode.getWechatCode();
            wxMenu.setWechatCode(wechatCode);
        }
        String name = wxMenu.getName();
        if (StringUtils.isEmpty(name)) {
            throw new ApiException(WxContants.WxMenu.message_fail_name_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxMenu.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxMenu.getStatus())) {
            throw new ApiException(WxContants.WxMenu.message_fail_status_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxMenu.message_fail_status_is_null, CommonContants.common_error_params_code);
        }
        if(StringUtils.isEmpty(wxMenu.getSort())){
            throw new ApiException(WxContants.WxMenu.message_fail_sort_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxMenu.message_fail_sort_is_null, CommonContants.common_error_params_code);
        }
        //根据wechatCode查找是否存在微信配置
        WxWechat wxWechat = wechatService.findByCode(wechatCode);
        if(wxWechat==null){
            throw new ApiException(WxContants.Wechat.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
        }
        String supMenucode = wxMenu.getSupMenucode();
        if (!StringUtils.isEmpty(supMenucode)) {//不为空,说明是子菜单,判断父菜单是否存在
        if (!"0".equals(supMenucode)) {//不为0,说明是子菜单,判断父菜单是否存在
            //说明是子菜单
            //判断父菜单是否存在
            WxMenu parentMenuCode = findByCode(supMenucode);
            if(parentMenuCode==null){
                throw new ApiException(WxContants.WxMenu.message_fail_supMenuCode_is_no_exist, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_supMenuCode_is_no_exist, CommonContants.common_error_params_code);
            }
            //查询已经存在的子菜单条数
            List<WxMenu> childMenus = findChildMenus(wechatCode, supMenucode);
            if(childMenus.size()==5){
                throw new ApiException(WxContants.WxMenu.message_fail_childMenu_is_to_much, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_childMenu_is_to_much, CommonContants.common_error_params_code);
            }
            if(name.getBytes().length>60){
                throw new ApiException(WxContants.WxMenu.message_fail_name_is_to_long, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_name_is_to_long, CommonContants.common_error_params_code);
            }
            if(StringUtils.isEmpty(wxMenu.getType())){
                throw new ApiException(WxContants.WxMenu.message_fail_type_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_type_is_null, CommonContants.common_error_params_code);
            }
        }else{
            //查找父菜单
            List<WxMenu> parentMenus = findParentMenuByWechatCode(wechatCode);
            if(parentMenus!=null){
                if(parentMenus.size()==3){
                    throw new ApiException(WxContants.WxMenu.message_fail_parentMenu_is_to_much, CommonContants.common_error_params_code);
                    throw new ApiException(WechatContants.WxMenu.message_fail_parentMenu_is_to_much, CommonContants.common_error_params_code);
                }
            }
            //说明是父菜单
            if(name.getBytes().length>16){
                throw new ApiException(WxContants.WxMenu.message_fail_name_is_to_long, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_name_is_to_long, CommonContants.common_error_params_code);
            }
        }
@ -323,38 +325,38 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
        if("click".equals(type)){
            String key = wxMenu.getMenuKey();
            if(StringUtils.isEmpty(key)){
                throw new ApiException(WxContants.WxMenu.message_fail_key_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_key_is_null, CommonContants.common_error_params_code);
            }
            if(key.getBytes().length>128){
                throw new ApiException(WxContants.WxMenu.message_fail_key_is_toLong, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_key_is_toLong, CommonContants.common_error_params_code);
            }
        }
        String url = wxMenu.getUrl();
        if("view".equals(type)){
            if(StringUtils.isEmpty(url)){
                throw new ApiException(WxContants.WxMenu.message_fail_url_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_url_is_null, CommonContants.common_error_params_code);
            }
            if(url.getBytes().length>128){
                throw new ApiException(WxContants.WxMenu.message_fail_url_is_toLong, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_url_is_toLong, CommonContants.common_error_params_code);
            }
        }
        if("miniprogram".equals(type)){
            if(StringUtils.isEmpty(url)){
                throw new ApiException(WxContants.WxMenu.message_fail_url_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_url_is_null, CommonContants.common_error_params_code);
            }
            if(url.getBytes().length>128){
                throw new ApiException(WxContants.WxMenu.message_fail_url_is_toLong, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_url_is_toLong, CommonContants.common_error_params_code);
            }
            if(StringUtils.isEmpty(wxMenu.getAppid())){
                throw new ApiException(WxContants.WxMenu.message_fail_appid_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_appid_is_null, CommonContants.common_error_params_code);
            }
            if(StringUtils.isEmpty(wxMenu.getPagepath())){
                throw new ApiException(WxContants.WxMenu.message_fail_pagepath_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_pagepath_is_null, CommonContants.common_error_params_code);
            }
        }
        if("media_id".equals(type)||"view_limited".equals(type)){
            if(StringUtils.isEmpty(wxMenu.getMediaId())){
                throw new ApiException(WxContants.WxMenu.message_fail_mediaId_is_null, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxMenu.message_fail_mediaId_is_null, CommonContants.common_error_params_code);
            }
        }
        WxMenu wxMenuTemp = null;
@ -365,7 +367,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
            wxMenuTemp = wxMenuDao.findByWechatCodeExcludeSortFromChild(wxMenu.getWechatCode(), wxMenu.getSort(), wxMenu.getSupMenucode(), wxMenu.getCode());
        }
        if(null!=wxMenuTemp){
            throw new ApiException(WxContants.WxMenu.message_fail_sort_is_repeat, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxMenu.message_fail_sort_is_repeat, CommonContants.common_error_params_code);
        }
        wxMenu.setUpdateTime(new Date());
        return true;

+ 15 - 15
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxTemplateService.java

@ -5,7 +5,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import com.yihu.jw.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.util.HttpUtil;
import com.yihu.jw.wx.dao.WxTemplateDao;
import com.yihu.jw.wx.model.*;
@ -39,52 +39,52 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxTemplate.setCode(code);
        if (StringUtils.isEmpty(wxTemplate.getWechatCode())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);
        }
        //根据wechatCode查找是否存在微信配置
        WxWechat wxWechat = wechatService.findByCode(wxTemplate.getWechatCode());
        if(wxWechat==null){
            throw new ApiException(WxContants.Wechat.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_templateid_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_templateid_is_null, CommonContants.common_error_params_code);
        }
        String content = wxTemplate.getContent().replace(" ","");
        if (StringUtils.isEmpty(content)) {
            throw new ApiException(WxContants.WxTemplate.message_fail_content_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_content_is_null, CommonContants.common_error_params_code);
        }
        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
            throw new ApiException(WxContants.WxTemplate.message_fail_content_format_is_not_right, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_content_format_is_not_right, CommonContants.common_error_params_code);
        }
        return wxTemplateDao.save(wxTemplate);
    }
    public WxTemplate updateWxTemplate(WxTemplate wxTemplate) {
        if (StringUtils.isEmpty(wxTemplate.getCode())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_code_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxTemplate.getWechatCode())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wxTemplate.getTemplateId())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_templateid_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_templateid_is_null, CommonContants.common_error_params_code);
        }
        String content = wxTemplate.getContent().replace(" ","");
        if (StringUtils.isEmpty(content)) {
            throw new ApiException(WxContants.WxTemplate.message_fail_content_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_content_is_null, CommonContants.common_error_params_code);
        }
        Long id = wxTemplate.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WxContants.Wechat.message_fail_id_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_id_is_null, CommonContants.common_error_params_code);
        }
        WxTemplate wxTemplate1 = findById(id);
        if(wxTemplate1==null){
            throw new ApiException(WxContants.WxTemplate.message_fail_template_is_no_exist, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_template_is_no_exist, CommonContants.common_error_params_code);
        }
        wxTemplate.setCreateTime(wxTemplate1.getCreateTime());
        wxTemplate.setUpdateTime(new Date());
        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
            throw new ApiException(WxContants.WxTemplate.message_fail_content_format_is_not_right, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxTemplate.message_fail_content_format_is_not_right, CommonContants.common_error_params_code);
        }
        return wxTemplateDao.save(wxTemplate);
    }
@ -95,7 +95,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
            for (String code : codeArray) {
                WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
                if (wxTemplate == null) {
                    throw new ApiException(WxContants.WxTemplate.message_fail_code_no_exist, CommonContants.common_error_params_code);
                    throw new ApiException(WechatContants.WxTemplate.message_fail_code_no_exist, CommonContants.common_error_params_code);
                }
                wxTemplate.setStatus(-1);
                wxTemplate.setUpdateUser(userCode);
@ -120,7 +120,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
            //首先根据wechatTemplate获取微信模版
            WxTemplate wxTemplate = findByCode(templateCode);
            if(wxTemplate==null){
                throw new ApiException(WxContants.WxTemplate.message_fail_template_is_no_exist, CommonContants.common_error_params_code);
                throw new ApiException(WechatContants.WxTemplate.message_fail_template_is_no_exist, CommonContants.common_error_params_code);
            }
            String wechatCode =  wxTemplate.getWechatCode();
            String content = wxTemplate.getContent().replaceAll(" ", "");//{{result.DATA}}领奖金额:{{withdrawMoney.DATA}   }领奖  时间:{ {withdrawTime.DATA} }银行信息:{ {cardInfo.DATA} }到账时间:{{arrivedTime.DATA}}{{remark.DATA}}

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

@ -105,6 +105,10 @@
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-mysql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <dependency>

+ 8 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/base/SaasController.java

@ -11,6 +11,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
 * Created by Administrator on 2017/6/13 0013.
 */
@ -37,4 +39,10 @@ public class SaasController {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
        }
    }
    @GetMapping("/saases/list")
    @ApiOperation(value = "获取微信配置列表(不分页)")
    public List getListNoPage(){
        return saasService.getListNoPage();
    }
}

+ 21 - 3
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/login/LoginController.java

@ -1,9 +1,11 @@
package com.yihu.jw.manage.controller.login;
import com.yihu.jw.manage.adapter.CacheAdapter;
import com.yihu.jw.manage.adapter.cache.model.LoginCacheModel;
import com.yihu.jw.manage.aop.annotation.ManageLog;
import com.yihu.jw.manage.cache.login.LoginCache;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.service.login.LoginService;
import com.yihu.jw.manage.service.system.MenuRoleService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.business.ManageException;
@ -19,13 +21,18 @@ import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/8.
 * Created by chenweida on 2017/6/6
 */
@RestController
@Api(description = "登陆模块")
public class LoginController extends EnvelopRestController {
    @Autowired
    private LoginService loginService;
    @Autowired
    private MenuRoleService menuRoleService;
    @Autowired
    private CacheAdapter cacheAdapter;
    @GetMapping("/login")
    @ApiOperation(value = "登陆")
@ -34,6 +41,16 @@ public class LoginController extends EnvelopRestController {
            @ApiParam(name = "username", value = "账号", required = true)@RequestParam(required = true, name = "username") String username,
            @ApiParam(name = "password", value = "密码", required = true)@RequestParam(required = true, name = "password") String password) throws ManageException {
        ManageUser data = loginService.login(username, password);
        String userCode = data.getCode();
        //根据userCode查找用户拥有的权限,放入缓存中
        List<Map<String, Object>> maps = menuRoleService.findByUserCode(userCode);
        cacheAdapter.setData(CacheAdapter.ROLE,userCode,maps);
        //登陆用户放入缓存
        LoginCacheModel loginCacheModel = new LoginCacheModel();
        loginCacheModel.setCode(userCode);
        cacheAdapter.setData(CacheAdapter.LOGIN,userCode,loginCacheModel);
        return Envelop.getSuccess("登陆成功", data);
    }
@ -43,7 +60,8 @@ public class LoginController extends EnvelopRestController {
            @ApiParam(name = "userCode", value = "用户code", required = true)@RequestParam(required = true, name = "userCode") String userCode) {
        try {
            //从缓存清空
            LoginCache.cleanUser(userCode);
            cacheAdapter.removeData(CacheAdapter.ROLE,userCode);//权限移除
            cacheAdapter.removeData(CacheAdapter.LOGIN,userCode);//登陆移除
            return Envelop.getSuccess("登出成功");
        } catch (Exception e) {
            error(e);

+ 26 - 25
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/MenuController.java

@ -10,10 +10,11 @@ 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.*;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -31,27 +32,28 @@ public class MenuController {
    @GetMapping("menu/list")
    @ApiOperation(value = "用户列表")
    public Envelop list(
            @ApiParam(name = "name", value = "用户名称", required = false) @RequestParam(required = false, name = "name") String name,
            @ApiParam(name = "start", value = "当前页(0开始)", required = false) @RequestParam(required = false, name = "start", defaultValue = "0") Integer page,
            @ApiParam(name = "length", value = "每页显示条数", required = false) @RequestParam(required = false, name = "length", defaultValue = "10") Integer pageSize
    ) {
        try {
            page=page/pageSize;
            Page<ManageMenu> menus = menuService.list(name, page, pageSize);
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    menus.getContent(),//数据内容
                    page, //当前页
                    pageSize,//每个显示条数
                    menus.getTotalElements()//总数
            );
    public Map<String,Object> list() {
        //查询结果
        List<ManageMenu> menus = menuService.list();
        } catch (Exception e) {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
        }
        //添加基卫
        ArrayList<ManageMenu> manageMenus = new ArrayList<ManageMenu>();
        ManageMenu manageMenu = new ManageMenu();
        manageMenu.setChildren(menus);
        manageMenu.setName("基卫后台管理系统");
        manageMenu.setParentCode("-1");
        manageMenu.setId(new Long(0));
        manageMenu.setCode("0");
        manageMenu.setType(0);
        manageMenus.add(manageMenu);
        //数据返回
        Map<String, Object> map = new HashMap<String, Object>();
        map.put("rows",manageMenus);
        return map;
    }
    @GetMapping(value = "menu/{code}")
    @ApiOperation(value = "根据code查找用户", notes = "根据code查找用户")
    public Envelop findByCode(
@ -82,7 +84,7 @@ public class MenuController {
    }
    @DeleteMapping(value = "menu/{codes}")
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @ApiOperation(value = "删除菜单", notes = "删除菜单")
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
@ -104,10 +106,9 @@ public class MenuController {
        return Envelop.getSuccess("成功");
    }
    @RequestMapping("menu/menuTree")
    public Envelop getMenus() throws ManageException {
        Map<String, List> menuTree = menuService.getMenuTree();
        return Envelop.getSuccess("查询成功",menuTree);
    @GetMapping("menu/menuTree")
    public List<ManageMenu> getMenus() throws ManageException {
        List<ManageMenu> menus = menuService.list();
        return menus;
    }
}

+ 10 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/RoleController.java

@ -2,6 +2,7 @@ package com.yihu.jw.manage.controller.system;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageRole;
import com.yihu.jw.manage.service.base.SaasService;
import com.yihu.jw.manage.service.system.RoleService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.ApiException;
@ -14,6 +15,8 @@ import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@RestController
@ -23,6 +26,8 @@ public class RoleController {
    @Autowired
    private RoleService roleService;
    @Autowired
    private SaasService saasService;
    @GetMapping("role/list")
    @ApiOperation(value = "用户列表")
@ -34,6 +39,11 @@ public class RoleController {
        try {
            page=page/pageSize;
            Page<ManageRole> roles = roleService.list(name, page, pageSize);
            List<ManageRole> list = roles.getContent();
            Map<String, String> saasMap = saasService.getSaasMap();
            for(ManageRole manageRole:list){
                manageRole.setSaasName(saasMap.get(manageRole.getSaasId()));
            }
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    roles.getContent(),//数据内容

+ 1 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/MenuDao.java

@ -18,7 +18,7 @@ public interface MenuDao extends PagingAndSortingRepository<ManageMenu, Long>, J
    @Query("from ManageMenu m where m.status!=-1 and m.parentCode = ?1 ")
    List<ManageMenu> getChildMenus(String parentCode);
    @Query("from ManageMenu m where m.status!=-1 and m.parentCode = 0 ")
    @Query("from ManageMenu m where m.status!=-1 and m.parentCode = '0' ")
    List<ManageMenu> getParentMenus();
}

+ 25 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/interceptors/UserInterceptor.java

@ -1,5 +1,7 @@
package com.yihu.jw.manage.interceptors;
import com.yihu.jw.manage.adapter.CacheAdapter;
import com.yihu.jw.manage.adapter.cache.model.RoleCacheModel;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.restmodel.common.Envelop;
@ -21,18 +23,25 @@ import java.util.List;
@Component
public class UserInterceptor implements HandlerInterceptor {
    private static Integer NOT_LOGIN=-1000;
    private static Integer NO_PRIVILEGE=-2000;
    List<String> unFilters=new ArrayList<>();
    @Autowired
    private UserService userService;
    @Autowired
    private CacheAdapter cacheAdapter;
    @PostConstruct
    public void addUnFilterURI(){
        //添加不需要过滤的路径
        unFilters.add("/login");
        unFilters.add("/error");
        unFilters.add("/index");
        unFilters.add("/loginout");
        unFilters.add("/manage/menuRole/reloadPrivilege");//刷新权限缓存
        unFilters.add("");
    }
    @Override
    public boolean preHandle(HttpServletRequest requset, HttpServletResponse response, Object o) throws Exception {
        boolean flag = true;
        boolean flag = false;
        try {
            //判断路径是否要过滤
            String uri=requset.getRequestURI();
@ -50,6 +59,21 @@ public class UserInterceptor implements HandlerInterceptor {
                // 未登录
                response.getOutputStream().write(JSONObject.fromObject(Envelop.getError("请登录后再操作!",NOT_LOGIN)).toString().getBytes());
            }
            String method = requset.getMethod();
            //判断权限
            List<RoleCacheModel> privilege = (List<RoleCacheModel>) cacheAdapter.getData(CacheAdapter.ROLE, obj);
            for(RoleCacheModel roleCacheModel:privilege){
                String url = roleCacheModel.getUrl();
                if(url==null)
                    continue;
                String pri_method = roleCacheModel.getMethod();
                if(uri.contains(url) && method.equalsIgnoreCase(pri_method)){//url以及请求方式相同才有权限
                    return true;
                }
            }
            response.getOutputStream().write(JSONObject.fromObject(Envelop.getError("该用户没有权限!", NO_PRIVILEGE)).toString().getBytes());
            return flag;
        } catch (Exception e) {
            e.printStackTrace();
        }

+ 124 - 88
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageMenu.java

@ -2,8 +2,12 @@ package com.yihu.jw.manage.model.system;// default package
import com.yihu.jw.manage.model.IdEntity;
import javax.persistence.*;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
import java.util.Map;
/**
 * ManageMenu entity. @author MyEclipse Persistence Tools
@ -12,90 +16,122 @@ import java.util.Date;
@Table(name = "manage_menu")
public class ManageMenu extends IdEntity implements java.io.Serializable {
	// Fields
	private String parentCode;
	private String name;
	private String url;
	private Integer status;
	private Integer sort;
	private String remark;
	// Constructors
	/** default constructor */
	public ManageMenu() {
	}
	/** full constructor */
	public ManageMenu(String code, String parentCode, String name, String url,
			Integer status, Date createTime, String createUser,
			String createUserName, Date updateTime, String updateUser,
			String updateUserName, String remark) {
		this.code = code;
		this.parentCode = parentCode;
		this.name = name;
		this.url = url;
		this.status = status;
		this.createTime = createTime;
		this.createUser = createUser;
		this.createUserName = createUserName;
		this.updateTime = updateTime;
		this.updateUser = updateUser;
		this.updateUserName = updateUserName;
		this.remark = remark;
	}
	@Column(name = "parent_code", length = 100)
	public String getParentCode() {
		return this.parentCode;
	}
	public void setParentCode(String parentCode) {
		this.parentCode = parentCode;
	}
	@Column(name = "name", length = 100)
	public String getName() {
		return this.name;
	}
	public void setName(String name) {
		this.name = name;
	}
	@Column(name = "url", length = 1500)
	public String getUrl() {
		return this.url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	@Column(name = "status")
	public Integer getStatus() {
		return this.status;
	}
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Column(name = "remark", length = 1500)
	public String getRemark() {
		return this.remark;
	}
	public void setRemark(String remark) {
		this.remark = remark;
	}
	public Integer getSort() {
		return sort;
	}
	public void setSort(Integer sort) {
		this.sort = sort;
	}
    // Fields
    private String parentCode;
    private String name;
    private Integer status;
    private Integer sort;
    private String remark;
    private Integer type;
    @Transient
    private String text;
    @Transient
    private List<ManageMenu> children;
    @Transient
    private List<String> url;
    @Transient
    private List<String> method;
    @Transient
    private List<Map<String,Object>> req;//用于取值
    /**
     * default constructor
     */
    public ManageMenu() {
    }
    public List<Map<String, Object>> getReq() {
        return req;
    }
    public void setReq(List<Map<String, Object>> req) {
        this.req = req;
    }
    public List<String> getMethod() {
        return method;
    }
    public void setMethod(List<String> method) {
        this.method = method;
    }
    public List<String> getUrl() {
        return url;
    }
    public void setUrl(List<String> url) {
        this.url = url;
    }
    public String getText() {
        return name;
    }
    public void setText(String text) {
        this.text = text;
    }
    public List<ManageMenu> getChildren() {
        return children;
    }
    public void setChildren(List<ManageMenu> children) {
        this.children = children;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    @Column(name = "parent_code", length = 100)
    public String getParentCode() {
        return this.parentCode;
    }
    public void setParentCode(String parentCode) {
        this.parentCode = parentCode;
    }
    @Column(name = "name", length = 100)
    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 = "remark", length = 1500)
    public String getRemark() {
        return this.remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "sort")
    public Integer getSort() {
        return sort;
    }
    public void setSort(Integer sort) {
        this.sort = sort;
    }
}

+ 19 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageRole.java

@ -16,6 +16,10 @@ public class ManageRole extends IdEntity implements java.io.Serializable {
	private String name;
	private Integer status;
	private String remark;
	@Column(name="saas_id")
	private String saasId;
	@Transient
	private String saasName;
	// Constructors
@ -41,6 +45,21 @@ public class ManageRole extends IdEntity implements java.io.Serializable {
		this.remark = remark;
	}
	public String getSaasId() {
		return saasId;
	}
	public void setSaasId(String saasId) {
		this.saasId = saasId;
	}
	public String getSaasName() {
		return saasName;
	}
	public void setSaasName(String saasName) {
		this.saasName = saasName;
	}
	@Column(name = "name", length = 100)
	public String getName() {

+ 28 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/base/SaasService.java

@ -1,11 +1,17 @@
package com.yihu.jw.manage.service.base;
import com.yihu.jw.restmodel.base.base.BaseContants;
import com.yihu.jw.restmodel.common.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/6/13 0013.
 */
@ -25,4 +31,26 @@ public class SaasService {
       return forObject;
    }
    public List getListNoPage() {
        Envelop envelop = template.getForObject(url +"/"+ BaseContants.Saas.api_common+"/"+BaseContants.Saas.api_getSaassNoPage,Envelop.class);
        List list = envelop.getDetailModelList();
        return list;
    }
    /**
     * key为code ,value为微信名字
     * @return
     */
    public Map<String,String> getSaasMap(){
        List saases = getListNoPage();
        Map<String, String> map = new HashMap<>();
        if(null!=saases){
            for(int i=0;i<saases.size();i++){
                LinkedHashMap saas = (LinkedHashMap) saases.get(i);
                map.put(saas.get("code").toString(),saas.get("name").toString());
            }
        }
        return map;
    }
}

+ 12 - 4
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/login/LoginService.java

@ -3,10 +3,8 @@ package com.yihu.jw.manage.service.login;
import com.yihu.jw.manage.cache.login.LoginCache;
import com.yihu.jw.manage.dao.login.ManageLoginLogDao;
import com.yihu.jw.manage.model.login.ManageLoginLog;
import com.yihu.jw.manage.model.system.ManageMenu;
import com.yihu.jw.manage.model.system.ManageRole;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.model.system.MenuItems;
import com.yihu.jw.manage.model.system.*;
import com.yihu.jw.manage.service.system.ManageMenuUrlService;
import com.yihu.jw.manage.service.system.MenuService;
import com.yihu.jw.manage.service.system.RoleService;
import com.yihu.jw.manage.service.system.UserService;
@ -33,6 +31,8 @@ public class LoginService {
    private RoleService roleService;
    @Autowired
    private ManageLoginLogDao manageLoginLogDao;
    @Autowired
    private ManageMenuUrlService menuUrlService;
    /**
     * ManageException异常不回滚
@ -93,6 +93,14 @@ public class LoginService {
            for(ManageMenu parentMenu:parentMenus){
                //通过父菜单查找对应的子菜单
                List<ManageMenu> childMenus = menuService.findChildMenus(usercode,parentMenu.getCode());
                for(ManageMenu childMenu:childMenus){
                    List<ManageMenuUrl> menuUrls = menuUrlService.getListByMenuCode(childMenu.getCode());
                    ArrayList<String> urls = new ArrayList<String>();
                    if(menuUrls.size()>0){
                        urls.add(menuUrls.get(0).getUrl());
                    }
                    childMenu.setUrl(urls);
                }
                MenuItems menuItem = new MenuItems();
                menuItem.setParentMenu(parentMenu);
                menuItem.setChildMenus(childMenus);

+ 42 - 5
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/MenuService.java

@ -18,6 +18,7 @@ import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import javax.transaction.Transactional;
import java.util.*;
/**
@ -31,6 +32,8 @@ public class MenuService {
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private UserService userService;
    @Autowired
    private ManageMenuUrlService menuUrlService;
    public List<ManageMenu> findByUserCode(String code) {
        String sql="SELECT DISTINCT " +
@ -79,13 +82,43 @@ public class MenuService {
        if (!StringUtils.isEmpty(name)&&!("null".equals(name))) {
            filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, name));
        }
        //首先查找父菜单
        filters.put("type",new SearchFilter("type", SearchFilter.Operator.EQ, 1));
        // 未作废
        filters.put("status", new SearchFilter("status", SearchFilter.Operator.EQ, WlyyContant.status_normal));
        Specification<ManageMenu> spec = DynamicSpecifications.bySearchFilter(filters.values(), ManageMenu.class);
        return menuDao.findAll(spec, pageRequest);
        Page<ManageMenu> manageMenus = menuDao.findAll(spec, pageRequest);
        List<ManageMenu> parentMenus = manageMenus.getContent();
        for(ManageMenu parentMenu: parentMenus){
            List<ManageMenu> childMenus = getChildMenus(parentMenu.getCode());//查找子菜单
            for(ManageMenu childMenu:childMenus){
                List<ManageMenu> funcMenus = getChildMenus(childMenu.getCode());//查找功能
                childMenu.setChildren(funcMenus);
            }
            parentMenu.setChildren(childMenus);
        }
        return manageMenus;
    }
    public List<ManageMenu> list(){
        List<ManageMenu> parentMenus = getParentMenus();//查找模块/父菜单
        for(ManageMenu parentMenu: parentMenus){
            List<ManageMenu> childMenus = getChildMenus(parentMenu.getCode());//查找子菜单
            for(ManageMenu childMenu:childMenus){
                List<ManageMenu> funcMenus = getChildMenus(childMenu.getCode());//查找功能
                childMenu.setChildren(funcMenus);
            }
            parentMenu.setChildren(childMenus);
        }
        return parentMenus;
    }
    public ManageMenu findByCode(String code) {
        ManageMenu menu = menuDao.findByCode(code);
        List<Map<String, Object>> req = menuUrlService.getUrlByMenuCode(menu.getCode());
        menu.setReq(req);
        return menuDao.findByCode(code);
    }
@ -123,6 +156,7 @@ public class MenuService {
        }
    }
    @Transactional
    public void saveOrUpdate(ManageMenu menu,String userCode) {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
@ -134,18 +168,21 @@ public class MenuService {
        }
        menu.setUpdateUser(userCode);
        menu.setUpdateUserName(userName);
        menuDao.save(menu);
        menuDao.save(menu);//保存或更新之后,同步保存manage_menu_url
        List<String> urls = menu.getUrl();
        List<String> methods = menu.getMethod();
        String menuCode = menu.getCode();
        menuUrlService.saveOrUpdate(menuCode,urls,methods);
    }
    public Map<String, List> getMenuTree() throws ManageException {
        List<MenuItems> menuItemses = new ArrayList<>();
        Map<String, List> data = new HashMap<>();
        //查询所有父菜单
        //查询所有模块
        List<ManageMenu> parentMenus = getParentMenus();
        //查询所有子菜单
        if(parentMenus!=null){
            for(ManageMenu parentMenu:parentMenus){
                //通过父菜单查找对应的子菜单
                //查询所有菜单
                List<ManageMenu> childMenus = getChildMenus(parentMenu.getCode());
                MenuItems menuItem = new MenuItems();
                menuItem.setParentMenu(parentMenu);

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

@ -6,6 +6,7 @@ import com.yihu.jw.manage.model.wechat.GraphicMessage;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WechatContants;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +26,7 @@ import java.util.Map;
@Service
public class GraphicMessageService {
    @Value("${spring.gateway}")
    @Value("${spring.gateway}"+"/"+ WechatContants.api_common+"/")
    private String url;
    @Autowired
@ -46,8 +47,7 @@ public class GraphicMessageService {
            map.put("filters",filters);
        }
        Envelop forObject = template.getForObject(url + "/wechat/graphicMessage/list?size={size}&page={page}&sorts={sorts}&filters={filters}",
                Envelop.class,map);
        Envelop forObject = template.getForObject(url +WechatContants.WxGraphicMessage.api_getWxGraphicMessages+ "?size={size}&page={page}&sorts={sorts}&filters={filters}", Envelop.class,map);
        return forObject;
    }
@ -61,14 +61,14 @@ public class GraphicMessageService {
        Map<String, String> par = new HashMap<>();
        par.put("userCode", userCode);
        par.put("userName", userName);
        String urlRequest = url + "/wechat/graphicMessage/"+codes+"?userCode={userCode}&userName={userName}";
        String urlRequest = url + "graphicMessage/"+codes+"?userCode={userCode}&userName={userName}";
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,par);
        return envelop;
    }
    public Envelop findByCode(String code) {
        Envelop envelop = template.getForObject(url + "/wechat/graphicMessage/"+code, Envelop.class);
        Envelop envelop = template.getForObject(url + "graphicMessage/"+code, Envelop.class);
        return envelop;
    }
@ -92,11 +92,11 @@ public class GraphicMessageService {
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        Envelop envelop =null;
        if(graphicMessage.getId()==null){//说明是保存
            ResponseEntity<Envelop> responseEntity = template.postForEntity(url + "/wechat/graphicMessage", formEntity, Envelop.class);
            ResponseEntity<Envelop> responseEntity = template.postForEntity(url +WechatContants.WxGraphicMessage.api_create, formEntity, Envelop.class);
            envelop = responseEntity.getBody();
            return envelop;
        }
        ResponseEntity<Envelop> resp = template.exchange(url + "/wechat/graphicMessage",HttpMethod.PUT,formEntity,Envelop.class);
        ResponseEntity<Envelop> resp = template.exchange(url + WechatContants.WxGraphicMessage.api_update,HttpMethod.PUT,formEntity,Envelop.class);
        envelop = resp.getBody();
        return envelop;

+ 8 - 11
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/WechatConfigService.java

@ -6,6 +6,7 @@ import com.yihu.jw.manage.model.wechat.WechatConfig;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WechatContants;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +26,7 @@ import java.util.Map;
@Service
public class WechatConfigService {
    @Value("${spring.gateway}")
    @Value("${spring.gateway}"+"/"+ WechatContants.api_common+"/")
    private String url;
    @Autowired
@ -45,10 +46,7 @@ public class WechatConfigService {
           filters.put("name",name);
           map.put("filters",filters);
       }
       Envelop forObject = template.getForObject(url + "/wechat/wechatConfig/list?size={size}&page={page}&sorts={sorts}&filters={filters}",
               Envelop.class,map);
       return forObject;
       return template.getForObject(url +WechatContants.WxConfig.api_getWechats+"?size={size}&page={page}&sorts={sorts}&filters={filters}", Envelop.class,map);
    }
@ -60,7 +58,7 @@ public class WechatConfigService {
        Map<String, String> map = new HashMap<>();
        map.put("userCode", userCode);
        map.put("userName", userName);
        String urlRequest = url + "/wechat/wechatConfig/"+codes+"?userCode={userCode}&userName={userName}";
        String urlRequest = url +"wechatConfig/"+codes+"?userCode={userCode}&userName={userName}";
        MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,multiValueMap);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,map);
@ -68,7 +66,7 @@ public class WechatConfigService {
    }
    public Envelop findByCode(String code) {
        Envelop envelop = template.getForObject(url + "/wechat/wechatConfig/"+code, Envelop.class);
        Envelop envelop = template.getForObject(url +"wechatConfig/"+code, Envelop.class);
        return envelop;
    }
@ -93,11 +91,11 @@ public class WechatConfigService {
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        Envelop envelop =null;
        if(wechatConfig.getId()==null){//说明是保存
            ResponseEntity<Envelop> responseEntity = template.postForEntity(url + "/wechat/wechatConfig", formEntity, Envelop.class);
            ResponseEntity<Envelop> responseEntity = template.postForEntity(url + WechatContants.WxConfig.api_create, formEntity, Envelop.class);
            envelop = responseEntity.getBody();
            return envelop;
        }
        ResponseEntity<Envelop> resp = template.exchange(url + "/wechat/wechatConfig",HttpMethod.PUT,formEntity,Envelop.class);
        ResponseEntity<Envelop> resp = template.exchange(url + WechatContants.WxConfig.api_update,HttpMethod.PUT,formEntity,Envelop.class);
        envelop = resp.getBody();
        return envelop;
    }
@ -107,8 +105,7 @@ public class WechatConfigService {
        map.put("fields",fields);
        map.put("sorts",sorts);
        map.put("filter",filter);
        Envelop forObject = template.getForObject(url + "/wechat/wechatConfig/listNoPage?fields={fields}&filter={filter}&sorts={sorts}",
                Envelop.class,map);
        Envelop forObject = template.getForObject(url + WechatContants.WxConfig.api_getWechatNoPage+"?fields={fields}&filter={filter}&sorts={sorts}", Envelop.class,map);
        return forObject;
    }
}

+ 19 - 1
svr/svr-manage/src/main/resources/application.yml

@ -27,7 +27,19 @@ spring:
  session:
      store-type: HASH_MAP
  redis:
    database: 0 # Database index used by the connection factory.
    timeout: 0 # Connection timeout in milliseconds.
       #sentinel:
       #  master: # Name of Redis server.
       #  nodes: # Comma-separated list of host:port pairs.
    pool:
      max-active: 8 # Max number of connections that can be allocated by the pool at a given time. Use a negative value for no limit.
      max-idle: 8 # Max number of "idle" connections in the pool. Use a negative value to indicate an unlimited number of idle connections.
      max-wait: -1 # Maximum amount of time (in milliseconds) a connection allocation should block before throwing an exception when the pool is exhausted. Use a negative value to block indefinitely.
      min-idle: 1 # Target for the minimum number of idle connections to maintain in the pool. This setting only has an effect if it is positive.
cache: 1
---
spring:
@ -37,4 +49,10 @@ spring:
  datasource:
    url: jdbc:mysql://172.19.103.77/jw2?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    password: 123456
    password: 123456
  redis:
    host: 192.168.1.220
    port: 6379
    password:    #redis服务器连接密码(默认为空)

+ 1 - 1
svr/svr-manage/src/main/resources/webapp/html/index/index.html

@ -59,7 +59,7 @@
                    </a>
                    <ul class="nav nav-second-level" v-for="childMenu in menu.childMenus">
                        <li>
                                <a class="J_menuItem" :href="childMenu.url" >{{childMenu.name}}</a>
                            <a class="J_menuItem" :href="childMenu.url[0]" >{{childMenu.name}}</a>
                        </li>
                    </ul>
                </li>

+ 5 - 91
svr/svr-manage/src/main/resources/webapp/html/system/menu/html/menuList.html

@ -23,24 +23,6 @@
    </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-1 control-label">菜单名:</label>
                    <div class="col-sm-2">
                        <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">
@ -51,21 +33,7 @@
                    </h5>
                </div>
                <div class="ibox-content">
                    <table id="list" class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th>菜单名</th>
                            <th>路径</th>
                            <th>菜单类型</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                    <table id="list" style="width:100%"></table>
                </div>
            </div>
        </div>
@ -74,72 +42,15 @@
<div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:1200px;height: 800px;">
    <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="menu.id" />
                <input  type="hidden" name="code" :value="menu.code" />
                <input  type="hidden" name="createUser" :value="menu.createUser" />
                <input  type="hidden" name="createUserName" :value="menu.createUserName" />
                <input type="hidden" name="status" value="1"/>
                <!--<input  type="hidden" name="createTime" :value="menu.createTime" />-->
                <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="name" style="width: 250px"   :value="menu.name"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >父级菜单</label>
                    <div class="col-sm-5">
                        <select class="form-control m-b" name="parentCode" id="parentCode" >
                            <option value="">--请选择--</option>
                            <option v-for="parentMenu in parentMenus"  :value="parentMenu.code" :selected="menu.parentCode==parentMenu.code" >{{parentMenu.name}}</option>
                        </select>
                    </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="url" style="width: 250px"   :value="menu.url"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >排序:</label>
                    <div class="col-sm-5">
                        <input type="text"  class="form-control"  name="sort" style="width: 250px"   :value="menu.sort"/>
                    </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" name="remark" :value="menu.remark" style="width: 250px" class="form-control" />
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="submit" 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-->
@ -148,7 +59,10 @@
<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/jquery-easyui-1.5.2/easyloader.js"></script>
<script type="text/javascript" src="/common/js/jquery-easyui-1.5.2/jquery.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.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>

+ 12 - 0
svr/svr-manage/src/main/resources/webapp/html/system/role/html/roleList.html

@ -56,6 +56,7 @@
                        <tr>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th>角色名称</th>
                            <th>saasId</th>
                            <th>描述</th>
                            <th>创建时间</th>
                            <th>操作</th>
@ -93,6 +94,17 @@
                        <input type="text"  class="form-control"  name="name" style="width: 250px"  required="true"  :value="detail.name"/>
                    </div>
                </div>
                <div style="margin-top:15px;margin-bottom: 15px;" >
                    <label class="col-sm-4 control-label no-padding-right" > saasId:</label>
                    <div class="col-sm-6">
                        <select name="saasId" class="form-control m-b" required="true" :value="detail.saasId">
                            <option value="">--请选择--</option>
                            <template v-for="saas in saasList">
                                <option :value="saas.code">{{saas.name}}</option>
                            </template>
                        </select>
                    </div>
                </div>
                <div class="m-form-group">
                    <label class="col-sm-4 control-label no-padding-right" >描&#12288;&#12288;述: </label>
                    <div class="col-sm-6">

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

@ -5,6 +5,7 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.fegin.base.SaasFegin;
import com.yihu.jw.restmodel.base.base.BaseContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping(BaseContants.Saas.api_common)
@RequestMapping("{version}/"+BaseContants.Saas.api_common)
@Api(description = "saas相关")
public class SaasController {
@ -31,7 +32,8 @@ public class SaasController {
    private Tracer tracer;
    @GetMapping(value = BaseContants.Saas.api_getSaass)
    @ApiVersion(1)
    @GetMapping(value = BaseContants.Saas.api_getSaassNoPage)
    @ApiOperation(value = "获取saas,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间

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

@ -2,9 +2,9 @@ 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.commnon.base.wx.WechatContants;
import com.yihu.jw.fegin.base.wx.AccessTokenFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WechatContants;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping(WechatContants.AccessToken.api_common)
@RequestMapping("{version}/"+ WechatContants.WxAccessToken.api_common)
@Api(description = "微信token相关")
public class WechatAccessTokenController {
@ -33,7 +33,7 @@ public class WechatAccessTokenController {
    @Autowired
    private Tracer tracer;
    @GetMapping(value = WechatContants.AccessToken.api_get)
    @GetMapping(value = WechatContants.WxAccessToken.api_get)
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间

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

@ -2,10 +2,10 @@ 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.commnon.base.wx.WechatContants;
import com.yihu.jw.fegin.base.wx.WechatFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信配置")
public class WechatConfigController {
@ -34,7 +34,7 @@ public class WechatConfigController {
    @ApiVersion(1)
    @ApiOperation(value = "创建微信配置")
    @PostMapping(value = WechatContants.Config.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxConfig.api_create,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -49,7 +49,7 @@ public class WechatConfigController {
    @ApiVersion(1)
    @ApiOperation(value = "更新微信配置")
    @PutMapping(value = WechatContants.Config.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxConfig.api_update,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -62,7 +62,7 @@ public class WechatConfigController {
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Config.api_delete)
    @DeleteMapping(value = WechatContants.WxConfig.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -79,7 +79,7 @@ public class WechatConfigController {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Config.api_getByCode)
    @GetMapping(value = WechatContants.WxConfig.api_getByCode)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -92,7 +92,7 @@ public class WechatConfigController {
    }
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.Config.api_getWechats, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxConfig.api_getWechats, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信配置列表(分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -121,7 +121,7 @@ public class WechatConfigController {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Config.api_getWechatNoPage)
    @GetMapping(value = WechatContants.WxConfig.api_getWechatNoPage)
    @ApiOperation(value = "获取微信列表配置,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间

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

@ -2,10 +2,10 @@ 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.commnon.base.wx.WechatContants;
import com.yihu.jw.fegin.base.wx.GraphicMessageFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信图文相关")
public class WechatGraphicMessageController {
    private Logger logger= LoggerFactory.getLogger(WechatGraphicMessageController.class);
@ -38,7 +38,7 @@ public class WechatGraphicMessageController {
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.GraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxGraphicMessage.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -53,7 +53,7 @@ public class WechatGraphicMessageController {
    @ApiVersion(1)
    @PutMapping(value = WechatContants.GraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxGraphicMessage.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -66,7 +66,7 @@ public class WechatGraphicMessageController {
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.GraphicMessage.api_delete)
    @DeleteMapping(value = WechatContants.WxGraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -82,7 +82,7 @@ public class WechatGraphicMessageController {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_getByCode)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getByCode)
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -95,7 +95,7 @@ public class WechatGraphicMessageController {
    }
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信图文消息列表(分页)")
    public Envelop getWxGraphicMessages(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
@ -124,7 +124,7 @@ public class WechatGraphicMessageController {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessageNoPage)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessageNoPage)
    @ApiOperation(value = "获取图文消息列表,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -140,7 +140,7 @@ public class WechatGraphicMessageController {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_sendGraphicMessages)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_sendGraphicMessages)
    @ApiOperation(value = "发送图文消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间

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

@ -2,10 +2,10 @@ 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.commnon.base.wx.WechatContants;
import com.yihu.jw.fegin.base.wx.WechatMenuFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信菜单配置")
public class WechatMenuController {
@ -36,7 +36,7 @@ public class WechatMenuController {
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.Menu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -50,7 +50,7 @@ public class WechatMenuController {
    }
    @PutMapping(value = WechatContants.Menu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxMenu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -63,7 +63,7 @@ public class WechatMenuController {
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Menu.api_delete)
    @DeleteMapping(value = WechatContants.WxMenu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -78,7 +78,7 @@ public class WechatMenuController {
        return wechatMenuFegin.deleteWxMenu(codes,userCode,userName);
    }
    @GetMapping(value = WechatContants.Menu.api_getByCode)
    @GetMapping(value = WechatContants.WxMenu.api_getByCode)
     @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
     @HystrixCommand(commandProperties = {
             @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -90,7 +90,7 @@ public class WechatMenuController {
        return wechatMenuFegin.findByCode(code);
    }
    @RequestMapping(value = WechatContants.Menu.api_getWxMenus, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getWxMenus, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信菜单列表(分页)")
    public Envelop getWxMenus(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
@ -115,7 +115,7 @@ public class WechatMenuController {
    }
    @GetMapping(value = WechatContants.Menu.api_getWxMenuNoPage)
    @GetMapping(value = WechatContants.WxMenu.api_getWxMenuNoPage)
    @ApiOperation(value = "获取微信菜单列表,不分页")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -136,7 +136,7 @@ public class WechatMenuController {
     * @return
     */
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @RequestMapping(value = WechatContants.Menu.api_createMenu ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -146,7 +146,7 @@ public class WechatMenuController {
        return wechatMenuFegin.createWechatMenu(wechatCode);
    }
    @GetMapping(value = WechatContants.Menu.api_getParentMenu)
    @GetMapping(value = WechatContants.WxMenu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -158,7 +158,7 @@ public class WechatMenuController {
        return wechatMenuFegin.getParentMenu(wechatCode);
    }
    @GetMapping(value = WechatContants.Menu.api_getChildMenus)
    @GetMapping(value = WechatContants.WxMenu.api_getChildMenus)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间

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

@ -2,10 +2,10 @@ 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.commnon.base.wx.WechatContants;
import com.yihu.jw.fegin.base.wx.WechatTemplateFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信模板消息相关")
public class WechatTemplateControlle {
@ -36,7 +36,7 @@ public class WechatTemplateControlle {
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.Template.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = WechatContants.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -50,7 +50,7 @@ public class WechatTemplateControlle {
    }
    @ApiVersion(1)
    @PutMapping(value = WechatContants.Template.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = WechatContants.WxTemplate.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -64,7 +64,7 @@ public class WechatTemplateControlle {
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Template.api_delete)
    @DeleteMapping(value = WechatContants.WxTemplate.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -80,7 +80,7 @@ public class WechatTemplateControlle {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_getByCode)
    @GetMapping(value = WechatContants.WxTemplate.api_getByCode)
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -93,7 +93,7 @@ public class WechatTemplateControlle {
    }
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.Template.api_getWxTemplates, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信模版列表(分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -121,7 +121,7 @@ public class WechatTemplateControlle {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_getWxTemplatesNoPage)
    @GetMapping(value = WechatContants.WxTemplate.api_getWxTemplatesNoPage)
    @ApiOperation(value = "获取微信模版列表(不分页)")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -137,7 +137,7 @@ public class WechatTemplateControlle {
    }
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_sendTemplateMessage)
    @GetMapping(value = WechatContants.WxTemplate.api_sendTemplateMessage)
    @ApiOperation(value = "发送微信模板消息")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间

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

@ -3,7 +3,7 @@ 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 com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@ -16,10 +16,10 @@ import org.springframework.web.bind.annotation.RequestParam;
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = AccessTokenFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxAccessToken.api_common)
@RequestMapping(value = WechatContants.WxAccessToken.api_common)
public interface AccessTokenFegin {
    @RequestMapping(value = WxContants.WxAccessToken.api_get, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxAccessToken.api_get, method = RequestMethod.GET)
    Envelop getWxAccessToken(@RequestParam(value = "wechatCode") String wechatCode) ;
}

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

@ -4,7 +4,7 @@ import com.yihu.jw.fegin.fallbackfactory.base.wx.GraphicMessageFeginFallbackFact
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
@ -19,22 +19,22 @@ import org.springframework.web.bind.annotation.RequestParam;
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = GraphicMessageFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxGraphicMessage.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface GraphicMessageFegin {
    @RequestMapping(value = WxContants.WxGraphicMessage.api_create, method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_create, method = RequestMethod.POST,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop createWxGraphicMessage( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_update,method = RequestMethod.PUT,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_update,method = RequestMethod.PUT,consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop updateWxGraphicMessage( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_delete,method = RequestMethod.DELETE)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWxGraphicMessage(@RequestParam(value = "codes") String codes,@RequestParam(value = "userCode") String userCode,@RequestParam(value = "userName") String userName) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_getByCode,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(@RequestParam(value = "code") String code) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_getWxGraphicMessages,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessages,method = RequestMethod.GET)
    Envelop getWxGraphicMessages(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -42,13 +42,13 @@ public interface GraphicMessageFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_getWxGraphicMessageNoPage,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.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) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_sendGraphicMessages,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_sendGraphicMessages,method = RequestMethod.GET)
    String sendGraphicMessages(
            @RequestParam(value = "codes", required = true) String codes,
            @RequestParam(value = "fromUserName", required = true) String fromUserName,

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

@ -4,7 +4,7 @@ import com.yihu.jw.fegin.fallbackfactory.base.wx.WechatFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
@ -17,24 +17,24 @@ import org.springframework.web.bind.annotation.RequestParam;
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = WechatFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.Wechat.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface WechatFegin {
    @RequestMapping(value = WxContants.Wechat.api_create, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxConfig.api_create, method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop createWechat( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.Wechat.api_update, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxConfig.api_update, method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop updateWechat(String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.Wechat.api_delete,method = RequestMethod.DELETE)
    @RequestMapping(value = WechatContants.WxConfig.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWechat(@RequestParam(value = "codes") String codes,@RequestParam(value = "userCode") String userCode,@RequestParam(value = "userName") String userName) throws JiWeiException;
    @RequestMapping(value = WxContants.Wechat.api_getByCode,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxConfig.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(@RequestParam(value = "code") String code) throws JiWeiException;
    @RequestMapping(value = WxContants.Wechat.api_getWechats ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxConfig.api_getWechats ,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) throws JiWeiException;
    @RequestMapping(value = WxContants.Wechat.api_getWechatNoPage,method = RequestMethod.GET )
    @RequestMapping(value = WechatContants.WxConfig.api_getWechatNoPage,method = RequestMethod.GET )
    Envelop getWechatNoPage(@RequestParam(value = "fields")String fields,@RequestParam(value = "filters") String filters,@RequestParam(value = "sorts") String sorts) throws JiWeiException;
}

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

@ -4,7 +4,7 @@ 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.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -16,28 +16,28 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  =WechatMenuFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxMenu.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface WechatMenuFegin {
    @RequestMapping(value = WxContants.WxMenu.api_create,method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxMenu.api_create,method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop createWxMenu( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_update,method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxMenu.api_update,method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop updateWxMenu( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_delete,method = RequestMethod.DELETE)
    @RequestMapping(value = WechatContants.WxMenu.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWxMenu(@RequestParam(value="codes")String codes,@RequestParam(value = "userCode") String userCode,@RequestParam(value = "userName") String userName) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getByCode,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getByCode,method = RequestMethod.GET)
    Envelop findByCode(@RequestParam(value="code")String code) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getWxMenuNoPage,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.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) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getWxMenus,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getWxMenus,method = RequestMethod.GET)
    Envelop getWxMenus(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -45,12 +45,12 @@ public interface WechatMenuFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    Envelop createWechatMenu(@RequestParam(value = "wechatCode", required = true)String wechatCode);
    @RequestMapping(value = WxContants.WxMenu.api_getParentMenu,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getParentMenu,method = RequestMethod.GET)
    Envelop getParentMenu(@PathVariable(value = "wechatCode", required = true) String wechatCode) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getChildMenus,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getChildMenus,method = RequestMethod.GET)
    Envelop getChildMenus(@PathVariable(value = "parentCode", required = true) String parentCode) throws JiWeiException;
}

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

@ -4,7 +4,7 @@ import com.yihu.jw.fegin.fallbackfactory.base.wx.WechatTemplateFeginFallbackFact
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -16,28 +16,28 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  =WechatTemplateFeginFallbackFactory.class
)
@RequestMapping(value = WxContants.WxTemplate.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface WechatTemplateFegin {
    @RequestMapping(value = WxContants.WxTemplate.api_create ,method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxTemplate.api_create ,method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop createWxTemplate(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_update ,method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @RequestMapping(value = WechatContants.WxTemplate.api_update ,method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop updateWxTemplate(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_delete ,method = RequestMethod.DELETE)
    @RequestMapping(value = WechatContants.WxTemplate.api_delete ,method = RequestMethod.DELETE)
    Envelop deleteWxTemplate( @RequestParam(value = "codes", required = true) String codes,@RequestParam(value = "userCode") String userCode,@RequestParam(value = "userName") String userName) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_getByCode ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxTemplate.api_getByCode ,method = RequestMethod.GET)
    Envelop findByCode( @RequestParam(value = "code", required = true) String code) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_getWxTemplatesNoPage ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.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) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    Envelop getWechats(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
@ -45,7 +45,7 @@ public interface WechatTemplateFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_sendTemplateMessage ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxTemplate.api_sendTemplateMessage ,method = RequestMethod.GET)
    @ResponseBody
    Envelop sendTemplateMessage(
            @RequestParam(value="openid") String openid,