Ver código fonte

Merge branch 'dev' of http://192.168.1.220:10080/jiwei/wlyy2.0 into dev

Conflicts:
	svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/servicePackage/ServicePackageEndpoint.java
yeshijie 6 anos atrás
pai
commit
0bde557bd1
23 arquivos alterados com 878 adições e 14 exclusões
  1. 117 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceDO.java
  2. 57 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceErrorCodeDO.java
  3. 107 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceParamDO.java
  4. 49 0
      common/common-entity/src/main/java/com/yihu/jw/entity/base/module/ModuleDO.java
  5. 1 0
      common/common-exception/src/main/java/com/yihu/jw/exception/code/BaseErrorCode.java
  6. 7 4
      common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java
  7. 54 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceErrorCodeVO.java
  8. 104 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceParamVO.java
  9. 113 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceVO.java
  10. 20 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/ModuleVO.java
  11. 13 0
      common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/MenuVO.java
  12. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/contant/MenuContant.java
  13. 14 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceDao.java
  14. 14 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceErrorCodeDao.java
  15. 14 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceParamDao.java
  16. 8 0
      svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/ModuleDao.java
  17. 56 1
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/module/ModuleEndpoint.java
  18. 38 4
      svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/MenuEndpoint.java
  19. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceErrorCodeService.java
  20. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceParamService.java
  21. 16 0
      svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceService.java
  22. 40 1
      svr/svr-base/src/main/java/com/yihu/jw/base/service/module/ModuleService.java
  23. 2 2
      svr/svr-base/src/main/java/com/yihu/jw/base/service/role/MenuService.java

+ 117 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceDO.java

@ -0,0 +1,117 @@
package com.yihu.jw.entity.base.module;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 接口
 * @author yeshijie on 2018/9/28.
 */
@Entity
@Table(name = "base_interface")
public class InterfaceDO extends UuidIdentityEntity {
    private String name;//接口名称
    private String moduleId;//模块id
    private String moduleName;//模块名称
    private String methodName;//方法名
    private Integer protocolType;//协议类型(2restful,1webservice)
    private Integer openLevel;//开发程度(1公开,2私有)
    private Integer checkLevel;//审计程度(1审计,2不审计)
    private Integer status;//状态(1生效中,0已失效)
    private String remark;//接口说明
    private String url;//https请求地址
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "module_id")
    public String getModuleId() {
        return moduleId;
    }
    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }
    @Column(name = "module_name")
    public String getModuleName() {
        return moduleName;
    }
    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }
    @Column(name = "method_name")
    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    @Column(name = "protocol_type")
    public Integer getProtocolType() {
        return protocolType;
    }
    public void setProtocolType(Integer protocolType) {
        this.protocolType = protocolType;
    }
    @Column(name = "open_level")
    public Integer getOpenLevel() {
        return openLevel;
    }
    public void setOpenLevel(Integer openLevel) {
        this.openLevel = openLevel;
    }
    @Column(name = "check_level")
    public Integer getCheckLevel() {
        return checkLevel;
    }
    public void setCheckLevel(Integer checkLevel) {
        this.checkLevel = checkLevel;
    }
    @Column(name = "status")
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    @Column(name = "remark")
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    @Column(name = "url")
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
}

+ 57 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceErrorCodeDO.java

@ -0,0 +1,57 @@
package com.yihu.jw.entity.base.module;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 接口错误说明
 * @author yeshijie on 2018/9/28.
 */
@Entity
@Table(name = "base_interface_error_code")
public class InterfaceErrorCodeDO extends UuidIdentityEntity {
    private String interfaceId;//接口id
    private String name;//错误码名称
    private String describe;//错误码描述
    private String solution;//解决方案
    @Column(name = "interface_id")
    public String getInterfaceId() {
        return interfaceId;
    }
    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    }
    @Column(name = "solution")
    public String getSolution() {
        return solution;
    }
    public void setSolution(String solution) {
        this.solution = solution;
    }
}

+ 107 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/InterfaceParamDO.java

@ -0,0 +1,107 @@
package com.yihu.jw.entity.base.module;
import com.yihu.jw.entity.UuidIdentityEntity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
/**
 * 接口入参出参
 * @author yeshijie on 2018/9/28.
 */
