chenweida il y a 7 ans
Parent
commit
55e7906f1a
47 fichiers modifiés avec 685 ajouts et 483 suppressions
  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;
package com.yihu.jw.restmodel.wx;
import java.util.Date;
import java.util.Date;
import java.util.List;
/**
/**
 * Created by Administrator on 2017/5/20 0020.
 * Created by Administrator on 2017/5/20 0020.
@ -28,6 +29,15 @@ public class MWxMenu {
    private String createUserName;//创建人
    private String createUserName;//创建人
    private String remark;//备注
    private String remark;//备注
    private Integer status; //状态 -1删除 0 冻结 1可用
    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() {
    public Long getId() {
        return id;
        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;
package com.yihu.jw.restmodel.wx;
import java.util.Date;
import java.util.Date;
import java.util.List;
/**
/**
 * Created by Administrator on 2017/5/20 0020.
 * Created by Administrator on 2017/5/20 0020.
@ -26,6 +27,15 @@ public class MWxWechat {
    private String updateUserName;//'修改人名'
    private String updateUserName;//'修改人名'
    private Date updateTime;//'修改时间'
    private Date updateTime;//'修改时间'
    private String remark;//'备注'
    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() {
    public Long getId() {
        return id;
        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.base.base.BaseContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.restmodel.wlyy.agreement.WlyyAgreementContants;
import com.yihu.jw.restmodel.wlyy.patient.WlyyPatientContants;
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.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Configuration;
@ -35,11 +35,8 @@ public class SwaggerConfig {
                .paths(or(
                .paths(or(
                        regex("/patient/.*")
                        regex("/patient/.*")
                        , regex("/"+ BaseContants.Function.api_common+"/.*")
                        , 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()
                .build()
                .apiInfo(publicApiInfo());
                .apiInfo(publicApiInfo());
@ -103,11 +100,8 @@ public class SwaggerConfig {
                         regex("/"+ BaseContants.Function.api_common+"/.*")
                         regex("/"+ BaseContants.Function.api_common+"/.*")
                        ,regex("/"+ BaseContants.Saas.api_common+"/.*")
                        ,regex("/"+ BaseContants.Saas.api_common+"/.*")
                        ,regex("/"+ BaseContants.Module.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()
                .build()
                .apiInfo(jwBaseApiInfo());
                .apiInfo(jwBaseApiInfo());

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

@ -73,6 +73,7 @@
        <version.springside>4.2.3-GA</version.springside>
        <version.springside>4.2.3-GA</version.springside>
        <version.common.lang3>3.1</version.common.lang3>
        <version.common.lang3>3.1</version.common.lang3>
        <version.elasticsearch>2.4.4</version.elasticsearch>
        <version.elasticsearch>2.4.4</version.elasticsearch>
        <version.redis>1.5.3.RELEASE</version.redis>
    </properties>
    </properties>
    <!--dependencyManagement作用子配置不写版本默认继承父配置-->
    <!--dependencyManagement作用子配置不写版本默认继承父配置-->
    <dependencyManagement>
    <dependencyManagement>
@ -488,6 +489,13 @@
                <version>${version.common.lang3}</version>
                <version>${version.common.lang3}</version>
            </dependency>
            </dependency>
            <!--  redis -->
            <dependency>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-starter-data-redis</artifactId>
                <version>${version.redis}</version>
            </dependency>
        </dependencies>
        </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)
    @GetMapping(value = BaseContants.Saas.api_getSaassNoPage)
    @ApiOperation(value = "获取Saas配置列表,不分页")
    @ApiOperation(value = "获取Saas配置列表,不分页")
    public Envelop getAppsNoPage(
    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,
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,

+ 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.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxWechat;
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.model.WxWechat;
import com.yihu.jw.wx.service.WechatService;
import com.yihu.jw.wx.service.WechatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -24,40 +24,40 @@ import java.util.List;
 * Created by chenweida on 2017/5/11.
 * Created by chenweida on 2017/5/11.
 */
 */
