Ver código fonte

代码提交

chenweida 7 anos atrás
pai
commit
414bbcfb9d
89 arquivos alterados com 2310 adições e 1839 exclusões
  1. 23 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/version/BaseVersionContants.java
  2. 11 1
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/gateway/GatewayContanrts.java
  3. 60 34
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/MWxMenu.java
  4. 2 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/wx/WxContants.java
  5. 7 0
      svr/svr-base/readme.MD
  6. 3 0
      svr/svr-base/src/main/java/com/yihu/jw/SvrBaseApplication.java
  7. 96 9
      svr/svr-base/src/main/java/com/yihu/jw/base/model/IdEntity.java
  8. 3 94
      svr/svr-base/src/main/java/com/yihu/jw/base/model/base/Function.java
  9. 3 99
      svr/svr-base/src/main/java/com/yihu/jw/base/model/base/Module.java
  10. 12 1
      svr/svr-base/src/main/java/com/yihu/jw/base/model/base/ModuleFunction.java
  11. 3 74
      svr/svr-base/src/main/java/com/yihu/jw/base/model/base/Saas.java
  12. 12 1
      svr/svr-base/src/main/java/com/yihu/jw/base/model/base/SaasModule.java
  13. 7 7
      svr/svr-base/src/main/java/com/yihu/jw/version/controller/ServerVersionController.java
  14. 29 28
      svr/svr-base/src/main/java/com/yihu/jw/version/controller/WlyyVersionController.java
  15. 0 11
      svr/svr-base/src/main/java/com/yihu/jw/version/model/BaseServerVersion.java
  16. 11 2
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WechatConfigController.java
  17. 12 3
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxGraphicMessageController.java
  18. 62 4
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxMenuController.java
  19. 26 6
      svr/svr-base/src/main/java/com/yihu/jw/wx/controller/WxTemplateController.java
  20. 4 0
      svr/svr-base/src/main/java/com/yihu/jw/wx/dao/WechatDao.java
  21. 4 1
      svr/svr-base/src/main/java/com/yihu/jw/wx/dao/WxMenuDao.java
  22. 0 67
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxGraphicMessage.java
  23. 3 72
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxMenu.java
  24. 0 106
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxTemplate.java
  25. 0 72
      svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxWechat.java
  26. 23 23
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WechatService.java
  27. 11 14
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxGraphicMessageService.java
  28. 62 19
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxMenuService.java
  29. 15 13
      svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxTemplateService.java
  30. 10 0
      svr/svr-manage/pom.xml
  31. 10 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/SvrMamageApp.java
  32. 2 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/login/LoginController.java
  33. 105 2
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/MenuController.java
  34. 78 4
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/RoleController.java
  35. 53 16
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/UserController.java
  36. 7 4
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/GraphicMessageController.java
  37. 18 4
      svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/WechatConfigController.java
  38. 13 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/MenuDao.java
  39. 4 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/RoleDao.java
  40. 13 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/RoleMenuDao.java
  41. 5 0
      svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/UserDao.java
  42. 16 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/UserRoleDao.java
  43. 96 9
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/IdEntity.java
  44. 1 81
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageMenu.java
  45. 1 80
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageRole.java
  46. 12 10
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageRoleMenu.java
  47. 17 103
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageUser.java
  48. 26 7
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageUserRole.java
  49. 1 84
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/GraphicMessage.java
  50. 3 124
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/Template.java
  51. 0 66
      svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/WechatConfig.java
  52. 103 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/MenuService.java
  53. 70 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/RoleService.java
  54. 61 3
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/UserService.java
  55. 27 10
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/GraphicMessageService.java
  56. 40 13
      svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/WechatConfigService.java
  57. 27 1
      svr/svr-manage/src/main/java/com/yihu/jw/manage/util/RestTemplateUtil.java
  58. 2 1
      svr/svr-manage/src/main/resources/webapp/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css
  59. 3 0
      svr/svr-manage/src/main/resources/webapp/common/js/plugins/dataTables/jquery.dataTables.js
  60. 6 3
      svr/svr-manage/src/main/resources/webapp/common/js/util/util.js
  61. 152 2
      svr/svr-manage/src/main/resources/webapp/html/system/menu/html/menuList.html
  62. 139 2
      svr/svr-manage/src/main/resources/webapp/html/system/role/html/roleList.html
  63. 123 27
      svr/svr-manage/src/main/resources/webapp/html/system/user/html/userList.html
  64. 203 152
      svr/svr-manage/src/main/resources/webapp/html/system/user/js/userList.js
  65. 7 6
      svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/html/graphicMessageList.html
  66. 32 50
      svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/js/graphicMessageList.js
  67. 10 11
      svr/svr-manage/src/main/resources/webapp/html/wechat/template/html/templateList.html
  68. 19 30
      svr/svr-manage/src/main/resources/webapp/html/wechat/template/js/templateList.js
  69. 13 25
      svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/html/wechatConfigList.html
  70. 22 43
      svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/js/wechatConfigList.js
  71. 10 0
      svr/svr-quota/src/main/java/com/yihu/jw/quota/controller/JobController.java
  72. 1 1
      svr/svr-quota/src/main/java/com/yihu/jw/quota/etl/extract/ExtractHelper.java
  73. 22 14
      svr/svr-quota/src/main/java/com/yihu/jw/quota/etl/extract/es/EsExtract.java
  74. 1 1
      svr/svr-quota/src/main/java/com/yihu/jw/quota/vo/QuotaVo.java
  75. 8 8
      web-gateway/src/main/java/com/yihu/jw/commnon/base/wx/WechatContants.java
  76. 8 8
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatConfigController.java
  77. 8 8
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatGraphicMessageController.java
  78. 61 16
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatMenuController.java
  79. 8 8
      web-gateway/src/main/java/com/yihu/jw/controller/base/wx/WechatTemplateControlle.java
  80. 48 4
      web-gateway/src/main/java/com/yihu/jw/controller/login/LoginController.java
  81. 1 1
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/GraphicMessageFegin.java
  82. 1 1
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatFegin.java
  83. 17 12
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatMenuFegin.java
  84. 1 1
      web-gateway/src/main/java/com/yihu/jw/fegin/base/wx/WechatTemplateFegin.java
  85. 1 1
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/GraphicMessageFeginFallbackFactory.java
  86. 1 1
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatFeginFallbackFactory.java
  87. 55 13
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatMenuFeginFallbackFactory.java
  88. 1 1
      web-gateway/src/main/java/com/yihu/jw/fegin/fallbackfactory/base/wx/WechatTemplateFeginFallbackFactory.java
  89. 3 2
      web-gateway/src/main/resources/application.yml

+ 23 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/version/BaseVersionContants.java