@Entity
@Table(name = "base_interface_param")
public class InterfaceParamDO extends UuidIdentityEntity {
    
    private String interfaceId;//接口id
    private String name;//参数名
    private Integer paramType;//参数类型
    private Integer dataType;//数据类型
    private Integer isRequire;//是否必填(1是,0否)
    private Integer maxLength;//最大长度
    private String describe;//描述
    private String example;//示例
    private Integer type;//类型(1入参,2出参)
    @Column(name = "interface_id")
    public String getInterfaceId() {
        return interfaceId;
    }
    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "param_type")
    public Integer getParamType() {
        return paramType;
    }
    public void setParamType(Integer paramType) {
        this.paramType = paramType;
    }
    @Column(name = "data_type")
    public Integer getDataType() {
        return dataType;
    }
    public void setDataType(Integer dataType) {
        this.dataType = dataType;
    }
    @Column(name = "is_require")
    public Integer getIsRequire() {
        return isRequire;
    }
    public void setIsRequire(Integer isRequire) {
        this.isRequire = isRequire;
    }
    @Column(name = "max_length")
    public Integer getMaxLength() {
        return maxLength;
    }
    public void setMaxLength(Integer maxLength) {
        this.maxLength = maxLength;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    }
    @Column(name = "example")
    public String getExample() {
        return example;
    }
    public void setExample(String example) {
        this.example = example;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}

+ 49 - 0
common/common-entity/src/main/java/com/yihu/jw/entity/base/module/ModuleDO.java

@ -46,6 +46,35 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
		}
	}
	public enum Type {
		common("通用", 0),
		doctor("医生端", 1),
		patient("居民端", 2);
		private String name;
		private Integer value;
		Type(String name, Integer value) {
			this.name = name;
			this.value = value;
		}
		public String getName() {
			return name;
		}
		public void setName(String name) {
			this.name = name;
		}
		public Integer getValue() {
			return value;
		}
		public void setValue(Integer value) {
			this.value = value;
		}
	}
	//模块名称
	private String name;
	//模块连接
@ -60,6 +89,8 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
	private String remark;
	//0-表示有子节点,1-表示没有子节点
	private Integer isEnd ;
	//0-表示非必选,1-表示必选
	private Integer isMust ;
	//逻辑删除标志1正常,0删除
	private Integer del ;
	//子集