@RestController
@RestController
@RequestMapping(WxContants.Wechat.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信相关操作", description = "微信相关操作")
@Api(value = "微信相关操作", description = "微信相关操作")
public class WechatConfigController extends EnvelopRestController {
public class WechatConfigController extends EnvelopRestController {
    @Autowired
    @Autowired
    private WechatService wechatService;
    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 = "创建微信配置")
    @ApiOperation(value = "创建微信配置", notes = "创建微信配置")
    public Envelop createWechat(
    public Envelop createWechat(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxWechat wechat = toEntity(jsonData, WxWechat.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "修改微信配置")
    @ApiOperation(value = "修改微信配置", notes = "修改微信配置")
    public Envelop updateWechat(
    public Envelop updateWechat(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxWechat wechat = toEntity(jsonData, WxWechat.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @DeleteMapping(value = WxContants.Wechat.api_delete)
    @DeleteMapping(value = WechatContants.WxConfig.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    public Envelop deleteWechat(
    public Envelop deleteWechat(
            @ApiParam(name = "codes", value = "codes")
            @ApiParam(name = "codes", value = "codes")
@ -69,26 +69,26 @@ public class WechatConfigController extends EnvelopRestController {
            ) {
            ) {
        try {
        try {
            wechatService.deleteWechat(codes,userCode,userName);
            wechatService.deleteWechat(codes,userCode,userName);
            return Envelop.getSuccess(WxContants.Wechat.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxConfig.message_success_delete );
        } catch (ApiException e) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @GetMapping(value = WxContants.Wechat.api_getByCode)
    @GetMapping(value = WechatContants.WxConfig.api_getByCode)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    public Envelop findByCode(
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
            @RequestParam(value = "code", required = true) String code
    ) {
    ) {
        try {
        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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "获取微信配置列表(分页)")
    @ApiOperation(value = "获取微信配置列表(分页)")
    public Envelop getWechats(
    public Envelop getWechats(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段")
            @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);
        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 = "获取微信列表配置,不分页")
    @ApiOperation(value = "获取微信列表配置,不分页")
    public Envelop getWechatNoPage(
    public Envelop getWechatNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @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<WxWechat> list = wechatService.search(fields,filters,sorts);
        //封装返回格式
        //封装返回格式
        List<MWxWechat> mWxWechats = convertToModels(list, new ArrayList<>(list.size()), MWxWechat.class, fields);
        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.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
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.model.WxAccessToken;
import com.yihu.jw.wx.service.WxAccessTokenService;
import com.yihu.jw.wx.service.WxAccessTokenService;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -19,7 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
 * Created by cyx on 2017/5/11.
 * Created by cyx on 2017/5/11.
 */
 */
@RestController
@RestController
@RequestMapping(WxContants.WxAccessToken.api_common)
@RequestMapping(WechatContants.WxAccessToken.api_common)
@Api(value = "微信token模块", description = "微信token模块接口管理")
@Api(value = "微信token模块", description = "微信token模块接口管理")
public class WxAccessTokenController extends EnvelopRestController {
public class WxAccessTokenController extends EnvelopRestController {
@ -32,14 +32,14 @@ public class WxAccessTokenController extends EnvelopRestController {
     * @return MWxAccessToken
     * @return MWxAccessToken
     * @throws Exception
     * @throws Exception
     */
     */
    @GetMapping(value = WxContants.WxAccessToken.api_get)
    @GetMapping(value = WechatContants.WxAccessToken.api_get)
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    public Envelop getWxAccessToken(
    public Envelop getWxAccessToken(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @RequestParam(value = "wechatCode") String wechatCode) {
            @RequestParam(value = "wechatCode") String wechatCode) {
        try {
        try {
            WxAccessToken wxAccessToken = wxAccessTokenService.getWxAccessTokenByCode(wechatCode);
            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) {
        }catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxGraphicMessage;
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.model.WxGraphicMessage;
import com.yihu.jw.wx.service.WxGraphicMessageService;
import com.yihu.jw.wx.service.WxGraphicMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
@ -24,41 +24,41 @@ import java.util.List;
 *   2017/5/11.
 *   2017/5/11.
 */
 */
@RestController
@RestController
@RequestMapping(WxContants.WxGraphicMessage.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信图文相关操作", description = "微信图文相关操作")
@Api(value = "微信图文相关操作", description = "微信图文相关操作")
public class WxGraphicMessageController extends EnvelopRestController {
public class WxGraphicMessageController extends EnvelopRestController {
    @Autowired
    @Autowired
    private WxGraphicMessageService wxGraphicMessageService;
    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 = "创建微信图文消息")
    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
    public Envelop createWxGraphicMessage(
    public Envelop createWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxGraphicMessage WxGraphicMessage = toEntity(jsonData, WxGraphicMessage.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "修改微信图文消息")
    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
    public Envelop updateWxGraphicMessage(
    public Envelop updateWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxGraphicMessage WxGraphicMessage = toEntity(jsonData, WxGraphicMessage.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @DeleteMapping(value = WxContants.WxGraphicMessage.api_delete)
    @DeleteMapping(value = WechatContants.WxGraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    public Envelop deleteWxGraphicMessage(
    public Envelop deleteWxGraphicMessage(
            @ApiParam(name = "codes", value = "codes")
            @ApiParam(name = "codes", value = "codes")
@ -70,26 +70,26 @@ public class WxGraphicMessageController extends EnvelopRestController {
    ) {
    ) {
        try {
        try {
            wxGraphicMessageService.deleteWxGraphicMessage(codes, userCode, userName);
            wxGraphicMessageService.deleteWxGraphicMessage(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxGraphicMessage.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxGraphicMessage.message_success_delete );
        } catch (ApiException e) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @GetMapping(value = WxContants.WxGraphicMessage.api_getByCode)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getByCode)
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    public Envelop findByCode(
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
            @RequestParam(value = "code", required = true) String code
    ) {
    ) {
        try {
        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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "获取微信图文消息列表(分页)")
    @ApiOperation(value = "获取微信图文消息列表(分页)")
    public Envelop getWxGraphicMessages(
    public Envelop getWxGraphicMessages(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
            @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);
        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 = "获取图文消息列表,不分页")
    @ApiOperation(value = "获取图文消息列表,不分页")
    public Envelop getWxGraphicMessageNoPage(
    public Envelop getWxGraphicMessageNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
            @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<WxGraphicMessage> list = wxGraphicMessageService.search(fields,filters,sorts);
        //封装返回格式
        //封装返回格式
        List<MWxGraphicMessage> mWxGraphicMessages = convertToModels(list, new ArrayList<>(list.size()), MWxGraphicMessage.class, fields);
        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)
    //@GetMapping(value = WlyyContants.WxGraphicMessage.api_sendGraphicMessages)
@ -145,7 +145,7 @@ public class WxGraphicMessageController extends EnvelopRestController {
    //    return Envelop.getSuccess("成功",messages);
    //    return Envelop.getSuccess("成功",messages);
    //}
    //}
    @GetMapping(value = WxContants.WxGraphicMessage.api_sendGraphicMessages)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_sendGraphicMessages)
    @ApiOperation(value = "发送图文消息")
    @ApiOperation(value = "发送图文消息")
    @ResponseBody
    @ResponseBody
    public String sendGraphicMessages(
    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.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxMenu;
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.WechatResponse;
import com.yihu.jw.wx.model.WxMenu;
import com.yihu.jw.wx.model.WxMenu;
import com.yihu.jw.wx.model.WxWechat;
import com.yihu.jw.wx.model.WxWechat;
@ -29,7 +30,7 @@ import java.util.Map;
 * Created by Administrator on 2017/5/19 0019.
 * Created by Administrator on 2017/5/19 0019.
 */
 */
@RestController
@RestController
@RequestMapping(WxContants.WxMenu.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信菜单相关操作", description = "微信菜单相关操作")
@Api(value = "微信菜单相关操作", description = "微信菜单相关操作")
public class WxMenuController extends EnvelopRestController {
public class WxMenuController extends EnvelopRestController {
@ -39,34 +40,34 @@ public class WxMenuController extends EnvelopRestController {
    @Autowired
    @Autowired
    private WechatService wechatService;
    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 = "添加微信菜单")
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    public Envelop createWxMenu(
    public Envelop createWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxMenu wxMenu = toEntity(jsonData, WxMenu.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "修改微信菜单")
    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
    public Envelop updateWxMenu(
    public Envelop updateWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxMenu wxMenu = toEntity(jsonData, WxMenu.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @DeleteMapping(value = WxContants.WxMenu.api_delete)
    @DeleteMapping(value = WechatContants.WxMenu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    public Envelop deleteWxMenu(
    public Envelop deleteWxMenu(
            @ApiParam(name = "codes", value = "codes")
            @ApiParam(name = "codes", value = "codes")
@ -78,26 +79,26 @@ public class WxMenuController extends EnvelopRestController {
    ) {
    ) {
        try {
        try {
            wxMenuService.deleteWxMenu(codes, userCode, userName);
            wxMenuService.deleteWxMenu(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxMenu.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxMenu.message_success_delete );
        } catch (ApiException e) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @GetMapping(value = WxContants.WxMenu.api_getByCode)
    @GetMapping(value = WechatContants.WxMenu.api_getByCode)
    @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
    @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
    public Envelop findByCode(
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
            @RequestParam(value = "code", required = true) String code
    ) {
    ) {
        try {
        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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "获取微信菜单列表(分页)")
    @ApiOperation(value = "获取微信菜单列表(分页)")
    public Envelop getWxMenus(
    public Envelop getWxMenus(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @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)){
        if(StringUtils.isBlank(sorts)){
            sorts = "-updateTime";
            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);
        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 = "获取微信菜单列表,不分页")
    @ApiOperation(value = "获取微信菜单列表,不分页")
    public Envelop getWxMenuNoPage(
    public Envelop getWxMenuNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @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,
            @RequestParam(value = "filters", required = false) String filters,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        if(filters!=null){
            filters = "supMenucode=0;"+filters;
        }else{
            filters = "supMenucode=0;";
        }
        //得到list数据
        //得到list数据
        List<WxMenu> list = wxMenuService.search(fields,filters,sorts);
        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);
        List<MWxMenu> mWxMenus = convertToModels(list, new ArrayList<>(list.size()), MWxMenu.class, fields);
        Map<String, String> map = wechatService.getAllWechatConfig();
        Map<String, String> map = wechatService.getAllWechatConfig();
        for(MWxMenu menu:mWxMenus){
        for(MWxMenu menu:mWxMenus){
            menu.setWechatName(map.get(menu.getWechatCode()));
            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
     * @return
     */
     */
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @RequestMapping(value = WxContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    public Envelop createWechatMenu(
    public Envelop createWechatMenu(
            @ApiParam(name = "wechatCode", value = "", defaultValue = "")
            @ApiParam(name = "wechatCode", value = "", defaultValue = "")
            @RequestParam(value = "wechatCode", required = true)String wechatCode){
            @RequestParam(value = "wechatCode", required = true)String wechatCode){
@ -177,14 +192,14 @@ public class WxMenuController extends EnvelopRestController {
     * @param wechatCode
     * @param wechatCode
     * @return
     * @return
     */
     */
    @GetMapping(value = WxContants.WxMenu.api_getParentMenu)
    @GetMapping(value = WechatContants.WxMenu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    public Envelop getParentMenu(
    public Envelop getParentMenu(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @PathVariable(value = "wechatCode", required = true) String wechatCode
            @PathVariable(value = "wechatCode", required = true) String wechatCode
    ) {
    ) {
        try {
        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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
@ -196,14 +211,14 @@ public class WxMenuController extends EnvelopRestController {
     * @param parentCode
     * @param parentCode
     * @return
     * @return
     */
     */
    @GetMapping(value = WxContants.WxMenu.api_getChildMenus)
    @GetMapping(value = WechatContants.WxMenu.api_getChildMenus)
    @ApiOperation(value = "根据父级菜单code查找子菜单", notes = "根据父级菜单code查找子菜单")
    @ApiOperation(value = "根据父级菜单code查找子菜单", notes = "根据父级菜单code查找子菜单")
    public Envelop getChildMenus(
    public Envelop getChildMenus(
            @ApiParam(name = "parentCode", value = "parentCode")
            @ApiParam(name = "parentCode", value = "parentCode")
            @PathVariable(value = "parentCode", required = true) String parentCode
            @PathVariable(value = "parentCode", required = true) String parentCode
    ) {
    ) {
        try {
        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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.wx.MWxTemplate;
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.WechatResponse;
import com.yihu.jw.wx.model.Miniprogram;
import com.yihu.jw.wx.model.Miniprogram;
import com.yihu.jw.wx.model.WxTemplate;
import com.yihu.jw.wx.model.WxTemplate;
@ -29,7 +29,7 @@ import java.util.Map;
 * Created by Administrator on 2017/5/19 0019.
 * Created by Administrator on 2017/5/19 0019.
 */
 */
@RestController
@RestController
@RequestMapping(WxContants.WxTemplate.api_common)
@RequestMapping(WechatContants.api_common)
@Api(value = "微信模版相关操作", description = "微信模版相关操作")
@Api(value = "微信模版相关操作", description = "微信模版相关操作")
public class WxTemplateController extends EnvelopRestController {
public class WxTemplateController extends EnvelopRestController {
    @Autowired
    @Autowired
@ -38,33 +38,33 @@ public class WxTemplateController extends EnvelopRestController {
    @Autowired
    @Autowired
    private WechatService wechatService;
    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 = "创建微信模版")
    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
    public Envelop createWxTemplate(
    public Envelop createWxTemplate(
            @ApiParam(name = "json_data", value = "微信模版json字符串")
            @ApiParam(name = "json_data", value = "微信模版json字符串")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxTemplate WxTemplate = toEntity(jsonData, WxTemplate.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "修改微信模版")
    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
    public Envelop updateWxTemplate(
    public Envelop updateWxTemplate(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) {
        try {
        try {
            WxTemplate WxTemplate = toEntity(jsonData, WxTemplate.class);
            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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @DeleteMapping(value = WxContants.WxTemplate.api_delete)
    @DeleteMapping(value = WechatContants.WxTemplate.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    public Envelop deleteWxTemplate(
    public Envelop deleteWxTemplate(
            @ApiParam(name = "codes", value = "codes")
            @ApiParam(name = "codes", value = "codes")
@ -76,26 +76,26 @@ public class WxTemplateController extends EnvelopRestController {
    ) {
    ) {
        try {
        try {
            wxTemplateService.deleteWxTemplate(codes, userCode, userName);
            wxTemplateService.deleteWxTemplate(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxTemplate.message_success_delete );
            return Envelop.getSuccess(WechatContants.WxTemplate.message_success_delete );
        } catch (ApiException e) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
        }
    }
    }
    @GetMapping(value = WxContants.WxTemplate.api_getByCode)
    @GetMapping(value = WechatContants.WxTemplate.api_getByCode)
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    public Envelop findByCode(
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
            @RequestParam(value = "code", required = true) String code
    ) {
    ) {
        try {
        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) {
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
            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 = "获取微信模版列表(分页)")
    @ApiOperation(value = "获取微信模版列表(分页)")
    public Envelop getWechats(
    public Envelop getWechats(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
            @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()));
            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 = "获取微信模版列表(不分页)")
    @ApiOperation(value = "获取微信模版列表(不分页)")
    public Envelop getWechatNoPage(
    public Envelop getWechatNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,wechatCode,templateId,content,remark,status")
            @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){
        for(MWxTemplate template:mMWxTemplates){
            template.setWechatName(map.get(template.getWechatCode()));
            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 = "发送微信模板消息")
    @ApiOperation(value = "发送微信模板消息")
    @ResponseBody
    @ResponseBody
    public Envelop sendTemplateMessage(
    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 wechatCode
     * @param sort
     * @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);
    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")
    @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);
    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);
    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.Column;
import javax.persistence.Entity;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.util.List;
/**
/**
 * 微信 菜单表
 * 微信 菜单表
@ -13,7 +15,6 @@ import javax.persistence.Table;
@Table(name = "wx_menu")
@Table(name = "wx_menu")
public class WxMenu extends IdEntity implements java.io.Serializable {
public class WxMenu extends IdEntity implements java.io.Serializable {
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String supMenucode;//父菜单id 如果是一级菜单 此字段为空
    private String supMenucode;//父菜单id 如果是一级菜单 此字段为空
    private String type;//菜单类型
    private String type;//菜单类型
@ -27,6 +28,9 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
    private String remark;//备注
    private String remark;//备注
    private Integer status; //状态 -1删除 0 冻结 1可用
    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 WxMenu() {
    }
    }
    public List<WxMenu> getChildren() {
        return children;
    }
    public void setChildren(List<WxMenu> children) {
        this.children = children;
    }
    @Column(name="menu_key")
    @Column(name="menu_key")
    public String getMenuKey() {
    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 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.Date;
import java.util.List;
/**
/**
 * WxWechat entity. @author MyEclipse Persistence Tools
 * 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 appSecret;//'微信app_secret'
    private String baseUrl;//'微信base_url'
    private String baseUrl;//'微信base_url'
    private String remark;//'备注'
    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) {
    public WxWechat(String code, String saasId, String name, String token, String encodingAesKey, Integer encType, Integer status, String type, String appId, String appSecret, String baseUrl, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark) {
        this.code = code;
        this.code = code;
        this.saasId = saasId;
        this.saasId = saasId;
@ -49,6 +56,15 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
     */
     */
    public WxWechat() {
    public WxWechat() {
    }
    }
    public List<WxMenu> getChildren() {
        return children;
    }
    public void setChildren(List<WxMenu> children) {
        this.children = children;
    }
    @Column(name = "enc_type")
    @Column(name = "enc_type")
    public Integer getEncType() {
    public Integer getEncType() {
        return encType;
        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.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
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.dao.WechatDao;
import com.yihu.jw.wx.model.WxWechat;
import com.yihu.jw.wx.model.WxWechat;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -27,20 +27,20 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wechat.setCode(code);
        wechat.setCode(code);
        if (StringUtils.isEmpty(wechat.getSaasId())) {
        if (StringUtils.isEmpty(wechat.getSaasId())) {
            throw new ApiException(WxContants.Wechat.message_fail_saasId_is_null, CommonContants.common_error_params_code);
            throw new ApiException(WechatContants.WxConfig.message_fail_saasId_is_null, CommonContants.common_error_params_code);
        }
        }
        if (StringUtils.isEmpty(wechat.getStatus())) {
        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())) {
        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())) {
        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());
        WxWechat wechatTem = wechatDao.findByAppId(wechat.getAppId());
        if (wechatTem != null) {
        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);
        return wechatDao.save(wechat);
    }
    }
@ -48,31 +48,31 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    @Transient
    @Transient
    public WxWechat updateWxchat(WxWechat wechat) {
    public WxWechat updateWxchat(WxWechat wechat) {
        if (StringUtils.isEmpty(wechat.getCode())) {
        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())) {
        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())) {
        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())) {
        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())) {
        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();
        Long id = wechat.getId();
        if (StringUtils.isEmpty(id)) {
        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);
        WxWechat wechat1 = findById(id);
        if(wechat1 == null){
        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());
        WxWechat wechatTem = wechatDao.findByAppIdExcludeCode(wechat.getAppId(),wechat.getCode());
        if(wechatTem!=null){
        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);
        return wechatDao.save(wechat);
    }
    }
@ -93,7 +93,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
            for(String code:codeArray){
            for(String code:codeArray){
                WxWechat wxWechat = wechatDao.findByCode(code);
                WxWechat wxWechat = wechatDao.findByCode(code);
                if (wxWechat == null) {
                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.setStatus(-1);
                wxWechat.setUpdateUser(userCode);
                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.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
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.util.HttpUtil;
import com.yihu.jw.wx.dao.WechatDao;
import com.yihu.jw.wx.dao.WechatDao;
import com.yihu.jw.wx.dao.WxAccessTokenDao;
import com.yihu.jw.wx.dao.WxAccessTokenDao;
@ -45,7 +45,7 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessToken, WxAccess
            //根据wechatCode查找出appid和appSecret
            //根据wechatCode查找出appid和appSecret
            WxWechat wxWechat = wechatDao.findByCode(wechatCode);
            WxWechat wxWechat = wechatDao.findByCode(wechatCode);
            if(wxWechat==null){
            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);
            List<WxAccessToken> wxAccessTokens =  wxAccessTokenDao.getWxAccessTokenByCode(wechatCode);
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
            if(wxAccessTokens!=null&&wxAccessTokens.size()>0){
@ -64,10 +64,10 @@ public class WxAccessTokenService extends BaseJpaService<WxAccessToken, WxAccess
            appId = wxWechat.getAppId();
            appId = wxWechat.getAppId();
            appSecret = wxWechat.getAppSecret();
            appSecret = wxWechat.getAppSecret();
            if (StringUtils.isEmpty(appId)){
            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)){
            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 params = "grant_type=client_credential&appid=" + appId + "&secret=" + appSecret;
            String result = HttpUtil.sendGet(token_url, params);
            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.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
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.util.MessageUtil;
import com.yihu.jw.wx.dao.WxGraphicMessageDao;
import com.yihu.jw.wx.dao.WxGraphicMessageDao;
import com.yihu.jw.wx.model.WxGraphicMessage;
import com.yihu.jw.wx.model.WxGraphicMessage;
@ -29,14 +29,14 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxGraphicMessage.setCode(code);
        wxGraphicMessage.setCode(code);
        if (StringUtils.isEmpty(wxGraphicMessage.getStatus())) {
        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())) {
        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());
        WxGraphicMessage wxGraphicMessageTem = wxGraphicMessageDao.findByCode(wxGraphicMessage.getCode());
        if (wxGraphicMessageTem != null) {
        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);
        return wxGraphicMessageDao.save(wxGraphicMessage);
    }
    }
@ -44,19 +44,19 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
    @Transient
    @Transient
    public WxGraphicMessage updateWxGraphicMessage(WxGraphicMessage wxGraphicMessage) {
    public WxGraphicMessage updateWxGraphicMessage(WxGraphicMessage wxGraphicMessage) {
        if (StringUtils.isEmpty(wxGraphicMessage.getCode())) {
        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())) {
        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();
        Long id = wxGraphicMessage.getId();
        if (StringUtils.isEmpty(id)) {
        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查找
        //根据id查找
        WxGraphicMessage wxGraphicMessage1 = findById(id);
        WxGraphicMessage wxGraphicMessage1 = findById(id);
        if(wxGraphicMessage1==null){
        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);
        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.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
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.util.HttpUtil;
import com.yihu.jw.wx.dao.WxMenuDao;
import com.yihu.jw.wx.dao.WxMenuDao;
import com.yihu.jw.wx.model.WxAccessToken;
import com.yihu.jw.wx.model.WxAccessToken;
@ -56,16 +56,16 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    @Transient
    @Transient
    public WxMenu updateWxMenu(WxMenu wxMenu) {
    public WxMenu updateWxMenu(WxMenu wxMenu) {
        if (StringUtils.isEmpty(wxMenu.getCode())) {
        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)){
        if(canSaveOrUpata(wxMenu)){
            Long id = wxMenu.getId();
            Long id = wxMenu.getId();
            if (StringUtils.isEmpty(id)) {
            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);
            WxMenu wxMenu1 = findById(id);
            if(wxMenu1==null){
            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);
            return wxMenuDao.save(wxMenu);
        }
        }
@ -164,12 +164,12 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    public JSONObject createWechatMenu(String wechatCode) {
    public JSONObject createWechatMenu(String wechatCode) {
        WxWechat wechat = wechatService.findByCode(wechatCode);
        WxWechat wechat = wechatService.findByCode(wechatCode);
        if(wechat==null){
        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字符串
        //首先根据wechatCode获取菜单,然后封装成json字符串
        List<WxMenu> menus = wxMenuDao.findByWechatCode(wechatCode);
        List<WxMenu> menus = wxMenuDao.findByWechatCode(wechatCode);
        if(menus==null){
        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);
        String menuJsonString = getMenuToString(menus, wechatCode);
        logger.info("-----------------微信菜单json字符串:"+ menuJsonString+"--------------------");
        logger.info("-----------------微信菜单json字符串:"+ menuJsonString+"--------------------");
@ -262,56 +262,58 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    private boolean canSaveOrUpata(WxMenu wxMenu){
    private boolean canSaveOrUpata(WxMenu wxMenu){
        String wechatCode = wxMenu.getWechatCode();
        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();
        String name = wxMenu.getName();
        if (StringUtils.isEmpty(name)) {
        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())) {
        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())){
        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查找是否存在微信配置
        //根据wechatCode查找是否存在微信配置
        WxWechat wxWechat = wechatService.findByCode(wechatCode);
        WxWechat wxWechat = wechatService.findByCode(wechatCode);
        if(wxWechat==null){
        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);
            WxMenu parentMenuCode = findByCode(supMenucode);
            if(parentMenuCode==null){
            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);
            List<WxMenu> childMenus = findChildMenus(wechatCode, supMenucode);
            if(childMenus.size()==5){
            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){
            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())){
            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{
        }else{
            //查找父菜单
            //查找父菜单
            List<WxMenu> parentMenus = findParentMenuByWechatCode(wechatCode);
            List<WxMenu> parentMenus = findParentMenuByWechatCode(wechatCode);
            if(parentMenus!=null){
            if(parentMenus!=null){
                if(parentMenus.size()==3){
                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){
            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)){
        if("click".equals(type)){
            String key = wxMenu.getMenuKey();
            String key = wxMenu.getMenuKey();
            if(StringUtils.isEmpty(key)){
            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){
            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();
        String url = wxMenu.getUrl();
        if("view".equals(type)){
        if("view".equals(type)){
            if(StringUtils.isEmpty(url)){
            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){
            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("miniprogram".equals(type)){
            if(StringUtils.isEmpty(url)){
            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){
            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())){
            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())){
            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("media_id".equals(type)||"view_limited".equals(type)){
            if(StringUtils.isEmpty(wxMenu.getMediaId())){
            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;
        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());
            wxMenuTemp = wxMenuDao.findByWechatCodeExcludeSortFromChild(wxMenu.getWechatCode(), wxMenu.getSort(), wxMenu.getSupMenucode(), wxMenu.getCode());
        }
        }
        if(null!=wxMenuTemp){
        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());
        wxMenu.setUpdateTime(new Date());
        return true;
        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.mysql.query.BaseJpaService;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.exception.ApiException;
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.util.HttpUtil;
import com.yihu.jw.wx.dao.WxTemplateDao;
import com.yihu.jw.wx.dao.WxTemplateDao;
import com.yihu.jw.wx.model.*;
import com.yihu.jw.wx.model.*;
@ -39,52 +39,52 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxTemplate.setCode(code);
        wxTemplate.setCode(code);
        if (StringUtils.isEmpty(wxTemplate.getWechatCode())) {
        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查找是否存在微信配置
        //根据wechatCode查找是否存在微信配置
        WxWechat wxWechat = wechatService.findByCode(wxTemplate.getWechatCode());
        WxWechat wxWechat = wechatService.findByCode(wxTemplate.getWechatCode());
        if(wxWechat==null){
        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())) {
        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(" ","");
        String content = wxTemplate.getContent().replace(" ","");
        if (StringUtils.isEmpty(content)) {
        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}}"
        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);
        return wxTemplateDao.save(wxTemplate);
    }
    }
    public WxTemplate updateWxTemplate(WxTemplate wxTemplate) {
    public WxTemplate updateWxTemplate(WxTemplate wxTemplate) {
        if (StringUtils.isEmpty(wxTemplate.getCode())) {
        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())) {
        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())) {
        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(" ","");
        String content = wxTemplate.getContent().replace(" ","");
        if (StringUtils.isEmpty(content)) {
        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();
        Long id = wxTemplate.getId();
        if (StringUtils.isEmpty(id)) {
        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);
        WxTemplate wxTemplate1 = findById(id);
        if(wxTemplate1==null){
        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.setCreateTime(wxTemplate1.getCreateTime());
        wxTemplate.setUpdateTime(new Date());
        wxTemplate.setUpdateTime(new Date());
        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
        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);
        return wxTemplateDao.save(wxTemplate);
    }
    }
@ -95,7 +95,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
            for (String code : codeArray) {
            for (String code : codeArray) {
                WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
                WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
                if (wxTemplate == null) {
                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.setStatus(-1);
                wxTemplate.setUpdateUser(userCode);
                wxTemplate.setUpdateUser(userCode);
@ -120,7 +120,7 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
            //首先根据wechatTemplate获取微信模版
            //首先根据wechatTemplate获取微信模版
            WxTemplate wxTemplate = findByCode(templateCode);
            WxTemplate wxTemplate = findByCode(templateCode);
            if(wxTemplate==null){
            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 wechatCode =  wxTemplate.getWechatCode();
            String content = wxTemplate.getContent().replaceAll(" ", "");//{{result.DATA}}领奖金额:{{withdrawMoney.DATA}   }领奖  时间:{ {withdrawTime.DATA} }银行信息:{ {cardInfo.DATA} }到账时间:{{arrivedTime.DATA}}{{remark.DATA}}
            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>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-mysql</artifactId>
            <artifactId>common-mysql</artifactId>
        </dependency>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>
        <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.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
/**
 * Created by Administrator on 2017/6/13 0013.
 * Created by Administrator on 2017/6/13 0013.
 */
 */
@ -37,4 +39,10 @@ public class SaasController {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
            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;
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.aop.annotation.ManageLog;
import com.yihu.jw.manage.cache.login.LoginCache;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.service.login.LoginService;
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.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.business.ManageException;
import com.yihu.jw.restmodel.exception.business.ManageException;
@ -19,13 +21,18 @@ import java.util.List;
import java.util.Map;
import java.util.Map;
/**
/**
 * Created by chenweida on 2017/6/8.
 * Created by chenweida on 2017/6/6
 */
 */
@RestController
@RestController
@Api(description = "登陆模块")
@Api(description = "登陆模块")
public class LoginController extends EnvelopRestController {
public class LoginController extends EnvelopRestController {
    @Autowired
    @Autowired
    private LoginService loginService;
    private LoginService loginService;
    @Autowired
    private MenuRoleService menuRoleService;
    @Autowired
    private CacheAdapter cacheAdapter;
    @GetMapping("/login")
    @GetMapping("/login")
    @ApiOperation(value = "登陆")
    @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 = "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 {
            @ApiParam(name = "password", value = "密码", required = true)@RequestParam(required = true, name = "password") String password) throws ManageException {
        ManageUser data = loginService.login(username, password);
        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);
        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) {
            @ApiParam(name = "userCode", value = "用户code", required = true)@RequestParam(required = true, name = "userCode") String userCode) {
        try {
        try {
            //从缓存清空
            //从缓存清空
            LoginCache.cleanUser(userCode);
            cacheAdapter.removeData(CacheAdapter.ROLE,userCode);//权限移除
            cacheAdapter.removeData(CacheAdapter.LOGIN,userCode);//登陆移除
            return Envelop.getSuccess("登出成功");
            return Envelop.getSuccess("登出成功");
        } catch (Exception e) {
        } catch (Exception e) {
            error(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.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.List;
import java.util.Map;
import java.util.Map;
@ -31,27 +32,28 @@ public class MenuController {
    @GetMapping("menu/list")
    @GetMapping("menu/list")
    @ApiOperation(value = "用户列表")
    @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}")
    @GetMapping(value = "menu/{code}")
    @ApiOperation(value = "根据code查找用户", notes = "根据code查找用户")
    @ApiOperation(value = "根据code查找用户", notes = "根据code查找用户")
    public Envelop findByCode(
    public Envelop findByCode(
@ -82,7 +84,7 @@ public class MenuController {
    }
    }
    @DeleteMapping(value = "menu/{codes}")
    @DeleteMapping(value = "menu/{codes}")
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @ApiOperation(value = "删除菜单", notes = "删除菜单")
    public Envelop delete(
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @PathVariable(value = "codes", required = true) String codes,
@ -104,10 +106,9 @@ public class MenuController {
        return Envelop.getSuccess("成功");
        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.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageRole;
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.manage.service.system.RoleService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.ApiException;
@ -14,6 +15,8 @@ import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
@RestController
@RestController
@ -23,6 +26,8 @@ public class RoleController {
    @Autowired
    @Autowired
    private RoleService roleService;
    private RoleService roleService;
    @Autowired
    private SaasService saasService;
    @GetMapping("role/list")
    @GetMapping("role/list")
    @ApiOperation(value = "用户列表")
    @ApiOperation(value = "用户列表")
@ -34,6 +39,11 @@ public class RoleController {
        try {
        try {
            page=page/pageSize;
            page=page/pageSize;
            Page<ManageRole> roles = roleService.list(name, 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(
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    "获取信息成功",
                    roles.getContent(),//数据内容
                    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 ")
    @Query("from ManageMenu m where m.status!=-1 and m.parentCode = ?1 ")
    List<ManageMenu> getChildMenus(String parentCode);
    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();
    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;
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.model.system.ManageUser;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
@ -21,18 +23,25 @@ import java.util.List;
@Component
@Component
public class UserInterceptor implements HandlerInterceptor {
public class UserInterceptor implements HandlerInterceptor {
    private static Integer NOT_LOGIN=-1000;
    private static Integer NOT_LOGIN=-1000;
    private static Integer NO_PRIVILEGE=-2000;
    List<String> unFilters=new ArrayList<>();
    List<String> unFilters=new ArrayList<>();
    @Autowired
    @Autowired
    private UserService userService;
    private UserService userService;
    @Autowired
    private CacheAdapter cacheAdapter;
    @PostConstruct
    @PostConstruct
    public void addUnFilterURI(){
    public void addUnFilterURI(){
        //添加不需要过滤的路径
        //添加不需要过滤的路径
        unFilters.add("/login");
        unFilters.add("/login");
        unFilters.add("/error");
        unFilters.add("/error");
        unFilters.add("/index");
        unFilters.add("/loginout");
        unFilters.add("/manage/menuRole/reloadPrivilege");//刷新权限缓存
        unFilters.add("");
    }
    }
    @Override
    @Override
    public boolean preHandle(HttpServletRequest requset, HttpServletResponse response, Object o) throws Exception {
    public boolean preHandle(HttpServletRequest requset, HttpServletResponse response, Object o) throws Exception {
        boolean flag = true;
        boolean flag = false;
        try {
        try {
            //判断路径是否要过滤
            //判断路径是否要过滤
            String uri=requset.getRequestURI();
            String uri=requset.getRequestURI();
@ -50,6 +59,21 @@ public class UserInterceptor implements HandlerInterceptor {
                // 未登录
                // 未登录
                response.getOutputStream().write(JSONObject.fromObject(Envelop.getError("请登录后再操作!",NOT_LOGIN)).toString().getBytes());
                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) {
        } catch (Exception e) {
            e.printStackTrace();
            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 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
 * ManageMenu entity. @author MyEclipse Persistence Tools
@ -12,90 +16,122 @@ import java.util.Date;
@Table(name = "manage_menu")
@Table(name = "manage_menu")
public class ManageMenu extends IdEntity implements java.io.Serializable {
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 String name;
	private Integer status;
	private Integer status;
	private String remark;
	private String remark;
	@Column(name="saas_id")
	private String saasId;
	@Transient
	private String saasName;
	// Constructors
	// Constructors
@ -41,6 +45,21 @@ public class ManageRole extends IdEntity implements java.io.Serializable {
		this.remark = remark;
		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)
	@Column(name = "name", length = 100)
	public String getName() {
	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;
package com.yihu.jw.manage.service.base;
import com.yihu.jw.restmodel.base.base.BaseContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import org.springframework.stereotype.Service;
import org.springframework.web.client.RestTemplate;
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.
 * Created by Administrator on 2017/6/13 0013.
 */
 */
@ -25,4 +31,26 @@ public class SaasService {
       return forObject;
       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.cache.login.LoginCache;
import com.yihu.jw.manage.dao.login.ManageLoginLogDao;
import com.yihu.jw.manage.dao.login.ManageLoginLogDao;
import com.yihu.jw.manage.model.login.ManageLoginLog;
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.MenuService;
import com.yihu.jw.manage.service.system.RoleService;
import com.yihu.jw.manage.service.system.RoleService;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.manage.service.system.UserService;
@ -33,6 +31,8 @@ public class LoginService {
    private RoleService roleService;
    private RoleService roleService;
    @Autowired
    @Autowired
    private ManageLoginLogDao manageLoginLogDao;
    private ManageLoginLogDao manageLoginLogDao;
    @Autowired
    private ManageMenuUrlService menuUrlService;
    /**
    /**
     * ManageException异常不回滚
     * ManageException异常不回滚
@ -93,6 +93,14 @@ public class LoginService {
            for(ManageMenu parentMenu:parentMenus){
            for(ManageMenu parentMenu:parentMenus){
                //通过父菜单查找对应的子菜单
                //通过父菜单查找对应的子菜单
                List<ManageMenu> childMenus = menuService.findChildMenus(usercode,parentMenu.getCode());
                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();
                MenuItems menuItem = new MenuItems();
                menuItem.setParentMenu(parentMenu);
                menuItem.setParentMenu(parentMenu);
                menuItem.setChildMenus(childMenus);
                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.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import org.springside.modules.persistence.SearchFilter;
import javax.transaction.Transactional;
import java.util.*;
import java.util.*;
/**
/**
@ -31,6 +32,8 @@ public class MenuService {
    private JdbcTemplate jdbcTemplate;
    private JdbcTemplate jdbcTemplate;
    @Autowired
    @Autowired
    private UserService userService;
    private UserService userService;
    @Autowired
    private ManageMenuUrlService menuUrlService;
    public List<ManageMenu> findByUserCode(String code) {
    public List<ManageMenu> findByUserCode(String code) {
        String sql="SELECT DISTINCT " +
        String sql="SELECT DISTINCT " +
@ -79,13 +82,43 @@ public class MenuService {
        if (!StringUtils.isEmpty(name)&&!("null".equals(name))) {
        if (!StringUtils.isEmpty(name)&&!("null".equals(name))) {
            filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, 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));
        filters.put("status", new SearchFilter("status", SearchFilter.Operator.EQ, WlyyContant.status_normal));
        Specification<ManageMenu> spec = DynamicSpecifications.bySearchFilter(filters.values(), ManageMenu.class);
        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) {
    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);
        return menuDao.findByCode(code);
    }
    }
@ -123,6 +156,7 @@ public class MenuService {
        }
        }
    }
    }
    @Transactional
    public void saveOrUpdate(ManageMenu menu,String userCode) {
    public void saveOrUpdate(ManageMenu menu,String userCode) {
        ManageUser user = userService.findByCode(userCode);
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        String userName = user.getName();
@ -134,18 +168,21 @@ public class MenuService {
        }
        }
        menu.setUpdateUser(userCode);
        menu.setUpdateUser(userCode);
        menu.setUpdateUserName(userName);
        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 {
    public Map<String, List> getMenuTree() throws ManageException {
        List<MenuItems> menuItemses = new ArrayList<>();
        List<MenuItems> menuItemses = new ArrayList<>();
        Map<String, List> data = new HashMap<>();
        Map<String, List> data = new HashMap<>();
        //查询所有父菜单
        //查询所有模块
        List<ManageMenu> parentMenus = getParentMenus();
        List<ManageMenu> parentMenus = getParentMenus();
        //查询所有子菜单
        if(parentMenus!=null){
        if(parentMenus!=null){
            for(ManageMenu parentMenu:parentMenus){
            for(ManageMenu parentMenu:parentMenus){
                //通过父菜单查找对应的子菜单
                //查询所有菜单
                List<ManageMenu> childMenus = getChildMenus(parentMenu.getCode());
                List<ManageMenu> childMenus = getChildMenus(parentMenu.getCode());
                MenuItems menuItem = new MenuItems();
                MenuItems menuItem = new MenuItems();
                menuItem.setParentMenu(parentMenu);
                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.service.system.UserService;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WechatContants;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +26,7 @@ import java.util.Map;
@Service
@Service
public class GraphicMessageService {
public class GraphicMessageService {
    @Value("${spring.gateway}")
    @Value("${spring.gateway}"+"/"+ WechatContants.api_common+"/")
    private String url;
    private String url;
    @Autowired
    @Autowired
@ -46,8 +47,7 @@ public class GraphicMessageService {
            map.put("filters",filters);
            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;
        return forObject;
    }
    }
@ -61,14 +61,14 @@ public class GraphicMessageService {
        Map<String, String> par = new HashMap<>();
        Map<String, String> par = new HashMap<>();
        par.put("userCode", userCode);
        par.put("userCode", userCode);
        par.put("userName", userName);
        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);
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,par);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,par);
        return envelop;
        return envelop;
    }
    }
    public Envelop findByCode(String code) {
    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;
        return envelop;
    }
    }
@ -92,11 +92,11 @@ public class GraphicMessageService {
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        Envelop envelop =null;
        Envelop envelop =null;
        if(graphicMessage.getId()==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();
            envelop = responseEntity.getBody();
            return envelop;
            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();
        envelop = resp.getBody();
        return envelop;
        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.service.system.UserService;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WechatContants;
import net.sf.json.JSONObject;
import net.sf.json.JSONObject;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Autowired;
@ -25,7 +26,7 @@ import java.util.Map;
@Service
@Service
public class WechatConfigService {
public class WechatConfigService {
    @Value("${spring.gateway}")
    @Value("${spring.gateway}"+"/"+ WechatContants.api_common+"/")
    private String url;
    private String url;
    @Autowired
    @Autowired
@ -45,10 +46,7 @@ public class WechatConfigService {
           filters.put("name",name);
           filters.put("name",name);
           map.put("filters",filters);
           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<String, String> map = new HashMap<>();
        map.put("userCode", userCode);
        map.put("userCode", userCode);
        map.put("userName", userName);
        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<>();
        MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,multiValueMap);
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,multiValueMap);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,map);
@ -68,7 +66,7 @@ public class WechatConfigService {
    }
    }
    public Envelop findByCode(String code) {
    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;
        return envelop;
    }
    }
@ -93,11 +91,11 @@ public class WechatConfigService {
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        Envelop envelop =null;
        Envelop envelop =null;
        if(wechatConfig.getId()==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();
            envelop = responseEntity.getBody();
            return envelop;
            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();
        envelop = resp.getBody();
        return envelop;
        return envelop;
    }
    }
@ -107,8 +105,7 @@ public class WechatConfigService {
        map.put("fields",fields);
        map.put("fields",fields);
        map.put("sorts",sorts);
        map.put("sorts",sorts);
        map.put("filter",filter);
        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;
        return forObject;
    }
    }
}
}

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

@ -27,7 +27,19 @@ spring:
  session:
  session:
      store-type: HASH_MAP
      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:
spring:
@ -37,4 +49,10 @@ spring:
  datasource:
  datasource:
    url: jdbc:mysql://172.19.103.77/jw2?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    url: jdbc:mysql://172.19.103.77/jw2?useUnicode:true&characterEncoding=utf-8&autoReconnect=true
    username: root
    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>
                    </a>
                    <ul class="nav nav-second-level" v-for="childMenu in menu.childMenus">
                    <ul class="nav nav-second-level" v-for="childMenu in menu.childMenus">
                        <li>
                        <li>
                                <a class="J_menuItem" :href="childMenu.url" >{{childMenu.name}}</a>
                            <a class="J_menuItem" :href="childMenu.url[0]" >{{childMenu.name}}</a>
                        </li>
                        </li>
                    </ul>
                    </ul>
                </li>
                </li>

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

@ -23,24 +23,6 @@
    </style>
    </style>
</head>
</head>
<body class="gray-bg">
<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="wrapper wrapper-content animated fadeInRight">
    <div class="row">
    <div class="row">
        <div class="col-sm-12">
        <div class="col-sm-12">
@ -51,21 +33,7 @@
                    </h5>
                    </h5>
                </div>
                </div>
                <div class="ibox-content">
                <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>
            </div>
        </div>
        </div>
@ -74,72 +42,15 @@
<div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
<div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
     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-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><!-- /.modal-content -->
    </div>
    </div>
</div>
</div>
<!-- 全局js -->
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<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/util/util.js"></script>
<!--<script type="text/javascript" src="/common/js/vue/vue.js"></script>--><!--2.0-->
<!--<script type="text/javascript" src="/common/js/vue/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/layer/layer.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<script type="text/javascript" src="/common/js/plugins/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>
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<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>
                        <tr>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th>角色名称</th>
                            <th>角色名称</th>
                            <th>saasId</th>
                            <th>描述</th>
                            <th>描述</th>
                            <th>创建时间</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"/>
                        <input type="text"  class="form-control"  name="name" style="width: 250px"  required="true"  :value="detail.name"/>
                    </div>
                    </div>
                </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">
                <div class="m-form-group">
                    <label class="col-sm-4 control-label no-padding-right" >描&#12288;&#12288;述: </label>
                    <label class="col-sm-4 control-label no-padding-right" >描&#12288;&#12288;述: </label>
                    <div class="col-sm-6">
                    <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.fegin.base.SaasFegin;
import com.yihu.jw.restmodel.base.base.BaseContants;
import com.yihu.jw.restmodel.base.base.BaseContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
@ -19,7 +20,7 @@ import org.springframework.web.bind.annotation.RestController;
@RestController
@RestController
@RequestMapping(BaseContants.Saas.api_common)
@RequestMapping("{version}/"+BaseContants.Saas.api_common)
@Api(description = "saas相关")
@Api(description = "saas相关")
public class SaasController {
public class SaasController {
@ -31,7 +32,8 @@ public class SaasController {
    private Tracer tracer;
    private Tracer tracer;
    @GetMapping(value = BaseContants.Saas.api_getSaass)
    @ApiVersion(1)
    @GetMapping(value = BaseContants.Saas.api_getSaassNoPage)
    @ApiOperation(value = "获取saas,不分页")
    @ApiOperation(value = "获取saas,不分页")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
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.fegin.base.wx.AccessTokenFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WechatContants;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import io.swagger.annotations.ApiParam;
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.RestController;
 * Created by Administrator on 2017/5/31 0031.
 * Created by Administrator on 2017/5/31 0031.
 */
 */
@RestController
@RestController
@RequestMapping(WechatContants.AccessToken.api_common)
@RequestMapping("{version}/"+ WechatContants.WxAccessToken.api_common)
@Api(description = "微信token相关")
@Api(description = "微信token相关")
public class WechatAccessTokenController {
public class WechatAccessTokenController {
@ -33,7 +33,7 @@ public class WechatAccessTokenController {
    @Autowired
    @Autowired
    private Tracer tracer;
    private Tracer tracer;
    @GetMapping(value = WechatContants.AccessToken.api_get)
    @GetMapping(value = WechatContants.WxAccessToken.api_get)
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    @ApiOperation(value = "根据wechatCode获取最新的WxAccessToken")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
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.fegin.base.wx.WechatFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信配置")
@Api(description = "微信配置")
public class WechatConfigController {
public class WechatConfigController {
@ -34,7 +34,7 @@ public class WechatConfigController {
    @ApiVersion(1)
    @ApiVersion(1)
    @ApiOperation(value = "创建微信配置")
    @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 = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -49,7 +49,7 @@ public class WechatConfigController {
    @ApiVersion(1)
    @ApiVersion(1)
    @ApiOperation(value = "更新微信配置")
    @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 = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -62,7 +62,7 @@ public class WechatConfigController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Config.api_delete)
    @DeleteMapping(value = WechatContants.WxConfig.api_delete)
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -79,7 +79,7 @@ public class WechatConfigController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Config.api_getByCode)
    @GetMapping(value = WechatContants.WxConfig.api_getByCode)
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    @ApiOperation(value = "根据code查找微信配置", notes = "根据code查找微信配置")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -92,7 +92,7 @@ public class WechatConfigController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.Config.api_getWechats, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxConfig.api_getWechats, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信配置列表(分页)")
    @ApiOperation(value = "获取微信配置列表(分页)")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -121,7 +121,7 @@ public class WechatConfigController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Config.api_getWechatNoPage)
    @GetMapping(value = WechatContants.WxConfig.api_getWechatNoPage)
    @ApiOperation(value = "获取微信列表配置,不分页")
    @ApiOperation(value = "获取微信列表配置,不分页")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
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.fegin.base.wx.GraphicMessageFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -26,7 +26,7 @@ import javax.servlet.http.HttpServletResponse;
 * Created by Administrator on 2017/5/31 0031.
 * Created by Administrator on 2017/5/31 0031.
 */
 */
@RestController
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信图文相关")
@Api(description = "微信图文相关")
public class WechatGraphicMessageController {
public class WechatGraphicMessageController {
    private Logger logger= LoggerFactory.getLogger(WechatGraphicMessageController.class);
    private Logger logger= LoggerFactory.getLogger(WechatGraphicMessageController.class);
@ -38,7 +38,7 @@ public class WechatGraphicMessageController {
    private Tracer tracer;
    private Tracer tracer;
    @ApiVersion(1)
    @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 = "创建微信图文消息")
    @ApiOperation(value = "创建微信图文消息", notes = "创建微信图文消息")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -53,7 +53,7 @@ public class WechatGraphicMessageController {
    @ApiVersion(1)
    @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 = "修改微信图文消息")
    @ApiOperation(value = "修改微信图文消息", notes = "修改微信图文消息")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -66,7 +66,7 @@ public class WechatGraphicMessageController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.GraphicMessage.api_delete)
    @DeleteMapping(value = WechatContants.WxGraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -82,7 +82,7 @@ public class WechatGraphicMessageController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_getByCode)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getByCode)
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    @ApiOperation(value = "根据code查找微信图文消息", notes = "根据code查找微信图文消息")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -95,7 +95,7 @@ public class WechatGraphicMessageController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessages, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信图文消息列表(分页)")
    @ApiOperation(value = "获取微信图文消息列表(分页)")
    public Envelop getWxGraphicMessages(
    public Envelop getWxGraphicMessages(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,title,description,url,pic_url,remark,status")
@ -124,7 +124,7 @@ public class WechatGraphicMessageController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_getWxGraphicMessageNoPage)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_getWxGraphicMessageNoPage)
    @ApiOperation(value = "获取图文消息列表,不分页")
    @ApiOperation(value = "获取图文消息列表,不分页")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -140,7 +140,7 @@ public class WechatGraphicMessageController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.GraphicMessage.api_sendGraphicMessages)
    @GetMapping(value = WechatContants.WxGraphicMessage.api_sendGraphicMessages)
    @ApiOperation(value = "发送图文消息")
    @ApiOperation(value = "发送图文消息")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
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.fegin.base.wx.WechatMenuFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 * Created by Administrator on 2017/5/31 0031.
 */
 */
@RestController
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信菜单配置")
@Api(description = "微信菜单配置")
public class WechatMenuController {
public class WechatMenuController {
@ -36,7 +36,7 @@ public class WechatMenuController {
    private Tracer tracer;
    private Tracer tracer;
    @ApiVersion(1)
    @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 = "添加微信菜单")
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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 = "修改微信菜单")
    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -63,7 +63,7 @@ public class WechatMenuController {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Menu.api_delete)
    @DeleteMapping(value = WechatContants.WxMenu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -78,7 +78,7 @@ public class WechatMenuController {
        return wechatMenuFegin.deleteWxMenu(codes,userCode,userName);
        return wechatMenuFegin.deleteWxMenu(codes,userCode,userName);
    }
    }
    @GetMapping(value = WechatContants.Menu.api_getByCode)
    @GetMapping(value = WechatContants.WxMenu.api_getByCode)
     @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
     @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
     @HystrixCommand(commandProperties = {
     @HystrixCommand(commandProperties = {
             @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
             @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -90,7 +90,7 @@ public class WechatMenuController {
        return wechatMenuFegin.findByCode(code);
        return wechatMenuFegin.findByCode(code);
    }
    }
    @RequestMapping(value = WechatContants.Menu.api_getWxMenus, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_getWxMenus, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信菜单列表(分页)")
    @ApiOperation(value = "获取微信菜单列表(分页)")
    public Envelop getWxMenus(
    public Envelop getWxMenus(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @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 = "获取微信菜单列表,不分页")
    @ApiOperation(value = "获取微信菜单列表,不分页")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -136,7 +136,7 @@ public class WechatMenuController {
     * @return
     * @return
     */
     */
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @ApiOperation(value = "创建微信公众号菜单", notes = "创建微信公众号菜单")
    @RequestMapping(value = WechatContants.Menu.api_createMenu ,method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
@ -146,7 +146,7 @@ public class WechatMenuController {
        return wechatMenuFegin.createWechatMenu(wechatCode);
        return wechatMenuFegin.createWechatMenu(wechatCode);
    }
    }
    @GetMapping(value = WechatContants.Menu.api_getParentMenu)
    @GetMapping(value = WechatContants.WxMenu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -158,7 +158,7 @@ public class WechatMenuController {
        return wechatMenuFegin.getParentMenu(wechatCode);
        return wechatMenuFegin.getParentMenu(wechatCode);
    }
    }
    @GetMapping(value = WechatContants.Menu.api_getChildMenus)
    @GetMapping(value = WechatContants.WxMenu.api_getChildMenus)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
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.fegin.base.wx.WechatTemplateFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WechatContants;
import com.yihu.jw.version.ApiVersion;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiOperation;
@ -23,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 * Created by Administrator on 2017/5/31 0031.
 */
 */
@RestController
@RestController
@RequestMapping("{version}/"+WechatContants.api_common)
@RequestMapping("{version}/"+ WechatContants.api_common)
@Api(description = "微信模板消息相关")
@Api(description = "微信模板消息相关")
public class WechatTemplateControlle {
public class WechatTemplateControlle {
@ -36,7 +36,7 @@ public class WechatTemplateControlle {
    private Tracer tracer;
    private Tracer tracer;
    @ApiVersion(1)
    @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 = "创建微信模版")
    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -50,7 +50,7 @@ public class WechatTemplateControlle {
    }
    }
    @ApiVersion(1)
    @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 = "修改微信模版")
    @ApiOperation(value = "修改微信模版", notes = "修改微信模版")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -64,7 +64,7 @@ public class WechatTemplateControlle {
    @ApiVersion(1)
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Template.api_delete)
    @DeleteMapping(value = WechatContants.WxTemplate.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -80,7 +80,7 @@ public class WechatTemplateControlle {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_getByCode)
    @GetMapping(value = WechatContants.WxTemplate.api_getByCode)
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    @ApiOperation(value = "根据code查找微信模版", notes = "根据code查找微信模版")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -93,7 +93,7 @@ public class WechatTemplateControlle {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @RequestMapping(value = WechatContants.Template.api_getWxTemplates, method = RequestMethod.GET)
    @RequestMapping(value = WechatContants.WxTemplate.api_getWxTemplates, method = RequestMethod.GET)
    @ApiOperation(value = "获取微信模版列表(分页)")
    @ApiOperation(value = "获取微信模版列表(分页)")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -121,7 +121,7 @@ public class WechatTemplateControlle {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_getWxTemplatesNoPage)
    @GetMapping(value = WechatContants.WxTemplate.api_getWxTemplatesNoPage)
    @ApiOperation(value = "获取微信模版列表(不分页)")
    @ApiOperation(value = "获取微信模版列表(不分页)")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
@ -137,7 +137,7 @@ public class WechatTemplateControlle {
    }
    }
    @ApiVersion(1)
    @ApiVersion(1)
    @GetMapping(value = WechatContants.Template.api_sendTemplateMessage)
    @GetMapping(value = WechatContants.WxTemplate.api_sendTemplateMessage)
    @ApiOperation(value = "发送微信模板消息")
    @ApiOperation(value = "发送微信模板消息")
    @HystrixCommand(commandProperties = {
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @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.fegin.fallbackfactory.base.wx.AccessTokenFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.restmodel.wx.WechatContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestMethod;
@ -16,10 +16,10 @@ import org.springframework.web.bind.annotation.RequestParam;
        name = CommonContants.svr_base // name值是eurika的实例名字
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = AccessTokenFeginFallbackFactory.class
        ,fallbackFactory  = AccessTokenFeginFallbackFactory.class
)
)
@RequestMapping(value = WxContants.WxAccessToken.api_common)
@RequestMapping(value = WechatContants.WxAccessToken.api_common)
public interface AccessTokenFegin {
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) ;
    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.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
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.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestBody;
@ -19,22 +19,22 @@ import org.springframework.web.bind.annotation.RequestParam;
        name = CommonContants.svr_base // name值是eurika的实例名字
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = GraphicMessageFeginFallbackFactory.class
        ,fallbackFactory  = GraphicMessageFeginFallbackFactory.class
)
)
@RequestMapping(value = WxContants.WxGraphicMessage.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface GraphicMessageFegin {
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;
    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;
    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;
    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;
    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(
    Envelop getWxGraphicMessages(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
@ -42,13 +42,13 @@ public interface GraphicMessageFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
            @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(
    Envelop getWxGraphicMessageNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
            @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(
    String sendGraphicMessages(
            @RequestParam(value = "codes", required = true) String codes,
            @RequestParam(value = "codes", required = true) String codes,
            @RequestParam(value = "fromUserName", required = true) String fromUserName,
            @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.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
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.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestBody;
@ -17,24 +17,24 @@ import org.springframework.web.bind.annotation.RequestParam;
        name = CommonContants.svr_base // name值是eurika的实例名字
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  = WechatFeginFallbackFactory.class
        ,fallbackFactory  = WechatFeginFallbackFactory.class
)
)
@RequestMapping(value = WxContants.Wechat.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface WechatFegin {
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;
    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;
    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;
    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;
    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;
    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;
    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.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
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.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
@ -16,28 +16,28 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_base // name值是eurika的实例名字
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  =WechatMenuFeginFallbackFactory.class
        ,fallbackFactory  =WechatMenuFeginFallbackFactory.class
)
)
@RequestMapping(value = WxContants.WxMenu.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface WechatMenuFegin {
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;
    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;
    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;
    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;
    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(
    Envelop getWxMenuNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
            @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(
    Envelop getWxMenus(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
@ -45,12 +45,12 @@ public interface WechatMenuFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
            @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);
    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;
    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;
    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.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
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.cloud.netflix.feign.FeignClient;
import org.springframework.http.MediaType;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.*;
@ -16,28 +16,28 @@ import org.springframework.web.bind.annotation.*;
        name = CommonContants.svr_base // name值是eurika的实例名字
        name = CommonContants.svr_base // name值是eurika的实例名字
        ,fallbackFactory  =WechatTemplateFeginFallbackFactory.class
        ,fallbackFactory  =WechatTemplateFeginFallbackFactory.class
)
)
@RequestMapping(value = WxContants.WxTemplate.api_common)
@RequestMapping(value = WechatContants.api_common)
public interface WechatTemplateFegin {
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;
    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;
    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;
    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;
    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(
    Envelop getWechatNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
            @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(
    Envelop getWechats(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "filters", required = false) String filters,
@ -45,7 +45,7 @@ public interface WechatTemplateFegin {
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "size", required = false) int size,
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
            @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
    @ResponseBody
    Envelop sendTemplateMessage(
    Envelop sendTemplateMessage(
            @RequestParam(value="openid") String openid,
            @RequestParam(value="openid") String openid,