@ -29,8 +29,31 @@ public class BaseVersionContants {
    }
    public static class BaseServerUrlVersion {
        public static final String message_success_create = "ServerUrlVersion create success";
        public static final String message_success_update = "ServerUrlVersion update success";
        public static final String message_success_find = "ServerUrlVersion find success";
        public static final String message_success_find_BaseServerUrlVersions = "ServerUrlVersion find success";
        public static final String message_success_delete = "ServerUrlVersion delete success";
        public static final String message_fail_name_exist = "ServerUrlVersion name exist";
        public static final String message_fail_code_is_null = "code is null";
        public static final String message_fail_name_is_null = "ServerUrlVersion is null";
        public static final String message_fail_id_is_null = "id is null";
        public static final String message_fail_code_no_exist = "code no exist";
        public static final String api_common = "serverUrlVerion";
        public static final String api_create = "create";
        public static final String api_update = "update";
        public static final String api_delete = "delete";
        public static final String api_getByCode = "getByCode";
        public static final String api_getServerUrlVersions="getServerUrlVersions";
        public static final String api_getServerUrlVersionNoPage="getServerUrlVersionNoPage";
    }
    public static class BaseServerVersionLog {
        public static final String message_success_create = "BaseServerVersionLog create success";
        public static final String message_success_update = "BaseServerVersionLog update success";

+ 11 - 1
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/gateway/GatewayContanrts.java

@ -5,10 +5,20 @@ package com.yihu.jw.restmodel.gateway;
 */
public class GatewayContanrts {
    /**
     * 日志切面用的静态类
     */
    public static final class ZipkinElasticKey {
        static public String gateway_input_params = "gateway_input_params";
        static public String gateway_out_params = "gateway_output_params";
        static public String gateway_error_params = "gateway_error_params";
    }
    /**
     * 登陆报错用的静态类
     */
    public static final class LoginErrorMessage {
        static public String account_no_exists = "用户不存在";
        static public String password_error = "密码错误";
    }
}

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

@ -10,53 +10,24 @@ public class MWxMenu {
    private String code;//业务code
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String wechatName;//关联的微信名 关联表 Wx_Wechat
    private String supMenucode;//父菜单id 如果是一级菜单 此字段为空
    private String type;//菜单类型
    private String name;//菜单名称
    private String key;//click等点击类型必须
    private String menuKey;//click等点击类型必须
    private Integer sort;//菜单排序 父菜单排序 不包含子菜单那
    private String url;//url
    private String mediaId;//点用新增永久素材接口返回的合法media_id
    private String appid;//小程序的appid
    private String pagepath;//小程序的页面程序
    private String updateUser;//更新人
    private String updateUserName;//更新人
    private Date updateTime;//更新时间
    private Date createTime;//创建时间
    private String createUser;//创建人
    private String createUserName;//创建人
    private String remark;//备注
    private Integer status; //状态 -1 已删除 0可用
    public String getKey() {
        return key;
    }
    public void setKey(String key) {
        this.key = key;
    }
    public String getMediaId() {
        return mediaId;
    }
    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }
    public String getAppid() {
        return appid;
    }
    public void setAppid(String appid) {
        this.appid = appid;
    }
    public String getPagepath() {
        return pagepath;
    }
    public void setPagepath(String pagepath) {
        this.pagepath = pagepath;
    }
    private Integer status; //状态 -1删除 0 冻结 1可用
    public Long getId() {
        return id;
@ -106,6 +77,14 @@ public class MWxMenu {
        this.name = name;
    }
    public String getMenuKey() {
        return menuKey;
    }
    public void setMenuKey(String menuKey) {
        this.menuKey = menuKey;
    }
    public Integer getSort() {
        return sort;
    }
@ -122,6 +101,30 @@ public class MWxMenu {
        this.url = url;
    }
    public String getMediaId() {
        return mediaId;
    }
    public void setMediaId(String mediaId) {
        this.mediaId = mediaId;
    }
    public String getAppid() {
        return appid;
    }
    public void setAppid(String appid) {
        this.appid = appid;
    }
    public String getPagepath() {
        return pagepath;
    }
    public void setPagepath(String pagepath) {
        this.pagepath = pagepath;
    }
    public String getUpdateUser() {
        return updateUser;
    }
@ -130,6 +133,14 @@ public class MWxMenu {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
@ -154,6 +165,14 @@ public class MWxMenu {
        this.createUser = createUser;
    }
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    public String getRemark() {
        return remark;
    }
@ -170,4 +189,11 @@ public class MWxMenu {
        this.status = status;
    }
    public String getWechatName() {
        return wechatName;
    }
    public void setWechatName(String wechatName) {
        this.wechatName = wechatName;
    }
}

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

@ -19,6 +19,8 @@ public class WxContants {
        public static final String api_create="create";
        public static final String api_delete="delete";
        public static final String api_getByCode="getByCode";
        public static final String api_getParentMenu="parentMenu/{wechatCode}";
        public static final String api_getChildMenus="childMenu/list/{parentCode}";
        public static final String api_update="update";
        public static final String api_getWxMenus="getWxMenus";
        public static final String api_getWxMenuNoPage="getWxMenuNoPage";

+ 7 - 0
svr/svr-base/readme.MD

@ -11,4 +11,11 @@
        wxGraphicMessage    微信图文管理
        wxMenu  微信菜单管理
        wxTemplate  微信模版
    version: 
       ServerVersion 后台接口版本
       WlyyVersion i健康app的版本
    login:
       loginAccout 用户登陆 
    util:
        工具类
    

+ 3 - 0
svr/svr-base/src/main/java/com/yihu/jw/SvrBaseApplication.java

@ -3,11 +3,14 @@ package com.yihu.jw;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
/**
 * Created by chenweida on 2017/5/10.
 * localhost:10020/refresh  刷新当个微服务的配置 可以在需要刷新的bean上面@RefreshScope
 */
@EnableJpaAuditing
@SpringBootApplication
@EnableDiscoveryClient//服务注册到发现服务
public class SvrBaseApplication {

+ 96 - 9
svr/svr-base/src/main/java/com/yihu/jw/base/model/IdEntity.java

@ -5,11 +5,14 @@
 *******************************************************************************/
package com.yihu.jw.base.model;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
 * 统一定义id的entity基类.
@ -21,13 +24,41 @@ import java.io.Serializable;
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
@EntityListeners(AuditingEntityListener.class)
public abstract class IdEntity {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	protected Long id;  // 非业务主键
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name="code")
	protected String code;
	@CreatedDate
	@Column(name = "create_time", nullable = false, length = 0,updatable = false)
	protected Date createTime;
	@CreatedBy
	@Column(name = "create_user",updatable = false)
	protected String createUser;
	@CreatedBy
	@Column(name = "create_user_name",updatable = false)
	protected String createUserName;
	@LastModifiedDate
	@Column(name = "update_time", nullable = false, length = 0)
	protected Date updateTime;
	@LastModifiedBy
	@Column(name = "update_user", length = 100)
	protected String updateUser;
	@LastModifiedBy
	@Column(name = "update_user_name", length = 50)
	protected String updateUserName;
	public Long getId() {
		return id;
	}
@ -35,4 +66,60 @@ public abstract class IdEntity implements Serializable {
	public void setId(Long id) {
		this.id = id;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getCreateUser() {
		return createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	public String getCreateUserName() {
		return createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public String getUpdateUser() {
		return updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	public String getUpdateUserName() {
		return updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}

+ 3 - 94
svr/svr-base/src/main/java/com/yihu/jw/base/model/base/Function.java

@ -2,9 +2,9 @@ package com.yihu.jw.base.model.base;// default package
import com.yihu.jw.base.model.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * WlyyFunction entity. @author MyEclipse Persistence Tools
@ -15,18 +15,11 @@ public class Function extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;//业务code
	private String name; //功能名称
	private String saasId; // saasid
	private String parentCode; //父功能code
	private Integer status; //状态 -1 删除 0 禁用 可用
	private String url;//功能对应的后台url路径
	private String createUser;
	private String createUserName;
	private Date createTime;
	private String modifyUser;
	private String modifyUserName;
	private Date modifyTime;
	private String remark; //备注
	// Constructors
@ -35,34 +28,6 @@ public class Function extends IdEntity implements java.io.Serializable {
	public Function() {
	}
	/** minimal constructor */
	public Function(Long id, Timestamp createTime, Timestamp modifyTime) {
		this.id = id;
		this.createTime = createTime;
		this.modifyTime = modifyTime;
	}
	/** full constructor */
	public Function(Long id, String code, String name, String saasId,
			String parentCode, Integer status, String createUser,
			String createUserName, Timestamp createTime, String modifyUser,
			String modifyUserName, Timestamp modifyTime, String remark) {
		this.id = id;
		this.code = code;
		this.name = name;
		this.saasId = saasId;
		this.parentCode = parentCode;
		this.status = status;
		this.createUser = createUser;
		this.createUserName = createUserName;
		this.createTime = createTime;
		this.modifyUser = modifyUser;
		this.modifyUserName = modifyUserName;
		this.modifyTime = modifyTime;
		this.remark = remark;
	}
	public void setId(Long id) {
		this.id = id;
	}
@ -112,62 +77,6 @@ public class Function extends IdEntity implements java.io.Serializable {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modify_time", nullable = false, length = 0)
	public Date getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;

+ 3 - 99
svr/svr-base/src/main/java/com/yihu/jw/base/model/base/Module.java

@ -2,9 +2,9 @@ package com.yihu.jw.base.model.base;// default package
import com.yihu.jw.base.model.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * WlyyModule entity. @author MyEclipse Persistence Tools
@ -14,17 +14,10 @@ import javax.persistence.*;
public class Module extends IdEntity implements java.io.Serializable {
	// Fields
	private String code; //业务code
	private String name; //模块名称
	private String saasId; //关联 Saas code
	private String parentCode;//父id
	private Integer status; //-1 删除 0 禁用 可用
	private String createUser;
	private String createUserName;
	private Date createTime;
	private String modifyUser;
	private String modifyUserName;
	private Date modifyTime;
	private String remark;
	// Constructors
@ -33,41 +26,6 @@ public class Module extends IdEntity implements java.io.Serializable {
	public Module() {
	}
	/** minimal constructor */
	public Module(Long id, Timestamp createTime, Timestamp modifyTime) {
		this.id = id;
		this.createTime = createTime;
		this.modifyTime = modifyTime;
	}
	/** full constructor */
	public Module(Long id, String code, String name, String saasId,
			String parentCode, Integer status, String createUser,
			String createUserName, Timestamp createTime, String modifyUser,
			String modifyUserName, Timestamp modifyTime, String remark) {
		this.id = id;
		this.code = code;
		this.name = name;
		this.saasId = saasId;
		this.parentCode = parentCode;
		this.status = status;
		this.createUser = createUser;
		this.createUserName = createUserName;
		this.createTime = createTime;
		this.modifyUser = modifyUser;
		this.modifyUserName = modifyUserName;
		this.modifyTime = modifyTime;
		this.remark = remark;
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 200)
	public String getName() {
@ -105,60 +63,6 @@ public class Module extends IdEntity implements java.io.Serializable {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modify_time", nullable = false, length = 0)
	public Date getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;

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

@ -12,7 +12,9 @@ import javax.persistence.*;
public class ModuleFunction extends IdEntity implements java.io.Serializable {
	// Fields
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	private String functionId;//关联 WlyyFunction    code
	private String moduleId;//关联 WlyyModule code
@ -40,4 +42,13 @@ public class ModuleFunction extends IdEntity implements java.io.Serializable {
		this.moduleId = moduleId;
	}
	@Override
	public Long getId() {
		return id;
	}
	@Override
	public void setId(Long id) {
		this.id = id;
	}
}

+ 3 - 74
svr/svr-base/src/main/java/com/yihu/jw/base/model/base/Saas.java

@ -2,8 +2,9 @@ package com.yihu.jw.base.model.base;// default package
import com.yihu.jw.base.model.IdEntity;
import java.util.Date;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * WlyySaas entity. @author MyEclipse Persistence Tools
@ -14,17 +15,9 @@ public class Saas extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;//业务code、
	private String name;//名称
	private Integer status;//状态 -1 已删除 0待审核 1审核通过 2 审核不通过
	private String createUser; //创建人code
	private String createUserName;//创建人名称
	private Date createTime;//创建时间
	private String modifyUser;//修改人
	private String modifyUserName;//修改人名称
	private Date modifyTime;//修改时间
	private String remark;//备注
	// Constructors
	/** default constructor */
@ -50,60 +43,6 @@ public class Saas extends IdEntity implements java.io.Serializable {
		this.status = status;
	}
	@Column(name = "create_user", length = 200)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 200)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "modify_user", length = 200)
	public String getModifyUser() {
		return this.modifyUser;
	}
	public void setModifyUser(String modifyUser) {
		this.modifyUser = modifyUser;
	}
	@Column(name = "modify_user_name", length = 200)
	public String getModifyUserName() {
		return this.modifyUserName;
	}
	public void setModifyUserName(String modifyUserName) {
		this.modifyUserName = modifyUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "modify_time", nullable = false, length = 0)
	public Date getModifyTime() {
		return this.modifyTime;
	}
	public void setModifyTime(Date modifyTime) {
		this.modifyTime = modifyTime;
	}
	@Column(name = "remark", length = 1000)
	public String getRemark() {
		return this.remark;
@ -112,14 +51,4 @@ public class Saas extends IdEntity implements java.io.Serializable {
	public void setRemark(String remark) {
		this.remark = remark;
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}

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

@ -12,7 +12,9 @@ import javax.persistence.*;
public class SaasModule extends IdEntity implements java.io.Serializable {
	// Fields
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	private String saasId; //关联WlyySaas code
	private String moduleId; //关联 WlyyModule code
@ -36,4 +38,13 @@ public class SaasModule extends IdEntity implements java.io.Serializable {
		this.moduleId = moduleId;
	}
	@Override
	public Long getId() {
		return id;
	}
	@Override
	public void setId(Long id) {
		this.id = id;
	}
}

+ 7 - 7
svr/svr-base/src/main/java/com/yihu/jw/version/controller/ServerVersionController.java

@ -23,13 +23,13 @@ import java.util.List;
 * Created by chenweida on 2017/5/19.
 */
@RestController
@RequestMapping(BaseVersionContants.WlyyVersion.api_common)
@RequestMapping(BaseVersionContants.BaseServerVersion.api_common)
@Api(value = "服务器版本模块", description = "服务器版本模块接口管理")
public class ServerVersionController extends EnvelopRestController {
    @Autowired
    private WlyyVersionService wlyyVersionService;
    @PostMapping(value = BaseVersionContants.WlyyVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseVersionContants.BaseServerVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建服务器版本", notes = "创建单个服务器版本")
    public Envelop createWlyyVersion(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
@ -42,7 +42,7 @@ public class ServerVersionController extends EnvelopRestController {
        }
    }
    @PutMapping(value = BaseVersionContants.WlyyVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = BaseVersionContants.BaseServerVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改服务器版本", notes = "修改服务器版本")
    public Envelop updateWlyyVersion(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
@ -54,7 +54,7 @@ public class ServerVersionController extends EnvelopRestController {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = BaseVersionContants.WlyyVersion.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @DeleteMapping(value = BaseVersionContants.BaseServerVersion.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "删除服务器版本", notes = "删除服务器版本")
    public Envelop deleteWlyyVersion(
            @ApiParam(name = "code", value = "code")
@ -67,7 +67,7 @@ public class ServerVersionController extends EnvelopRestController {
        }
    }
    @GetMapping(value = BaseVersionContants.WlyyVersion.api_getByCode, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @GetMapping(value = BaseVersionContants.BaseServerVersion.api_getByCode, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "根据code查找服务器版本", notes = "根据code查找服务器版本")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
@ -81,7 +81,7 @@ public class ServerVersionController extends EnvelopRestController {
    }
    @RequestMapping(value = BaseVersionContants.WlyyVersion.api_getWlyyVersion, method = RequestMethod.GET)
    @RequestMapping(value = BaseVersionContants.BaseServerVersion.api_getBaseServerVersion, method = RequestMethod.GET)
    @ApiOperation(value = "获取服务器版本列表(分页)")
    public Envelop getWlyyVersions(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
@ -110,7 +110,7 @@ public class ServerVersionController extends EnvelopRestController {
    }
    @GetMapping(value = BaseVersionContants.WlyyVersion.api_getWlyyVersionNoPage)
    @GetMapping(value = BaseVersionContants.BaseServerVersion.api_getBaseServerVersionNoPage)
    @ApiOperation(value = "获取服务器版本列表,不分页")
    public Envelop getAppsNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")

+ 29 - 28
svr/svr-base/src/main/java/com/yihu/jw/version/controller/WlyyVersionController.java

@ -1,12 +1,13 @@
package com.yihu.jw.version.controller;
import com.yihu.jw.restmodel.base.version.BaseVersionContants;
import com.yihu.jw.restmodel.base.version.MBaseServerVersion;
import com.yihu.jw.restmodel.base.version.MWlyyVersion;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.common.EnvelopRestController;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.version.model.BaseServerVersion;
import com.yihu.jw.version.model.WlyyVersion;
import com.yihu.jw.version.service.ServerVersionService;
import com.yihu.jw.version.service.WlyyVersionService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
@ -24,67 +25,67 @@ import java.util.List;
 */
@RestController
@RequestMapping(BaseVersionContants.BaseServerVersion.api_common)
@RequestMapping(BaseVersionContants.WlyyVersion.api_common)
@Api(value = "i健康APP版本模块", description = "i健康APP版本模块接口管理")
public class WlyyVersionController  extends EnvelopRestController {
    @Autowired
    private ServerVersionService BaseServerVersionService;
    private WlyyVersionService wlyyVersionService;
    @PostMapping(value = BaseVersionContants.BaseServerVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PostMapping(value = BaseVersionContants.WlyyVersion.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建i健康APP版本", notes = "创建单个i健康APP版本")
    public Envelop createBaseServerVersion(
    public Envelop createWlyyVersion(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            BaseServerVersion BaseServerVersion = toEntity(jsonData, BaseServerVersion.class);
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersion.message_success_create, BaseServerVersionService.createBaseServerVersion(BaseServerVersion));
            WlyyVersion WlyyVersion = toEntity(jsonData, WlyyVersion.class);
            return Envelop.getSuccess(BaseVersionContants.WlyyVersion.message_success_create, wlyyVersionService.createWlyyVersion(WlyyVersion));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PutMapping(value = BaseVersionContants.BaseServerVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @PutMapping(value = BaseVersionContants.WlyyVersion.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改i健康APP版本", notes = "修改i健康APP版本")
    public Envelop updateBaseServerVersion(
    public Envelop updateWlyyVersion(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
        try {
            BaseServerVersion BaseServerVersion = toEntity(jsonData, BaseServerVersion.class);
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersion.message_success_update, BaseServerVersionService.updateBaseServerVersion(BaseServerVersion));
            WlyyVersion WlyyVersion = toEntity(jsonData, WlyyVersion.class);
            return Envelop.getSuccess(BaseVersionContants.WlyyVersion.message_success_update, wlyyVersionService.updateWlyyVersion(WlyyVersion));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @DeleteMapping(value = BaseVersionContants.BaseServerVersion.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @DeleteMapping(value = BaseVersionContants.WlyyVersion.api_delete, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "删除i健康APP版本", notes = "删除i健康APP版本")
    public Envelop deleteBaseServerVersion(
    public Envelop deleteWlyyVersion(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        try {
            BaseServerVersionService.deleteBaseServerVersion(code);
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersion.message_success_delete );
            wlyyVersionService.deleteWlyyVersion(code);
            return Envelop.getSuccess(BaseVersionContants.WlyyVersion.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = BaseVersionContants.BaseServerVersion.api_getByCode, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @GetMapping(value = BaseVersionContants.WlyyVersion.api_getByCode, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "根据code查找i健康APP版本", notes = "根据code查找i健康APP版本")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess(BaseVersionContants.BaseServerVersion.message_success_find, BaseServerVersionService.findByCode(code));
            return Envelop.getSuccess(BaseVersionContants.WlyyVersion.message_success_find, wlyyVersionService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @RequestMapping(value = BaseVersionContants.BaseServerVersion.api_getBaseServerVersion, method = RequestMethod.GET)
    @RequestMapping(value = BaseVersionContants.WlyyVersion.api_getWlyyVersion, method = RequestMethod.GET)
    @ApiOperation(value = "获取i健康APP版本列表(分页)")
    public Envelop getBaseServerVersions(
    public Envelop getWlyyVersions(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "filters", value = "过滤器,为空检索所有条件")
@ -99,19 +100,19 @@ public class WlyyVersionController  extends EnvelopRestController {
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        //得到list数据
        List<BaseServerVersion> list = BaseServerVersionService.search(fields, filters, sorts, page, size);
        List<WlyyVersion> list = wlyyVersionService.search(fields, filters, sorts, page, size);
        //获取总数
        long count=BaseServerVersionService.getCount(filters);
        long count=wlyyVersionService.getCount(filters);
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<MBaseServerVersion> mBaseServerVersions = convertToModels(list, new ArrayList<>(list.size()), MBaseServerVersion.class, fields);
        List<MWlyyVersion> mWlyyVersions = convertToModels(list, new ArrayList<>(list.size()), MWlyyVersion.class, fields);
        return Envelop.getSuccessListWithPage(BaseVersionContants.BaseServerVersion.message_success_find_BaseServerVersions,mBaseServerVersions, page, size,count);
        return Envelop.getSuccessListWithPage(BaseVersionContants.WlyyVersion.message_success_find_WlyyVersions,mWlyyVersions, page, size,count);
    }
    @GetMapping(value = BaseVersionContants.BaseServerVersion.api_getBaseServerVersionNoPage)
    @GetMapping(value = BaseVersionContants.WlyyVersion.api_getWlyyVersionNoPage)
    @ApiOperation(value = "获取i健康APP版本列表,不分页")
    public Envelop getAppsNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "code,name,saasId,parentCode,remark")
@ -121,10 +122,10 @@ public class WlyyVersionController  extends EnvelopRestController {
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts) throws Exception {
        //得到list数据
        List<BaseServerVersion> list = BaseServerVersionService.search(fields,filters,sorts);
        List<WlyyVersion> list = wlyyVersionService.search(fields,filters,sorts);
        //封装返回格式
        List<MBaseServerVersion> mBaseServerVersions = convertToModels(list, new ArrayList<>(list.size()), MBaseServerVersion.class, fields);
        return Envelop.getSuccessList(BaseVersionContants.BaseServerVersion.message_success_find_BaseServerVersions,mBaseServerVersions);
        List<MWlyyVersion> mWlyyVersions = convertToModels(list, new ArrayList<>(list.size()), MWlyyVersion.class, fields);
        return Envelop.getSuccessList(BaseVersionContants.WlyyVersion.message_success_find_WlyyVersions,mWlyyVersions);
    }
}

+ 0 - 11
svr/svr-base/src/main/java/com/yihu/jw/version/model/BaseServerVersion.java

@ -16,7 +16,6 @@ public class BaseServerVersion  extends IdEntity implements java.io.Serializable
 
	private String code; //业务code
	private String saasId;//关联base_saas code
	private String userCode;//用户表code 医生
	private String name; //版本名称
	private Integer versionInt;//版本号
	private Date createTime;
@ -51,7 +50,6 @@ public class BaseServerVersion  extends IdEntity implements java.io.Serializable
			String remark) {
		this.code = code;
		this.saasId = saasId;
		this.userCode = userCode;
		this.name = name;
		this.versionInt = versionInt;
		this.createTime = createTime;
@ -82,15 +80,6 @@ public class BaseServerVersion  extends IdEntity implements java.io.Serializable
		this.saasId = saasId;
	}
	@Column(name = "user_code", length = 100)
	public String getUserCode() {
		return this.userCode;
	}
	public void setUserCode(String userCode) {
		this.userCode = userCode;
	}
	@Column(name = "name", nullable = false, length = 10)
	public String getName() {
		return this.name;

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

@ -10,6 +10,7 @@ import com.yihu.jw.wx.service.WechatService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -60,9 +61,14 @@ public class WechatConfigController extends EnvelopRestController {
    @ApiOperation(value = "删除微信配置", notes = "删除微信配置")
    public Envelop deleteWechat(
            @ApiParam(name = "codes", value = "codes")
            @RequestParam(value = "codes", required = true) String codes) {
            @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName
            ) {
        try {
            wechatService.deleteWechat(codes);
            wechatService.deleteWechat(codes,userCode,userName);
            return Envelop.getSuccess(WxContants.Wechat.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
@ -97,6 +103,9 @@ public class WechatConfigController extends EnvelopRestController {
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        if(StringUtils.isBlank(sorts)){
            sorts = "-updateTime";
        }
        //得到list数据
        List<WxWechat> list = wechatService.search(fields, filters, sorts, page, size);
        //获取总数

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

@ -10,6 +10,7 @@ import com.yihu.jw.wx.service.WxGraphicMessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -60,10 +61,15 @@ public class WxGraphicMessageController extends EnvelopRestController {
    @DeleteMapping(value = WxContants.WxGraphicMessage.api_delete)
    @ApiOperation(value = "删除微信图文消息", notes = "删除微信图文消息")
    public Envelop deleteWxGraphicMessage(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
            @ApiParam(name = "codes", value = "codes")
            @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName
    ) {
        try {
            wxGraphicMessageService.deleteWxGraphicMessage(code);
            wxGraphicMessageService.deleteWxGraphicMessage(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxGraphicMessage.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
@ -98,6 +104,9 @@ public class WxGraphicMessageController extends EnvelopRestController {
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        if(StringUtils.isBlank(sorts)){
            sorts = "-updateTime";
        }
        //得到list数据
        List<WxGraphicMessage> list = wxGraphicMessageService.search(fields, filters, sorts, page, size);
        //获取总数

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

@ -8,10 +8,12 @@ import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.wx.WechatResponse;
import com.yihu.jw.wx.model.WxMenu;
import com.yihu.jw.wx.model.WxWechat;
import com.yihu.jw.wx.service.WechatService;
import com.yihu.jw.wx.service.WxMenuService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
@ -21,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/5/19 0019.
@ -33,6 +36,9 @@ public class WxMenuController extends EnvelopRestController {
    @Autowired
    private WxMenuService wxMenuService;
    @Autowired
    private WechatService wechatService;
    @PostMapping(value = WxContants.WxMenu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    public Envelop createWxMenu(
@ -63,10 +69,15 @@ public class WxMenuController extends EnvelopRestController {
    @DeleteMapping(value = WxContants.WxMenu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    public Envelop deleteWxMenu(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
            @ApiParam(name = "codes", value = "codes")
            @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName
    ) {
        try {
            wxMenuService.deleteWxMenu(code);
            wxMenuService.deleteWxMenu(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxMenu.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
@ -101,6 +112,9 @@ public class WxMenuController extends EnvelopRestController {
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        if(StringUtils.isBlank(sorts)){
            sorts = "-updateTime";
        }
        //得到list数据
        List<WxWechat> list = wxMenuService.search(fields, filters, sorts, page, size);
        //获取总数
@ -109,7 +123,10 @@ public class WxMenuController extends EnvelopRestController {
        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);
    }
@ -127,6 +144,10 @@ public class WxMenuController extends EnvelopRestController {
        List<WxMenu> list = wxMenuService.search(fields,filters,sorts);
        //封装返回格式
        List<MWxMenu> mWxMenus = convertToModels(list, new ArrayList<>(list.size()), MWxMenu.class, fields);
        Map<String, String> map = wechatService.getAllWechatConfig();
        for(MWxMenu menu:mWxMenus){
            menu.setWechatName(map.get(menu.getWechatCode()));
        }
        return Envelop.getSuccessList(WxContants.WxMenu.message_success_find_functions,mWxMenus);
    }
@ -151,4 +172,41 @@ public class WxMenuController extends EnvelopRestController {
        }
    }
    /**
     * 根据微信code查找父菜单
     * @param wechatCode
     * @return
     */
    @GetMapping(value = WxContants.WxMenu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    public Envelop getParentMenu(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @PathVariable(value = "wechatCode", required = true) String wechatCode
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxMenu.message_success_find, wxMenuService.findParentMenuByWechatCode(wechatCode));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    /**
     * 根据父级菜单code查找子菜单
     * @param parentCode
     * @return
     */
    @GetMapping(value = WxContants.WxMenu.api_getChildMenus)
    @ApiOperation(value = "根据父级菜单code查找子菜单", notes = "根据父级菜单code查找子菜单")
    public Envelop getChildMenus(
            @ApiParam(name = "parentCode", value = "parentCode")
            @PathVariable(value = "parentCode", required = true) String parentCode
    ) {
        try {
            return Envelop.getSuccess(WxContants.WxMenu.message_success_find, wxMenuService.findChildMenus(parentCode));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
}

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

@ -8,6 +8,7 @@ import com.yihu.jw.restmodel.wx.WxContants;
import com.yihu.jw.wx.WechatResponse;
import com.yihu.jw.wx.model.Miniprogram;
import com.yihu.jw.wx.model.WxTemplate;
import com.yihu.jw.wx.service.WechatService;
import com.yihu.jw.wx.service.WxTemplateService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
@ -22,6 +23,7 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
 * Created by Administrator on 2017/5/19 0019.
@ -33,6 +35,9 @@ public class WxTemplateController extends EnvelopRestController {
    @Autowired
    private WxTemplateService wxTemplateService;
    @Autowired
    private WechatService wechatService;
    @PostMapping(value = WxContants.WxTemplate.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "创建微信模版", notes = "创建微信模版")
    public Envelop createWxTemplate(
@ -59,14 +64,18 @@ public class WxTemplateController extends EnvelopRestController {
        }
    }
    @DeleteMapping(value = WxContants.WxTemplate.api_delete)
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    public Envelop deleteWxTemplate(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
            @ApiParam(name = "codes", value = "codes")
            @RequestParam(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName
    ) {
        try {
            wxTemplateService.deleteWxTemplate(code);
            wxTemplateService.deleteWxTemplate(codes, userCode, userName);
            return Envelop.getSuccess(WxContants.WxTemplate.message_success_delete );
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
@ -101,6 +110,9 @@ public class WxTemplateController extends EnvelopRestController {
            @RequestParam(value = "page", required = false) int page,
            HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        if(StringUtils.isBlank(sorts)){
            sorts = "-updateTime";
        }
        //得到list数据
        List<WxTemplate> list = wxTemplateService.search(fields, filters, sorts, page, size);
        //获取总数
@ -108,9 +120,13 @@ public class WxTemplateController extends EnvelopRestController {
        //封装头信息
        pagedResponse(request, response, count, page, size);
        //封装返回格式
        List<MWxTemplate> mWxWechats = convertToModels(list, new ArrayList<>(list.size()), MWxTemplate.class, fields);
        List<MWxTemplate> templates = convertToModels(list, new ArrayList<>(list.size()), MWxTemplate.class, fields);
        Map<String, String> map = wechatService.getAllWechatConfig();
        for(MWxTemplate template:templates){
            template.setWechatName(map.get(template.getWechatCode()));
        }
        return Envelop.getSuccessListWithPage(WxContants.WxTemplate.message_success_find_functions,mWxWechats, page, size,count);
        return Envelop.getSuccessListWithPage(WxContants.WxTemplate.message_success_find_functions,templates, page, size,count);
    }
@ -127,6 +143,10 @@ public class WxTemplateController extends EnvelopRestController {
        List<WxTemplate> list = wxTemplateService.search(fields,filters,sorts);
        //封装返回格式
        List<MWxTemplate> mMWxTemplates = convertToModels(list, new ArrayList<>(list.size()), MWxTemplate.class, fields);
        Map<String, String> map = wechatService.getAllWechatConfig();
        for(MWxTemplate template:mMWxTemplates){
            template.setWechatName(map.get(template.getWechatCode()));
        }
        return Envelop.getSuccessList(WxContants.WxTemplate.message_success_find_functions,mMWxTemplates);
    }

+ 4 - 0
svr/svr-base/src/main/java/com/yihu/jw/wx/dao/WechatDao.java

@ -5,6 +5,8 @@ import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by Administrator on 2017/5/20 0020.
 */
@ -23,4 +25,6 @@ public interface WechatDao extends PagingAndSortingRepository<WxWechat, Long>, J
    @Query("from WxWechat w where w.id = ?1 and w.status!=-1")
    WxWechat findById(Long id);
    @Query("from WxWechat w where w.status!=-1")
    List<WxWechat> findAll();
}

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

@ -24,6 +24,9 @@ public interface WxMenuDao  extends PagingAndSortingRepository<WxMenu, Long>, Jp
    @Query("from WxMenu m where m.wechatCode = ?1 and  m.supMenucode= ?2 and m.status =1 order by m.sort")
    List<WxMenu> findChildMenus(String wechatCode, String sup_menucode);
    @Query("from WxMenu m where  m.supMenucode= ?1 and m.status =1 order by m.sort")
    List<WxMenu> findChildMenus( String parentCode);
    /**
     * 根据wechatCode判断父菜单的sort是否重复
     * @param wechatCode
@ -40,7 +43,7 @@ public interface WxMenuDao  extends PagingAndSortingRepository<WxMenu, Long>, Jp
    @Query("from WxMenu m where m.wechatCode = ?1 and m.status =1 and m.sort =?2 and m.supMenucode =?3 and m.code != ?4")
    WxMenu findByWechatCodeExcludeSortFromChild(String wechatCode, Integer sort,String supMenucode,String code);
    @Query("from WxMenu m where m.wechatCode =?1 and m.status = 1 and m.supMenucode is null order by m.supMenucode ,m.sort")
    @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")
    List<WxMenu> findParentMenuByWechatCode(String wechatCode);
}

+ 0 - 67
svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxGraphicMessage.java

@ -12,17 +12,10 @@ import java.util.Date;
@Table(name = "wx_graphic_message")
public class WxGraphicMessage extends IdEntity implements java.io.Serializable {
    private String code;//业务code
    private String title;//标题
    private String description;//描述
    private String url;//图文消息url值
    private String picUrl;//图片地址
    private String createUser;//创建人
    private String createUserName;//创建人名
    private Date createTime;//创建时间
    private String updateUser;//修改人
    private String updateUserName;//修改人名称
    private Date updateTime;//修改时间
    private String remark;//备注
    private Integer status;  //状态 -1删除 0 冻结 1可用
@ -46,15 +39,6 @@ public class WxGraphicMessage extends IdEntity implements java.io.Serializable {
        this.status = status;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "title", length = 200)
    public String getTitle() {
        return title;
@ -91,63 +75,12 @@ public class WxGraphicMessage extends IdEntity implements java.io.Serializable {
        this.picUrl = picUrl;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_user", length = 200)
    public String getUpdateUser() {
        return updateUser;
    }
    @Column(name = "remark", length = 1000)
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", length = 0)
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return remark;

+ 3 - 72
svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxMenu.java

@ -2,8 +2,9 @@ package com.yihu.jw.wx.model;// default package
import com.yihu.jw.base.model.IdEntity;
import javax.persistence.*;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 微信 菜单表
@ -13,7 +14,6 @@ import java.util.Date;
public class WxMenu extends IdEntity implements java.io.Serializable {
    private String code;//业务code
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String supMenucode;//父菜单id 如果是一级菜单 此字段为空
    private String type;//菜单类型
@ -24,10 +24,6 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
    private String mediaId;//点用新增永久素材接口返回的合法media_id
    private String appid;//小程序的appid
    private String pagepath;//小程序的页面程序
    private String updateUser;//更新人
    private Date updateTime;//更新时间
    private Date createTime;//创建时间
    private String createUser;//创建人
    private String remark;//备注
    private Integer status; //状态 -1删除 0 冻结 1可用
@ -39,25 +35,6 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
    public WxMenu() {
    }
    public WxMenu(String code, String wechatCode, String supMenucode, String type, String name, String menuKey, Integer sort, String url, String mediaId, String appid, String pagepath, String updateUser, Date updateTime, Date createTime, String createUser, String remark, Integer status) {
        this.code = code;
        this.wechatCode = wechatCode;
        this.supMenucode = supMenucode;
        this.type = type;
        this.name = name;
        this.menuKey = menuKey;
        this.sort = sort;
        this.url = url;
        this.mediaId = mediaId;
        this.appid = appid;
        this.pagepath = pagepath;
        this.updateUser = updateUser;
        this.updateTime = updateTime;
        this.createTime = createTime;
        this.createUser = createUser;
        this.remark = remark;
        this.status = status;
    }
    @Column(name="menu_key")
    public String getMenuKey() {
@ -93,14 +70,6 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
        this.pagepath = pagepath;
    }
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    public Integer getStatus() {
        return status;
    }
@ -164,44 +133,6 @@ public class WxMenu extends IdEntity implements java.io.Serializable {
        this.url = url;
    }
    @Column(name = "update_user", length = 50)
    public String getUpdateUser() {
        return this.updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", length = 0)
    public Date getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "create_user", length = 50)
    public String getCreateUser() {
        return this.createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return this.remark;

+ 0 - 106
svr/svr-base/src/main/java/com/yihu/jw/wx/model/WxTemplate.java

@ -13,18 +13,10 @@ import java.util.Date;
public class WxTemplate extends IdEntity implements java.io.Serializable {
    // Fields
    private String code;//模板code
    private String title;//模板标题
    private String wechatCode;//关联的微信code 关联表 Wx_Wechat
    private String wechatName;//关联的微信名
    private String templateId;//微信模板id
    private String content;//模板内容
    private String createUser;//创建人
    private String createUserName;//创建人名
    private Date createTime;//创建时间
    private String updateUser;//修改人
    private String updateUserName;//修改人名称
    private Date updateTime;//修改时间
    private String remark;
    private Integer status;  //状态 -1删除 0 冻结 1可用
@ -68,15 +60,6 @@ public class WxTemplate extends IdEntity implements java.io.Serializable {
        this.wechatCode = wechatCode;
    }
    @Column(name="wechat_name")
    public String getWechatName() {
        return wechatName;
    }
    public void setWechatName(String wechatName) {
        this.wechatName = wechatName;
    }
    @Column(name="template_id")
    public String getTemplateId() {
        return templateId;
@ -96,30 +79,6 @@ public class WxTemplate extends IdEntity implements java.io.Serializable {
        this.content = content;
    }
    public String getUpdateUser() {
        return updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    public Integer getStatus() {
        return status;
    }
@ -129,71 +88,6 @@ public class WxTemplate extends IdEntity implements java.io.Serializable {
        this.status = status;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return this.createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", nullable = false, length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_user", length = 200)
    public String geUpdateUser() {
        return this.updateUser;
    }
    public void seUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String geUpdateUserName() {
        return this.updateUserName;
    }
    public void seUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", nullable = false, length = 0)
    public Date geUpdateTime() {
        return this.updateTime;
    }
    public void seUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return this.remark;

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

@ -13,7 +13,6 @@ import java.util.Date;
public class WxWechat extends IdEntity implements java.io.Serializable {
    // Fields
    private String code;//业务code
    private String saasId;//'saas配置id'
    private String name;//名称
    private String token;//token
@ -24,12 +23,6 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
    private String appId;//'微信app_id'
    private String appSecret;//'微信app_secret'
    private String baseUrl;//'微信base_url'
    private String createUser;//'创建人'
    private String createUserName;//'创建人名'
    private Date createTime;//'创建时间'
    private String updateUser;//'修改人
    private String updateUserName;//'修改人名'
    private Date updateTime;//'修改时间'
    private String remark;//'备注'
    public 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;
@ -83,15 +76,6 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
        this.encodingAesKey = encodingAesKey;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "saas_id", length = 50)
    public String getSaasId() {
        return this.saasId;
@ -155,34 +139,6 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
        this.baseUrl = baseUrl;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return this.createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", nullable = false, length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return this.remark;
@ -192,32 +148,4 @@ public class WxWechat extends IdEntity implements java.io.Serializable {
        this.remark = remark;
    }
    @Column(name = "update_user", length = 200)
    public String getUpdateUser() {
        return this.updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String getUpdateUserName() {
        return this.updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", nullable = false, length = 0)
    public Date getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

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

@ -11,8 +11,7 @@ import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.persistence.Transient;
import java.util.Date;
import java.util.UUID;
import java.util.*;
/**
 * Created by Administrator on 2017/5/20 0020.
@ -39,21 +38,10 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getName())) {
            throw new ApiException(WxContants.Wechat.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getAppId())) {
            throw new ApiException(WxContants.Wechat.message_fail_appId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getAppSecret())) {
            throw new ApiException(WxContants.Wechat.message_fail_appSecret_is_null, CommonContants.common_error_params_code);
        }
        WxWechat wechatTem = wechatDao.findByAppId(wechat.getAppId());
        if (wechatTem != null) {
            throw new ApiException(WxContants.Wechat.message_fail_appId_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wechat.setCreateTime(date);
        wechat.setUpdateTime(date);
        return wechatDao.save(wechat);
    }
@ -74,12 +62,6 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if (StringUtils.isEmpty(wechat.getName())) {
            throw new ApiException(WxContants.Wechat.message_fail_name_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getAppId())) {
            throw new ApiException(WxContants.Wechat.message_fail_appId_is_null, CommonContants.common_error_params_code);
        }
        if (StringUtils.isEmpty(wechat.getAppSecret())) {
            throw new ApiException(WxContants.Wechat.message_fail_appSecret_is_null, CommonContants.common_error_params_code);
        }
        Long id = wechat.getId();
        if (StringUtils.isEmpty(id)) {
            throw new ApiException(WxContants.Wechat.message_fail_id_is_null, CommonContants.common_error_params_code);
@ -88,9 +70,6 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
        if(wechat1 == null){
            throw new ApiException(WxContants.Wechat.message_fail_wxWechat_is_no_exist, CommonContants.common_error_params_code);
        }
        //设置修改时间创建时间
        wechat.setCreateTime(wechat1.getCreateTime());
        wechat.setUpdateTime(new Date());
        WxWechat wechatTem = wechatDao.findByAppIdExcludeCode(wechat.getAppId(),wechat.getCode());
        if(wechatTem!=null){
            throw new ApiException(WxContants.Wechat.message_fail_appId_exist, CommonContants.common_error_params_code);
@ -108,7 +87,7 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
    }
    @Transient
    public void deleteWechat(String codes) {
    public void deleteWechat(String codes,String userCode,String userName) {
        if(!StringUtils.isEmpty(codes)){
            String[] codeArray = codes.split(",");
            for(String code:codeArray){
@ -117,8 +96,29 @@ public class WechatService extends BaseJpaService<WxWechat, WechatDao> {
                    throw new ApiException(WxContants.Wechat.message_fail_code_no_exist, CommonContants.common_error_params_code);
                }
                wxWechat.setStatus(-1);
                wxWechat.setUpdateUser(userCode);
                wxWechat.setUpdateUserName(userName);
                wechatDao.save(wxWechat);
            }
        }
    }
    public List<WxWechat> findAll(){
        return wechatDao.findAll();
    }
    /**
     * key为code ,value为微信名字
     * @return
     */
    public Map<String,String> getAllWechatConfig(){
        List<WxWechat> wechats = findAll();
        Map<String, String> map = new HashMap<>();
        if(null!=wechats){
            for(WxWechat wx: wechats){
                map.put(wx.getCode(),wx.getName());
            }
        }
        return map;
    }
}

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

@ -38,12 +38,6 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
        if (wxGraphicMessageTem != null) {
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_code_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wxGraphicMessage.setCreateTime(date);
        wxGraphicMessage.setUpdateTime(date);
        return wxGraphicMessageDao.save(wxGraphicMessage);
    }
@ -64,10 +58,6 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
        if(wxGraphicMessage1==null){
            throw new ApiException(WxContants.WxGraphicMessage.message_fail_wxGraphicMessage_is_no_exist, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wxGraphicMessage.setCreateTime(wxGraphicMessage1.getCreateTime());
        wxGraphicMessage.setUpdateTime(date);
        return wxGraphicMessageDao.save(wxGraphicMessage);
    }
@ -81,10 +71,17 @@ public class WxGraphicMessageService extends BaseJpaService<WxGraphicMessage, Wx
    }
    @Transient
    public void deleteWxGraphicMessage(String code) {
        WxGraphicMessage WxGraphicMessage = findByCode(code);
        WxGraphicMessage.setStatus(-1);
        wxGraphicMessageDao.save(WxGraphicMessage);
    public void deleteWxGraphicMessage(String codes, String userCode, String userName) {
        if(!StringUtils.isEmpty(codes)){
            String[] codeArray = codes.split(",");
            for(String code:codeArray){
                WxGraphicMessage wxGraphicMessage = findByCode(code);
                wxGraphicMessage.setStatus(-1);
                wxGraphicMessage.setUpdateUser(userCode);
                wxGraphicMessage.setUpdateUserName(userName);
                wxGraphicMessageDao.save(wxGraphicMessage);
            }
        }
    }

+ 62 - 19
svr/svr-base/src/main/java/com/yihu/jw/wx/service/WxMenuService.java

@ -20,6 +20,7 @@ import javax.persistence.Transient;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.UUID;
/**
 * Created by Administrator on 2017/5/19 0019.
@ -44,8 +45,9 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
     * @return
     */
    public WxMenu createWxMenu(WxMenu wxMenu) {
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxMenu.setCode(code);
        if(canSaveOrUpata(wxMenu)){
            wxMenu.setCreateTime(new Date());
            return wxMenuDao.save(wxMenu);
        }
        return null;
@ -53,6 +55,9 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    @Transient
    public WxMenu updateWxMenu(WxMenu wxMenu) {
        if (StringUtils.isEmpty(wxMenu.getCode())) {
            throw new ApiException(WxContants.WxMenu.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        if(canSaveOrUpata(wxMenu)){
            Long id = wxMenu.getId();
            if (StringUtils.isEmpty(id)) {
@ -62,32 +67,69 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
            if(wxMenu1==null){
                throw new ApiException(WxContants.WxMenu.message_fail_WxMenu_is_no_exist, CommonContants.common_error_params_code);
            }
            wxMenu.setCreateTime(wxMenu1.getCreateTime());
            return wxMenuDao.save(wxMenu);
        }
        return null;
    }
    @Transient
    public void deleteWxMenu(String code) {
        WxMenu wxMenu = wxMenuDao.findByCode(code);
        if (wxMenu == null) {
            throw new ApiException(WxContants.WxMenu.message_fail_code_no_exist, CommonContants.common_error_params_code);
    public void deleteWxMenu(String codes, String userCode, String userName) {
        if(!StringUtils.isEmpty(codes)) {
            String[] codeArray = codes.split(",");
            Date date = new Date();
            for (String code : codeArray) {
                WxMenu wxMenu = wxMenuDao.findByCode(code);
                if (wxMenu == null) {
                    continue;
                }
                String supMenucode = wxMenu.getSupMenucode();
                if (StringUtils.isEmpty(supMenucode)) {//如果是空,则为父菜单
                    List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatCode(), wxMenu.getCode());
                    if (childMenus != null) {
                        for (WxMenu wxmenu : childMenus) {
                            wxmenu.setStatus(-1);
                            wxmenu.setUpdateUser(userCode);
                            wxmenu.setUpdateUserName(userName);
                            wxMenuDao.save(wxmenu);
                        }
                    }
                }
                wxMenu.setStatus(-1);
                wxMenu.setUpdateUser(userCode);
                wxMenu.setUpdateUserName(userName);
                wxMenuDao.save(wxMenu);
            }
        }
        String supMenucode = wxMenu.getSupMenucode();
        if(StringUtils.isEmpty(supMenucode)) {//如果是空,则为父菜单
            List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatCode(), wxMenu.getCode());
            if(childMenus!=null){
                for(WxMenu wxmenu:childMenus){
                    wxmenu.setStatus(-1);
                    wxMenuDao.save(wxmenu);
    }
    @Transient
    public void delete(String codes,String userCode) {
        if(!StringUtils.isEmpty(codes)) {
            String[] codeArray = codes.split(",");
            for (String code : codeArray) {
                WxMenu wxMenu = wxMenuDao.findByCode(code);
                if (wxMenu == null) {
                    continue;
                }
                String supMenucode = wxMenu.getSupMenucode();
                if (StringUtils.isEmpty(supMenucode)) {//如果是空,则为父菜单
                    List<WxMenu> childMenus = findChildMenus(wxMenu.getWechatCode(), wxMenu.getCode());
                    if (childMenus != null) {
                        for (WxMenu wxmenu : childMenus) {
                            wxmenu.setStatus(-1);
                            wxmenu.setUpdateUser(userCode);
                            wxMenuDao.save(wxmenu);
                        }
                    }
                }
                wxMenu.setStatus(-1);
                wxMenu.setUpdateUser(userCode);
                wxMenuDao.save(wxMenu);
            }
        }
        wxMenu.setStatus(-1);
        wxMenuDao.save(wxMenu);
    }
    public WxMenu findByCode(String code) {
        return wxMenuDao.findByCode(code);
    }
@ -106,7 +148,7 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
    }
    /**
     * 根据wechatCode查找所有菜单
     * 根据wechatCode查找所有父菜单
     * @param wechatCode
     * @return
     */
@ -214,10 +256,11 @@ public class WxMenuService extends BaseJpaService<WxMenu, WxMenuDao> {
        return wxMenuDao.findChildMenus(wechatCode,sup_menucode);
    }
    public List<WxMenu> findChildMenus(String parentCode ){
        return wxMenuDao.findChildMenus(parentCode);
    }
    private boolean canSaveOrUpata(WxMenu wxMenu){
        if (StringUtils.isEmpty(wxMenu.getCode())) {
            throw new ApiException(WxContants.WxMenu.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String wechatCode = wxMenu.getWechatCode();
        if (StringUtils.isEmpty(wechatCode)) {
            throw new ApiException(WxContants.WxMenu.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);

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

@ -36,9 +36,8 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
    private WechatService wechatService;
    public WxTemplate createWxTemplate(WxTemplate wxTemplate) {
        if (StringUtils.isEmpty(wxTemplate.getCode())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_code_is_null, CommonContants.common_error_params_code);
        }
        String code = UUID.randomUUID().toString().replaceAll("-", "");
        wxTemplate.setCode(code);
        if (StringUtils.isEmpty(wxTemplate.getWechatCode())) {
            throw new ApiException(WxContants.WxTemplate.message_fail_wechatCode_is_null, CommonContants.common_error_params_code);
        }
@ -57,10 +56,6 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
        if(!content.matches("\\{\\{.+\\.DATA\\}\\}")){//content必须还有 "{{.DATA}}"
            throw new ApiException(WxContants.WxTemplate.message_fail_content_format_is_not_right, CommonContants.common_error_params_code);
        }
        //设置创建时间和修改时间
        Date date = new Date();
        wxTemplate.setCreateTime(date);
        wxTemplate.setUpdateTime(date);
        return wxTemplateDao.save(wxTemplate);
    }
@ -94,13 +89,20 @@ public class WxTemplateService extends BaseJpaService<WxTemplate, WxTemplateDao>
        return wxTemplateDao.save(wxTemplate);
    }
    public void deleteWxTemplate(String code) {
        WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
        if (wxTemplate == null) {
            throw new ApiException(WxContants.WxTemplate.message_fail_code_no_exist, CommonContants.common_error_params_code);
    public void deleteWxTemplate(String codes, String userCode, String userName) {
        if(!StringUtils.isEmpty(codes)) {
            String[] codeArray = codes.split(",");
            for (String code : codeArray) {
                WxTemplate wxTemplate = wxTemplateDao.findByCode(code);
                if (wxTemplate == null) {
                    throw new ApiException(WxContants.WxTemplate.message_fail_code_no_exist, CommonContants.common_error_params_code);
                }
                wxTemplate.setStatus(-1);
                wxTemplate.setUpdateUser(userCode);
                wxTemplate.setUpdateUserName(userName);
                wxTemplateDao.save(wxTemplate);
            }
        }
        wxTemplate.setStatus(-1);
        wxTemplateDao.save(wxTemplate);
    }
    public WxTemplate findByCode(String code) {

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

@ -101,7 +101,17 @@
            <artifactId>httpclient</artifactId>
            <version>4.5.2</version>
        </dependency>
        <dependency>
            <groupId>com.yihu.jw</groupId>
            <artifactId>common-mysql</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
            <scope>provided</scope>
        </dependency>
    </dependencies>

+ 10 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/SvrMamageApp.java

@ -2,14 +2,23 @@ package com.yihu.jw.manage;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
/**
 * Created by chenweida on 2017/6/8.
 */
@EnableJpaAuditing
@SpringBootApplication
public class SvrMamageApp {
public class SvrMamageApp extends SpringBootServletInitializer {
    public static void main(String[] args) {
        SpringApplication.run(SvrMamageApp.class, args);
    }
    @Override
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(SvrMamageApp.class);
    }
}

+ 2 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/login/LoginController.java

@ -1,5 +1,6 @@
package com.yihu.jw.manage.controller.login;
import com.yihu.jw.manage.aop.annotation.ManageLog;
import com.yihu.jw.manage.cache.login.LoginCache;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.service.login.LoginService;
@ -28,6 +29,7 @@ public class LoginController extends EnvelopRestController {
    @GetMapping("/login")
    @ApiOperation(value = "登陆")
    @ManageLog
    public Envelop login(
            @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 {

+ 105 - 2
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/MenuController.java

@ -1,10 +1,113 @@
package com.yihu.jw.manage.controller.system;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageMenu;
import com.yihu.jw.manage.service.system.MenuService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.business.ManageException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/9.
 * Created by chenweida on 2017/6/12.
 */
@RestController
@RequestMapping("/manage")
@Api(description = "用户管理")
public class MenuController {
    @Autowired
    private MenuService menuService;
    @GetMapping("menu/list")
    @ApiOperation(value = "用户列表")
    public Envelop list(
            @ApiParam(name = "name", value = "用户名称", required = false) @RequestParam(required = false, name = "name") String name,
            @ApiParam(name = "start", value = "当前页(0开始)", required = false) @RequestParam(required = false, name = "start", defaultValue = "0") Integer page,
            @ApiParam(name = "length", value = "每页显示条数", required = false) @RequestParam(required = false, name = "length", defaultValue = "10") Integer pageSize
    ) {
        try {
            page=page/pageSize;
            Page<ManageMenu> menus = menuService.list(name, page, pageSize);
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    menus.getContent(),//数据内容
                    page, //当前页
                    pageSize,//每个显示条数
                    menus.getTotalElements()//总数
            );
        } catch (Exception e) {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
        }
    }
    @GetMapping(value = "menu/{code}")
    @ApiOperation(value = "根据code查找用户", notes = "根据code查找用户")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @PathVariable(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess("查询成功", menuService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping("childMenu/list/{parentCode}")
    @ApiOperation(value = "根据父菜单code,获取该父菜单下的子菜单")
    public Envelop getChildMenus(
            @ApiParam(name = "parentCode", value = "parentCode")
            @PathVariable String parentCode){
        List<ManageMenu> childMenus = menuService.getChildMenus(parentCode);
        return Envelop.getSuccess("查询成功", childMenus);
    }
    @GetMapping(value = "/parentMenus/list")
    @ApiOperation(value = "获取所有父菜单", notes = "获取所有父菜单")
    public Envelop getParentMenus(){
        List<ManageMenu> parentMenus = menuService.getParentMenus();
        return Envelop.getSuccess("查询成功", parentMenus);
    }
    @DeleteMapping(value = "menu/{codes}")
    @ApiOperation(value = "删除微信模版", notes = "删除微信模版")
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode
            ) {
        try {
            menuService.delete(codes,userCode);
            return Envelop.getSuccess("删除成功");
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = "menu")
    @ApiOperation(value = "保存或者修改菜单", notes = "保存或者修改菜单")
    public Envelop saveOrUpdate(@ModelAttribute @Valid ManageMenu menu,@RequestParam(value = "userCode" ,required = true)String userCode) throws JsonProcessingException, ManageException {
        menuService.saveOrUpdate(menu,userCode);
        return Envelop.getSuccess("成功");
    }
    @RequestMapping("menu/menuTree")
    public Envelop getMenus() throws ManageException {
        Map<String, List> menuTree = menuService.getMenuTree();
        return Envelop.getSuccess("查询成功",menuTree);
    }
}

+ 78 - 4
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/RoleController.java

@ -1,10 +1,84 @@
package com.yihu.jw.manage.controller.system;
import org.springframework.web.bind.annotation.RestController;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageRole;
import com.yihu.jw.manage.service.system.RoleService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.business.ManageException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
/**
 * Created by chenweida on 2017/6/9.
 */
@RestController
@RequestMapping("/manage")
@Api(description = "用户管理")
public class RoleController {
    @Autowired
    private RoleService roleService;
    @GetMapping("role/list")
    @ApiOperation(value = "用户列表")
    public Envelop list(
            @ApiParam(name = "name", value = "用户名称", required = false) @RequestParam(required = false, name = "name") String name,
            @ApiParam(name = "start", value = "当前页(0开始)", required = false) @RequestParam(required = false, name = "start", defaultValue = "0") Integer page,
            @ApiParam(name = "length", value = "每页显示条数", required = false) @RequestParam(required = false, name = "length", defaultValue = "10") Integer pageSize
    ) {
        try {
            page=page/pageSize;
            Page<ManageRole> roles = roleService.list(name, page, pageSize);
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    roles.getContent(),//数据内容
                    page, //当前页
                    pageSize,//每个显示条数
                    roles.getTotalElements()//总数
            );
        } catch (Exception e) {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
        }
    }
    @DeleteMapping(value = "role/{codes}")
    @ApiOperation(value = "删除角色", notes = "删除角色")
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode
    ) {
        try {
            roleService.delete(codes,userCode);
            return Envelop.getSuccess("删除成功");
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = "role/{code}")
    @ApiOperation(value = "根据code查找角色", notes = "根据code查找角色")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @PathVariable(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess("查询成功", roleService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = "role")
    @ApiOperation(value = "保存或者修改微信图文消息", notes = "保存或者修改微信图文消息")
    public Envelop saveOrUpdate(@ModelAttribute @Valid ManageRole role,@RequestParam(value = "userCode" ,required = true)String userCode) throws JsonProcessingException, ManageException {
        return roleService.saveOrUpdate(role,userCode);
    }
}

+ 53 - 16
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/system/UserController.java

@ -1,52 +1,89 @@
package com.yihu.jw.manage.controller.system;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.service.system.UserRoleService;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.ApiException;
import com.yihu.jw.restmodel.exception.business.ManageException;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.AutoConfigureOrder;
import org.springframework.data.domain.Page;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
/**
 * Created by chenweida on 2017/6/12.
 */
@RestController
@RequestMapping("/user")
@RequestMapping("/manage")
@Api(description = "用户管理")
public class UserController {
    @Autowired
    private UserService userService;
    @GetMapping("/list")
    @Autowired
    private UserRoleService userRoleService;
    @GetMapping("user/list")
    @ApiOperation(value = "用户列表")
    public Envelop userList(
            @ApiParam(name = "name", value = "用户名称", required = false) @RequestParam(required = false, name = "name") String name,
            @ApiParam(name = "mobile", value = "用户名称", required = false) @RequestParam(required = false, name = "mobile") String mobile,
            @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<ManageUser> users = userService.userList(name,page, pageSize);
            return Envelop.getSuccessListWithPage(
                    "获取信息成功",
                    users.getContent(),//数据内容
                    page, //当前页
                    pageSize,//每个显示条数
                    users.getTotalElements()//总数
            );
            page=page/pageSize;
            Page<ManageUser> users = userService.userList(name, mobile, page, pageSize);
            List<ManageUser> content = users.getContent();
            if(content!=null){//查找
                content = userRoleService.findByManageUser(content);
            }
            return Envelop.getSuccessListWithPage("获取信息成功", users.getContent(), page, pageSize, users.getTotalElements());
        } catch (Exception e) {
            return Envelop.getError("获取信息失败:" + e.getMessage(), -1);
        }
    }
    @DeleteMapping(value = "user/{codes}")
    @ApiOperation(value = "删除用户", notes = "删除用户")
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode) {
        try {
            userService.delete(codes,userCode);
            return Envelop.getSuccess("删除成功");
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @GetMapping(value = "user/{code}")
    @ApiOperation(value = "根据code查找用户", notes = "根据code查找用户")
    public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @PathVariable(value = "code", required = true) String code
    ) {
        try {
            return Envelop.getSuccess("查询成功", userService.findByCode(code));
        } catch (ApiException e) {
            return Envelop.getError(e.getMessage(), e.getErrorCode());
        }
    }
    @PostMapping(value = "user")
    @ApiOperation(value = "保存或者修改用户", notes = "保存或者修改用户")
    public Envelop saveOrUpdate(@ModelAttribute @Valid ManageUser user,@RequestParam(value="oldPsd" ,required = false)String oldPsd ,@RequestParam(value = "userCode" ,required = true)String userCode) throws JsonProcessingException, ManageException {
        return userService.saveOrUpdate(user,oldPsd,userCode);
    }
}

+ 7 - 4
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/GraphicMessageController.java

@ -32,6 +32,7 @@ public class GraphicMessageController {
            @ApiParam(name = "length", value = "每页显示条数", required = false) @RequestParam(required = false, name = "length", defaultValue = "10") Integer length
    ) {
        try {
            start=start/length+1;
            Envelop envelop = graphicMessageService.list(title, sorts,length, start);
            return envelop;
        } catch (Exception e) {
@ -44,9 +45,11 @@ public class GraphicMessageController {
    @ApiOperation(value = "通过codes删除,多个code用,分割", notes = "通过codes删除")
    public Envelop deleteByCodes(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable String codes
            @PathVariable String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam String userCode
    ) {
        Envelop envelop = graphicMessageService.deleteByCode(codes);
        Envelop envelop = graphicMessageService.deleteByCode(codes,userCode);
        return envelop;
    }
@ -62,7 +65,7 @@ public class GraphicMessageController {
    @PostMapping(value = "/graphicMessage")
    @ApiOperation(value = "保存或者修改微信图文消息", notes = "保存或者修改微信图文消息")
    public Envelop saveOrUpdate(@ModelAttribute @Valid GraphicMessage graphicMessage) throws JsonProcessingException {
        return graphicMessageService.saveOrUpdate(graphicMessage);
    public Envelop saveOrUpdate(@ModelAttribute @Valid GraphicMessage graphicMessage,@RequestParam String userCode) throws JsonProcessingException {
        return graphicMessageService.saveOrUpdate(graphicMessage,userCode);
    }
}

+ 18 - 4
svr/svr-manage/src/main/java/com/yihu/jw/manage/controller/wechat/WechatConfigController.java

@ -32,6 +32,7 @@ public class WechatConfigController {
            @ApiParam(name = "length", value = "每页显示条数", required = false) @RequestParam(required = false, name = "length", defaultValue = "10") Integer length
    ) {
        try {
            start=start/length+1;
            Envelop envelop = wechatConfigService.list(name, sorts,length, start);
            return envelop;
        } catch (Exception e) {
@ -44,9 +45,12 @@ public class WechatConfigController {
    @ApiOperation(value = "通过codes删除,多个code用,分割", notes = "通过codes删除")
    public Envelop deleteByCodes(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable String codes
            @PathVariable String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam String userCode
    ) {
        Envelop envelop = wechatConfigService.deleteByCode(codes);
        Envelop envelop = wechatConfigService.deleteByCode(codes,userCode);
        return envelop;
    }
@ -62,7 +66,17 @@ public class WechatConfigController {
    @PostMapping(value = "/wechatConfig")
    @ApiOperation(value = "保存微信配置", notes = "保存微信配置")
    public Envelop save(@ModelAttribute @Valid WechatConfig wechatConfig) throws JsonProcessingException {
        return wechatConfigService.saveOrUpdate(wechatConfig);
    public Envelop save(@ModelAttribute @Valid WechatConfig wechatConfig,@RequestParam String userCode) throws JsonProcessingException {
        return wechatConfigService.saveOrUpdate(wechatConfig, userCode);
    }
    @GetMapping("wechatConfig/listNoPage")
    @ApiOperation(value = "获取微信配置列表")
    public Envelop listNoPage(
            @ApiParam(name = "fields", value = "返回的字段,为空返回全部字段", defaultValue = "id,code,name,saasId,appId,appSecret,baseUrl,remark")
            @RequestParam(value = "fields", required = false) String fields,
            @ApiParam(name = "sorts", value = "排序,规则参见说明文档", defaultValue = "+name,+createTime")
            @RequestParam(value = "sorts", required = false) String sorts){
        return wechatConfigService.getListNoPage(fields,null,sorts);
    }
}

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

@ -2,10 +2,23 @@ package com.yihu.jw.manage.dao.system;
import com.yihu.jw.manage.model.system.ManageMenu;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import java.util.List;
/**
 * Created by chenweida on 2017/6/9.
 */
public interface MenuDao extends PagingAndSortingRepository<ManageMenu, Long>, JpaSpecificationExecutor<ManageMenu> {
    @Query("from ManageMenu m where m.status!=-1 and m.code=?1")
    ManageMenu findByCode(String code);
    @Query("from ManageMenu m where m.status!=-1 and m.parentCode = ?1 ")
    List<ManageMenu> getChildMenus(String parentCode);
    @Query("from ManageMenu m where m.status!=-1 and m.parentCode = 0 ")
    List<ManageMenu> getParentMenus();
}

+ 4 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/RoleDao.java

@ -2,10 +2,14 @@ package com.yihu.jw.manage.dao.system;
import com.yihu.jw.manage.model.system.ManageRole;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * Created by chenweida on 2017/6/9.
 */
public interface RoleDao extends PagingAndSortingRepository<ManageRole, Long>, JpaSpecificationExecutor<ManageRole> {
    @Query("from ManageRole m where m.code=?1 and m.status!=-1")
    ManageRole findByCode(String code);
}

+ 13 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/RoleMenuDao.java

@ -2,10 +2,23 @@ package com.yihu.jw.manage.dao.system;
import com.yihu.jw.manage.model.system.ManageRoleMenu;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * Created by chenweida on 2017/6/9.
 */
public interface RoleMenuDao extends PagingAndSortingRepository<ManageRoleMenu, Long>, JpaSpecificationExecutor<ManageRoleMenu> {
    @Query("from ManageRoleMenu m where m.roleCode=?1")
    List<ManageRoleMenu> findByRoleCode(String roleCode);
    @Transactional
    @Modifying
    @Query("delete from ManageRoleMenu r where r.roleCode = ?2 and r.menuCode=?1")
    void delete(String menuCode, String roleCode);
}

+ 5 - 0
svr/svr-manage/src/main/java/com/yihu/jw/manage/dao/system/UserDao.java

@ -3,6 +3,7 @@ package com.yihu.jw.manage.dao.system;
import com.yihu.jw.manage.model.system.ManageRoleMenu;
import com.yihu.jw.manage.model.system.ManageUser;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
@ -15,4 +16,8 @@ public interface UserDao extends PagingAndSortingRepository<ManageUser, Long>, J
    @Query("from ManageUser u where u.code=?1 and u.status=1 ")
    ManageUser findByCode(String usercode);
    @Modifying
    @Query("update ManageUser u set u.status = -1 where u.code = ?1 ")
    void delete(String code);
}

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

@ -1,12 +1,27 @@
package com.yihu.jw.manage.dao.system;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.model.system.ManageUserRole;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
 * Created by chenweida on 2017/6/9.
 */
public interface UserRoleDao extends PagingAndSortingRepository<ManageUserRole, Long>, JpaSpecificationExecutor<ManageUserRole> {
    @Query("from ManageUserRole m where m.roleCode = ?1")
    List<ManageUserRole> findByRoleCode(String roleCode);
    @Transactional
    @Modifying
    @Query("delete from ManageUserRole r where r.roleCode = ?1 and r.userCode=?2")
    void deleteUserRole(String roleCode, String userCode);
    @Query("from ManageUserRole r where r.roleCode = ?1 and r.userCode=?2")
    ManageUserRole findByRoleAndUserCode(String roleCode, String userCode);
}

+ 96 - 9
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/IdEntity.java

@ -5,11 +5,14 @@
 *******************************************************************************/
package com.yihu.jw.manage.model;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import javax.persistence.*;
import java.util.Date;
/**
 * 统一定义id的entity基类.
@ -21,13 +24,41 @@ import java.io.Serializable;
 */
// JPA 基类的标识
@MappedSuperclass
public abstract class IdEntity implements Serializable {
	private static final long serialVersionUID = 3673803562328635206L;
	protected Long id;  // 非业务主键
@EntityListeners(AuditingEntityListener.class)
public abstract class IdEntity {
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	protected Long id;  // 非业务主键
	@Column(name="code")
	protected String code;
	@CreatedDate
	@Column(name = "create_time", nullable = false, length = 0,updatable = false)
	protected Date createTime;
	@CreatedBy
	@Column(name = "create_user",updatable = false)
	protected String createUser;
	@CreatedBy
	@Column(name = "create_user_name",updatable = false)
	protected String createUserName;
	@LastModifiedDate
	@Column(name = "update_time", nullable = false, length = 0)
	protected Date updateTime;
	@LastModifiedBy
	@Column(name = "update_user", length = 100)
	protected String updateUser;
	@LastModifiedBy
	@Column(name = "update_user_name", length = 50)
	protected String updateUserName;
	public Long getId() {
		return id;
	}
@ -35,4 +66,60 @@ public abstract class IdEntity implements Serializable {
	public void setId(Long id) {
		this.id = id;
	}
	public Date getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	public String getCreateUser() {
		return createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	public String getCreateUserName() {
		return createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	public Date getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	public String getUpdateUser() {
		return updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	public String getUpdateUserName() {
		return updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
}

+ 1 - 81
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageMenu.java

@ -2,11 +2,8 @@ package com.yihu.jw.manage.model.system;// default package
import com.yihu.jw.manage.model.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.*;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
/**
 * ManageMenu entity. @author MyEclipse Persistence Tools
@ -16,18 +13,10 @@ import static javax.persistence.GenerationType.IDENTITY;
public class ManageMenu extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;
	private String parentCode;
	private String name;
	private String url;
	private Integer status;
	private Date createTime;
	private String createUser;
	private String createUserName;
	private Date updateTime;
	private String updateUser;
	private String updateUserName;
	private Integer sort;
	private String remark;
@ -37,12 +26,6 @@ public class ManageMenu extends IdEntity implements java.io.Serializable {
	public ManageMenu() {
	}
	/** minimal constructor */
	public ManageMenu(Date createTime, Date updateTime) {
		this.createTime = createTime;
		this.updateTime = updateTime;
	}
	/** full constructor */
	public ManageMenu(String code, String parentCode, String name, String url,
			Integer status, Date createTime, String createUser,
@ -63,15 +46,6 @@ public class ManageMenu extends IdEntity implements java.io.Serializable {
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "parent_code", length = 100)
	public String getParentCode() {
		return this.parentCode;
@ -107,60 +81,6 @@ public class ManageMenu extends IdEntity implements java.io.Serializable {
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "create_user", length = 100)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 50)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time", nullable = false, length = 0)
	public Date getUpdateTime() {
		return this.updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	@Column(name = "update_user", length = 100)
	public String getUpdateUser() {
		return this.updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	@Column(name = "update_user_name", length = 50)
	public String getUpdateUserName() {
		return this.updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
	@Column(name = "remark", length = 1500)
	public String getRemark() {

+ 1 - 80
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageRole.java

@ -2,11 +2,8 @@ package com.yihu.jw.manage.model.system;// default package
import com.yihu.jw.manage.model.IdEntity;
import java.sql.Timestamp;
import java.util.Date;
import javax.persistence.*;
import static javax.persistence.GenerationType.IDENTITY;
import java.util.Date;
/**
 * ManageRole entity. @author MyEclipse Persistence Tools
@ -16,16 +13,8 @@ import static javax.persistence.GenerationType.IDENTITY;
public class ManageRole extends IdEntity implements java.io.Serializable {
	// Fields
	private String code;
	private String name;
	private Integer status;
	private Date createTime;
	private String createUser;
	private String createUserName;
	private Date updateTime;
	private String updateUser;
	private String updateUserName;
	private String remark;
	// Constructors
@ -34,11 +23,6 @@ public class ManageRole extends IdEntity implements java.io.Serializable {
	public ManageRole() {
	}
	/** minimal constructor */
	public ManageRole(Date createTime, Date updateTime) {
		this.createTime = createTime;
		this.updateTime = updateTime;
	}
	/** full constructor */
	public ManageRole(String code, String name, Integer status,
@ -58,15 +42,6 @@ public class ManageRole extends IdEntity implements java.io.Serializable {
	}
	@Column(name = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 100)
	public String getName() {
		return this.name;
@ -84,60 +59,6 @@ public class ManageRole extends IdEntity implements java.io.Serializable {
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "create_user", length = 100)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 50)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time", nullable = false, length = 0)
	public Date getUpdateTime() {
		return this.updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	@Column(name = "update_user", length = 100)
	public String getUpdateUser() {
		return this.updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	@Column(name = "update_user_name", length = 50)
	public String getUpdateUserName() {
		return this.updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
	@Column(name = "remark", length = 1500)
	public String getRemark() {

+ 12 - 10
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageRoleMenu.java

@ -1,24 +1,19 @@
package com.yihu.jw.manage.model.system;// default package
import com.yihu.jw.manage.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import static javax.persistence.GenerationType.IDENTITY;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
/**
 * ManageRoleMenu entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "manage_role_menu")
public class ManageRoleMenu  extends IdEntity implements java.io.Serializable {
public class ManageRoleMenu  implements java.io.Serializable {
	// Fields
	private Integer id;
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private Long id;
	private String roleCode;
	private String menuCode;
@ -34,6 +29,13 @@ public class ManageRoleMenu  extends IdEntity implements java.io.Serializable {
		this.menuCode = menuCode;
	}
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	@Column(name = "role_code", length = 100)
	public String getRoleCode() {

+ 17 - 103
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageUser.java

@ -2,77 +2,37 @@ package com.yihu.jw.manage.model.system;// default package
import com.yihu.jw.manage.model.IdEntity;
import java.util.Date;
import javax.persistence.*;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
/**
 * ManageUser entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "manage_user")
public class ManageUser  extends IdEntity implements java.io.Serializable {
public class ManageUser  extends IdEntity implements Serializable {
	// Fields
	private String code;
	private String name;
	private String password;//密码  密码是 密码+salt MD5加密
	private String salt;//盐值
	private String loginAccount;//登陆的账号
	private String mobile;
	private Integer status;
	private Date createTime;
	private String createUser;
	private String createUserName;
	private Date updateTime;
	private String updateUser;
	private String updateUserName;
	private String remark;
	@Transient
	private String roleName;
	// Constructors
	/** default constructor */
	public ManageUser() {
	}
	/** minimal constructor */
	public ManageUser(Integer id, Date createTime, Date updateTime) {
		this.createTime = createTime;
		this.updateTime = updateTime;
	}
	/** full constructor */
	public ManageUser(Integer id, String code, String name, String password,
			String salt, String loginAccount, String mobile, Integer status,
			Date createTime, String createUser, String createUserName,
			Date updateTime, String updateUser, String updateUserName,
			String remark) {
		this.code = code;
		this.name = name;
		this.password = password;
		this.salt = salt;
		this.loginAccount = loginAccount;
		this.mobile = mobile;
		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 = "code", length = 100)
	public String getCode() {
		return this.code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	@Column(name = "name", length = 100)
	public String getName() {
		return this.name;
@ -126,60 +86,6 @@ public class ManageUser  extends IdEntity implements java.io.Serializable {
	public void setStatus(Integer status) {
		this.status = status;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "create_time", nullable = false, length = 0)
	public Date getCreateTime() {
		return this.createTime;
	}
	public void setCreateTime(Date createTime) {
		this.createTime = createTime;
	}
	@Column(name = "create_user", length = 100)
	public String getCreateUser() {
		return this.createUser;
	}
	public void setCreateUser(String createUser) {
		this.createUser = createUser;
	}
	@Column(name = "create_user_name", length = 50)
	public String getCreateUserName() {
		return this.createUserName;
	}
	public void setCreateUserName(String createUserName) {
		this.createUserName = createUserName;
	}
	@Temporal(TemporalType.TIMESTAMP)
	@Column(name = "update_time", nullable = false, length = 0)
	public Date getUpdateTime() {
		return this.updateTime;
	}
	public void setUpdateTime(Date updateTime) {
		this.updateTime = updateTime;
	}
	@Column(name = "update_user", length = 100)
	public String getUpdateUser() {
		return this.updateUser;
	}
	public void setUpdateUser(String updateUser) {
		this.updateUser = updateUser;
	}
	@Column(name = "update_user_name", length = 50)
	public String getUpdateUserName() {
		return this.updateUserName;
	}
	public void setUpdateUserName(String updateUserName) {
		this.updateUserName = updateUserName;
	}
	@Column(name = "remark", length = 1500)
	public String getRemark() {
@ -190,6 +96,14 @@ public class ManageUser  extends IdEntity implements java.io.Serializable {
		this.remark = remark;
	}
	public String getRoleName() {
		return roleName;
	}
	public void setRoleName(String roleName) {
		this.roleName = roleName;
	}
	@Override
	public String toString() {
		return "ManageUser{" +

+ 26 - 7
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/system/ManageUserRole.java

@ -1,23 +1,23 @@
package com.yihu.jw.manage.model.system;// default package
import com.yihu.jw.manage.model.IdEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.*;
import java.io.Serializable;
/**
 * ManageUserRole entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "manage_user_role")
public class ManageUserRole  extends IdEntity implements java.io.Serializable {
@Access(value = AccessType.PROPERTY)
public class ManageUserRole  implements Serializable {
	// Fields
	private Long id;
	private String roleCode;
	private String userCode;
	private String userName;
	// Constructors
@ -25,6 +25,17 @@ public class ManageUserRole  extends IdEntity implements java.io.Serializable {
	public ManageUserRole() {
	}
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Column(name="id")
	public Long getId() {
		return id;
	}
	public void setId(Long id) {
		this.id = id;
	}
	
	@Column(name = "role_code", length = 100)
	public String getRoleCode() {
		return this.roleCode;
@ -43,4 +54,12 @@ public class ManageUserRole  extends IdEntity implements java.io.Serializable {
		this.userCode = userCode;
	}
	@Transient
	public String getUserName() {
		return userName;
	}
	public void setUserName(String userName) {
		this.userName = userName;
	}
}

+ 1 - 84
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/GraphicMessage.java

@ -8,11 +8,9 @@ import java.util.Date;
/**
 * Created by Administrator on 2017/5/21 0021.
 */
@Entity
@Table(name = "wx_graphic_message")
public class GraphicMessage extends IdEntity implements java.io.Serializable {
    private String code;//业务code
    private String title;//标题
    private String description;//描述
    private String url;//图文消息url值
@ -30,31 +28,6 @@ public class GraphicMessage extends IdEntity implements java.io.Serializable {
    public GraphicMessage() {
    }
    public GraphicMessage(String code, String title, String description, String url, String picUrl, String createUser, String createUserName, Date createTime, String updateUser, String updateUserName, Date updateTime, String remark, Integer status) {
        this.code = code;
        this.title = title;
        this.description = description;
        this.url = url;
        this.picUrl = picUrl;
        this.createUser = createUser;
        this.createUserName = createUserName;
        this.createTime = createTime;
        this.updateUser = updateUser;
        this.updateUserName = updateUserName;
        this.updateTime = updateTime;
        this.remark = remark;
        this.status = status;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "title", length = 200)
    public String getTitle() {
        return title;
@ -91,62 +64,6 @@ public class GraphicMessage extends IdEntity implements java.io.Serializable {
        this.picUrl = picUrl;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", length = 0)
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "update_user", length = 200)
    public String getUpdateUser() {
        return updateUser;
    }
    @Column(name = "remark", length = 1000)
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String getUpdateUserName() {
        return updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", length = 0)
    public Date getUpdateTime() {
        return updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {

+ 3 - 124
svr/svr-manage/src/main/java/com/yihu/jw/manage/model/wechat/Template.java

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

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

@ -14,7 +14,6 @@ import java.util.Date;
public class WechatConfig extends IdEntity implements java.io.Serializable {
    // Fields
    private String code;//业务code
    private String saasId;//'saas配置id'
    private String name;//名称
    private String token;//token
@ -84,15 +83,6 @@ public class WechatConfig extends IdEntity implements java.io.Serializable {
        this.encodingAesKey = encodingAesKey;
    }
    @Column(name = "code", length = 64)
    public String getCode() {
        return this.code;
    }
    public void setCode(String code) {
        this.code = code;
    }
    @Column(name = "saas_id", length = 50)
    public String getSaasId() {
        return this.saasId;
@ -156,34 +146,6 @@ public class WechatConfig extends IdEntity implements java.io.Serializable {
        this.baseUrl = baseUrl;
    }
    @Column(name = "create_user", length = 200)
    public String getCreateUser() {
        return this.createUser;
    }
    public void setCreateUser(String createUser) {
        this.createUser = createUser;
    }
    @Column(name = "create_user_name", length = 200)
    public String getCreateUserName() {
        return this.createUserName;
    }
    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "create_time", nullable = false, length = 0)
    public Date getCreateTime() {
        return this.createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
    @Column(name = "remark", length = 1000)
    public String getRemark() {
        return this.remark;
@ -193,32 +155,4 @@ public class WechatConfig extends IdEntity implements java.io.Serializable {
        this.remark = remark;
    }
    @Column(name = "update_user", length = 200)
    public String getUpdateUser() {
        return this.updateUser;
    }
    public void setUpdateUser(String updateUser) {
        this.updateUser = updateUser;
    }
    @Column(name = "update_user_name", length = 200)
    public String getUpdateUserName() {
        return this.updateUserName;
    }
    public void setUpdateUserName(String updateUserName) {
        this.updateUserName = updateUserName;
    }
    @Temporal(TemporalType.TIMESTAMP)
    @Column(name = "update_time", nullable = false, length = 0)
    public Date getUpdateTime() {
        return this.updateTime;
    }
    public void setUpdateTime(Date updateTime) {
        this.updateTime = updateTime;
    }
}

+ 103 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/MenuService.java

@ -2,12 +2,23 @@ package com.yihu.jw.manage.service.system;
import com.yihu.jw.manage.dao.system.MenuDao;
import com.yihu.jw.manage.model.system.ManageMenu;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.model.system.MenuItems;
import com.yihu.jw.restmodel.exception.business.ManageException;
import com.yihu.jw.restmodel.wlyy.WlyyContant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import java.util.List;
import java.util.*;
/**
 * Created by chenweida on 2017/6/9.
@ -18,6 +29,8 @@ public class MenuService {
    private MenuDao menuDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private UserService userService;
    public List<ManageMenu> findByUserCode(String code) {
        String sql="SELECT DISTINCT " +
@ -54,6 +67,95 @@ public class MenuService {
        List<ManageMenu> mr = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ManageMenu.class), usercode,code);
        return mr;
    }
    public Page<ManageMenu> list(String name, Integer page, Integer pageSize) {
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        // 分页信息
        PageRequest pageRequest = new PageRequest(page, pageSize, sort);
        // 设置查询条件
        Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
        // 用户名称
        if (!StringUtils.isEmpty(name)&&!("null".equals(name))) {
            filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, name));
        }
        // 未作废
        filters.put("status", new SearchFilter("status", SearchFilter.Operator.EQ, WlyyContant.status_normal));
        Specification<ManageMenu> spec = DynamicSpecifications.bySearchFilter(filters.values(), ManageMenu.class);
        return menuDao.findAll(spec, pageRequest);
    }
    public ManageMenu findByCode(String code) {
        return menuDao.findByCode(code);
    }
    public List<ManageMenu> getChildMenus(String parentCode) {
       return menuDao.getChildMenus(parentCode);
    }
    public List<ManageMenu> getParentMenus() {
        return menuDao.getParentMenus();
    }
    public void delete(String codes,String userCode) {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        for(String code:codes.split(",")){
            ManageMenu menu = menuDao.findByCode(code);
            if (menu == null) {
                continue;
            }
            if ("0".equals(menu.getParentCode())) {//如果为0,说明是为父菜单
                List<ManageMenu> childMenus = getChildMenus(menu.getCode());
                if (childMenus != null) {
                    for (ManageMenu childMenu : childMenus) {
                        childMenu.setStatus(-1);
                        childMenu.setUpdateUser(userCode);
                        childMenu.setUpdateUserName(userName);
                        menuDao.save(childMenu);
                    }
                }
            }
            menu.setStatus(-1);
            menu.setUpdateUser(userCode);
            menu.setUpdateUserName(userName);
            menuDao.save(menu);
        }
    }
    public void saveOrUpdate(ManageMenu menu,String userCode) {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        if(null==menu.getId()){
            String code = UUID.randomUUID().toString().replaceAll("-","");
            menu.setCode(code);
            menu.setCreateUser(userCode);
            menu.setCreateUserName(userName);
        }
        menu.setUpdateUser(userCode);
        menu.setUpdateUserName(userName);
        menuDao.save(menu);
    }
    public Map<String, List> getMenuTree() throws ManageException {
        List<MenuItems> menuItemses = new ArrayList<>();
        Map<String, List> data = new HashMap<>();
        //查询所有父菜单
        List<ManageMenu> parentMenus = getParentMenus();
        //查询所有子菜单
        if(parentMenus!=null){
            for(ManageMenu parentMenu:parentMenus){
                //通过父菜单查找对应的子菜单
                List<ManageMenu> childMenus = getChildMenus(parentMenu.getCode());
                MenuItems menuItem = new MenuItems();
                menuItem.setParentMenu(parentMenu);
                menuItem.setChildMenus(childMenus);
                menuItemses.add(menuItem);
            }
        }
        data.put("menus", menuItemses);
        return data;
    }
}

+ 70 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/RoleService.java

@ -3,12 +3,24 @@ package com.yihu.jw.manage.service.system;
import com.yihu.jw.manage.dao.system.RoleDao;
import com.yihu.jw.manage.dao.system.RoleMenuDao;
import com.yihu.jw.manage.model.system.ManageRole;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.ManageException;
import com.yihu.jw.restmodel.wlyy.WlyyContant;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import java.util.List;
import javax.transaction.Transactional;
import java.util.*;
/**
 * Created by chenweida on 2017/6/9.
@ -21,10 +33,67 @@ public class RoleService {
    private RoleMenuDao roleMenuDao;
    @Autowired
    private JdbcTemplate jdbcTemplate;
    @Autowired
    private UserService userService;
    public List<ManageRole> findByUserCode(String code) {
        String sql = " select r.* from manage_role r,manage_user_role ur where r.`code`=ur.role_code and ur.user_code=? ";
        List<ManageRole> mr = jdbcTemplate.query(sql, new BeanPropertyRowMapper(ManageRole.class), code);
        return mr;
    }
    public Page<ManageRole> list(String name, Integer page, Integer pageSize) {
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "updateTime");
        // 分页信息
        PageRequest pageRequest = new PageRequest(page, pageSize, sort);
        // 设置查询条件
        Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
        // 用户名称
        if (!StringUtils.isEmpty(name)&&!("null".equals(name))) {
            filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, name));
        }
        // 未作废
        filters.put("status", new SearchFilter("status", SearchFilter.Operator.EQ, WlyyContant.status_normal));
        Specification<ManageRole> spec = DynamicSpecifications.bySearchFilter(filters.values(), ManageRole.class);
        return roleDao.findAll(spec, pageRequest);
    }
    @Transactional
    public void delete(String codes,String userCode) {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        for(String code:codes.split(",")){
            ManageRole role = roleDao.findByCode(code);
            role.setUpdateUser(userCode);
            role.setUpdateUserName(userName);
            role.setStatus(-1);
            roleDao.save(role);
        }
    }
    public Envelop saveOrUpdate(ManageRole role, String userCode) throws ManageException {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        role.setUpdateUserName(userName);
        role.setUpdateUser(userCode);
        if(role.getId()==null){//保存
            String code = UUID.randomUUID().toString().replaceAll("-","");
            role.setCode(code);
            role.setCreateUser(userCode);
            role.setCreateUserName(userName);
            roleDao.save(role);
            return Envelop.getSuccess("保存成功",role);
        }else{//修改
            ManageRole role1 = findByCode(role.getCode());
            //role.set
            roleDao.save(role);
            return Envelop.getSuccess("修改成功",role);
        }
    }
    public ManageRole findByCode(String code) {
        return roleDao.findByCode(code);
    }
}

+ 61 - 3
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/system/UserService.java

@ -3,8 +3,10 @@ package com.yihu.jw.manage.service.system;
import com.yihu.jw.manage.dao.system.UserDao;
import com.yihu.jw.manage.dao.system.UserRoleDao;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.ManageException;
import com.yihu.jw.restmodel.wlyy.WlyyContant;
import com.yihu.jw.util.security.MD5;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
@ -15,8 +17,10 @@ import org.springframework.util.StringUtils;
import org.springside.modules.persistence.DynamicSpecifications;
import org.springside.modules.persistence.SearchFilter;
import javax.transaction.Transactional;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/**
 * Created by chenweida on 2017/6/9.
@ -25,9 +29,13 @@ import java.util.Map;
public class UserService {
    @Autowired
    private UserDao userDao;
    @Autowired
    private UserRoleDao userRoleDao;
    @Autowired
    private UserService userService;
    public ManageUser findByAccount(String username) {
        return userDao.findByAccount(username);
    }
@ -36,18 +44,21 @@ public class UserService {
        return userDao.findByCode(usercode);
    }
    public Page<ManageUser> userList(String name,Integer page, Integer pageSize)throws ManageException {
    public Page<ManageUser> userList(String name,String mobile,Integer page, Integer pageSize)throws ManageException {
        // 排序
        Sort sort = new Sort(Sort.Direction.DESC, "createTime");
        Sort sort = new Sort(Sort.Direction.DESC, "updateTime");
        // 分页信息
        PageRequest pageRequest = new PageRequest(page, pageSize, sort);
        // 设置查询条件
        Map<String, SearchFilter> filters = new HashMap<String, SearchFilter>();
        // 用户名称
        if (!StringUtils.isEmpty(name)&&!("null".equals(name))) {
            name="%"+name+"%";
            filters.put("name", new SearchFilter("name", SearchFilter.Operator.LIKE, name));
        }
        // 电话号码
        if (!StringUtils.isEmpty(mobile)&&!("null".equals(mobile))) {
            filters.put("mobile", new SearchFilter("mobile", SearchFilter.Operator.LIKE, mobile));
        }
//        filters.put("recordDate1", new SearchFilter("recordDate", Operator.GTE, begin));
//        filters.put("recordDate2", new SearchFilter("recordDate", Operator.LTE, end));
        // 未作废
@ -56,4 +67,51 @@ public class UserService {
        return userDao.findAll(spec, pageRequest);
    }
    @Transactional
    public void delete(String codes, String userCode) {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        for(String code:codes.split(",")){
            ManageUser user1 = findByCode(code);
            user1.setStatus(-1);
            user1.setUpdateUserName(userName);
            user1.setUpdateUser(userCode);
            userDao.save(user1);
        }
    }
    public Envelop saveOrUpdate(ManageUser user, String oldPsd, String userCode) throws ManageException {
        ManageUser loginUser = userService.findByCode(userCode);
        String userName = loginUser.getName();
        if(user.getId()==null){//保存
            //判断登陆账号是否存在
            String loginAccount = user.getLoginAccount();
            ManageUser user1 = userDao.findByAccount(loginAccount);
            if(user1!=null){//登陆账号已存在
                throw new ManageException("该登陆账号已存在");
            }
            String salt = UUID.randomUUID().toString().replaceAll("-","");
            user.setSalt(salt);
            String password = MD5.GetMD5Code(user.getPassword() + salt);
            user.setPassword(password);
            String code = UUID.randomUUID().toString().replaceAll("-", "");
            user.setCode(code);
            user.setCreateUserName(userName);
            user.setCreateUser(userCode);
            user.setStatus(1);
            userDao.save(user);
            return Envelop.getSuccess("保存成功",user);
        }else{//修改
            ManageUser user1 = findByCode(user.getCode());
            String psd = MD5.GetMD5Code(oldPsd + user1.getSalt());
            if(!user1.getPassword().equals(psd)){//判断密码是否相同
                throw new ManageException("原密码错误");
            }
            user.setUpdateUser(userCode);
            user.setUpdateUserName(userName);
            userDao.save(user);
            return Envelop.getSuccess("修改成功",user);
        }
    }
}

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

@ -1,7 +1,9 @@
package com.yihu.jw.manage.service.wechat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.model.wechat.GraphicMessage;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import net.sf.json.JSONObject;
@ -29,6 +31,9 @@ public class GraphicMessageService {
    @Autowired
    private RestTemplate template;
    @Autowired
    private UserService userService;
    public Envelop list(String title, String sorts ,Integer size, Integer page) {
        Map<String, Object> map = new HashMap<>();
        Map<String, Object> filters = new HashMap<>();
@ -47,14 +52,18 @@ public class GraphicMessageService {
    }
    public Envelop deleteByCode(String codes) {
    public Envelop deleteByCode(String codes,String userCode) {
        //delete 没有返回值....
        //template.delete(url + "/graphicMessage/delete?codes={codes}", codes);
        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
        map.add("codes", codes);
        String urlRequest = url + "/wechat/graphicMessage/"+codes;
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        Map<String, String> par = new HashMap<>();
        par.put("userCode", userCode);
        par.put("userName", userName);
        String urlRequest = url + "/wechat/graphicMessage/"+codes+"?userCode={userCode}&userName={userName}";
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,par);
        return envelop;
    }
@ -63,7 +72,18 @@ public class GraphicMessageService {
        return envelop;
    }
    public Envelop saveOrUpdate(GraphicMessage graphicMessage) throws JsonProcessingException {
    public Envelop saveOrUpdate(GraphicMessage graphicMessage, String userCode) throws JsonProcessingException {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        //设置值
        if(graphicMessage.getId()==null){
            graphicMessage.setCreateUser(userCode);
            graphicMessage.setCreateUserName(userName);
        }
        graphicMessage.setUpdateUserName(userName);
        graphicMessage.setUpdateUser(userCode);
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
@ -76,11 +96,8 @@ public class GraphicMessageService {
            envelop = responseEntity.getBody();
            return envelop;
        }
        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
        map.add("jsonData",jsonObj.toString());
        String urlRequest = url + "/wechat/graphicMessage";
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.PUT, Envelop.class);
        ResponseEntity<Envelop> resp = template.exchange(url + "/wechat/graphicMessage",HttpMethod.PUT,formEntity,Envelop.class);
        envelop = resp.getBody();
        return envelop;
    }

+ 40 - 13
svr/svr-manage/src/main/java/com/yihu/jw/manage/service/wechat/WechatConfigService.java

@ -1,7 +1,9 @@
package com.yihu.jw.manage.service.wechat;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.yihu.jw.manage.model.system.ManageUser;
import com.yihu.jw.manage.model.wechat.WechatConfig;
import com.yihu.jw.manage.service.system.UserService;
import com.yihu.jw.manage.util.RestTemplateUtil;
import com.yihu.jw.restmodel.common.Envelop;
import net.sf.json.JSONObject;
@ -29,6 +31,9 @@ public class WechatConfigService {
    @Autowired
    private RestTemplate template;
    @Autowired
    private UserService userService;
   public Envelop list(String name, String sorts ,Integer size, Integer page) {
       Map<String, Object> map = new HashMap<>();
       Map<String, Object> filters = new HashMap<>();
@ -47,14 +52,18 @@ public class WechatConfigService {
    }
    public Envelop deleteByCode(String codes) {
    public Envelop deleteByCode(String codes,String userCode) {
        //delete 没有返回值....
        //template.delete(url + "/wechatConfig/delete?codes={codes}", codes);
        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
        map.add("codes", codes);
        String urlRequest = url + "/wechat/wechatConfig/"+codes;
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class);
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        Map<String, String> map = new HashMap<>();
        map.put("userCode", userCode);
        map.put("userName", userName);
        String urlRequest = url + "/wechat/wechatConfig/"+codes+"?userCode={userCode}&userName={userName}";
        MultiValueMap<String, String> multiValueMap = new LinkedMultiValueMap<>();
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,multiValueMap);
        Envelop envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.DELETE, Envelop.class,map);
        return envelop;
    }
@ -63,11 +72,23 @@ public class WechatConfigService {
        return envelop;
    }
    public Envelop saveOrUpdate(WechatConfig wechatConfig) throws JsonProcessingException {
    public Envelop saveOrUpdate(WechatConfig wechatConfig,String userCode) throws JsonProcessingException {
        ManageUser user = userService.findByCode(userCode);
        String userName = user.getName();
        //设置值
        if(wechatConfig.getId()==null){
            wechatConfig.setCreateUser(userCode);
            wechatConfig.setCreateUserName(userName);
        }
        wechatConfig.setUpdateUserName(userName);
        wechatConfig.setUpdateUser(userCode);
        HttpHeaders headers = new HttpHeaders();
        MediaType type = MediaType.parseMediaType("application/json; charset=UTF-8");
        headers.setContentType(type);
        headers.add("Accept", MediaType.APPLICATION_JSON.toString());
        JSONObject jsonObj = JSONObject.fromObject(wechatConfig);
        HttpEntity<String> formEntity = new HttpEntity<String>(jsonObj.toString(), headers);
        Envelop envelop =null;
@ -76,12 +97,18 @@ public class WechatConfigService {
            envelop = responseEntity.getBody();
            return envelop;
        }
        MultiValueMap<String, String> map = new LinkedMultiValueMap<>();
        map.add("jsonData",jsonObj.toString());
        String urlRequest = url + "/wechat/wechatConfig";
        RestTemplateUtil restTemplateUtil = new RestTemplateUtil(urlRequest,map);
        envelop = restTemplateUtil.exchange(urlRequest, HttpMethod.PUT, Envelop.class);
        ResponseEntity<Envelop> resp = template.exchange(url + "/wechat/wechatConfig",HttpMethod.PUT,formEntity,Envelop.class);
        envelop = resp.getBody();
        return envelop;
    }
    public Envelop getListNoPage(String fields, Map<String, Object> filter, String sorts) {
        Map<String, Object> map = new HashMap<>();
        map.put("fields",fields);
        map.put("sorts",sorts);
        map.put("filter",filter);
        Envelop forObject = template.getForObject(url + "/wechat/wechatConfig/listNoPage?fields={fields}&filter={filter}&sorts={sorts}",
                Envelop.class,map);
        return forObject;
    }
}

+ 27 - 1
svr/svr-manage/src/main/java/com/yihu/jw/manage/util/RestTemplateUtil.java

@ -10,6 +10,7 @@ import org.springframework.web.client.RestTemplate;
import org.springframework.web.util.UriComponentsBuilder;
import java.nio.charset.Charset;
import java.util.Map;
/**
 * Created by Administrator on 2017/6/15 0015.
@ -85,7 +86,7 @@ public class RestTemplateUtil {
        ObjectMapper mapper = new ObjectMapper();
        String str = null;
        try {
            if (!params.isEmpty()) {
            if (params!=null&&!params.isEmpty()) {
                str = mapper.writeValueAsString(params);
            }
        } catch (JsonProcessingException e) {
@ -98,4 +99,29 @@ public class RestTemplateUtil {
        return resultEntity.getBody();
    }
    public <T> T exchange(String url, HttpMethod method, Class<T> bodyType,Map<String ,?> map) {
        // 请求头
        HttpHeaders headers = new HttpHeaders();
        MimeType mimeType = MimeTypeUtils.parseMimeType("application/json");
        MediaType mediaType = new MediaType(mimeType.getType(), mimeType.getSubtype(), Charset.forName("UTF-8"));
        // 请求体
        headers.setContentType(mediaType);
        //提供json转化功能
        ObjectMapper mapper = new ObjectMapper();
        String str = null;
        try {
            if (params!=null&&!params.isEmpty()) {
                str = mapper.writeValueAsString(params);
            }
        } catch (JsonProcessingException e) {
            e.printStackTrace();
        }
        // 发送请求
        HttpEntity<String> entity = new HttpEntity<>(str, headers);
        RestTemplate restTemplate = new RestTemplate();
        ResponseEntity<T> resultEntity = restTemplate.exchange(url, method, entity, bodyType,map);
        return resultEntity.getBody();
    }
}

+ 2 - 1
svr/svr-manage/src/main/resources/webapp/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css

@ -19,10 +19,11 @@ div.dataTables_filter input {
div.dataTables_info {
    padding-top: 8px;
    float:right
}
div.dataTables_paginate {
    float: right;
    /*float: right;*/
    margin: 0;
}

+ 3 - 0
svr/svr-manage/src/main/resources/webapp/common/js/plugins/dataTables/jquery.dataTables.js

@ -2470,6 +2470,9 @@
		settings._iRecordsDisplay = parseInt(rocordsFiltered, 10);
	
		var data = _fnAjaxDataSrc( settings, json );
		if(data==undefined){
			data = [];
		}
		for ( var i=0, ien=data.length ; i<ien ; i++ ) {
			_fnAddData( settings, data[i] );
		}

+ 6 - 3
svr/svr-manage/src/main/resources/webapp/common/js/util/util.js

@ -73,7 +73,7 @@ function do_get(url, data, success,error) {
    });
}
//post方法
function do_post(url, data, success) {
function do_post(url, data, success ,error) {
    //获取用户的code
    var usercode = getUserCode();
    //data.userCode = usercode;
@ -87,11 +87,12 @@ function do_post(url, data, success) {
        url: url,
        data: data,
        success: success,
        error:error,
        dataType: "json"
    });
}
//put方法
function do_put(url, data, success) {
function do_put(url, data, success ,error) {
    //获取用户的code
    var usercode = getUserCode();
@ -102,11 +103,12 @@ function do_put(url, data, success) {
        url: url,
        data: data,
        success: success,
        error:error,
        dataType: "json"
    });
}
//delete方法
function do_delete(url, data, success) {
function do_delete(url, data, success,error) {
    //获取用户的code
    var usercode = getUserCode();
@ -117,6 +119,7 @@ function do_delete(url, data, success) {
        url: url,
        data: data,
        success: success,
        error:error,
        dataType: "json"
    });
}

+ 152 - 2
svr/svr-manage/src/main/resources/webapp/html/system/menu/html/menuList.html

@ -3,8 +3,158 @@
<head>
    <meta charset="UTF-8">
    <title>菜单管理页面</title>
    <link href="/common/css/bootstrap/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/common/css/bootstrap/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/common/css/bootstrap/animate.min.css" rel="stylesheet">
    <link href="/common/css/bootstrap/style.min.css?v=3.0.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <style>
        .m-form-group:after { display: table; content: " "; clear: both; }
        .m-form-group{
            margin-top: 18px;;
        }
        select{
            width:250px !important;
        }
    </style>
</head>
<body>
菜单管理页面
<body class="gray-bg">
<div class="panel panel-default">
    <div class="panel-body">
        <div class="col-md-12">
            <div class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-1 control-label">菜单名:</label>
                    <div class="col-sm-2">
                        <input type="text" class="form-control" id="name" name="name" style="width: 250px">
                    </div>
                    <div class="col-sm-2">
                        <button type="button" class="btn btn-success search" style="float: right;">查 询</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>
                        <small>菜单列表</small>
                    </h5>
                </div>
                <div class="ibox-content">
                    <table id="list" class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th>菜单名</th>
                            <th>路径</th>
                            <th>菜单类型</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:1200px;height: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    新 增
                </h4>
            </div>
            <form class="form-horizontal" role="form" action="" method="post"  id="category_add" >
                <input  id="id" type="hidden" name="id" :value="menu.id" />
                <input  type="hidden" name="code" :value="menu.code" />
                <input  type="hidden" name="createUser" :value="menu.createUser" />
                <input  type="hidden" name="createUserName" :value="menu.createUserName" />
                <input type="hidden" name="status" value="1"/>
                <!--<input  type="hidden" name="createTime" :value="menu.createTime" />-->
                <div class="m-form-group">
                    <label class="col-sm-3 control-label no-padding-right" >菜单名: </label>
                    <div class="col-sm-2">
                        <input type="text"  class="form-control"  name="name" style="width: 250px"   :value="menu.name"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >父级菜单</label>
                    <div class="col-sm-5">
                        <select class="form-control m-b" name="parentCode" id="parentCode" >
                            <option value="">--请选择--</option>
                            <option v-for="parentMenu in parentMenus"  :value="parentMenu.code" :selected="menu.parentCode==parentMenu.code" >{{parentMenu.name}}</option>
                        </select>
                    </div>
                </div>
                <div class="m-form-group">
                    <label class="col-sm-3 control-label no-padding-right" >路径: </label>
                    <div class="col-sm-2">
                        <input type="text"  class="form-control"  name="url" style="width: 250px"   :value="menu.url"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >排序:</label>
                    <div class="col-sm-5">
                        <input type="text"  class="form-control"  name="sort" style="width: 250px"   :value="menu.sort"/>
                    </div>
                </div>
                <div class="m-form-group">
                    <label class="col-sm-3 control-label no-padding-right" >备注:</label>
                    <div class="col-sm-2">
                        <input type="text" name="remark" :value="menu.remark" style="width: 250px" class="form-control" />
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="submit" class="btn btn-primary" id="btnsubmit">
                        提交
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div>
</div>
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/common/js/util/util.js"></script>
<!--<script type="text/javascript" src="/common/js/vue/vue.js"></script>--><!--2.0-->
<script type="text/javascript" src="/common/js/vue.js"></script><!--1.0-->
<script type="text/javascript" src="/common/js/layer/layer.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/system/menu/js/menuList.js"></script>
</body>
</html>

+ 139 - 2
svr/svr-manage/src/main/resources/webapp/html/system/role/html/roleList.html

@ -3,8 +3,145 @@
<head>
    <meta charset="UTF-8">
    <title>角色管理页面</title>
    <link href="/common/css/bootstrap/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/common/css/bootstrap/font-awesome.min.css?v=4.3.0" rel="stylesheet">
    <link href="/common/css/bootstrap/animate.min.css" rel="stylesheet">
    <link href="/common/css/bootstrap/style.min.css?v=3.0.0" rel="stylesheet">
    <!-- Data Tables -->
    <link href="/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <style>
        .m-form-group:after { display: table; content: " "; clear: both; }
        .m-form-group{
            margin-top: 18px;;
        }
        select{
            width:250px !important;
        }
    </style>
</head>
<body>
角色管理页面
<body class="gray-bg">
<div class="panel panel-default">
    <div class="panel-body">
        <div class="col-md-12">
            <div class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-2 control-label">角色名称:</label>
                    <div class="col-sm-3">
                        <input type="text" class="form-control" id="name" name="name" style="width: 250px">
                    </div>
                    <div class="col-sm-2">
                        <button type="button" class="btn btn-success search" style="float: right;">查 询</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <h5>
                        <small>角色列表</small>
                    </h5>
                </div>
                <div class="ibox-content">
                    <table id="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>
                        </tr>
                        </thead>
                        <tbody>
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:500px;height: 450px;">
        <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="detail.id" />
                <input  type="hidden" name="code" :value="detail.code" />
                <input type="hidden" name="status" value="1"/>
                <div class="m-form-group">
                    <label class="col-sm-4 control-label no-padding-right" >角色名称: </label>
                    <div class="col-sm-6">
                        <input type="text"  class="form-control"  name="name" style="width: 250px"  required="true"  :value="detail.name"/>
                    </div>
                </div>
                <div class="m-form-group">
                    <label class="col-sm-4 control-label no-padding-right" >描&#12288;&#12288;述: </label>
                    <div class="col-sm-6">
                     <textarea style="width:115%;height:150px;" :value="detail.remark" name="remark"></textarea>
                    </div>
                </div>
                <!--<div style="margin:0 auto; text-align: center;margin-top: 15px">
                </div>-->
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="submit" class="btn btn-primary" id="btnsubmit">
                        提交
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div>
</div>
<!-- 从远程加载  用于人员配置,权限配置-->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true" data-code="">
    <div class="modal-dialog" style="width:1000px;height: 750px;" id="myModalDialog">
        <div class="modal-content">
        </div>
     </div>
</div>
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/common/js/util/util.js"></script>
<!--<script type="text/javascript" src="/common/js/vue/vue.js"></script>--><!--2.0-->
<script type="text/javascript" src="/common/js/vue.js"></script><!--1.0-->
<script type="text/javascript" src="/common/js/layer/layer.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/system/role/js/roleList.js"></script>
</body>
</html>

+ 123 - 27
svr/svr-manage/src/main/resources/webapp/html/system/user/html/userList.html

@ -2,8 +2,7 @@
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>用户管理页面</title>
    <title>微信配置管理页面</title>
    <link href="/common/css/bootstrap/bootstrap.min.css?v=3.4.0" rel="stylesheet">
    <link href="/common/css/bootstrap/font-awesome.min.css?v=4.3.0" rel="stylesheet">
@ -13,8 +12,40 @@
    <!-- Data Tables -->
    <link href="/common/css/bootstrap/plugins/dataTables/dataTables.bootstrap.css" rel="stylesheet">
    <style>
        .m-form-group:after { display: table; content: " "; clear: both; }
        .m-form-group{
            margin-top: 18px;;
        }
        select{
            width:250px !important;
        }
    </style>
</head>
<body class="gray-bg">
<div class="panel panel-default">
    <div class="panel-body">
        <div class="col-md-12">
            <div class="form-horizontal">
                <div class="form-group">
                    <label class="col-sm-1 control-label">名称:</label>
                    <div class="col-sm-2">
                        <input type="text" class="form-control" id="name" name="name" style="width: 250px">
                    </div>
                    <label class="col-sm-1 control-label">电话号码:</label>
                    <div class="col-sm-2">
                        <input type="text" class="form-control" id="mobile" name="mobile" style="width: 250px">
                    </div>
                    <div class="col-sm-1">
                        <button type="button" class="btn btn-success search" style="float: right;">查 询</button>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <div class="col-sm-12">
@ -23,33 +54,15 @@
                    <h5>
                        <small>用户列表</small>
                    </h5>
                    <div class="ibox-tools">
                        <a class="collapse-link">
                            <i class="fa fa-chevron-up"></i>
                        </a>
                        <a class="dropdown-toggle" data-toggle="dropdown" href="table_data_tables.html#">
                            <i class="fa fa-wrench"></i>
                        </a>
                        <ul class="dropdown-menu dropdown-user">
                            <li><a href="table_data_tables.html#">选项1</a>
                            </li>
                            <li><a href="table_data_tables.html#">选项2</a>
                            </li>
                        </ul>
                        <a class="close-link">
                            <i class="fa fa-times"></i>
                        </a>
                    </div>
                </div>
                <div class="ibox-content">
                    <table id="userlist" class="table table-striped table-bordered table-hover dataTables-example">
                    <table id="list" class="table table-striped table-bordered table-hover dataTables-example">
                        <thead>
                        <tr>
                            <th><input type="checkbox" name="allChecked" /></th>
                            <th>code</th>
                            <th>名称</th>
                            <th>电话号码</th>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th>用户名</th>
                            <th>手机号</th>
                            <th>状态</th>
                            <th>创建时间</th>
                            <th>操作</th>
@ -62,20 +75,103 @@
    </div>
</div>
<div class="modal fade" id="myModal-add-info" tabindex="-1" role="dialog"
     aria-labelledby="myModalLabel" aria-hidden="true">
    <div class="modal-dialog" style="width:1200px;height: 800px;">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close"
                        data-dismiss="modal" aria-hidden="true">
                    &times;
                </button>
                <h4 class="modal-title" id="myModalLabel">
                    新 增
                </h4>
            </div>
            <form class="form-horizontal" role="form" action="" method="post"  id="category_add" >
                <input  id="id" type="hidden" name="id" :value="user.id" />
                <input  type="hidden" name="code" :value="user.code" />
                <input  type="hidden" name="createUser" :value="user.createUser" />
                <input  type="hidden" name="createUserName" :value="user.createUserName" />
                <input type="hidden" name="salt" :value="user.salt"/>
                <input type="hidden" name="status" :value="user.status"/>
                <!--<input  type="hidden" name="createTime" :value="user.createTime" />-->
                <!--<input  type="hidden" name="updateUser" :value="user.updateUser" />
                <input  type="hidden" name="updateUserName" :value="user.updateUserName" />
                <input  type="hidden" name="updateTime" :value="user.updateTime" />-->
                <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="user.name" required="true"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >登陆账号:</label>
                    <div class="col-sm-5">
                        <input type="text"  class="form-control"  name="loginAccount" style="width: 250px" required="true" :value="user.loginAccount"  />
                    </div>
                </div>
                <div class="m-form-group" style="display: none" id="oldPsdDiv">
                    <label class="col-sm-3 control-label no-padding-right" >原密码:</label>
                    <div class="col-sm-2">
                        <input type="password"  class="form-control" id="oldPsd"  name="oldPsd" style="width: 250px"  required="true" />
                    </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="password"  class="form-control" id="password"  name="password" style="width: 250px"  required="true" />
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >请重新输入密码:</label>
                    <div class="col-sm-5">
                        <input type="password"  class="form-control"  id="rePassword"  style="width: 250px" required="true" />
                    </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="mobile" style="width: 250px"   :value="user.mobile" pattern="^1[3-9]\d{9}$" />
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >备注</label>
                    <div class="col-sm-5">
                        <input type="text"  class="form-control"  name="remark" style="width: 250px"  :value="user.remark"/>
                    </div>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="submit" class="btn btn-primary" id="btnsubmit">
                        提交
                    </button>
                </div>
            </form>
        </div><!-- /.modal-content -->
    </div>
</div>
<!-- 全局js -->
<script type="text/javascript" src="/common/js/jquery/jquery-2.1.1.min.js"></script>
<script type="text/javascript" src="/common/js/bootstrap/bootstrap.min.js"></script>
<script type="text/javascript" src="/common/js/util/util.js"></script>
<!--<script type="text/javascript" src="/common/js/vue/vue.js"></script>--><!--2.0-->
<script type="text/javascript" src="/common/js/vue.js"></script><!--1.0-->
<script type="text/javascript" src="/common/js/layer/layer.min.js"></script>
<script type="text/javascript" src="/common/js/plugins/jeditable/jquery.jeditable.js"></script>
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- 自定义js -->
<script type="text/javascript" src="/common/js/content.min.js?v=1.0.0"></script>
<script type="text/javascript" src="/system/user/js/userList.js"></script>

+ 203 - 152
svr/svr-manage/src/main/resources/webapp/html/system/user/js/userList.js

@ -1,137 +1,129 @@
$(document).ready(function () {
    //初始化用户列表
    $("#userlist").DataTable({
        "aLengthMenu": [1, 2, 3, 4],
        "searching": false,//禁用搜索
        "lengthChange": true,
        "paging": true,//开启表格分页
        "bProcessing": true,
        "bServerSide": true,
        "bAutoWidth": false,
        "sort": "position",
        "deferRender": true,//延迟渲染
        "bStateSave": false, //在第三页刷新页面,会自动到第一页
        "iDisplayLength": 1,//每页显示条数
        "iDisplayStart": 0, //当前页
        "dom": '<l<\'#topPlugin\'>f>rt<ip><"clear">',
        "ordering": false,//全局禁用排序
        "ajax": {
            "url": '/user/list',
            "type": 'GET',
            "dataSrc": "detailModelList",
            "data": function (d) {
                d.userCode = window.parent.getUserCode();
                d.name ="";
            }
        },
        "aoColumns": [{
            "mData": "id",
            "orderable": false, // 禁用排序
            "sDefaultContent": "",
            "sWidth": "2%"
        },  {
            "mData": "code",
            "orderable": false, // 禁用排序
            "sDefaultContent": "",
            "sWidth": "10%"
        },  {
            "mData": "name",
            "orderable": false, // 禁用排序
            "sDefaultContent": "",
            "sWidth": "10%"
        }, {
            "mData": "mobile",
            "orderable": false, // 禁用排序
            "sDefaultContent": "",
            "sWidth": "10%"
        },{
            "mData": "status",
            "orderable": false, // 禁用排序
            "sDefaultContent": "",
            "sWidth": "3%",
            "render": function (data, type, full, meta) {
                if (data == 1) {
                    data = "<a href='#' class='upOrderStatus' data-id=" + full.id + ">有效</a>";
                } else {
                    data = "<a href='#' class='upOrderStatus' data-id=" + full.id + "><font color='red'>无效</font></a>";
var table;
var usercode = window.localStorage.getItem("userCode");
$(function () {
    table = $("#list").DataTable({
            "aLengthMenu": [1, 2, 3, 4],
            "searching": false,//禁用搜索
            "lengthChange": true,
            "paging": true,//开启表格分页
            "bProcessing": true,
            "bServerSide": true,
            "bAutoWidth": false,
            "sort": "position",
            "deferRender": true,//延迟渲染
            "bStateSave": false, //在第三页刷新页面,会自动到第一页
            "iDisplayLength": 10,//每页显示条数
            "iDisplayStart": 0, //当前页
            "dom": '<l<\'#topPlugin\'>f>rt<ip><"clear">',
            "ordering": false,//全局禁用排序
            "ajax": {
                "url": '/manage/user/list',
                "type": 'GET',
                "dataSrc": "detailModelList",
                "data": function (d) {
                    d.userCode = window.parent.getUserCode();
                    d.name =$("#name").val();
                    d.mobile=$("#mobile").val();
                }
                return data;
            }
        } ,
            {
                "mData": "createTime",
            },
            "aoColumns": [ {
                "mData": "code",
                "orderable": false, // 禁用排序
                "sDefaultContent": "",
                "sWidth": "2%"
            },  {
                "mData": "name",
                "orderable": false, // 禁用排序
                "sDefaultContent": "",
                "sWidth": "10%"
            }, {
                "mData": "mobile",
                "orderable": false, // 禁用排序
                "sDefaultContent": "",
                "sWidth": "10%",
                "sWidth": "10%"
            },{
                "mData": "status",
                "orderable": false, // 禁用排序
                "sDefaultContent": "",
                "sWidth": "3%",
                "render": function (data, type, full, meta) {
                    //时间格式化
                    return moment(data).format("YYYY-MM-DD HH:mm:ss");
                    if (data == 1) {
                        data = "有效";
                    } else {
                        data = "无效";
                    }
                    return data;
                }
            },
            {
                "mData": "id",
            } ,
                {
                    "mData": "createTime",
                    "orderable": false, // 禁用排序
                    "sDefaultContent": "",
                    "sWidth": "10%",
                    "render": function (data, type, full, meta) {
                        //时间格式化
                        return moment(data).format("YYYY-MM-DD HH:mm:ss");
                    }
                },
                {
                    "mData": "code",
                    "orderable": false, // 禁用排序
                    "sDefaultContent": '',
                    "sWidth": "10%",
                    "render": function (data, type, full, meta) {
                        return data = '<button id="findOne" class="btn btn-primary  btn-sm" data-id=' + data + ' onclick="show(\''+data+'\')">查 看</button>';/*<button id="deleteOne" class="btn btn-danger btn-sm" style="margin-left: 7px;" data-id=' + data + '>删 除</button>*/
                    }
                }],
            "columnDefs": [{
                "orderable": false, // 禁用排序
                "sDefaultContent": '',
                "sWidth": "10%",
                "targets": [0], // 指定的列
                "data": "code",
                "render": function (data, type, full, meta) {
                    return data = '<button id="deleteOne" class="btn btn-danger btn-sm" data-id=' + data + '>删 除</button>';
                    return '<input type="checkbox" value="' + data + '" name="code"/>';
                }
            }],
        "columnDefs": [{
            "orderable": false, // 禁用排序
            "targets": [0], // 指定的列
            "data": "id",
            "render": function (data, type, full, meta) {
                return '<input type="checkbox" value="' + data + '" name="id"/>';
            }
        }],
        "oLanguage": { // 国际化配置
            "sProcessing": "正在获取数据,请稍后...",
            "sLengthMenu": "显示 _MENU_ 条",
            "sZeroRecords": "没有找到数据",
            "sInfo": "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
            "sInfoEmpty": "记录数为0",
            "sInfoFiltered": "(全部记录数 _MAX_ 条)",
            "sInfoPostFix": "",
            "sSearch": "搜索",
            "sUrl": "",
            "oPaginate": {
                "sFirst": "第一页",
                "sPrevious": "上一页",
                "sNext": "下一页",
                "sLast": "最后一页"
            "oLanguage": { // 国际化配置
                "sProcessing": "正在获取数据,请稍后...",
                "sLengthMenu": "显示 _MENU_ 条",
                "sZeroRecords": "没有找到数据",
                "sInfo": "从 _START_ 到  _END_ 条记录 总记录数为 _TOTAL_ 条",
                "sInfoEmpty": "记录数为0",
                "sInfoFiltered": "(全部记录数 _MAX_ 条)",
                "sInfoPostFix": "",
                "sSearch": "搜索",
                "sUrl": "",
                "oPaginate": {
                    "sFirst": "第一页",
                    "sPrevious": "上一页",
                    "sNext": "下一页",
                    "sLast": "最后一页"
                }
            },
            initComplete: initComplete,
            drawCallback: function (settings) {
                $('input[name=checkAll]')[0].checked = false;//取消全选状态
            }
        },
        initComplete: initComplete,
        drawCallback: function (settings) {
            $('input[name=allChecked]')[0].checked = false;//取消全选状态
        }
    });
    );
    /**
     * 表格加载渲染完毕后执行的方法
     * @param data
     */
    function initComplete(data){
        //上方topPlugin DIV中追加HTML
        //var topPlugin='<button id="addButton" class="btn btn-success btn-sm" data-toggle="modal" data-target="#addUser" style="display:block;">' +
        // '<span class="glyphicon glyphicon-plus" aria-hidden="true"></span>添加用户</button>';
        //删除用户按钮的HTMLDOM
        var topPlugin='<button   class="btn btn-danger btn-sm" id="deleteAll">批量删除</button> <button   class="btn btn-primary btn-sm addBtn" >新 增</button>             <iframe id="exp" style="display:none;"></iframe><button  class="btn btn-info btn-sm" id="expCsv">导 出全部</button>             <button  class="btn btn-warning btn-sm" id="reset">重置搜索条件</button>' ;
        var topPlugin='<button   class="btn btn-danger btn-sm" id="deleteAll">批量删除</button> <button   class="btn btn-primary btn-sm addBtn" >新 增</button>       <button  class="btn btn-warning btn-sm" id="reset">重置搜索条件</button>' ;
        $("#topPlugin").append(topPlugin);//在表格上方topPlugin DIV中追加HTML
        //$("#expCsv").on("click", exp1);//给下方按钮绑定事件
    }
    /**
     * 多选选中和取消选中,同时选中第一个单元格单选框,并联动全选单选框
     */
    $('#userlist tbody').on('click', 'tr', function(event) {
        var allChecked=$('input[name=allChecked]')[0];//关联全选单选框
    $('#list tbody').on('click', 'tr', function(event) {
        var checkAll=$('input[name=checkAll]')[0];//关联全选单选框
        $($(this).children()[0]).children().each(function(){
            if(this.type=="checkbox" && (!$(event.target).is(":checkbox") && $(":checkbox",this).trigger("click"))){
                if(!this.checked){
@ -142,12 +134,12 @@ $(document).ready(function () {
                    var recordsDisplay=table.page.info().recordsDisplay;//搜索条件过滤后的总行数
                    var iDisplayStart=table.page.info().start;// 起始行数
                    if(selected === table.page.len()||selected === recordsDisplay||selected === (recordsDisplay - iDisplayStart)){
                        allChecked.checked = true;
                        checkAll.checked = true;
                    }
                }else{
                    this.checked = false;
                    cancelValue(this);
                    allChecked.checked = false;
                    checkAll.checked = false;
                }
            }
        });
@ -155,19 +147,18 @@ $(document).ready(function () {
    });
    /**
     * 全选按钮被点击事件
     */
    $('input[name=allChecked]').click(function(){
    $('input[name=checkAll]').click(function(){
        if(this.checked){
            $('#userlist tbody tr').each(function(){
            $('#list tbody tr').each(function(){
                if(!$(this).hasClass('selected')){
                    $(this).click();
                }
            });
        }else{
            $('#userlist tbody tr').click();
            $('#list tbody tr').click();
        }
    });
@ -175,11 +166,11 @@ $(document).ready(function () {
     * 单选框被选中时将它的value放入隐藏域
     */
    function addValue(para) {
        var userIds = $("input[name=userIds]");
        if(userIds.val() === ""){
            userIds.val($(para).val());
        var codes = $("input[name=codes]");
        if(codes.val() === ""){
            codes.val($(para).val());
        }else{
            userIds.val(userIds.val()+","+$(para).val());
            codes.val(codes.val()+","+$(para).val());
        }
    }
@ -188,65 +179,125 @@ $(document).ready(function () {
     */
    function cancelValue(para){
        //取消选中checkbox要做的操作
        var userIds = $("input[name=allChecked]");
        var array = userIds.val().split(",");
        userIds.val("");
        var codes = $("input[name=checkAll]");
        var array = codes.val().split(",");
        codes.val("");
        for (var i = 0; i < array.length; i++) {
            if (array[i] === $(para).val()) {
                continue;
            }
            if (userIds.val() === "") {
                userIds.val(array[i]);
            if (codes.val() === "") {
                codes.val(array[i]);
            } else {
                userIds.val(userIds.val() + "," + array[i]);
                codes.val(codes.val() + "," + array[i]);
            }
        }
    }
//   function exp1(){
//	   $("#exp").attr("src",contextPath+"/department/export.do?t=" + new Date().getTime());
//   }
    $(document).delegate('#expCsv','click',function() {
    $(document).delegate('.addBtn','click',function() {
        contentVM.user='';
        $('#myModal-add-info').modal('show');
        $("#oldPsd").removeAttr("required");
        $("#oldPsdDiv").css('display','none');
        setTimeout(function(){
            $(':input','#myModal-add-info')
                .not(':button, :submit, :reset, :hidden')
                .val('')
                .removeAttr('checked');
        },200);
        $("#exp").attr("src",contextPath+"/department/export.do?t=" + new Date().getTime());
    });
    $(document).delegate('.addBtn','click',function() {
        $('#myModal-add-info').modal('show');
    });
    //批量删除
    $(document).delegate('#deleteAll','click',function() {
        var theArray=[];
        $("input[name=id]:checked").each(function() {
        $("input[name=code]:checked").each(function() {
            theArray.push($(this).val());
        });
        if(theArray.length<1){
            alert("请至少选择一个");
        }else{
            alert(theArray);
            var codes = theArray.join(",");
            del(codes);
        }
    });
    $(document).delegate('.upOrderStatus','click',function() {
        var id=$(this).data("id");
        //alert(id);
        $("#titleId").html(id);
        $('#editOrderStatus').modal("show");
    });
    //清空查询条件
    $(document).delegate('#reset','click',function() {
        $("#state").val("");
        $("#deptname").val("");
        $("#startTime").val("");
        $("#endTime").val("");
        $("#name").val("");
        $("#mobile").val("");
    });
    $(document).delegate('.search','click',function() {
    //重新查询
    $(document).delegate('.search', 'click', function () {
        table.ajax.reload();
        // $("#example").dataTable().api().ajax.reload();
//		   table.search(
//				   "state="+$('#state').val()
//			    ).draw();
//		  var 	    state=$("#state").val();
//		   table.column(1).search(state, false, false).draw();
    });
});
var contentVM = new Vue({
    el: '#category_add',
    data: {
        user: ''//记录详情信息
    },
    replace:false,
});
//查看配置
function show(code){
    $("#oldPsd").attr("required","true");
    $("#oldPsdDiv").css('display','block');
    $("#myModal-add-info").removeData("modal");
    $("#password").val("");
    $("#rePassword").val("");
    var data={};
    do_get("/manage/user/"+code,data,function(data){
        contentVM.user = data.obj;
        $('#myModal-add-info').modal('show');
        $("#myModalLabel").html("查看");
    },function(data){
    });
}
function del(codes){
    var url = "/manage/user/"+codes+"?userCode="+usercode;
    do_delete(url,{},function(data){
        if(data.errorMsg!=undefined){
            alert(data.errorMsg);
            return
        }
        alert("删除成功");
        table.ajax.reload();
    })
}
$("#category_add").submit(function(){
    var psd = $("#password").val();
    var rePsd = $("#rePassword").val();
    if(psd!=rePsd){
        alert("两次密码不一样");
        return false;
    }
    var id = $("#id").val();
    var data = $("#category_add").serialize();
    var url = "/manage/user"
    do_post(url,data,function(data){
        if(id==''){
            alert("保存成功");
        }else{
            alert("修改成功");
        }
        $('#myModal-add-info').modal('hide');
        table.ajax.reload();
        return;
    },function(data){
        alert(data.responseJSON.message)
    })
    return false
})

+ 7 - 6
svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/html/graphicMessageList.html

@ -89,15 +89,15 @@
                <input  type="hidden" name="code" :value="graphicMessage.code" />
                <input  type="hidden" name="createUser" :value="graphicMessage.createUser" />
                <input  type="hidden" name="createUserName" :value="graphicMessage.createUserName" />
                <!--<input  type="hidden" name="createTime" :value="graphicMessage.createTime" />-->
                <input type="hidden" name="status" value="1"/>
                <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="title" style="width: 250px"   :value="graphicMessage.title"/>
                        <input type="text"  class="form-control"  name="title" style="width: 250px"  required="true"  :value="graphicMessage.title"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >url:</label>
                    <label class="col-sm-2 control-label no-padding-right" >跳转地址:</label>
                    <div class="col-sm-5">
                        <input type="url"  class="form-control"  name="url" style="width: 250px" required="true" :value="graphicMessage.url"/>
                        <input type="url"  class="form-control"  name="url" style="width: 250px"  :value="graphicMessage.url"/>
                    </div>
                </div>
@ -108,7 +108,7 @@
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >备注:</label>
                    <div class="col-sm-5">
                        <input type="text"  class="form-control"  name="remark" style="width: 250px" required="true" :value="graphicMessage.remark"/>
                        <input type="text"  class="form-control"  name="remark" style="width: 250px"  :value="graphicMessage.remark"/>
                    </div>
                </div>
                <div style="margin:0 auto; text-align: center;margin-top: 15px">
@ -119,7 +119,7 @@
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="btnsubmit">
                    <button type="submit" class="btn btn-primary" id="btnsubmit">
                        提交
                    </button>
                </div>
@ -143,6 +143,7 @@
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/wechat/graphicMessage/js/graphicMessageList.js"></script>

+ 32 - 50
svr/svr-manage/src/main/resources/webapp/html/wechat/graphicMessage/js/graphicMessageList.js

@ -13,7 +13,7 @@ $(function () {
            "deferRender": true,//延迟渲染
            "bStateSave": false, //在第三页刷新页面,会自动到第一页
            "iDisplayLength": 10,//每页显示条数
            "iDisplayStart": 1, //当前页
            "iDisplayStart": 0, //当前页
            "dom": '<l<\'#topPlugin\'>f>rt<ip><"clear">',
            "ordering": false,//全局禁用排序
            "ajax": {
@ -109,8 +109,8 @@ $(function () {
    /**
     * 多选选中和取消选中,同时选中第一个单元格单选框,并联动全选单选框
     */
    $('#wechatList tbody').on('click', 'tr', function(event) {
        var checkAllWechat=$('input[name=checkAllWechat]')[0];//关联全选单选框
    $('#list tbody').on('click', 'tr', function(event) {
        var checkAll=$('input[name=checkAll]')[0];//关联全选单选框
        $($(this).children()[0]).children().each(function(){
            if(this.type=="checkbox" && (!$(event.target).is(":checkbox") && $(":checkbox",this).trigger("click"))){
                if(!this.checked){
@ -121,12 +121,12 @@ $(function () {
                    var recordsDisplay=table.page.info().recordsDisplay;//搜索条件过滤后的总行数
                    var iDisplayStart=table.page.info().start;// 起始行数
                    if(selected === table.page.len()||selected === recordsDisplay||selected === (recordsDisplay - iDisplayStart)){
                        checkAllWechat.checked = true;
                        checkAll.checked = true;
                    }
                }else{
                    this.checked = false;
                    cancelValue(this);
                    checkAllWechat.checked = false;
                    checkAll.checked = false;
                }
            }
        });
@ -137,15 +137,15 @@ $(function () {
    /**
     * 全选按钮被点击事件
     */
    $('input[name=checkAllWechat]').click(function(){
    $('input[name=checkAll]').click(function(){
        if(this.checked){
            $('#wechatList tbody tr').each(function(){
            $('#list tbody tr').each(function(){
                if(!$(this).hasClass('selected')){
                    $(this).click();
                }
            });
        }else{
            $('#wechatList tbody tr').click();
            $('#list tbody tr').click();
        }
    });
@ -153,11 +153,11 @@ $(function () {
     * 单选框被选中时将它的value放入隐藏域
     */
    function addValue(para) {
        var wechatCodes = $("input[name=wechatCodes]");
        if(wechatCodes.val() === ""){
            wechatCodes.val($(para).val());
        var codes = $("input[name=codes]");
        if(codes.val() === ""){
            codes.val($(para).val());
        }else{
            wechatCodes.val(wechatCodes.val()+","+$(para).val());
            codes.val(codes.val()+","+$(para).val());
        }
    }
@ -166,37 +166,31 @@ $(function () {
     */
    function cancelValue(para){
        //取消选中checkbox要做的操作
        var wechatCodes = $("input[name=checkAllWechat]");
        var array = wechatCodes.val().split(",");
        wechatCodes.val("");
        var codes = $("input[name=checkAll]");
        var array = codes.val().split(",");
        codes.val("");
        for (var i = 0; i < array.length; i++) {
            if (array[i] === $(para).val()) {
                continue;
            }
            if (wechatCodes.val() === "") {
                wechatCodes.val(array[i]);
            if (codes.val() === "") {
                codes.val(array[i]);
            } else {
                wechatCodes.val(wechatCodes.val() + "," + array[i]);
                codes.val(codes.val() + "," + array[i]);
            }
        }
    }
    $(document).delegate('.addBtn','click',function() {
        contentVM.wechatConfig='';
        contentVM.graphicMessage='';
        $('#myModal-add-info').modal('show');
        setTimeout(function(){
            console.log($(':input','#myModal-add-info')
                .not(':button, :submit, :reset, :hidden').length)
            console.log("---------------------")
            $(':input','#myModal-add-info')
                .not(':button, :submit, :reset, :hidden')
                .val('')
                .removeAttr('checked');
        },200);
    });
@ -215,13 +209,6 @@ $(function () {
    });
    $(document).delegate('.upOrderStatus','click',function() {
        var id=$(this).data("id");
        //alert(id);
        $("#titleId").html(id);
        $('#editOrderStatus').modal("show");
    });
    //清空查询条件
    $(document).delegate('#reset','click',function() {
        $("#title").val("");
@ -263,33 +250,28 @@ function show(code){
}
function del(codes){
    var url = "/wechat/graphicMessage/"+codes+"?userCode="+usercode;
    var url = "/wechat/graphicMessage/"+codes;
    do_delete(url,{},function(data){
        if(data.successFlg==true){
            alert("删除成功");
            table.ajax.reload();
        }else{
            alert("删除失败")
        }
        alert("删除成功");
        table.ajax.reload();
    })
}
$("#btnsubmit").click(function(){
$("#category_add").submit(function(){
    debugger
    var url = "";
    var id = $("#id").val();
    var data = $("#category_add").serialize();
    url = "/wechat/graphicMessage"
    do_post(url,data,function(data){
        if(data.successFlg){
            if(id==''){
                alert("保存成功");
            }else{
                alert("修改成功");
            }
            $('#myModal-add-info').modal('hide');
            table.ajax.reload();
            return;
        debugger
        if(id==''){
            alert("保存成功");
        }else{
            alert("修改成功");
        }
        alert(data.errorMsg);
        $('#myModal-add-info').modal('hide');
        table.ajax.reload();
    })
    return false;
})

+ 10 - 11
svr/svr-manage/src/main/resources/webapp/html/wechat/template/html/templateList.html

@ -57,7 +57,7 @@
                        <tr>
                            <th><input type="checkbox" name="checkAll" /></th>
                            <th>标题</th>
                            <th>公众号名</th>
                            <th>微信名</th>
                            <th>创建时间</th>
                            <th>操作</th>
                        </tr>
@ -89,37 +89,35 @@
                <input  type="hidden" name="code" :value="template.code" />
                <input  type="hidden" name="createUser" :value="template.createUser" />
                <input  type="hidden" name="createUserName" :value="template.createUserName" />
                <!--<input  type="hidden" name="createTime" :value="template.createTime" />-->
                <input type="hidden" name="status" value="1"/>
                <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="title" style="width: 250px"   :value="template.title"/>
                    </div>
                    <label class="col-sm-2 control-label no-padding-right" >公众号名:</label>
                    <label class="col-sm-2 control-label no-padding-right" >微信名:</label>
                    <div class="col-sm-5">
                        <input type="url"  class="form-control"  name="wechatName" style="width: 250px" required="true" :value="template.wechatName"/>
                        <select class="form-control m-b" name="wechatCode" id="wechatCode" required="true">
                            <option v-for="wechatConfig in wechatConfigs"  :value="wechatConfig.code" :selected="wechatConfig.code==template.wechatCode ">{{wechatConfig.name}}</option>
                        </select>
                    </div>
                </div>
                <div class="m-form-group">
                    <label class="col-sm-3 control-label no-padding-right" >模板id:</label>
                    <div class="col-sm-2">
                        <input type="text"  class="form-control"  name="templateId" style="width: 250px"   :value="template.templateId"/>
                        <input type="text"  class="form-control"  name="templateId" style="width: 250px"  required="true"  :value="template.templateId"/>
                    </div>
                   <!-- <label class="col-sm-2 control-label no-padding-right" >模板格式:</label>
                    <div class="col-sm-5">
                        <input type="text"  class="form-control"  name="content" style="width: 250px" required="true" :value="template.content"/>
                    </div>-->
                </div>
                <div style="margin:0 auto; text-align: center;margin-top: 15px">
                    <label class="col-sm-3 control-label no-padding-right" >模板格式:</label>
                    <textarea style="width:54%;height:150px;margin-left: -211px;" :value="template.content" name="content"></textarea>
                    <textarea style="width:54%;height:150px;margin-left: -211px;" :value="template.content" name="content" required="true"></textarea>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default"
                            data-dismiss="modal">关闭
                    </button>
                    <button type="button" class="btn btn-primary" id="btnsubmit">
                    <button type="submit" class="btn btn-primary" id="btnsubmit">
                        提交
                    </button>
                </div>
@ -143,6 +141,7 @@
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/wechat/template/js/templateList.js"></script>

+ 19 - 30
svr/svr-manage/src/main/resources/webapp/html/wechat/template/js/templateList.js

@ -13,7 +13,7 @@ $(function () {
            "deferRender": true,//延迟渲染
            "bStateSave": false, //在第三页刷新页面,会自动到第一页
            "iDisplayLength": 10,//每页显示条数
            "iDisplayStart": 1, //当前页
            "iDisplayStart": 0, //当前页
            "dom": '<l<\'#topPlugin\'>f>rt<ip><"clear">',
            "ordering": false,//全局禁用排序
            "ajax": {
@ -109,8 +109,8 @@ $(function () {
    /**
     * 多选选中和取消选中,同时选中第一个单元格单选框,并联动全选单选框
     */
    $('#template tbody').on('click', 'tr', function(event) {
        var checkAllWechat=$('input[name=checkAll]')[0];//关联全选单选框
    $('#list tbody').on('click', 'tr', function(event) {
        var checkAll=$('input[name=checkAll]')[0];//关联全选单选框
        $($(this).children()[0]).children().each(function(){
            if(this.type=="checkbox" && (!$(event.target).is(":checkbox") && $(":checkbox",this).trigger("click"))){
                if(!this.checked){
@ -121,12 +121,12 @@ $(function () {
                    var recordsDisplay=table.page.info().recordsDisplay;//搜索条件过滤后的总行数
                    var iDisplayStart=table.page.info().start;// 起始行数
                    if(selected === table.page.len()||selected === recordsDisplay||selected === (recordsDisplay - iDisplayStart)){
                        checkAllWechat.checked = true;
                        checkAll.checked = true;
                    }
                }else{
                    this.checked = false;
                    cancelValue(this);
                    checkAllWechat.checked = false;
                    checkAll.checked = false;
                }
            }
        });
@ -183,19 +183,14 @@ $(function () {
    $(document).delegate('.addBtn','click',function() {
        contentVM.wechatConfig='';
        contentVM.template='';
        $('#myModal-add-info').modal('show');
        setTimeout(function(){
            console.log($(':input','#myModal-add-info')
                .not(':button, :submit, :reset, :hidden').length)
            $(':input','#myModal-add-info')
                .not(':button, :submit, :reset, :hidden')
                .val('')
                .removeAttr('checked');
        },200);
    });
@ -214,13 +209,6 @@ $(function () {
    });
    $(document).delegate('.upOrderStatus','click',function() {
        var id=$(this).data("id");
        //alert(id);
        $("#titleId").html(id);
        $('#editOrderStatus').modal("show");
    });
    //清空查询条件
    $(document).delegate('#reset','click',function() {
        $("#title").val("");
@ -236,19 +224,19 @@ var contentVM = new Vue({
    el: '#category_add',
    data: {
        template: '',//记录详情信息
        saasList:''//记录saas列表
        wechatConfigs:''//记录saas列表
    },
    replace:false
});
do_get("/base/saases",{},function(data){
    contentVM.saasList = data.detailModelList;
do_get("/wechat/wechatConfig/listNoPage",{},function(data){
    contentVM.wechatConfigs = data.detailModelList;
    console.log( data.detailModelList);
},function(data){
})
//查看配置
//查看
function show(code){
    $("#myModal-add-info").removeData("modal");
    var data={};
@ -262,23 +250,23 @@ function show(code){
}
function del(codes){
    var url = "/wechat/template/"+codes+"?userCode="+usercode;
    var url = "/wechat/template/"+codes;
    do_delete(url,{},function(data){
        if(data.successFlg==true){
            alert("删除成功");
            table.ajax.reload();
        }else{
            alert("删除失败")
        }
        alert("删除成功");
        table.ajax.reload();
    })
}
$("#btnsubmit").click(function(){
$("#category_add").submit(function(){
    var url = "";
    var id = $("#id").val();
    var data = $("#category_add").serialize();
    url = "/wechat/template"
    do_post(url,data,function(data){
        if(data.errorMsg!=undefined){
            alert(data.errorMsg);
            return
        }
        if(id==''){
            alert("保存成功");
        }else{
@ -288,4 +276,5 @@ $("#btnsubmit").click(function(){
        table.ajax.reload();
        return;
    })
    return false;
})

+ 13 - 25
svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/html/wechatConfigList.html

@ -91,21 +91,18 @@
                    <input  type="hidden" name="code" :value="wechatConfig.code" />
                    <input  type="hidden" name="createUser" :value="wechatConfig.createUser" />
                    <input  type="hidden" name="createUserName" :value="wechatConfig.createUserName" />
                    <!--<input  type="hidden" name="createTime" :value="wechatConfig.createTime" />-->
                    <!--<input  type="hidden" name="updateUser" :value="wechatConfig.updateUser" />
                    <input  type="hidden" name="updateUserName" :value="wechatConfig.updateUserName" />
                    <input  type="hidden" name="updateTime" :value="wechatConfig.updateTime" />-->
                    <input  type="hidden" name="saasId" value="1" />
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >saasId: </label>
                        <label class="col-sm-3 control-label no-padding-right" >微信名: </label>
                        <div class="col-sm-2">
                            <select class="form-control m-b" name="saasId" id="saasList">
                               <!-- <option>&#45;&#45;请选择&#45;&#45;</option>-->
                                <option v-for="saas in saasList"  :value="saas.code" :selected="saas.code==wechatConfig.saasId ">{{saas.name}}</option>
                            </select>
                            <input type="text"  class="form-control"  name="name" style="width: 250px" required="true" :value="wechatConfig.name" />
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >公众号名: </label>
                        <label class="col-sm-2 control-label no-padding-right" >公众号类型: </label>
                        <div class="col-sm-5">
                            <input type="text"  class="form-control"  name="name" style="width: 250px" required="true" :value="wechatConfig.name" />
                            <select class="form-control m-b" name="type" required="true">
                                <option value="1" :selected="wechatConfig.type==1">服务号</option>
                                <option value="2" :selected="wechatConfig.status==2">订阅号</option>
                            </select>
                        </div>
                    </div>
@ -116,7 +113,7 @@
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >加密密钥: </label>
                        <div class="col-sm-5">
                            <input type="text"  class="form-control"  name="encodingAesKey" style="width: 250px" required="true" :value="wechatConfig.encodingAesKey"/>
                            <input type="text"  class="form-control"  name="encodingAesKey" style="width: 250px"  :value="wechatConfig.encodingAesKey"/>
                        </div>
                    </div>
@ -127,7 +124,7 @@
                        </div>
                        <label class="col-sm-2 control-label no-padding-right" >状态: </label>
                        <div class="col-sm-5">
                            <select class="form-control m-b" name="status">
                            <select class="form-control m-b" name="status" required="true">
                                <!--<option value="">&#45;&#45;请选择&#45;&#45;</option>-->
                                <option value="0" :selected="wechatConfig.status==0">待审核</option>
                                <option value="1" :selected="wechatConfig.status==1">审核通过</option>
@ -148,7 +145,7 @@
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >baseUrl:</label>
                        <label class="col-sm-3 control-label no-padding-right" >服务器地址:</label>
                        <div class="col-sm-2">
                            <input type="text"  class="form-control"  name="baseUrl" style="width: 250px" :value="wechatConfig.baseUrl"/>
                        </div>
@ -157,22 +154,12 @@
                            <input type="text"  class="form-control"  name="remark" style="width: 250px"  :value="wechatConfig.remark"/>
                        </div>
                    </div>
                    <div class="m-form-group">
                        <label class="col-sm-3 control-label no-padding-right" >公众号类型</label>
                        <div class="col-sm-2">
                            <select class="form-control m-b" name="type">
                                <option value="1" :selected="wechatConfig.type==1">服务号</option>
                                <option value="2" :selected="wechatConfig.status==2">订阅号</option>
                            </select>
                        </div>
                    </div>
                    <div class="modal-footer">
                        <button type="button" class="btn btn-default"
                                data-dismiss="modal">关闭
                        </button>
                        <button type="button" class="btn btn-primary" id="btnsubmit">
                        <button type="submit" class="btn btn-primary" id="btnsubmit">
                            提交
                        </button>
                    </div>
@ -196,6 +183,7 @@
<script type="text/javascript" src="/common/js/plugins/moment/moment.js"></script>
<!-- Data Tables -->
<script type="text/javascript" src="/common/js/plugins/dataTables/jquery.dataTables.js"></script>
<script type="text/javascript" src="/common/js/plugins/dataTables/dataTables.bootstrap.js"></script>
<script type="text/javascript" src="/wechat/wechatConfig/js/wechatConfigList.js"></script>

+ 22 - 43
svr/svr-manage/src/main/resources/webapp/html/wechat/wechatConfig/js/wechatConfigList.js

@ -2,7 +2,7 @@ var table;
var usercode = window.localStorage.getItem("userCode");
$(function () {
    table = $("#wechatList").DataTable({
            "aLengthMenu": [1, 2, 30, 40],
            "aLengthMenu": [1, 2, 3, 40],
            "searching": false,//禁用搜索
            "lengthChange": true,
            "paging": true,//开启表格分页
@ -12,8 +12,8 @@ $(function () {
            "sort": "position",
            "deferRender": true,//延迟渲染
            "bStateSave": false, //在第三页刷新页面,会自动到第一页
            "iDisplayLength": 10,//每页显示条数
            "iDisplayStart": 1, //当前页
            "iDisplayLength": 1,//每页显示条数
            "iDisplayStart": 0, //当前页
            "dom": '<l<\'#topPlugin\'>f>rt<ip><"clear">',
            "ordering": false,//全局禁用排序
            "ajax": {
@ -48,9 +48,9 @@ $(function () {
                    "orderable": false, // 禁用排序
                    "render": function (data, type, full, meta) {
                        if (data == 1) {
                            data = "<a href='#' class='upOrderStatus' >服务号</a>";
                            data = "服务号";
                        } else {
                            data = "<a href='#' class='upOrderStatus' >订阅号</a>";
                            data = "订阅号";
                        }
                        return data;
                    }
@ -61,13 +61,13 @@ $(function () {
                    "orderable": false, // 禁用排序
                    "render": function (data, type, full, meta) {
                        if (data == -1) {//类型 -1 已删除 0待审核 1审核通过 2 审核不通过
                            data = "<a href='#' class='upOrderStatus' >已删除</a>";
                            data = "已删除";
                        } else if (data == 0) {
                            data = "<a href='#' class='upOrderStatus' >待审核</a>";
                            data = "待审核";
                        } else if (data == 1) {
                            data = "<a href='#' class='upOrderStatus'>审核通过</a>";
                            data = "审核通过";
                        } else if (data == 2) {
                            data = "<a href='#' class='upOrderStatus' >审核不通过</a>";
                            data = "审核不通过";
                        }
                        return data;
                    }
@ -221,11 +221,7 @@ $(function () {
    $(document).delegate('.addBtn','click',function() {
        contentVM.wechatConfig='';
        $('#myModal-add-info').modal('show');
       setTimeout(function(){
           console.log($(':input','#myModal-add-info')
               .not(':button, :submit, :reset, :hidden').length)
           console.log("---------------------")
           $(':input','#myModal-add-info')
               .not(':button, :submit, :reset, :hidden')
               .val('')
@ -251,13 +247,6 @@ $(function () {
    });
    $(document).delegate('.upOrderStatus','click',function() {
        var id=$(this).data("id");
        //alert(id);
        $("#titleId").html(id);
        $('#editOrderStatus').modal("show");
    });
    //清空查询条件
    $(document).delegate('#reset','click',function() {
        $("#name").val("");
@ -299,45 +288,35 @@ function show(code){
}
function del(codes){
    var url = "/wechat/wechatConfig/"+codes+"?userCode="+usercode;
    var url = "/wechat/wechatConfig/"+codes;
    do_delete(url,{},function(data){
        if(data.successFlg==true){
            alert("删除成功");
            table.ajax.reload();
        }else{
            alert("删除失败")
        }
        alert("删除成功");
        table.ajax.reload();
    })
}
$("#btnsubmit").click(function(){
$("#category_add").submit(function(){
    var url = "";
    var id = $("#id").val();
    var data = $("#category_add").serialize();
    if(id==''){//说明是保存
        url = "/wechat/wechatConfig"
        do_post(url,data,function(data){
            if(data.successFlg){
                alert("保存成功");
                $('#myModal-add-info').modal('hide');
                table.ajax.reload();
                return;
            }
            alert(data.errorMsg);
            alert("保存成功");
            $('#myModal-add-info').modal('hide');
            table.ajax.reload();
            return;
        })
    }else{//说明是修改
        url="/wechat/wechatConfig?userCode="+usercode;
        do_put(url,data,function(data){
            console.log(data);
            if(data.successFlg){
                alert("修改成功");
                $('#myModal-add-info').modal('hide');
                table.ajax.reload();
                return;
            }
            alert(data.errorMsg);
            alert("修改成功");
            $('#myModal-add-info').modal('hide');
            table.ajax.reload();
            return;
        })
    }
    return false;
})

+ 10 - 0
svr/svr-quota/src/main/java/com/yihu/jw/quota/controller/JobController.java

@ -54,4 +54,14 @@ public class JobController extends BaseController {
        System.out.println(file.getSize()+"");
        return null;
    }
    /**
     *
     * @return
     */
    @GetMapping("/hello")
    public String hello() {
        System.out.println("hello");
        return null;
    }
}

+ 1 - 1
svr/svr-quota/src/main/java/com/yihu/jw/quota/etl/extract/ExtractHelper.java

@ -47,7 +47,7 @@ public class ExtractHelper {
     * @return
     * @throws Exception
     */
    public List<SaveModel> extractData(QuotaVo quotaVO, String startTime, String endTime, String timeLevel, String saasid) throws Exception {
    public List<SaveModel> extractData(QuotaVo quotaVO, String startTime, String endTime,String timeLevel,String saasid) throws Exception {
        try {
            //得到该指标的数据来源
            TjQuotaDataSource quotaDataSource = dataSourceService.findSourceByQuotaCode(quotaVO.getCode());

+ 22 - 14
svr/svr-quota/src/main/java/com/yihu/jw/quota/etl/extract/es/EsExtract.java

@ -22,6 +22,7 @@ import org.elasticsearch.search.SearchHits;
import org.elasticsearch.search.aggregations.Aggregation;
import org.elasticsearch.search.aggregations.Aggregations;
import org.elasticsearch.search.aggregations.InternalAggregations;
import org.elasticsearch.search.aggregations.bucket.terms.LongTerms;
import org.elasticsearch.search.aggregations.bucket.terms.StringTerms;
import org.elasticsearch.search.aggregations.bucket.terms.Terms;
import org.elasticsearch.search.aggregations.bucket.terms.TermsBuilder;
@ -86,7 +87,7 @@ public class EsExtract {
    }
    private Map<String, SaveModel> setAllSlaveData(Map<String, SaveModel> allData, List<DictModel> dictData,Integer key) {
    private Map<String, SaveModel> setAllSlaveData(Map<String, SaveModel> allData, List<DictModel> dictData, Integer key) {
        try {
            Map<String, SaveModel> returnAllData = new HashMap<>();
            for (Map.Entry<String, SaveModel> one : allData.entrySet()) {
@ -174,7 +175,7 @@ public class EsExtract {
        allData.put(key, one);
    }
    private  List<SaveModel> queryEsBySql(Map<String, TjQuotaDimensionMain> sqls, List<TjQuotaDimensionSlave> tjQuotaDimensionSlaves) {
    private List<SaveModel> queryEsBySql(Map<String, TjQuotaDimensionMain> sqls, List<TjQuotaDimensionSlave> tjQuotaDimensionSlaves) {
        List<SaveModel> returnList = new ArrayList<>();
        //初始化es链接
        esConfig = (EsConfig) JSONObject.toBean(JSONObject.fromObject(esConfig), EsConfig.class);
@ -210,7 +211,7 @@ public class EsExtract {
                StringTerms stringTerms = (StringTerms) response.getAggregations().asList().get(0);
                Iterator<Terms.Bucket> gradeBucketIt = stringTerms.getBuckets().iterator();
                //里面存放的数据 例  350200-5-2-2    主维度  细维度1  细维度2  值
                Map<String,Integer> map = new HashMap<>();
                Map<String, Integer> map = new HashMap<>();
                //递归解析json
                expainJson(gradeBucketIt, map, null);
@ -228,13 +229,13 @@ public class EsExtract {
    private void compute(List<TjQuotaDimensionSlave> tjQuotaDimensionSlaves, List<SaveModel> returnList, Map.Entry<String, TjQuotaDimensionMain> one, Map<String, Integer> map) {
        Map<String, SaveModel> allData = new HashMap<>();
        //初始化主细维度
        allData= initDimension(tjQuotaDimensionSlaves, one, allData);
        allData = initDimension(tjQuotaDimensionSlaves, one, allData);
        for(Map.Entry<String,SaveModel> oneMap:allData.entrySet()){
            String key=oneMap.getKey();
            SaveModel saveModel=oneMap.getValue();
            Integer num=map.get(key);
            if(saveModel!=null){
        for (Map.Entry<String, SaveModel> oneMap : allData.entrySet()) {
            String key = oneMap.getKey();
            SaveModel saveModel = oneMap.getValue();
            Integer num = map.get(key);
            if (saveModel != null) {
                saveModel.setResult(num);
                returnList.add(saveModel);
            }
@ -244,7 +245,7 @@ public class EsExtract {
    /**
     * 初始化主细维度
     */
    private  Map<String, SaveModel>  initDimension(List<TjQuotaDimensionSlave> tjQuotaDimensionSlaves, Map.Entry<String, TjQuotaDimensionMain> one, Map<String, SaveModel> allData) {
    private Map<String, SaveModel> initDimension(List<TjQuotaDimensionSlave> tjQuotaDimensionSlaves, Map.Entry<String, TjQuotaDimensionMain> one, Map<String, SaveModel> allData) {
        TjQuotaDimensionMain quotaDimensionMain = one.getValue();
        //查询字典数据
        List<SaveModel> dictData = jdbcTemplate.query(quotaDimensionMain.getDictSql(), new BeanPropertyRowMapper(SaveModel.class));
@ -253,8 +254,8 @@ public class EsExtract {
        for (int i = 0; i < tjQuotaDimensionSlaves.size(); i++) {
           List<DictModel> dictDataSlave = jdbcTemplate.query(tjQuotaDimensionSlaves.get(i).getDictSql(), new BeanPropertyRowMapper(DictModel.class));
            allData = setAllSlaveData(allData, dictDataSlave,i);
            List<DictModel> dictDataSlave = jdbcTemplate.query(tjQuotaDimensionSlaves.get(i).getDictSql(), new BeanPropertyRowMapper(DictModel.class));
            allData = setAllSlaveData(allData, dictDataSlave, i);
        }
        return allData;
    }
@ -266,7 +267,7 @@ public class EsExtract {
     * @param map
     * @param sb
     */
    private void expainJson(Iterator<Terms.Bucket> gradeBucketIt,Map<String,Integer>map, StringBuffer sb) {
    private void expainJson(Iterator<Terms.Bucket> gradeBucketIt, Map<String, Integer> map, StringBuffer sb) {
        while (gradeBucketIt.hasNext()) {
            StringTerms.Bucket b = (StringTerms.Bucket) gradeBucketIt.next();
            if (b.getAggregations().asList().get(0) instanceof StringTerms) {
@ -276,9 +277,16 @@ public class EsExtract {
                    StringBuffer sbTemp = new StringBuffer((sb == null ? "" : (sb.toString() + "-")) + b.getKey());
                    expainJson(gradeBucketItCh, map, sbTemp);
                }
            } else if (b.getAggregations().asList().get(0) instanceof LongTerms) {
                LongTerms stringTermsCh = (LongTerms) b.getAggregations().asList().get(0);
                Iterator<Terms.Bucket> gradeBucketItCh = stringTermsCh.getBuckets().iterator();
                while (gradeBucketItCh.hasNext()) {
                    StringBuffer sbTemp = new StringBuffer((sb == null ? "" : (sb.toString() + "-")) + b.getKey());
                    expainJson(gradeBucketItCh, map, sbTemp);
                }
            } else {
                InternalValueCount count = (InternalValueCount) b.getAggregations().asList().get(0);
                map.put(new StringBuffer(sb.toString() + "-" + b.getKey()).toString() , (int)count.getValue());
                map.put(new StringBuffer(sb.toString() + "-" + b.getKey()).toString(), (int) count.getValue());
            }
        }
    }

+ 1 - 1
svr/svr-quota/src/main/java/com/yihu/jw/quota/vo/QuotaVo.java

@ -4,7 +4,7 @@ import java.io.Serializable;
import java.util.Date;
/**
 * Created by chenweida on 2017/6/1. test
 * Created by chenweida on 2017/6/1.
 */
public class QuotaVo implements Serializable{
    private Integer id;

+ 8 - 8
web-gateway/src/main/java/com/yihu/jw/commnon/base/wx/WechatContants.java

@ -16,15 +16,15 @@ public class WechatContants {
    //微信按钮模块常量
    public static class Menu{
        public static final String api_common="menu";
        public static final String api_create="create";
        public static final String api_delete="delete";
        public static final String api_getByCode="getByCode";
        public static final String api_update="update";
        public static final String api_getWxMenus="getWxMenus";
        public static final String api_getWxMenuNoPage="getWxMenuNoPage";
        public static final String api_create="wxMenu";
        public static final String api_update="wxMenu";
        public static final String api_delete="wxMenu/{codes}/{userCode}";
        public static final String api_getWxMenuNoPage="wxMenu/listNoPage";
        public static final String api_getWxMenus="wxMenu/list";
        public static final String api_getByCode="wxMenu/{code}";
        public static final String api_getParentMenu="parentMenu/{wechatCode}";
        public static final String api_createMenu="createMenu";
        public static final String api_getChildMenus="childMenu/list/{parentCode}";
    }
    //微信模板消息

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

@ -56,12 +56,8 @@ public class WechatConfigController {
    public Envelop updateWechat(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        JSONObject json = new JSONObject(jsonData);
        String data = json.get("jsonData").toString();
        data = data.substring(2,data.length() - 2);
        data = data.replaceAll("\\\\\"","\"");
        tracer.getCurrentSpan().logEvent("更新微信配置:jsonData="+data);
        Envelop wechat =wechatFegin.updateWechat(data);
        tracer.getCurrentSpan().logEvent("更新微信配置:jsonData="+jsonData);
        Envelop wechat =wechatFegin.updateWechat(jsonData);
        return wechat;
    }
@ -73,8 +69,12 @@ public class WechatConfigController {
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWechat(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes) throws JiWeiException {
        Envelop wechat =wechatFegin.deleteWechat(codes);
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        Envelop wechat =wechatFegin.deleteWechat(codes,userCode,userName);
        return wechat;
    }

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

@ -61,12 +61,8 @@ public class WechatGraphicMessageController {
    public Envelop updateWxGraphicMessage(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        JSONObject json = new JSONObject(jsonData);
        String data = json.get("jsonData").toString();
        data = data.substring(2,data.length() - 2);
        data = data.replaceAll("\\\\\"","\"");
        tracer.getCurrentSpan().logEvent("更新图文消息:jsonData="+data);
        return graphicMessageFegin.updateWxGraphicMessage(data);
        tracer.getCurrentSpan().logEvent("更新图文消息:jsonData="+jsonData);
        return graphicMessageFegin.updateWxGraphicMessage(jsonData);
    }
    @ApiVersion(1)
@ -77,8 +73,12 @@ public class WechatGraphicMessageController {
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWxGraphicMessage(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes) throws JiWeiException {
        return graphicMessageFegin.deleteWxGraphicMessage(codes);
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        return graphicMessageFegin.deleteWxGraphicMessage(codes,userCode,userName);
    }
    @ApiVersion(1)

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

@ -5,9 +5,13 @@ import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import com.yihu.jw.commnon.base.wx.WechatContants;
import com.yihu.jw.fegin.base.wx.WechatMenuFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang.StringUtils;
import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
@ -19,7 +23,7 @@ import org.springframework.web.bind.annotation.*;
 * Created by Administrator on 2017/5/31 0031.
 */
@RestController
@RequestMapping(WechatContants.Menu.api_common)
@RequestMapping("{version}/"+WechatContants.api_common)
@Api(description = "微信菜单配置")
public class WechatMenuController {
@ -31,6 +35,7 @@ public class WechatMenuController {
    @Autowired
    private Tracer tracer;
    @ApiVersion(1)
    @PostMapping(value = WechatContants.Menu.api_create, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "添加微信菜单", notes = "添加微信菜单")
    @HystrixCommand(commandProperties = {
@ -38,10 +43,13 @@ public class WechatMenuController {
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop createWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("创建微信菜单:jsonData="+jsonData);
        //{"id":null,"code":"","saasId":"1","name":"aaaawefr","token":"","encodingAesKey":"","encType":null,"status":0,"type":"1","appId":"","appSecret":"","baseUrl":"","createUser":"","createUserName":"","createTime":null,"updateUser":null,"updateUserName":null,"updateTime":null,"remark":""}
        return wechatMenuFegin.createWxMenu(jsonData);
    }
    @PutMapping(value = WechatContants.Menu.api_update, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "修改微信菜单", notes = "修改微信菜单")
    @HystrixCommand(commandProperties = {
@ -49,31 +57,36 @@ public class WechatMenuController {
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop updateWxMenu(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) {
            @RequestBody String jsonData) throws JiWeiException {
        tracer.getCurrentSpan().logEvent("更新微信菜单:jsonData="+jsonData);
        return wechatMenuFegin.updateWxMenu(jsonData);
    }
    @ApiVersion(1)
    @DeleteMapping(value = WechatContants.Menu.api_delete)
    @ApiOperation(value = "删除微信菜单", notes = "删除微信菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWxMenu(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code) {
        return wechatMenuFegin.deleteWxMenu(code);
    public Envelop delete(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        return wechatMenuFegin.deleteWxMenu(codes,userCode,userName);
    }
    @GetMapping(value = WechatContants.Menu.api_getByCode)
    @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop findByCode(
     @ApiOperation(value = "根据code查找微信菜单", notes = "根据code查找微信菜单")
     @HystrixCommand(commandProperties = {
             @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
             @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
     public Envelop findByCode(
            @ApiParam(name = "code", value = "code")
            @RequestParam(value = "code", required = true) String code
    ) {
            @PathVariable(value = "code", required = true) String code
    ) throws JiWeiException {
        return wechatMenuFegin.findByCode(code);
    }
@ -90,7 +103,15 @@ public class WechatMenuController {
            @RequestParam(value = "size", required = false) int size,
            @ApiParam(name = "page", value = "页码", defaultValue = "1")
            @RequestParam(value = "page", required = false) int page) throws Exception {
        return wechatMenuFegin.getWxMenus(fields,filters,sorts,size,page);
        String filterStr = "";
        if(StringUtils.isNotBlank(filters)){
            filters = filters.replaceAll("=", ":");
            JSONObject jsonResult = new JSONObject(filters);
            if(jsonResult.has("name")){
                filterStr+="name?"+jsonResult.get("name")+";";
            }
        }
        return wechatMenuFegin.getWxMenus(fields,filterStr,sorts,size,page);
    }
@ -124,4 +145,28 @@ public class WechatMenuController {
            @RequestParam(value = "wechatCode", required = true)String wechatCode){
        return wechatMenuFegin.createWechatMenu(wechatCode);
    }
    @GetMapping(value = WechatContants.Menu.api_getParentMenu)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getParentMenu(
            @ApiParam(name = "wechatCode", value = "wechatCode")
            @PathVariable(value = "wechatCode", required = true) String wechatCode
    ) throws JiWeiException {
        return wechatMenuFegin.getParentMenu(wechatCode);
    }
    @GetMapping(value = WechatContants.Menu.api_getChildMenus)
    @ApiOperation(value = "根据微信code查找父菜单", notes = "根据微信code查找父菜单")
    @HystrixCommand(commandProperties = {
            @HystrixProperty(name = "execution.isolation.thread.timeoutInMilliseconds", value = "-1"),//超时时间
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop getChildMenus(
            @ApiParam(name = "parentCode", value = "parentCode")
            @PathVariable(value = "parentCode", required = true) String parentCode
    ) throws JiWeiException {
        return wechatMenuFegin.getChildMenus(parentCode);
    }
}

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

@ -58,12 +58,8 @@ public class WechatTemplateControlle {
    public Envelop updateWxTemplate(
            @ApiParam(name = "json_data", value = "", defaultValue = "")
            @RequestBody String jsonData) throws JiWeiException {
        JSONObject json = new JSONObject(jsonData);
        String data = json.get("jsonData").toString();
        data = data.substring(2,data.length() - 2);
        data = data.replaceAll("\\\\\"","\"");
        tracer.getCurrentSpan().logEvent("更新模板配置:jsonData="+data);
        return wechatTemplateFegin.updateWxTemplate(data);
        tracer.getCurrentSpan().logEvent("更新模板配置:jsonData="+jsonData);
        return wechatTemplateFegin.updateWxTemplate(jsonData);
    }
@ -75,8 +71,12 @@ public class WechatTemplateControlle {
            @HystrixProperty(name = "execution.timeout.enabled", value = "false") })
    public Envelop deleteWxTemplate(
            @ApiParam(name = "codes", value = "codes")
            @PathVariable(value = "codes", required = true) String codes) throws JiWeiException {
        return wechatTemplateFegin.deleteWxTemplate(codes);
            @PathVariable(value = "codes", required = true) String codes,
            @ApiParam(name = "userCode", value = "userCode")
            @RequestParam(value = "userCode", required = true) String userCode,
            @ApiParam(name = "userName", value = "userName")
            @RequestParam(value = "userName", required = true) String userName) throws JiWeiException {
        return wechatTemplateFegin.deleteWxTemplate(codes,userCode,userName);
    }
    @ApiVersion(1)

+ 48 - 4
web-gateway/src/main/java/com/yihu/jw/controller/login/LoginController.java

@ -2,9 +2,12 @@ package com.yihu.jw.controller.login;
import com.yihu.jw.commnon.wlyy.PatientContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.version.ApiVersion;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
@ -14,11 +17,52 @@ import org.springframework.web.bind.annotation.*;
@RestController
@Api(value = "登陆相关操作", description = "登陆相关操作")
public class LoginController {
    @Autowired
    private Tracer tracer;
    @GetMapping(value = "/doctorlogin", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "医生登陆", notes = "医生登陆")
    public Envelop doctorlogin(
            @ApiParam(name = "account", value = "账号", defaultValue = "") @RequestParam(name = "account", required = true) String account,
            @ApiParam(name = "password", value = "密码", defaultValue = "") @RequestParam(name = "password", required = true) String password,
            @ApiParam(name = "type", value = "登陆方式(默认1):1账号密码 2账号验证码", defaultValue = "") @RequestParam(name = "type", required = true, defaultValue = "1") Integer type) throws Exception {
        //获取用户信息
        //判断用户是否存在
        //判断密码是否正确
        //获取用户的版本信息
        //获取用户的模块信息
        //用户登陆的信息放入缓存中
        //保存登陆日志
        return null;
    }
    @GetMapping(value = "/employLogin", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "患者登陆", notes = "患者登陆")
    public Envelop employLogin(
            @ApiParam(name = "account", value = "账号", defaultValue = "") @RequestParam(name = "account", required = true) String account,
            @ApiParam(name = "password", value = "密码", defaultValue = "") @RequestParam(name = "password", required = true) String password,
            @ApiParam(name = "type", value = "登陆方式(默认1):1账号密码 2账号验证码", defaultValue = "") @RequestParam(name = "type", required = true, defaultValue = "1") Integer type) throws Exception {
        //获取用户信息
        //判断用户是否存在
        //判断密码是否正确
        //获取用户的版本信息
        //用户登陆的信息放入缓存中
        //保存登陆日志
    @GetMapping(value = "/login", consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    @ApiOperation(value = "登陆", notes = "登陆")
    public Envelop create(
            @ApiParam(name = "account", value = "", defaultValue = "") @RequestParam(name = "account", required = true) String account) {
        return null;
    }
}

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

@ -29,7 +29,7 @@ public interface GraphicMessageFegin {
    Envelop updateWxGraphicMessage( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxGraphicMessage.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWxGraphicMessage(@RequestParam(value = "code") String codes) 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)
    Envelop findByCode(@RequestParam(value = "code") String code) throws JiWeiException;

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

@ -27,7 +27,7 @@ public interface WechatFegin {
    Envelop updateWechat(String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.Wechat.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWechat(@RequestParam(value = "codes") String codes) 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)
    Envelop findByCode(@RequestParam(value = "code") String code) throws JiWeiException;

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

@ -3,12 +3,11 @@ package com.yihu.jw.fegin.base.wx;
import com.yihu.jw.fegin.fallbackfactory.base.wx.WechatMenuFeginFallbackFactory;
import com.yihu.jw.restmodel.common.CommonContants;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import com.yihu.jw.restmodel.wx.WxContants;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
/**
 * Created by Administrator on 2017/5/31 0031.
@ -20,23 +19,23 @@ import org.springframework.web.bind.annotation.RequestParam;
@RequestMapping(value = WxContants.WxMenu.api_common)
public interface WechatMenuFegin {
    @RequestMapping(value = WxContants.WxMenu.api_create,method = RequestMethod.POST)
    Envelop createWxMenu( @RequestBody String jsonData) ;
    @RequestMapping(value = WxContants.WxMenu.api_create,method = RequestMethod.POST, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop createWxMenu( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_update,method = RequestMethod.PUT)
    Envelop updateWxMenu( @RequestBody String jsonData);
    @RequestMapping(value = WxContants.WxMenu.api_update,method = RequestMethod.PUT, consumes = MediaType.APPLICATION_JSON_UTF8_VALUE)
    Envelop updateWxMenu( @RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_delete,method = RequestMethod.DELETE)
    Envelop deleteWxMenu(@RequestParam(value="code")String code);
    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)
    Envelop findByCode(@RequestParam(value="code")String code);
    Envelop findByCode(@RequestParam(value="code")String code) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getWxMenuNoPage,method = RequestMethod.GET)
    Envelop getWxMenuNoPage(
            @RequestParam(value = "fields", required = false) String fields,
            @RequestParam(value = "filters", required = false) String filters,
            @RequestParam(value = "sorts", required = false) String sorts);
            @RequestParam(value = "sorts", required = false) String sorts) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getWxMenus,method = RequestMethod.GET)
    Envelop getWxMenus(
@ -44,8 +43,14 @@ public interface WechatMenuFegin {
            @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);
            @RequestParam(value = "page", required = false) int page) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_createMenu ,method = RequestMethod.GET)
    Envelop createWechatMenu(@RequestParam(value = "wechatCode", required = true)String wechatCode);
    @RequestMapping(value = WxContants.WxMenu.api_getParentMenu,method = RequestMethod.GET)
    Envelop getParentMenu(@PathVariable(value = "wechatCode", required = true) String wechatCode) throws JiWeiException;
    @RequestMapping(value = WxContants.WxMenu.api_getChildMenus,method = RequestMethod.GET)
    Envelop getChildMenus(@PathVariable(value = "parentCode", required = true) String parentCode) throws JiWeiException;
}

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

@ -26,7 +26,7 @@ public interface WechatTemplateFegin {
    Envelop updateWxTemplate(@RequestBody String jsonData) throws JiWeiException;
    @RequestMapping(value = WxContants.WxTemplate.api_delete ,method = RequestMethod.DELETE)
    Envelop deleteWxTemplate( @RequestParam(value = "code", required = true) String code) 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)
    Envelop findByCode( @RequestParam(value = "code", required = true) String code) throws JiWeiException;

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

@ -36,7 +36,7 @@ public class GraphicMessageFeginFallbackFactory implements FallbackFactory<Graph
            }
            @Override
            public Envelop deleteWxGraphicMessage(String codes) throws JiWeiException {
            public Envelop deleteWxGraphicMessage(String codes,String userCode,String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除微信配置失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:"+codes);
                throw new JiWeiException(e);

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

@ -31,7 +31,7 @@ public class WechatFeginFallbackFactory implements FallbackFactory<WechatFegin>
                throw new JiWeiException(e);
            }
            public Envelop deleteWechat(String codes) throws JiWeiException {
            public Envelop deleteWechat(String codes,String userCode,String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除微信配置失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:"+codes);
                throw new JiWeiException(e);

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

@ -2,40 +2,62 @@ package com.yihu.jw.fegin.fallbackfactory.base.wx;
import com.yihu.jw.fegin.base.wx.WechatMenuFegin;
import com.yihu.jw.restmodel.common.Envelop;
import com.yihu.jw.restmodel.exception.business.JiWeiException;
import feign.hystrix.FallbackFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.sleuth.Tracer;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PathVariable;
/**
 * Created by Administrator on 2017/5/31 0031.
 */
@Component
public class WechatMenuFeginFallbackFactory implements FallbackFactory<WechatMenuFegin> {
    @Autowired
    private Tracer tracer;
    @Override
    public WechatMenuFegin create(Throwable throwable) {
    public WechatMenuFegin create(Throwable e) {
        return new WechatMenuFegin() {
            @Override
            public Envelop createWxMenu(String jsonData) {
                return null;
            public Envelop createWxMenu(String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("创建微信菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:"+jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop updateWxMenu(String jsonData) {
                return null;
            public Envelop updateWxMenu(String jsonData) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("更新微信菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("jsonData:"+jsonData);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop deleteWxMenu(String code) {
                return null;
            public Envelop deleteWxMenu(String codes,String userCode,String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除微信菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:"+codes);
                tracer.getCurrentSpan().logEvent("操作人userCode:"+userCode);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop findByCode(String code) {
                return null;
            public Envelop findByCode(String code) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找微信菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("code:"+code);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getWxMenuNoPage(String fields, String filters, String sorts) {
                return null;
            public Envelop getWxMenuNoPage(String fields, String filters, String sorts) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("查找微信菜单列表失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filters);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                throw new JiWeiException(e);
            }
@ -45,8 +67,28 @@ public class WechatMenuFeginFallbackFactory implements FallbackFactory<WechatMen
            }
            @Override
            public Envelop getWxMenus(String fields, String filters, String sorts, int size, int page) {
                return null;
            public Envelop getParentMenu(@PathVariable String wechatCode) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("根据微信code查找父菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("wechatCode:"+wechatCode);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getChildMenus(@PathVariable(value = "parentCode", required = true) String parentCode) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("根据父级菜单code查找子菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("parentCode:"+parentCode);
                throw new JiWeiException(e);
            }
            @Override
            public Envelop getWxMenus(String fields, String filters, String sorts, int size, int page) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("分页查找微信菜单失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("fields:" + fields);
                tracer.getCurrentSpan().logEvent("filters:" + filters);
                tracer.getCurrentSpan().logEvent("sorts:" + sorts);
                tracer.getCurrentSpan().logEvent("size:" + size);
                tracer.getCurrentSpan().logEvent("page:" + page);
                throw new JiWeiException(e);
            }
        };
    }

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

@ -35,7 +35,7 @@ public class WechatTemplateFeginFallbackFactory implements FallbackFactory<Wecha
            }
            @Override
            public Envelop deleteWxTemplate(String codes) throws JiWeiException {
            public Envelop deleteWxTemplate(String codes,String userCode,String userName) throws JiWeiException {
                tracer.getCurrentSpan().logEvent("删除微信模板消息失败:原因:"+e.getMessage());
                tracer.getCurrentSpan().logEvent("codes:"+codes);
                throw new JiWeiException(e);

+ 3 - 2
web-gateway/src/main/resources/application.yml

@ -27,8 +27,9 @@ zuul:
    svr-base: /v1/base/**  ##svr-base方向代理到/base下多层级的路径
    svr-wlyy: /v1/wlyy/**
    api-esb-url:
      path: /zuul/job/**
      url: http://localhost:10030/
      path: /job/**
      url: http://192.168.131.131:10030/
      stripPrefix: false ##如果是物理服务器要设置成false
#    svr-base:    这种方式和  svr-base: /base/**  一样  svr-base可以随便写 唯一即可
#      path: /base/**  path是代理后的路径
#      serviceId: svr-base  serviceId是微服务name