@ -112,6 +143,15 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
		this.url = url;
	}
	@Column(name = "type")
	public Integer getType() {
		return type;
	}
	public void setType(Integer type) {
		this.type = type;
	}
	@Column(name = "is_end")
	public Integer getIsEnd() {
		return isEnd;
@ -130,6 +170,15 @@ public class ModuleDO extends UuidIdentityEntityWithOperator {
		this.del = del;
	}
	@Column(name = "is_must")
	public Integer getIsMust() {
		return isMust;
	}
	public void setIsMust(Integer isMust) {
		this.isMust = isMust;
	}
	@Transient
	public List<ModuleDO> getChildren() {
		return children;

+ 1 - 0
common/common-exception/src/main/java/com/yihu/jw/exception/code/BaseErrorCode.java

@ -48,6 +48,7 @@ public class BaseErrorCode {
     */
    public static class Module{
        public static final String FINDDICTBYCODE = "-103000";
        public static final String NAME_IS_EXIST = "-103001";
    }
    /**

+ 7 - 4
common/common-request-mapping/src/main/java/com/yihu/jw/rm/base/BaseRequestMapping.java

@ -55,7 +55,9 @@ public class BaseRequestMapping {
     */
    public static class Module extends Basic {
        public static final String PREFIX  = "/module";
        public static final String STATUS  = "/status";
        public static final String IS_NAME_EXIST  = "/isNameExist";
        public static final String FIND_ALL  = "/findAll";
    }
    /**
@ -129,9 +131,10 @@ public class BaseRequestMapping {
    public static class Menu extends Basic {
        public static final String PREFIX  = "/menu";
        public static final String STATUS  = "/status";
        public static final String ISNAMEEXIST  = "/isNameExist";
        public static final String MOVEUP  = "/moveUp";
        public static final String MOVEDOWN  = "/moveDown";
        public static final String IS_NAME_EXIST  = "/isNameExist";
        public static final String MOVE_UP  = "/moveUp";
        public static final String MOVE_DOWN  = "/moveDown";
        public static final String FIND_ALL  = "/findAll";
    }
    /**

+ 54 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceErrorCodeVO.java

@ -0,0 +1,54 @@
package com.yihu.jw.restmodel.base.module;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import javax.persistence.Column;
/**
 * @author yeshijie on 2018/9/28.
 */
@ApiModel(value = "InterfaceVO", description = "接口错误说明")
public class InterfaceErrorCodeVO extends UuidIdentityVO {
    private String interfaceId;//接口id
    private String name;//错误码名称
    private String describe;//错误码描述
    private String solution;//解决方案
    @Column(name = "interface_id")
    public String getInterfaceId() {
        return interfaceId;
    }
    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    }
    @Column(name = "solution")
    public String getSolution() {
        return solution;
    }
    public void setSolution(String solution) {
        this.solution = solution;
    }
}

+ 104 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceParamVO.java

@ -0,0 +1,104 @@
package com.yihu.jw.restmodel.base.module;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import javax.persistence.Column;
/**
 * @author yeshijie on 2018/9/28.
 */
@ApiModel(value = "InterfaceVO", description = "接口入参出参")
public class InterfaceParamVO extends UuidIdentityVO {
    
    private String interfaceId;//接口id
    private String name;//参数名
    private Integer paramType;//参数类型
    private Integer dataType;//数据类型
    private Integer isRequire;//是否必填(1是,0否)
    private Integer maxLength;//最大长度
    private String describe;//描述
    private String example;//示例
    private Integer type;//类型(1入参,2出参)
    @Column(name = "interface_id")
    public String getInterfaceId() {
        return interfaceId;
    }
    public void setInterfaceId(String interfaceId) {
        this.interfaceId = interfaceId;
    }
    @Column(name = "name")
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    @Column(name = "param_type")
    public Integer getParamType() {
        return paramType;
    }
    public void setParamType(Integer paramType) {
        this.paramType = paramType;
    }
    @Column(name = "data_type")
    public Integer getDataType() {
        return dataType;
    }
    public void setDataType(Integer dataType) {
        this.dataType = dataType;
    }
    @Column(name = "is_require")
    public Integer getIsRequire() {
        return isRequire;
    }
    public void setIsRequire(Integer isRequire) {
        this.isRequire = isRequire;
    }
    @Column(name = "max_length")
    public Integer getMaxLength() {
        return maxLength;
    }
    public void setMaxLength(Integer maxLength) {
        this.maxLength = maxLength;
    }
    @Column(name = "describe")
    public String getDescribe() {
        return describe;
    }
    public void setDescribe(String describe) {
        this.describe = describe;
    }
    @Column(name = "example")
    public String getExample() {
        return example;
    }
    public void setExample(String example) {
        this.example = example;
    }
    @Column(name = "type")
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
}

+ 113 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/InterfaceVO.java

@ -0,0 +1,113 @@
package com.yihu.jw.restmodel.base.module;
import com.yihu.jw.restmodel.UuidIdentityVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
 * @author yeshijie on 2018/9/28.
 */
@ApiModel(value = "InterfaceVO", description = "接口")
public class InterfaceVO extends UuidIdentityVO {
    @ApiModelProperty(value = "接口名称", example = "接口1")
    private String name;
    @ApiModelProperty(value = "模块id", example = "模块1d")
    private String moduleId;
    @ApiModelProperty(value = "模块名称", example = "模块名称")
    private String moduleName;
    @ApiModelProperty(value = "方法名", example = "方法1")
    private String methodName;
    @ApiModelProperty(value = "协议类型(2restful,1webservice)", example = "1")
    private Integer protocolType;
    @ApiModelProperty(value = "开发程度(1公开,2私有)", example = "1")
    private Integer openLevel;
    @ApiModelProperty(value = "审计程度(1审计,2不审计)", example = "1")
    private Integer checkLevel;
    @ApiModelProperty(value = "状态(1生效中,0已失效)", example = "1")
    private Integer status;
    @ApiModelProperty(value = "接口说明", example = "明")
    private String remark;
    @ApiModelProperty(value = "https请求地址", example = "https://")
    private String url;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getModuleId() {
        return moduleId;
    }
    public void setModuleId(String moduleId) {
        this.moduleId = moduleId;
    }
    public String getModuleName() {
        return moduleName;
    }
    public void setModuleName(String moduleName) {
        this.moduleName = moduleName;
    }
    public String getMethodName() {
        return methodName;
    }
    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }
    public Integer getProtocolType() {
        return protocolType;
    }
    public void setProtocolType(Integer protocolType) {
        this.protocolType = protocolType;
    }
    public Integer getOpenLevel() {
        return openLevel;
    }
    public void setOpenLevel(Integer openLevel) {
        this.openLevel = openLevel;
    }
    public Integer getCheckLevel() {
        return checkLevel;
    }
    public void setCheckLevel(Integer checkLevel) {
        this.checkLevel = checkLevel;
    }
    public Integer getStatus() {
        return status;
    }
    public void setStatus(Integer status) {
        this.status = status;
    }
    public String getRemark() {
        return remark;
    }
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public String getUrl() {
        return url;
    }
    public void setUrl(String url) {
        this.url = url;
    }
}

+ 20 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/module/ModuleVO.java

@ -20,12 +20,16 @@ public class ModuleVO extends UuidIdentityVOWithOperator {
    private String parentId;
    @ApiModelProperty(value = "url", example = "/doctor/*")
    private String url;
    @ApiModelProperty(value = "类型", example = "0通用,1医生端你,2居民端")
    private String type;
    @ApiModelProperty(value = "状态", example = "1有效,0失效")
    private Integer status;
    @ApiModelProperty(value = "备注", example = "我是备注")
    private String remark;
    @ApiModelProperty(value = "节点信息(0-表示有子节点,1-表示没有子节点)", example = "1")
    private Integer isEnd ;
    @ApiModelProperty(value = "节点信息(0-表示非必选,1-表示必选)", example = "1")
    private Integer isMust ;
    @ApiModelProperty(value = "子集")
    private List<ModuleVO> children = new ArrayList<>();
@ -77,6 +81,22 @@ public class ModuleVO extends UuidIdentityVOWithOperator {
        this.isEnd = isEnd;
    }
    public String getType() {
        return type;
    }
    public void setType(String type) {
        this.type = type;
    }
    public Integer getIsMust() {
        return isMust;
    }
    public void setIsMust(Integer isMust) {
        this.isMust = isMust;
    }
    public List<ModuleVO> getChildren() {
        return children;
    }

+ 13 - 0
common/common-rest-model/src/main/java/com/yihu/jw/restmodel/base/role/MenuVO.java

@ -4,6 +4,9 @@ import com.yihu.jw.restmodel.UuidIdentityVOWithOperator;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.ArrayList;
import java.util.List;
/**
 * @author yeshijie on 2018/9/26.
 */
@ -24,6 +27,8 @@ public class MenuVO extends UuidIdentityVOWithOperator {
    private Integer status;
    @ApiModelProperty(value = "备注", example = "说明")
    private String remark;
    @ApiModelProperty(value = "子集")
    private List<MenuVO> children = new ArrayList<>();
    public String getName() {
        return name;
@ -72,4 +77,12 @@ public class MenuVO extends UuidIdentityVOWithOperator {
    public void setRemark(String remark) {
        this.remark = remark;
    }
    public List<MenuVO> getChildren() {
        return children;
    }
    public void setChildren(List<MenuVO> children) {
        this.children = children;
    }
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/contant/MenuContant.java

@ -1,10 +1,10 @@
package com.yihu.jw.base.contant;
/**
 * 菜单常量
 * 常量
 * @author yeshijie on 2018/9/27.
 */
public class MenuContant {
public class CommonContant {
    /**
     * 默认父类id 0

+ 14 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.InterfaceDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 接口
 * @author yeshijie on 2018/9/28.
 */
public interface InterfaceDao extends PagingAndSortingRepository<InterfaceDO, String>, JpaSpecificationExecutor<InterfaceDO> {
}

+ 14 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceErrorCodeDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.InterfaceErrorCodeDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 接口错误说明
 * @author yeshijie on 2018/9/28.
 */
public interface InterfaceErrorCodeDao extends PagingAndSortingRepository<InterfaceErrorCodeDO, String>, JpaSpecificationExecutor<InterfaceErrorCodeDO> {
}

+ 14 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/InterfaceParamDao.java

@ -0,0 +1,14 @@
package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.InterfaceParamDO;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.repository.PagingAndSortingRepository;
/**
 * 接口入参出参
 * @author yeshijie on 2018/9/28.
 */
public interface InterfaceParamDao extends PagingAndSortingRepository<InterfaceParamDO, String>, JpaSpecificationExecutor<InterfaceParamDO> {
    
}

+ 8 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/dao/module/ModuleDao.java

@ -2,6 +2,8 @@ package com.yihu.jw.base.dao.module;
import com.yihu.jw.entity.base.module.ModuleDO;
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;
/**
@ -10,4 +12,10 @@ import org.springframework.data.repository.PagingAndSortingRepository;
 */
public interface ModuleDao extends PagingAndSortingRepository<ModuleDO, String>, JpaSpecificationExecutor<ModuleDO> {
    @Modifying
    @Query("update ModuleDO p set p.status=?2 where p.id=?1")
    void updateStatus(String id,Integer status);
    @Query("select count(*) from ModuleDO a where a.name = ?1 ")
    int isExistName(String name);
}

+ 56 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/module/ModuleEndpoint.java

@ -1,5 +1,6 @@
package com.yihu.jw.base.endpoint.module;
import com.yihu.jw.base.contant.CommonContant;
import com.yihu.jw.base.service.module.ModuleService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.module.ModuleDO;
@ -14,11 +15,15 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * Endpoint - 模块
@ -40,10 +45,33 @@ public class ModuleEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        ModuleDO module = toEntity(jsonData, ModuleDO.class);
        module = moduleService.save(module);
        int count = moduleService.isExistName(module.getName());
        if(count>0){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Module.NAME_IS_EXIST), ObjEnvelop.class);
        }
        module = moduleService.addModule(module);
        return success(module, ModuleVO.class);
    }
    @PostMapping(value = BaseRequestMapping.Module.STATUS)
    @ApiOperation(value = "生效/失效")
    public Envelop status(
            @ApiParam(name = "id", value = "id", required = true)
            @RequestParam(value = "id") String id,
            @ApiParam(name = "status", value = "1生效,0失效", required = true)
            @RequestParam(value = "status") Integer status) {
        moduleService.updateStatus(id, status);
        return success("修改成功");
    }
    @GetMapping(value = BaseRequestMapping.Module.IS_NAME_EXIST)
    @ApiOperation(value = "名称是否存在",notes = "返回值中的obj=1表示名称已经存在,0表示名称不存在")
    public ObjEnvelop isNameExist(
            @ApiParam(name = "name", value = "名称", required = true)
            @RequestParam(value = "name") String name) {
        return success(moduleService.isExistName(name));
    }
    @PostMapping(value = BaseRequestMapping.Module.DELETE)
    @ApiOperation(value = "删除")
    public Envelop delete(
@ -62,6 +90,10 @@ public class ModuleEndpoint extends EnvelopRestEndpoint {
        if (null == module.getId()) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Common.ID_IS_NULL), ObjEnvelop.class);
        }
        int count = moduleService.isExistName(module.getName());
        if(count > 1){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Module.NAME_IS_EXIST), ObjEnvelop.class);
        }
        module = moduleService.save(module);
        return success(module, ModuleVO.class);
    }
@ -97,4 +129,27 @@ public class ModuleEndpoint extends EnvelopRestEndpoint {
        return success(modules, ModuleVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Module.FIND_ALL)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<ModuleVO> findAll (
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status) throws Exception {
        String filters = null;
        if(StringUtils.isNotBlank(status)){
            filters = "status="+status;
        }
        List<ModuleDO> modules = moduleService.search(null, filters, null);
        List<ModuleVO> moduleVOs = convertToModels(modules,new ArrayList<>(modules.size()),ModuleVO.class);
        Map<String,List<ModuleVO>> map = moduleVOs.stream().collect(Collectors.groupingBy(ModuleVO::getParentId));
        moduleVOs.forEach(module->{
            List<ModuleVO> tmp = map.get(module.getId());
            module.setChildren(tmp);
        });
        moduleVOs = moduleVOs.stream()
                .filter(module -> CommonContant.DEFAULT_PARENTID.equals(module.getParentId()))
                .collect(Collectors.toList());
        return success(moduleVOs);
    }
}

+ 38 - 4
svr/svr-base/src/main/java/com/yihu/jw/base/endpoint/role/MenuEndpoint.java

@ -1,5 +1,6 @@
package com.yihu.jw.base.endpoint.role;
import com.yihu.jw.base.contant.CommonContant;
import com.yihu.jw.base.service.role.MenuService;
import com.yihu.jw.base.util.ErrorCodeUtil;
import com.yihu.jw.entity.base.role.MenuDO;
@ -14,11 +15,15 @@ import com.yihu.jw.rm.base.BaseRequestMapping;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
 * @author yeshijie on 2018/9/26.
@ -40,11 +45,15 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
            @ApiParam(name = "json_data", value = "Json数据", required = true)
            @RequestBody String jsonData) throws Exception {
        MenuDO menuDO = toEntity(jsonData, MenuDO.class);
        menuDO = menuService.save(menuDO);
        int count = menuService.isExistName(menuDO.getName());
        if(count>0){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
        }
        menuDO = menuService.addMenu(menuDO);
        return success(menuDO, MenuVO.class);
    }
    @PostMapping(value = BaseRequestMapping.Menu.MOVEDOWN)
    @PostMapping(value = BaseRequestMapping.Menu.MOVE_DOWN)
    @ApiOperation(value = "下移")
    public Envelop moveDown(
            @ApiParam(name = "id", value = "id", required = true)
@ -53,7 +62,7 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
        return success("修改成功");
    }
    @PostMapping(value = BaseRequestMapping.Menu.MOVEUP)
    @PostMapping(value = BaseRequestMapping.Menu.MOVE_UP)
    @ApiOperation(value = "上移")
    public Envelop moveUp(
            @ApiParam(name = "id", value = "id", required = true)
@ -73,7 +82,7 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
        return success("修改成功");
    }
    @GetMapping(value = BaseRequestMapping.Menu.ISNAMEEXIST)
    @GetMapping(value = BaseRequestMapping.Menu.IS_NAME_EXIST)
    @ApiOperation(value = "名称是否存在",notes = "返回值中的obj=1表示名称已经存在,0表示名称不存在")
    public ObjEnvelop isNameExist(
            @ApiParam(name = "name", value = "菜单名称", required = true)
@ -90,6 +99,10 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
        if (null == menuDO.getId()) {
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Common.ID_IS_NULL), Envelop.class);
        }
        int count = menuService.isExistName(menuDO.getName());
        if(count>1){
            return failed(errorCodeUtil.getErrorMsg(BaseErrorCode.Menu.NAME_IS_EXIST), ObjEnvelop.class);
        }
        menuDO = menuService.save(menuDO);
        return success(menuDO);
    }
@ -125,5 +138,26 @@ public class MenuEndpoint extends EnvelopRestEndpoint {
        return success(menuDOS, MenuVO.class);
    }
    @GetMapping(value = BaseRequestMapping.Module.FIND_ALL)
    @ApiOperation(value = "获取列表")
    public ListEnvelop<MenuVO> findAll (
            @ApiParam(name = "status", value = "状态")
            @RequestParam(value = "status", required = false) String status) throws Exception {
        String filters = null;
        if(StringUtils.isNotBlank(status)){
            filters = "status="+status;
        }
        List<MenuDO> menuDOs = menuService.search(null, filters, null);
        List<MenuVO> menuVOs = convertToModels(menuDOs,new ArrayList<>(menuDOs.size()),MenuVO.class);
        Map<String,List<MenuVO>> map = menuVOs.stream().collect(Collectors.groupingBy(MenuVO::getParentId));
        menuVOs.forEach(menu->{
            List<MenuVO> tmp = map.get(menu.getId());
            menu.setChildren(tmp);
        });
        menuVOs = menuVOs.stream()
                .filter(menu -> CommonContant.DEFAULT_PARENTID.equals(menu.getParentId()))
                .collect(Collectors.toList());
        return success(menuVOs);
    }
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceErrorCodeService.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.service.module;
import com.yihu.jw.base.dao.module.InterfaceErrorCodeDao;
import com.yihu.jw.entity.base.module.InterfaceErrorCodeDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 接口错误说明
 * @author yeshijie on 2018/9/28.
 */
@Service
public class InterfaceErrorCodeService extends BaseJpaService<InterfaceErrorCodeDO, InterfaceErrorCodeDao> {
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceParamService.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.service.module;
import com.yihu.jw.base.dao.module.InterfaceParamDao;
import com.yihu.jw.entity.base.module.InterfaceParamDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 接口入参出参
 * @author yeshijie on 2018/9/28.
 */
@Service
public class InterfaceParamService extends BaseJpaService<InterfaceParamDO, InterfaceParamDao> {
    
}

+ 16 - 0
svr/svr-base/src/main/java/com/yihu/jw/base/service/module/InterfaceService.java

@ -0,0 +1,16 @@
package com.yihu.jw.base.service.module;
import com.yihu.jw.base.dao.module.InterfaceDao;
import com.yihu.jw.entity.base.module.InterfaceDO;
import com.yihu.mysql.query.BaseJpaService;
import org.springframework.stereotype.Service;
/**
 * 接口
 * @author yeshijie on 2018/9/28.
 */
@Service
public class InterfaceService extends BaseJpaService<InterfaceDO, InterfaceDao> {
}

+ 40 - 1
svr/svr-base/src/main/java/com/yihu/jw/base/service/module/ModuleService.java

@ -1,10 +1,13 @@
package com.yihu.jw.base.service.module;
import com.yihu.jw.entity.base.module.ModuleDO;
import com.yihu.jw.base.contant.CommonContant;
import com.yihu.jw.base.dao.module.ModuleDao;
import com.yihu.jw.entity.base.module.ModuleDO;
import com.yihu.mysql.query.BaseJpaService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
/**
 * Service - 模块
@ -16,4 +19,40 @@ public class ModuleService extends BaseJpaService<ModuleDO, ModuleDao> {
    @Autowired
    private ModuleDao moduleDao;
    /**
     * 新增模块
     * @param moduleDO
     * @return
     */
    public ModuleDO addModule(ModuleDO moduleDO){
        if(StringUtils.isBlank(moduleDO.getParentId())){
            moduleDO.setParentId(CommonContant.DEFAULT_PARENTID);
        }
        moduleDao.save(moduleDO);
        //若新增某必选业务模块,则需为所有已创建的租户和租户类型添加此业务模块
        return moduleDO;
    }
    /**
     * 设置生效和失效
     * @param id
     * @param status
     */
    @Transactional(rollbackFor = Exception.class)
    public void updateStatus(String id,Integer status){
        moduleDao.updateStatus(id,status);
        //若原业务模块为失效/生效,操作生效/失效后的变更逻辑如以下流程图所示
    }
    /**
     * 名称是否存在
     * @param name
     * @return
     */
    public int isExistName(String name){
        return moduleDao.isExistName(name);
    }
}

+ 2 - 2
svr/svr-base/src/main/java/com/yihu/jw/base/service/role/MenuService.java

@ -1,6 +1,6 @@
package com.yihu.jw.base.service.role;
import com.yihu.jw.base.contant.MenuContant;
import com.yihu.jw.base.contant.CommonContant;
import com.yihu.jw.base.dao.role.MenuDao;
import com.yihu.jw.entity.base.role.MenuDO;
import com.yihu.mysql.query.BaseJpaService;
@ -38,7 +38,7 @@ public class MenuService extends BaseJpaService<MenuDO, MenuDao> {
     */
    public MenuDO addMenu(MenuDO menuDO){
        if(StringUtils.isBlank(menuDO.getParentId())){
            menuDO.setParentId(MenuContant.DEFAULT_PARENTID);
            menuDO.setParentId(CommonContant.DEFAULT_PARENTID);
        }
        int sort = menuDao.countMenuByParentId(menuDO.getParentId())+1;
        menuDO.setSort(sort);