提交 33891963 authored 作者: 陈世营's avatar 陈世营

loit-notice

上级 a8839722
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>loit-service-api</artifactId>
<groupId>com.loit</groupId>
<version>1.0.0</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-portal-api</artifactId>
<name>loit-portal-api</name>
<version>1.4-SNAPSHOT</version>
<description>门户api</description>
<dependencies>
<dependency>
<groupId>com.loit</groupId>
<artifactId>loit-common</artifactId>
<version>1.1-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
<build>
<finalName>loit-portal-api</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
<version>2.4</version>
<configuration>
<archive>
<manifest>
<addDefaultImplementationEntries>true</addDefaultImplementationEntries>
<addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
</manifest>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
\ No newline at end of file
package com.loit.Proxy;
import org.springframework.beans.factory.FactoryBean;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;
/**
* 接口实例工厂,这里主要是用于提供接口的实例对象
*
* @author Demon add by 2020-05-28
*/
public class ApiProxyBeanFactory<T> implements FactoryBean<T> {
private Class<T> interfaceType;
public ApiProxyBeanFactory(Class<T> interfaceType) {
this.interfaceType = interfaceType;
}
@Override
public T getObject() throws Exception {
//这里主要是创建接口对应的实例,便于注入到spring容器中
InvocationHandler handler = new ApiProxyHandler<>(interfaceType);
return (T) Proxy.newProxyInstance(interfaceType.getClassLoader(), new Class[] {interfaceType},handler);
}
@Override
public Class<T> getObjectType() {
return interfaceType;
}
@Override
public boolean isSingleton() {
return true;
}
}
package com.loit.Proxy;
/**
* 代理配置文件
*
* @author Demon add by 2020-05-28
*/
public interface ApiProxyConfig {
/**
* 扫描需要被动态代理的接口包名
*/
public static String[] PACKAGE_SCAN={
"com.loit.api.service",
"com.loit.getway"
};
}
package com.loit.Proxy;
import com.loit.common.json.AjaxJson;
import com.loit.common.utils.LoitStatusCode;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Method;
/**
* 动态代理,需要注意的是,这里用到的是JDK自带的动态代理,代理对象只能是接口,不能是类
*
* @author Demon add by 2020-05-28
*/
public class ApiProxyHandler<T> implements InvocationHandler {
private Class<T> interfaceType;
public ApiProxyHandler(Class<T> intefaceType) {
this.interfaceType = interfaceType;
}
@Override
public Object invoke(Object proxy, Method method, Object[] args) {
Logger logger = LoggerFactory.getLogger(method.getDeclaringClass());
AjaxJson json = new AjaxJson();
logger.info("服务未在线。");
json.setMsg("服务未在线,请稍后重试。");
json.setSuccess(false);
json.setCode(LoitStatusCode.FAIL.statusCode);
return json;
}
}
package com.loit.Proxy;
import java.io.File;
import java.io.FileFilter;
import java.io.IOException;
import java.net.JarURLConnection;
import java.net.URL;
import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.Enumeration;
import java.util.List;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
/**
* 包扫描器-扫描包内所有类和接口
*
* @author Demon add by 2020-05-26
*/
public class ApiProxyPackageScan {
/**
* 测试
* @param args
*/
public static void main(String[] args) {
List<Class<?>> classes = getClasses("com.loit.api.service","com.loit.getway");
for (Class<?> class1 : classes) {
System.out.println(class1);
}
}
/**
* 根据包全名,获取包内类和接口的Class列表-支持多包名扫描
* @param packageNames
* @return
*/
public static List<Class<?>> getClasses(String... packageNames){
List<Class<?>> classes = new ArrayList<Class<?>>();
for (String packageName : packageNames) {
classes.addAll(ApiProxyPackageScan.getClasses(packageName));
}
return classes;
}
/**
* 根据包全名,获取包内类和接口的Class列表
* @param packageName
* @return
*/
public static List<Class<?>> getClasses(String packageName){
//第一个class类的集合
List<Class<?>> classes = new ArrayList<Class<?>>();
//是否循环迭代
boolean recursive = true;
//获取包的名字 并进行替换
String packageDirName = packageName.replace('.', '/');
//定义一个枚举的集合 并进行循环来处理这个目录下的things
Enumeration<URL> dirs;
try {
dirs = Thread.currentThread().getContextClassLoader().getResources(packageDirName);
//循环迭代下去
while (dirs.hasMoreElements()){
//获取下一个元素
URL url = dirs.nextElement();
//得到协议的名称
String protocol = url.getProtocol();
//如果是以文件的形式保存在服务器上
if ("file".equals(protocol)) {
//获取包的物理路径
String filePath = URLDecoder.decode(url.getFile(), "UTF-8");
//以文件的方式扫描整个包下的文件 并添加到集合中
findAndAddClassesInPackageByFile(packageName, filePath, recursive, classes);
} else if ("jar".equals(protocol)){
//如果是jar包文件
//定义一个JarFile
JarFile jar;
try {
//获取jar
jar = ((JarURLConnection) url.openConnection()).getJarFile();
//从此jar包 得到一个枚举类
Enumeration<JarEntry> entries = jar.entries();
//同样的进行循环迭代
while (entries.hasMoreElements()) {
//获取jar里的一个实体 可以是目录 和一些jar包里的其他文件 如META-INF等文件
JarEntry entry = entries.nextElement();
String name = entry.getName();
//如果是以/开头的
if (name.charAt(0) == '/') {
//获取后面的字符串
name = name.substring(1);
}
//如果前半部分和定义的包名相同
if (name.startsWith(packageDirName)) {
int idx = name.lastIndexOf('/');
//如果以"/"结尾 是一个包
if (idx != -1) {
//获取包名 把"/"替换成"."
packageName = name.substring(0, idx).replace('/', '.');
}
//如果可以迭代下去 并且是一个包
if ((idx != -1) || recursive){
//如果是一个.class文件 而且不是目录
if (name.endsWith(".class") && !entry.isDirectory()) {
//去掉后面的".class" 获取真正的类名
String className = name.substring(packageName.length() + 1, name.length() - 6);
try {
//添加到classes
classes.add(Class.forName(packageName + '.' + className));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
} catch (IOException e) {
e.printStackTrace();
}
return classes;
}
public static void findAndAddClassesInPackageByFile(String packageName, String packagePath, final boolean recursive, List<Class<?>> classes){
//获取此包的目录 建立一个File
File dir = new File(packagePath);
//如果不存在或者 也不是目录就直接返回
if (!dir.exists() || !dir.isDirectory()) {
return;
}
//如果存在 就获取包下的所有文件 包括目录
File[] dirfiles = dir.listFiles(new FileFilter() {
//自定义过滤规则 如果可以循环(包含子目录) 或则是以.class结尾的文件(编译好的java类文件)
public boolean accept(File file) {
return (recursive && file.isDirectory()) || (file.getName().endsWith(".class"));
}
});
//循环所有文件
for (File file : dirfiles) {
//如果是目录 则继续扫描
if (file.isDirectory()) {
findAndAddClassesInPackageByFile(packageName + "." + file.getName(),
file.getAbsolutePath(),
recursive,
classes);
}
else {
//如果是java类文件 去掉后面的.class 只留下类名
String className = file.getName().substring(0, file.getName().length() - 6);
try {
//添加到集合中去
classes.add(Class.forName(packageName + '.' + className));
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}
}
}
package com.loit.Proxy;
import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.support.BeanDefinitionBuilder;
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
import org.springframework.beans.factory.support.BeanDefinitionRegistryPostProcessor;
import org.springframework.beans.factory.support.GenericBeanDefinition;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.context.ResourceLoaderAware;
import org.springframework.core.io.ResourceLoader;
import org.springframework.stereotype.Component;
import java.util.List;
/**
* 用于Spring动态注入自定义接口
* 继承BeanDefinitionRegistryPostProcessor,ResourceLoaderAware,ApplicationContextAware,实现项目启动自动执行
*
* @author Demon add by 2020-05-26
*/
@Component
public class ApiProxyRegistry implements BeanDefinitionRegistryPostProcessor,ResourceLoaderAware,ApplicationContextAware {
/**
* 扫描包内所有接口,通过ApiProxyBeanFactory的动态代理产生接口的实现类并批量注册到spring中
*/
@Override
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException {
// 通过反射获取需要代理的接口的clazz列表
List<Class<?>> beanClazzs = ApiProxyPackageScan.getClasses(ApiProxyConfig.PACKAGE_SCAN);
// 将扫描到的接口列表循环注入到spring的管理中
for (Class beanClazz : beanClazzs) {
BeanDefinitionBuilder builder = BeanDefinitionBuilder.genericBeanDefinition(beanClazz);
GenericBeanDefinition definition = (GenericBeanDefinition) builder.getRawBeanDefinition();
/*
* 在这里,我们可以给该对象的属性注入对应的实例。
* 比如mybatis,就在这里注入了dataSource和sqlSessionFactory,
* 注意,如果采用definition.getPropertyValues()方式的话,
* 类似definition.getPropertyValues().add("interfaceType", beanClazz);
* 则要求在FactoryBean(本应用中即ApiProxyBeanFactory)提供setter方法,否则会注入失败
* 如果采用definition.getConstructorArgumentValues(),
* 则FactoryBean中需要提供包含该属性的构造方法,否则会注入失败
*/
definition.getConstructorArgumentValues().addGenericArgumentValue(beanClazz);
/*
* 注意,这里的BeanClass是生成Bean实例的工厂,不是Bean本身。
* ApiProxyBeanFactory是一种特殊的Bean,其返回的对象不是指定类的一个实例,
* 其返回的是该工厂Bean的getObject方法所返回的对象。
*/
definition.setBeanClass(ApiProxyBeanFactory.class);
//这里采用的是byType方式注入,类似的还有byName等
definition.setAutowireMode(GenericBeanDefinition.AUTOWIRE_BY_TYPE);
registry.registerBeanDefinition(beanClazz.getSimpleName(), definition);
}
}
@Override
public void postProcessBeanFactory(ConfigurableListableBeanFactory arg0) throws BeansException {}
@Override
public void setApplicationContext(ApplicationContext arg0) throws BeansException {}
@Override
public void setResourceLoader(ResourceLoader arg0) {}
}
package com.loit.api.dto;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
/**
* @ClassName: AccoutInfo
* @Description: 人员账号信息表
* @author zhaokz
* @date 2019-10-23 15:22:25
* @version V1.0
**/
@ApiModel(value = "AccoutInfo", description="人员账号信息表数据对象")
public class AccoutInfo {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "人员唯一ID",example = "1")
private Integer accountId;
/**
* (0,访客1,普通用户2,一般管理员)
*/
@ApiModelProperty(value = "账号类别",example = "1")
private String userType;
@ApiModelProperty(value = "账号",example = "1")
private String userId;
@ApiModelProperty(value = "未加密密码",example = "123456")
private String unPassword;
@ApiModelProperty(value = "密码",example = "f@sdgfd%d$dsfs")
private String passWord;
/**
* (0,正常1,锁定2,一般管理员禁止)
*/
@ApiModelProperty(value = "账号状态",example = "0")
private String userStat;
@ApiModelProperty(value = "失败登录次数",example = "2")
private Integer loginFailnum;
@ApiModelProperty(value = "最近登录IP",example = "17.34.56.213")
private String lastLoginIp;
@ApiModelProperty(value = "最近登录日期",example = "2019-10-24 15:45:23")
@DateTimeFormat(pattern = "yyyy-MM-ddHH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastLoginDate;
@ApiModelProperty(value = "密码问题",example = "我是谁")
private String passQuestion;
@ApiModelProperty(value = "密码答案",example = "小马哥")
private String passAnswer;
/**
* (0:普通帐号1:临时账号2:应用管理帐号3:超级管理帐号)
*/
@ApiModelProperty(value = "账号类型",example = "0")
private String accountType;
@ApiModelProperty(value = "账号有效期限",example = "4")
private Integer accountTimelimit;
@ApiModelProperty(value = "密码修改时间",example = "2019-10-24 15:45:23")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date passUpdateTime;
@ApiModelProperty(value = "创建者类型",example = "2")
private String cteateBy;
@ApiModelProperty(value = "扩展1",example = "")
private String ext1;
@ApiModelProperty(value = "扩展2",example = "")
private String ext2;
@ApiModelProperty(value = "人员基本信息ID",example = "1")
private Integer personBaseId;
public void setAccountId(Integer accountId){
this.accountId = accountId;
}
public Integer getAccountId(){
return this.accountId;
}
public void setUserType(String userType){
this.userType = userType;
}
public String getUserType(){
return this.userType;
}
public void setUserId(String userId){
this.userId = userId;
}
public String getUserId(){
return this.userId;
}
public void setUnPassword(String unPassword){
this.unPassword = unPassword;
}
public String getUnPassword(){
return this.unPassword;
}
public void setPassWord(String passWord){
this.passWord = passWord;
}
public String getPassWord(){
return this.passWord;
}
public void setUserStat(String userStat){
this.userStat = userStat;
}
public String getUserStat(){
return this.userStat;
}
public void setLoginFailnum(Integer loginFailnum){
this.loginFailnum = loginFailnum;
}
public Integer getLoginFailnum(){
return this.loginFailnum;
}
public void setLastLoginIp(String lastLoginIp){
this.lastLoginIp = lastLoginIp;
}
public String getLastLoginIp(){
return this.lastLoginIp;
}
public void setLastLoginDate(Date lastLoginDate){
this.lastLoginDate = lastLoginDate;
}
public Date getLastLoginDate(){
return this.lastLoginDate;
}
public void setPassQuestion(String passQuestion){
this.passQuestion = passQuestion;
}
public String getPassQuestion(){
return this.passQuestion;
}
public void setPassAnswer(String passAnswer){
this.passAnswer = passAnswer;
}
public String getPassAnswer(){
return this.passAnswer;
}
public void setAccountType(String accountType){
this.accountType = accountType;
}
public String getAccountType(){
return this.accountType;
}
public void setAccountTimelimit(Integer accountTimelimit){
this.accountTimelimit = accountTimelimit;
}
public Integer getAccountTimelimit(){
return this.accountTimelimit;
}
public void setPassUpdateTime(Date passUpdateTime){
this.passUpdateTime = passUpdateTime;
}
public Date getPassUpdateTime(){
return this.passUpdateTime;
}
public void setCteateBy(String cteateBy){
this.cteateBy = cteateBy;
}
public String getCteateBy(){
return this.cteateBy;
}
public void setExt1(String ext1){
this.ext1 = ext1;
}
public String getExt1(){
return this.ext1;
}
public void setExt2(String ext2){
this.ext2 = ext2;
}
public String getExt2(){
return this.ext2;
}
public void setPersonBaseId(Integer personBaseId){
this.personBaseId = personBaseId;
}
public Integer getPersonBaseId(){
return this.personBaseId;
}
}
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @description 应用管理entity
* @author xutao
* @date 2019-10-21
*/
@ApiModel(value="ApplicationManage", description = "应用管理实体")
public class ApplicationManage {
public ApplicationManage ApplicationManage() {
return this;
}
@ApiModelProperty(name = "appId", value = "应用ID", example = "1")
private Integer appId;
@ApiModelProperty(name = "appCode", value = "应用代码", example = "qinwubaobei")
private String appCode;
public Integer getAppId() {
return appId;
}
public void setAppId(Integer appId) {
this.appId = appId;
}
public String getAppCode() {
return appCode;
}
public void setAppCode(String appCode) {
this.appCode = appCode;
}
}
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import java.util.Date;
/**
* 颜色Entity
* @author liwl
* @version 2020-08-24
*/
@ApiModel(value="Colour", description="颜色实体类")
public class Colour{
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private Integer id;
/**
* 字典编码
*/
private String dictCode;
/**
* 数据项编码
*/
private String dataCode;
/**
* 颜色值
*/
private String colourValue;
private Date createTime;
private String createUserId;
private Date updateTime;
private String updateUserId;
public Integer getId() {
return id;
}
public void setId(Integer id) {
this.id = id;
}
public String getDictCode() {
return dictCode;
}
public void setDictCode(String dictCode) {
this.dictCode = dictCode;
}
public String getDataCode() {
return dataCode;
}
public void setDataCode(String dataCode) {
this.dataCode = dataCode;
}
public String getColourValue() {
return colourValue;
}
public void setColourValue(String colourValue) {
this.colourValue = colourValue;
}
public Date getCreateTime() {
return createTime;
}
public void setCreateTime(Date createTime) {
this.createTime = createTime;
}
public String getCreateUserId() {
return createUserId;
}
public void setCreateUserId(String createUserId) {
this.createUserId = createUserId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
public String getUpdateUserId() {
return updateUserId;
}
public void setUpdateUserId(String updateUserId) {
this.updateUserId = updateUserId;
}
}
\ No newline at end of file
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @Description 上下文配置entity
* @author xutao
* @date 2019-10-18
*/
@ApiModel(value="ContextConfiguration", description = "上下文配置实体")
public class ContextConfiguration {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "contextId", value = "上下文ID", example = "1")
private int contextId;
@ApiModelProperty(name = "contextValue", value = "上下文值,默认为空", example = "http://localhost:7007/")
private String contextValue;
@ApiModelProperty(name = "contextDesc", value = "描述", required = true, example = "门户系统")
private String contextDesc;
@ApiModelProperty(name = "contextWebValue", value = "客户端上下文值(web或移动端)", example = "http://localhost:7007/")
private String contextWebValue;
@ApiModelProperty(name = "enableDel", value = "是否允许删除(0:否 1:是)")
private String enableDel;
public ContextConfiguration() {
super();
}
public ContextConfiguration(String contextValue){
this.contextValue = contextValue;
}
public int getContextId() {
return contextId;
}
public void setContextId(int contextId) {
this.contextId = contextId;
}
public String getContextValue() {
return contextValue;
}
public void setContextValue(String contextValue) {
this.contextValue = contextValue;
}
public String getContextDesc() {
return contextDesc;
}
public void setContextDesc(String contextDesc) {
this.contextDesc = contextDesc;
}
public String getContextWebValue() {
return contextWebValue;
}
public void setContextWebValue(String contextWebValue) {
this.contextWebValue = contextWebValue;
}
public String getEnableDel() {
return enableDel;
}
public void setEnableDel(String enableDel) {
this.enableDel = enableDel;
}
}
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.io.Serializable;
/**
* @Description 上下文配置数据传输实体类
* @Author xutao
* @Date 2019-10-18
*/
@ApiModel(value="ContextConfigurationDTO", description="上下文配置数据传输实体类")
public class ContextConfigurationDTO implements Serializable {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "contextValue", value = "上下文值,默认为空", example = "http://localhost:7007/")
private String contextValue;
@ApiModelProperty(name = "contextDesc", value = "描述", required = true, example = "门户系统")
private String contextDesc;
@ApiModelProperty(name = "contextWebValue", value = "客户端上下文值(web或移动端)", example = "http://localhost:7007/")
private String contextWebValue;
@ApiModelProperty(name = "enableDel", value = "是否允许删除(0:否 1:是)")
private String enableDel;
public String getContextValue() {
return contextValue;
}
public void setContextValue(String contextValue) {
this.contextValue = contextValue;
}
public String getContextDesc() {
return contextDesc;
}
public void setContextDesc(String contextDesc) {
this.contextDesc = contextDesc;
}
public String getContextWebValue() {
return contextWebValue;
}
public void setContextWebValue(String contextWebValue) {
this.contextWebValue = contextWebValue;
}
public String getEnableDel() {
return enableDel;
}
public void setEnableDel(String enableDel) {
this.enableDel = enableDel;
}
}
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* 字典Entity
* @author gzx
* @version 2019-11-03
*/
@ApiModel(value="Dict", description="字典实体类")
public class Dict {
private static final long serialVersionUID = 1L;
/**
* 唯一标识
*/
private Integer dictId;
/**
* 字典编码
*/
@ApiModelProperty("字典编码")
private String dictCode;
/**
* 字典名称
*/
private String dictName;
/**
* 字典描述
*/
private String dictDesc;
/**
* 父Id
*/
private Integer pId = 0;
/**
* 1、系统内置 2、用户自定义字典数据,默认为2
*/
private String baseFlag;
/**
* 子字典列表
*/
private List<Dict> children;
public Integer getDictId() {
return dictId;
}
public void setDictId(Integer dictId) {
this.dictId = dictId;
}
public String getDictCode() {
return dictCode;
}
public void setDictCode(String dictCode) {
this.dictCode = dictCode;
}
public String getDictName() {
return dictName;
}
public void setDictName(String dictName) {
this.dictName = dictName;
}
public String getDictDesc() {
return dictDesc;
}
public void setDictDesc(String dictDesc) {
this.dictDesc = dictDesc;
}
public Integer getpId() {
return pId;
}
public void setpId(Integer pId) {
this.pId = pId;
}
public String getBaseFlag() {
return baseFlag;
}
public void setBaseFlag(String baseFlag) {
this.baseFlag = baseFlag;
}
public List<Dict> getChildren() {
return children;
}
public void setChildren(List<Dict> children) {
this.children = children;
}
}
\ No newline at end of file
/**
* Copyright &copy; 2015-2020 isaac All rights reserved.
*/
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import javax.xml.bind.annotation.XmlAttribute;
/**
* 系统字典数据项实体
* @author xutao
* @date 2019-10-17
*/
@ApiModel(value="DictData", description = "系统字典数据项实体")
public class DictData {
private static final long serialVersionUID = 1L;
@ApiModelProperty(name = "dataId", value = "数据项ID", example = "1")
private Integer dataId;
@ApiModelProperty(name = "dataCode", value = "数据项编码", required = true, example = "0")
private String dataCode;
@ApiModelProperty(name = "dataName", value = "数据项名称", required = true, example = "汉族")
private String dataName;
@ApiModelProperty(name = "dataDesc", value = "数据项描述", example = "汉族")
private String dataDesc;
@ApiModelProperty(name = "serialIndex", value = "排序号", example = "1")
private Integer serialIndex;
@ApiModelProperty(name = "dictId", required = true, value = "数据字典ID")
private Integer dictId;
public DictData() {
super();
}
public DictData(String dataCode, String dataName){
this.dataCode = dataCode;
this.dataName = dataName;
}
public Integer getDataId() {
return dataId;
}
public void setDataId(Integer dataId) {
this.dataId = dataId;
}
@XmlAttribute
public String getDataCode() {
return dataCode;
}
public void setDataCode(String dataCode) {
this.dataCode = dataCode;
}
@XmlAttribute
public String getDataName() {
return dataName;
}
public void setDataName(String dataName) {
this.dataName = dataName;
}
@XmlAttribute
public String getDataDesc() {
return dataDesc;
}
public void setDataDesc(String dataDesc) {
this.dataDesc = dataDesc;
}
public Integer getSerialIndex() {
return serialIndex;
}
public void setSerialIndex(Integer serialIndex) {
this.serialIndex = serialIndex;
}
public Integer getDictId() {
return dictId;
}
public void setDictId(Integer dictId) {
this.dictId = dictId;
}
}
\ No newline at end of file
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import java.util.List;
/**
* @ClassName: Org
* @Description: 组织机构表
* @author zhaokz
* @date 2019-10-22 18:36:40
* @version V1.0
**/
@ApiModel(value = "Org", description="组织机构表数据对象")
public class Org {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "组织uuID,物联子平台需要",example = "1")
private String sid;
@ApiModelProperty(value = "组织唯一ID",example = "1")
private Integer orgId;
@ApiModelProperty(value = "组织版本",example = "1")
private String orgVersion;
@ApiModelProperty(value = "组织简称",example = "北京市城管局")
private String orgShortName;
@ApiModelProperty(value = "组织名称",example = "北京市城市管理综合执法监察局")
private String orgName;
@ApiModelProperty(value = "组织编码",example = "12312")
private String orgCode;
@ApiModelProperty(value = "组织邮箱",example = "293932@163.com")
private String orgMail;
@ApiModelProperty(value = "联系方式",example = "15944553322")
private String contact;
@ApiModelProperty(value = "组织行政级别",example = "1")
private String orgGrade;
@ApiModelProperty(value = "组织层数",example = "2")
private Integer orgLevel;
@ApiModelProperty(value = "排序号",example = "23")
private Integer serialIndex;
@ApiModelProperty(value = "说明",example = "阿斯顿发斯蒂芬")
private String orgDesc;
@ApiModelProperty(value = "父组织ID",example = "1")
private Integer parentId;
@ApiModelProperty(value = "状态(0正常1禁用2删除)",example = "0")
private String orgStatus;
@ApiModelProperty(value = "机构层次代码",example = "3424")
private String orgLevelCode;
@ApiModelProperty(value = "删除标记",example = "0")
private String deltag;
@ApiModelProperty(value = "应用id",example = "23")
private Integer appId;
@ApiModelProperty(value = "用户组id",example = "23")
private Integer grpId;
/**
* 组织扩展属性
*/
List<OrgExtattr> orgExtattrs;
public String getSid() {
return sid;
}
public void setSid(String sid) {
this.sid = sid;
}
public void setOrgId(Integer orgId){
this.orgId = orgId;
}
public Integer getOrgId(){
return this.orgId;
}
public void setOrgVersion(String orgVersion){
this.orgVersion = orgVersion;
}
public String getOrgVersion(){
return this.orgVersion;
}
public void setOrgShortName(String orgShortName){
this.orgShortName = orgShortName;
}
public String getOrgShortName(){
return this.orgShortName;
}
public void setOrgName(String orgName){
this.orgName = orgName;
}
public String getOrgName(){
return this.orgName;
}
public void setOrgCode(String orgCode){
this.orgCode = orgCode;
}
public String getOrgCode(){
return this.orgCode;
}
public void setOrgMail(String orgMail){
this.orgMail = orgMail;
}
public String getOrgMail(){
return this.orgMail;
}
public void setContact(String contact){
this.contact = contact;
}
public String getContact(){
return this.contact;
}
public void setOrgGrade(String orgGrade){
this.orgGrade = orgGrade;
}
public String getOrgGrade(){
return this.orgGrade;
}
public void setOrgLevel(Integer orgLevel){
this.orgLevel = orgLevel;
}
public Integer getOrgLevel(){
return this.orgLevel;
}
public void setSerialIndex(Integer serialIndex){
this.serialIndex = serialIndex;
}
public Integer getSerialIndex(){
return this.serialIndex;
}
public void setOrgDesc(String orgDesc){
this.orgDesc = orgDesc;
}
public String getOrgDesc(){
return this.orgDesc;
}
public void setParentId(Integer parentId){
this.parentId = parentId;
}
public Integer getParentId(){
return this.parentId;
}
public void setOrgStatus(String orgStatus){
this.orgStatus = orgStatus;
}
public String getOrgStatus(){
return this.orgStatus;
}
public void setOrgLevelCode(String orgLevelCode){
this.orgLevelCode = orgLevelCode;
}
public String getOrgLevelCode(){
return this.orgLevelCode;
}
public void setDeltag(String deltag){
this.deltag = deltag;
}
public String getDeltag(){
return this.deltag;
}
public Integer getAppId() {
return appId;
}
public void setAppId(Integer appId) {
this.appId = appId;
}
public Integer getGrpId() {
return grpId;
}
public void setGrpId(Integer grpId) {
this.grpId = grpId;
}
public List<OrgExtattr> getOrgExtattrs() {
return orgExtattrs;
}
public void setOrgExtattrs(List<OrgExtattr> orgExtattrs) {
this.orgExtattrs = orgExtattrs;
}
}
package com.loit.api.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
/**
* @ClassName: OrgExtattr
* @Description: 组织扩展属性表
* @author zhaokz
* @date 2019-10-23 15:24:06
* @version V1.0
**/
@ApiModel(value = "OrgExtattr", description="组织扩展属性表数据对象")
public class OrgExtattr {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "组织属性ID",example="1")
private Integer orgAttrId;
@ApiModelProperty(value = "属性代码")
private String attrCode;
@ApiModelProperty(value = "属性名称")
private String attrName;
@ApiModelProperty(value = "属性类型")
private String attrType;
@ApiModelProperty(value = "是否必填")
private String isHave;
@ApiModelProperty(value = "描述")
private String attrDesc;
@ApiModelProperty(value = "组织id",example="1")
private Integer orgId;
@ApiModelProperty(value = "属性实例值")
private String orgAttrValue;
public void setOrgAttrId(Integer orgAttrId){
this.orgAttrId = orgAttrId;
}
public Integer getOrgAttrId(){
return this.orgAttrId;
}
public void setAttrCode(String attrCode){
this.attrCode = attrCode;
}
public String getAttrCode(){
return this.attrCode;
}
public void setAttrName(String attrName){
this.attrName = attrName;
}
public String getAttrName(){
return this.attrName;
}
public void setAttrType(String attrType){
this.attrType = attrType;
}
public String getAttrType(){
return this.attrType;
}
public void setIsHave(String isHave){
this.isHave = isHave;
}
public String getIsHave(){
return this.isHave;
}
public void setAttrDesc(String attrDesc){
this.attrDesc = attrDesc;
}
public String getAttrDesc(){
return this.attrDesc;
}
public Integer getOrgId() {
return orgId;
}
public void setOrgId(Integer orgId) {
this.orgId = orgId;
}
public String getOrgAttrValue() {
return orgAttrValue;
}
public void setOrgAttrValue(String orgAttrValue) {
this.orgAttrValue = orgAttrValue;
}
}
package com.loit.api.proxy;
import com.loit.api.service.PersonApiService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* feign接口代理, 可在util工具类中获取feign接口并调用
*/
@Service(value = "personApiServiceProxy")
public class PersonApiServiceProxy {
@Autowired
PersonApiService personApiService;
public PersonApiService getPersonApiService(){
return personApiService;
}
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @ClassName: ActRightController
* @Description:
* @author zhaokz
* @date 2019年10月28日 下午3:56:15
* @version V1.0
*/
@FeignClient(name = "loit-portal")
public interface ActRightApiService {
@ApiOperation(value = "根据菜单ID获取当前用户对本资源的操作权限", notes = "根据菜单ID获取当前用户对本资源的操作权限")
@ApiImplicitParams({
@ApiImplicitParam(name = "menuId", value = "菜单ID", required = true, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/actRight/getActRightByMenuId")
public AjaxJson getActRightByMenuId(@RequestParam(value = "menuId", required = true) Integer menuId);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @description 组织
* @author liwl
* @date 2020年8月24日
*/
@FeignClient(name = "loit-portal")
public interface ApplicationManagerApiService {
/**
* @description 根据AppCode获取ApplicationManage
* @author liwl
* @date:2020年8月24日
* @return
*/
@GetMapping(value = "api/v1/feign/applicationManage/getByAppCode")
@ApiOperation(value = "根据AppCode获取ApplicationManage", notes = "根据AppCode获取ApplicationManage")
@ApiImplicitParam(name = "appCode", value = "应用编码", required = true, dataType = "String", paramType = "query")
public AjaxJson getByAppCode(@RequestParam(value = "appCode", required = true) String appCode);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
@FeignClient(name = "loit-portal")
public interface AreaCodeApiService {
@ApiOperation(value = "行政区域列表-根据父id", notes = "行政区域列表-根据父id")
@ApiImplicitParam(name = "pcode", value = "父id", required = true, dataType = "String",paramType = "query")
@GetMapping(value = "api/v1/feign/area/areaList")
public AjaxJson areaCodeList(@RequestParam(value = "pcode", required = true) Long pcode);
@ApiOperation(value = "行政区域树-根据父id", notes = "行政区域树-根据父id")
@ApiImplicitParam(name = "pcode", value = "id", required = true, dataType = "String",paramType = "query")
@GetMapping(value = "api/v1/feign/area/areaList/tree")
public AjaxJson areaCodeListTree(@RequestParam(value = "pcode", required = true) Long pcode);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @description 颜色
* @author liwl
* @date 2020年8月24日
*/
@FeignClient(name = "loit-portal")
public interface ColourApiService {
/**
* @description 根据DictCode和DataCode获取颜色
* @author liwl
* @date:2020年8月24日
* @return
*/
@GetMapping(value = "api/v1/feign/colour/findByDictCodeAndDataCode")
@ApiOperation(value = "根据DictCode和DataCode获取颜色", notes = "根据DictCode和DataCode获取颜色")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictCode", value = "字典编码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "dataCode", value = "数据项编码", required = true, dataType = "String", paramType = "query")
})
public AjaxJson findByDictCodeAndDataCode(@RequestParam(value = "dictCode", required = true) String dictCode,@RequestParam(value = "dataCode", required = true) String dataCode);
}
package com.loit.api.service;
import com.loit.api.dto.ContextConfigurationDTO;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @description 上下文配置
* @author xutao
* @date 2019-10-18
*/
@FeignClient(name = "loit-portal")
public interface ContextConfigurationApiService {
@GetMapping(value = "api/v1/feign/contextConfig/list")
@ApiOperation(value="列表", notes="获取上下文配置列表")
public AjaxJson list();
@GetMapping(value = "api/v1/feign/contextConfig/page")
@ApiOperation(value="分页列表", notes="获取上下文配置分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "contextValue", value = "上下文值", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "contextDesc", value = "描述", required = false, dataType = "String", paramType = "query")})
public AjaxJson page(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "contextValue", required = false) String contextValue,
@RequestParam(value = "contextDesc", required = false) String contextDesc);
@GetMapping(value = "api/v1/feign/contextConfig/{contextId}")
@ApiOperation(value="详情", notes="根据contextId获取上下文配置详情")
@ApiImplicitParam(name = "contextId", value = "上下文配置ID", required = true, dataType = "String")
public AjaxJson get(@PathVariable(required=false) String contextId);
@PostMapping(value = "api/v1/feign/contextConfig/save")
@ApiOperation(value = "保存", notes = "新增上下文配置")
@ApiImplicitParam(name = "contextConfigurationDTO", value = "上下文配置数据传输实体类", required = true, dataType = "ContextConfigurationDTO")
public AjaxJson save(@RequestBody ContextConfigurationDTO contextConfigurationDTO);
@PostMapping(value = "api/v1/feign/contextConfig/{contextId}")
@ApiOperation(value = "修改", notes = "修改上下文配置")
public AjaxJson update(@PathVariable int contextId,@RequestBody ContextConfigurationDTO contextConfigurationDTO);
@ApiOperation(value = "删除", notes = "单个或批量删除上下文配置,多ID时,以逗号分隔")
@DeleteMapping(value = "api/v1/feign/contextConfig/{contextId}")
public AjaxJson deleteAll(@PathVariable("contextId")String ids);
@GetMapping(value = "api/v1/feign/contextConfig/serviceId/{serviceId}")
public AjaxJson getByserviceId(@PathVariable("contextId")String ids);
@ApiOperation(value = "检查上下文描述是否重复", notes = "检查上下文描述是否重复")
@ApiImplicitParams({
@ApiImplicitParam(name = "contextId", value = "上下文ID", required = false, dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "contextDesc", value = "上下文描述", required = true, dataType = "String", paramType = "query")})
@GetMapping(value = "api/v1/feign/contextConfig/checkDescUnique")
public AjaxJson checkDictNameUnique(
@RequestParam(value = "contextId", required = false) Integer contextId,
@RequestParam(value = "contextDesc", required = true) String contextDesc);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @description 字典controller
* @author: gzx
* @date: 2019年11月4日 上午9:40:29
* @version: V1.0
*/
@FeignClient(name = "loit-portal")
public interface DictApiService {
/**
* @description 系统字典分页列表
* @author xutao
* @date:2019年10月18日
* @return
*/
@RequestMapping(value = "api/v1/feign/dict/list",method = RequestMethod.GET)
public AjaxJson list(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "dictCode", required = false)String dictCode,
@RequestParam(value = "dictName", required = false)String dictName,
@RequestParam(value = "baseFlag", required = false)String baseFlag);
/**
* @description 系统字典详情
* @author xutao
* @date:2019年10月18日
* @return
*/
@GetMapping(value = "api/v1/feign/dict/{dictId}")
public AjaxJson get(@PathVariable(required=true) String dictId);
/**
* @description 检查字典名称是否重复
* @param dictId
* @param dictName
* @return
*/
@GetMapping(value = "api/v1/feign/dict/checkDictNameUnique")
public AjaxJson checkDictNameUnique(
@RequestParam(value = "dictId", required = false) Integer dictId,
@RequestParam(value = "dictName", required = true) String dictName);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
/**
* @description 系统字典数据项Controller
* @author xutao
* @date 2019-10-18
*/
@FeignClient(name = "loit-portal")
public interface DictDataApiService {
/**
* @description 系统字典数据项分页列表
* @author xutao
* @date:2019年10月18日
* @return
*/
@GetMapping(value = "api/v1/feign/dictData/page")
@ApiOperation(value="分页列表", notes="获取系统字典数据项分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "dictId", value = "字典ID", required = true, dataType = "String", paramType = "query")
})
public AjaxJson page(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "dictId", required = true) Integer dictId);
/**
* @description 系统字典数据项列表
* @author xutao
* @date:2019年10月18日
* @return
*/
@GetMapping(value = "api/v1/feign/dictData/list")
@ApiOperation(value="列表", notes="获取系统字典数据项列表")
@ApiImplicitParam(name = "dictId", value = "字典ID", required = true, dataType = "String", paramType = "query")
public AjaxJson list(@RequestParam(value = "dictId", required = true) Integer dictId);
/**
* @description 系统字典数据项详情
* @author xutao
* @date:2019年10月18日
* @param dataId
* @return
*/
@GetMapping(value = "api/v1/feign/dictData/{dataId}")
@ApiOperation(value="详情", notes="根据dataId获取系统字典数据项详情")
@ApiImplicitParam(name = "dataId", value = "系统字典数据项ID", required = true, dataType = "String")
public AjaxJson get(@PathVariable(required=true) String dataId);
/**
* @description 从缓存中获取某字典数据项列表,如果缓存中没有,则从数据库中获取
* @return
*/
@GetMapping(value = "api/v1/feign/dictData/getDictDataByDictId")
@ApiOperation(value="从缓存中获取某字典数据项列表", notes="从缓存中获取某字典数据项列表,如果缓存中没有,则从数据库中获取")
@ApiImplicitParam(name = "dictCode", value = "字典dictCode", required = true, dataType = "String", paramType="query")
public AjaxJson listDictDataByDictId(@RequestParam(value = "dictCode", required = true) String dictCode);
/**
* @description 检查字典项名称是否重复
* @return
*/
@ApiOperation(value = "检查字典项名称是否重复", notes = "检查字典项名称是否重复")
@ApiImplicitParams({
@ApiImplicitParam(name = "dictId", value = "字典ID", required = true, dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "dataId", value = "字典项ID", required = false, dataType = "int", paramType = "query"),
@ApiImplicitParam(name = "dataName", value = "字典项名称", required = true, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/dictData/checkDataNameUnique")
public AjaxJson checkDataNameUnique(
@RequestParam(value = "dictId", required = true) Integer dictId,
@RequestParam(value = "dataId", required = false) Integer dataId,
@RequestParam(value = "dataName", required = true) String dataName);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
/**
* @description: websocket消息推送
* @date: 2020/5/7 10:16
* @author: wubj
* @version v1.0
*/
@FeignClient(name = "loit-portal")
public interface JPushApiService {
/**
* 极光推送
* Map<String, String> map {"userIds":"", "message":""})
* @return
*/
@PostMapping(value = "api/v1/feign/jPush/pushAndroid")
AjaxJson pushAndroid(@RequestBody Map<String, String> map);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.List;
import java.util.Map;
/**
* @description: 通知接收人信息
* @date: 2020/5/7 10:16
* @author: wubj
* @version v1.0
*/
@FeignClient(name = "loit-portal")
public interface NoticeReceiveApiService {
/**
* 更新阅读状态
* @return
*/
@PostMapping(value = "api/v1/feign/noticeReceive/updateStatus")
AjaxJson updateStatus(@RequestParam List<Long> noticeIds, @RequestParam String userId);
}
package com.loit.api.service;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;
import com.loit.api.dto.Org;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
/**
* @ClassName: OrgController
* @Description:
* @author zhaokz
* @date 2019年10月22日 下午5:41:41
* @version V1.0
*/
@FeignClient(name = "loit-portal")
public interface OrgApiService {
/**
* 获取组织树形列表
* @return
*/
@ApiOperation(value = "获取组织树形列表", notes = "获取组织树形列表")
@GetMapping(value = "api/v1/feign/org/treeList")
public AjaxJson treeList();
/**
* 获取当前应用组织树形列表
* @return
*/
@ApiOperation(value = "获取当前应用组织树形列表", notes = "获取当前应用组织树形列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "appId", value = "应用id", required = true, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/org/currentApp/treeList1")
public AjaxJson treeList1(
@RequestParam(value = "appId", required = true) String appId);
/**
* @description 根据组织编码获取当前应用组织树形列表
* @return
*/
@ApiOperation(value = "根据组织编码获取当前应用组织树形列表", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(name = "appId", value = "应用id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "orgCode", value = "组织编码", required = true, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/org/currentApp/treeList2")
public AjaxJson treeList2(
@RequestParam(value = "appId", required = true) String appId,
@RequestParam(value = "orgCode", required = true) String orgCode);
/**
* 获取组织分页列表
* @return
*/
@ApiOperation(value = "获取组织分页列表", notes = "获取组织分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "appId", value = "应用id", required = false, dataType = "String", paramType = "query") ,
@ApiImplicitParam(name = "orgId", value = "组织ID", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "orgName", value = "组织名称", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "orgCode", value = "组织编码", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "deltag", value = "删除标记", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "queryLabelName", value = "标签名称", required = false, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/org/pageList")
public AjaxJson list(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "appId", required = false) String appId,
@RequestParam(value = "orgId", required = false) String orgId,
@RequestParam(value = "orgName", required = false) String orgName,
@RequestParam(value = "orgCode", required = false) String orgCode,
@RequestParam(value = "deltag", required = true) String deltag,
@RequestParam(value = "queryLabelName", required = false) String queryLabelName);
/**
* 获取组织分页列表
* @return
*/
@ApiOperation(value = "获取组织分页列表-无登录用户", notes = "获取组织分页列表-无登录用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "appId", value = "应用id", required = false, dataType = "String", paramType = "query") ,
@ApiImplicitParam(name = "orgId", value = "组织ID", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "orgName", value = "组织名称", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "orgCode", value = "组织编码", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "deltag", value = "删除标记", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "queryLabelName", value = "标签名称", required = false, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/org/nouser/pageList")
public AjaxJson noUserList(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "appId", required = false) String appId,
@RequestParam(value = "orgId", required = false) String orgId,
@RequestParam(value = "orgName", required = false) String orgName,
@RequestParam(value = "orgCode", required = false) String orgCode,
@RequestParam(value = "deltag", required = true) String deltag,
@RequestParam(value = "queryLabelName", required = false) String queryLabelName);
/**
* 获取组织详细信息
* @param orgId
* @return
*/
@ApiOperation(value = "获取组织详细信息", notes = "根据id来获取Org详细信息")
@ApiImplicitParam(name = "orgId", value = "orgId", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "api/v1/feign/org/{orgId}")
public AjaxJson detail(@PathVariable String orgId);
/**
* 验证组织唯一
* @param
* @return
*/
@ApiOperation(value = "组织唯一验证", notes = "组织唯一验证")
@ApiImplicitParams({
@ApiImplicitParam(name = "orgName", value = "组织名称", required = false, dataType = "String",paramType = "query"),
@ApiImplicitParam(name = "orgShortName", value = "组织简称", required = false, dataType = "String",paramType = "query"),
@ApiImplicitParam(name = "parentId", value = "父组织id", required = true, dataType = "String",paramType = "query"),
})
@PostMapping(value = "api/v1/feign/org/validateOrgName")
public AjaxJson validateOrgName(@RequestBody Org org);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;
import java.util.List;
@FeignClient(name = "loit-portal")
public interface PersonApiService {
/**
* 获取人员信息列表
* @return
*/
@ApiOperation(value = "获取人员信息列表", notes = "获取人员信息列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "delFlag", value = "是否删除", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "appId", value = "应用Id", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "personName", value = "人员名称", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "userId", value = "用户id", required = false, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/person/pageList")
public AjaxJson list(
@RequestParam(value="pageNo", required = true) Integer pageNo,
@RequestParam(value="pageSize", required = true) Integer pageSize,
@RequestParam(value="delFlag", required = true) String delFlag,
@RequestParam(value="appId", required = false) Integer appId,
@RequestParam(value="personName", required = false) String personName,
@RequestParam(value="userId", required = false) String userId);
/**
* 根据组织id获取人员信息列表
* @return
*/
@ApiOperation(value = "根据组织id获取人员信息列表", notes = "根据组织id获取人员信息列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "orgId", value = "组织id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "delFlag", value = "是否删除", required = true, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/person/orgPersonList")
public AjaxJson getPersonByOrgId(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "orgId", required = true) String orgId,
@RequestParam(value = "delFlag", required = true) String delFlag);
/**
* @description 根据用户id获取该用户所在组织下的人员列表
* @return
*/
@ApiOperation(value = "根据用户id获取该用户所在组织下的人员列表", notes = "根据用户id获取该用户所在组织下的人员列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "accountId", value = "用户id", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "delFlag", value = "是否删除", required = true, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/person/ownOrgPersonList")
public AjaxJson getListByUserId(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "accountId", required = true) String accountId,
@RequestParam(value = "delFlag", required = true) String delFlag);
/**
* 获取人员详细信息
* @param accountId
* @return
*/
@ApiOperation(value = "获取人员详细信息", notes = "根据id来获取人员详细信息")
@ApiImplicitParam(name = "accountId", value = "id", required = true, dataType = "String", paramType = "path")
@GetMapping(value = "api/v1/feign/person/{accountId}")
public AjaxJson detail(@PathVariable(value="accountId") String accountId);
/**
* 获取密码策略
* @param
* @return
*/
@ApiOperation(value = "获取密码策略", notes = "获取密码策略")
@GetMapping(value = "api/v1/feign/person/passwordApolicy")
public AjaxJson passwordApolicy();
/**
* 验证账号唯一
* @param
* @return
*/
@ApiOperation(value = "账号唯一验证", notes = "账号唯一验证")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "账号", required = true, dataType = "String",paramType = "query"),
@ApiImplicitParam(name = "accountId", value = "账号id", required = false, dataType = "String",paramType = "query")
})
@GetMapping(value = "api/v1/feign/person/validateUserId")
public AjaxJson validateUserId(
@RequestParam(value = "userId", required = true) String userId,
@RequestParam(value = "accountId", required = false) Integer accountId);
/**
* 验证人员名称唯一
* @param
* @return
*/
@ApiOperation(value = "人员名称唯一验证", notes = "人员名称唯一验证")
@ApiImplicitParams({
@ApiImplicitParam(name = "personName", value = "人员名称", required = true, dataType = "String",paramType = "query"),
@ApiImplicitParam(name = "personBaseId", value = "人员基本信息id", required = false, dataType = "String",paramType = "query")
})
@GetMapping(value = "api/v1/feign/person/validatePersonName")
public AjaxJson validatePersonName(
@RequestParam(value = "personName", required = true) String personName,
@RequestParam(value = "personBaseId", required = false) Integer personBaseId);
/**
* 密码策略校验
* @param
* @return
*/
@ApiOperation(value = "密码策略校验", notes = "密码策略校验")
@ApiImplicitParam(name = "passWord", value = "密码", required = true, dataType = "String",paramType = "query")
@PostMapping(value = "api/v1/feign/person/validatePassword")
public AjaxJson validatePassword(@RequestParam(value = "passWord", required = true) String passWord);
/**
* 获取人员详细信息
* @param
* @return
*/
@ApiOperation(value = "获取当前登录用户", notes = "获取当前登录用户")
@ApiImplicitParams({
@ApiImplicitParam(name = "userId", value = "用户登录账号", required = false, dataType = "String", paramType = "query")
})
@GetMapping(value = "api/v1/feign/person/getCurretUser")
public AjaxJson getCurretUser(@RequestParam(value = "userId", required = false) String userId);
/**
* 获取所有的账号信息
* @param
* @return
*/
@ApiOperation(value = "获取所有的账号信息", notes = "获取所有的账号信息")
@GetMapping(value = "api/v1/feign/person/getAccoutInfoList")
public AjaxJson getAccoutInfoList();
/**
* 根据登录账号列表获取账号信息列表
* @param
* @return
*/
@ApiOperation(value = "根据登录账号列表获取账号信息列表", notes = "根据登录账号列表获取账号信息列表")
@GetMapping(value = "api/v1/feign/person/getAccountByUserIds")
public AjaxJson getAccountByUserIds(@RequestParam List<String> userIds);
/**
* @description 根据角色获取人员分页列表
* @author xutao
* @date:2019年10月18日
* @return
*/
@GetMapping(value = "api/v1/feign/person/findPersonPageByRole")
@ApiOperation(value="根据角色获取人员分页列表", notes="根据角色获取人员分页列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "pageNo", value = "当前页码", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "pageSize", value = "分页大小", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "roleId", value = "角色ID(和角色编码2选1)", required = false, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "roleCode", value = "角色编码(和角色ID2选1)", required = false, dataType = "String", paramType = "query")
})
public AjaxJson findPersonPageByRole(
@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "roleId", required = false) Integer roleId,
@RequestParam(value = "roleCode", required = false) String roleCode);
}
package com.loit.api.service;
import com.loit.common.json.AjaxJson;
import io.swagger.annotations.ApiOperation;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import java.util.Map;
/**
* @description: websocket消息推送
* @date: 2020/5/7 10:16
* @author: wubj
* @version v1.0
*/
@FeignClient(name = "loit-portal")
public interface WebSocketApiService {
/**
* 广播所有在线用户
* @return
*/
@PostMapping(value = "api/v1/feign/websocket/broadcast")
AjaxJson sendMessageBroadcast(@RequestBody String message);
/**
* 发送指定用户
* Map<String, String> sendMap(key:userId, value:消息)
* @return
*/
@PostMapping(value = "api/v1/feign/websocket/toUsers")
AjaxJson sendMessageToUsers(@RequestBody Map<String, String> sendMap);
/**
* 获取用户连接的websocket服务器信息
* @return
*/
@GetMapping(value = "api/v1/feign/websocket/websocketServer")
@ApiOperation(value = "获取用户连接的websocket服务器信息")
AjaxJson getWebsocketServer();
}
package com.loit.getway;
import com.loit.common.json.AjaxJson;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* @Description: 提供给网关资源权限校验专用
* @Author: yangwenbin
* @Date: 2020/4/27 22:36
*/
@FeignClient(name = "loit-portal")
public interface PermissionService {
@GetMapping(value = "api/v1/feign/permission/checkUrlPermission")
public AjaxJson<Boolean> checkUrlPermission(@RequestParam(value = "userId",required = true) String userId,@RequestParam(value = "actUrl",required = true) String actUrl,@RequestParam(value = "method",required = true) String method);
}
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>demo</artifactId>
<groupId>com.loit</groupId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-service-api</artifactId>
<version>1.0.0</version>
<modules>
<module>loit-portal-api</module>
</modules>
<packaging>pom</packaging>
<dependencies>
<dependency>
<groupId>com.loit</groupId>
<artifactId>loit-common</artifactId>
<version>1.0.0</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
...@@ -7,9 +7,124 @@ ...@@ -7,9 +7,124 @@
<groupId>com.loit</groupId> <groupId>com.loit</groupId>
<version>1.0.0</version> <version>1.0.0</version>
</parent> </parent>
<modelVersion>4.0.0</modelVersion>
<modelVersion>4.0.0</modelVersion>
<artifactId>loit-notice</artifactId> <artifactId>loit-notice</artifactId>
<name>loit-notice</name>
<version>1.0.0</version>
<url>http://maven.apache.org</url>
<dependencies>
<!-- nacos 注册中心 -->
<dependency>
<groupId>com.timeloit.cloud</groupId>
<artifactId>spring-cloud-starter-timeloit-nacos-discovery</artifactId>
</dependency>
<!-- 微服务:Feign -->
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-openfeign</artifactId>
</dependency>
<dependency>
<groupId>com.timeloit.cloud</groupId>
<artifactId>spring-cloud-starter-timeloit-nacos-config</artifactId>
</dependency>
<dependency>
<groupId>com.loit</groupId>
<artifactId>loit-core-boot</artifactId>
<version>${loit-core-boot}</version>
</dependency>
<dependency>
<groupId>com.loit</groupId>
<artifactId>loit-common</artifactId>
<version>${loit-common}</version>
</dependency>
<dependency>
<groupId>com.loit</groupId>
<artifactId>loit-portal-api</artifactId>
<version>${loit-portal-api}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
</dependencies>
<build>
<finalName>loit-notice</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<mainClass>com.loit.NoticeApplication</mainClass>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>true</skipTests>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
<compilerArgs>
<arg>-extdirs</arg>
<arg>${project.basedir}/src/main/resources/lib</arg>
</compilerArgs>
</configuration>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>${basedir}/src/notice/java</source>
<!-- 我们可以通过在这里添加多个source节点,来添加任意多个源文件夹 -->
</sources>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
<resources>
<!-- 打包时将jsp文件拷贝到META-INF目录下 -->
<resource>
<directory>${project.basedir}/src/main/resources/lib</directory>
<targetPath>BOOT-INF/lib/</targetPath>
<includes>
<include>**/*.jar</include>
</includes>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/notice/resources</directory>
<includes>
<include>**/**</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
</build>
</project> </project>
\ No newline at end of file
package com.loit;
import com.loit.common.spring.timeloit.utils.LogUtil;
import com.loit.loitcasclient.utils.ClientSpringContextUtil;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
@SpringBootApplication
@ServletComponentScan
@EnableDiscoveryClient
@EnableFeignClients
@RestController
@EnableSwagger2
@EnableScheduling
public class NoticeApplication {
public static void main(String[] args) {
long startTime = System.currentTimeMillis();
ConfigurableApplicationContext context = SpringApplication.run(NoticeApplication.class, args);
ClientSpringContextUtil.setApplicationContext(context);
long endTime = System.currentTimeMillis();
float excTime = (float) (endTime - startTime) / 1000;
System.out.println(LogUtil.print("loit-notice项目启动成功,执行用时:" + excTime + "秒"));
}
}
server:
port: 5002
tomcat:
uriEncoding: UTF-8
max-connections: 20000
threads:
max: 1000
servlet:
encoding:
charset: UTF-8
enabled: true
force: true
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 3ac84119-5558-4bf8-b309-034dd0e458e0
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30MB
max-request-size: 30MB
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://39.100.254.140:3306/loitnotice_5002?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: loit2019ABC
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
database: 0
host: localhost
port: 6379
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password:
activemq:
in-memory: true
packages:
trust-all: true
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
main:
allow-bean-definition-overriding: true
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://120.52.185.173
# 图标文件上传
fileUpload:
uploadDir: E:/img/
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
server:
port: 7005
tomcat:
uriEncoding: UTF-8
max-threads: 1000
max-connections: 20000
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 192.168.111.150:8103
namespace: 6a40f019-770a-4fee-8079-900a9151ef61
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30Mb
max-request-size: 30Mb
http:
encoding:
charset: UTF-8
enabled: true
force: true
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://192.168.111.152:3306/loitnotice?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: root
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
database: 6
host: 192.168.111.152
port: 8000
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password: portal2019
activemq:
broker-url: tcp://192.168.111.150:61616
user: admin
password: admin
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
mybatis:
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://192.168.111.150
# 图标文件上传
fileUpload:
uploadDir: /home/loit/icon
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
server:
port: 5002
tomcat:
uriEncoding: UTF-8
max-threads: 1000
max-connections: 20000
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 3ac84119-5558-4bf8-b309-034dd0e458e0
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30Mb
max-request-size: 30Mb
http:
encoding:
charset: UTF-8
enabled: true
force: true
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://39.100.254.140:3306/loitnotice_5002?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: loit2019ABC
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
database: 1
host: 39.100.254.140
port: 6379
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password: portal2019
activemq:
broker-url: tcp://localhost:61616
user: admin
password: admin
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
mybatis:
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://120.52.185.173
# 图标文件上传
fileUpload:
uploadDir: E:/img/
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
#测试环境
server:
port: 5003
tomcat:
uriEncoding: UTF-8
max-threads: 1000
max-connections: 20000
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 47.114.50.99:8010
namespace: f59261e2-1572-439e-ac44-0fbb645c04a3
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30Mb
max-request-size: 30Mb
http:
encoding:
charset: UTF-8
enabled: true
force: true
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://39.100.254.140:3306/loitnotice_5003?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: loit2019ABC
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
database: 2
host: 39.100.254.140
port: 6379
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password: portal2019
activemq:
broker-url: tcp://localhost:61616
user: admin
password: admin
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
mybatis:
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://120.52.185.173
# 图标文件上传
fileUpload:
uploadDir: E:/img/
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
server:
port: 5102
tomcat:
uriEncoding: UTF-8
max-threads: 1000
max-connections: 20000
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 6c8fa2e5-a3b8-48a0-9ab6-c1097ecc0dc3
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30Mb
max-request-size: 30Mb
http:
encoding:
charset: UTF-8
enabled: true
force: true
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://39.100.254.140:3306/loitnotice_5102?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: loit2019ABC
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
database: 5
host: 39.100.254.140
port: 6379
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password: portal2019
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
mybatis:
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://120.52.185.173
# 图标文件上传
fileUpload:
uploadDir: E:/img/
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
server:
port: 5103
tomcat:
uriEncoding: UTF-8
max-threads: 1000
max-connections: 20000
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 27dccadb-ad5e-4036-b63e-dd2ccd136a45
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30Mb
max-request-size: 30Mb
http:
encoding:
charset: UTF-8
enabled: true
force: true
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://39.100.254.140:3306/loitnotice_5103?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: loit2019ABC
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
database: 6
host: 39.100.254.140
port: 6379
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password: portal2019
activemq:
broker-url: tcp://localhost:61616
user: admin
password: admin
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
mybatis:
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://120.52.185.173
# 图标文件上传
fileUpload:
uploadDir: E:/img/
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
server:
port: 7005
tomcat:
uriEncoding: UTF-8
max-threads: 1000
max-connections: 20000
spring:
application:
name: loit-notice
cloud:
nacos:
discovery:
# Nacos 注册中心地址
server-addr: 39.100.254.140:8103
namespace: 27dccadb-ad5e-4036-b63e-dd2ccd136a45
metadata:
management:
context-path: /actuator
servlet:
multipart:
max-file-size: 30Mb
max-request-size: 30Mb
http:
encoding:
charset: UTF-8
enabled: true
force: true
messages:
encoding: UTF-8
banner:
charset: UTF-8
devtools:
restart:
enabled: true
cache:
type: ehcache
ehcache:
config: classpath:config/ehcache.xml
datasource:
url: jdbc:mysql://39.104.177.231:3306/loitnotice?useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
type: com.alibaba.druid.pool.DruidDataSource
username: root
password: 2018time1
driver-class-name: com.mysql.jdbc.Driver
initialSize: 5
minIdle: 5
maxActive: 20
maxWait: 60000
timeBetweenEvictionRunsMillis: 60000
minEvictableIdleTimeMillis: 300000
validationQuery: SELECT 1
thymeleaf:
cache: false
enabled: false
suffix: .html
jackson:
time-zone: GMT+8
redis:
host: 39.100.254.140
port: 6379
jedis:
pool:
max-idle: 20
min-idle: 0
max-active: 8
max-wait: -1
timeout: 10000
password: portal2019
activemq:
broker-url: tcp://localhost:61616
user: admin
password: admin
resources:
static-locations: classpath:/templates/
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 127.0.0.1:9300
mybatis:
configuration:
map-underscore-to-camel-case: true
typeAliasesPackage: com.loit
mapperLocations: classpath*:mapper/**/*.xml
#security:
# basic:
# enabled: false
management:
security:
enabled: false
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
info:
name: '@project.name@'
# 打印sql
logging:
level:
com.loit.*: DEBUG
# hystrix断路器设置
feign:
hystrix:
enabled: true
# hystrix 超时时间设置
hystrix:
command:
default:
execution:
isolation:
thread:
timeoutInMilliseconds: 3000
fastdfs:
file_server_prefix: http://120.52.185.173
# 图标文件上传
fileUpload:
uploadDir: E:/img/
# 单点登录配置
loit:
swagger:
basePackage: com.loit.v1
spring.profiles.active=dev
spring.application.name=loit-notice
# Nacos \u914D\u7F6E\u4E2D\u5FC3\u5730\u5740http://39.100.254.140/
spring.cloud.nacos.config.server-addr=39.100.254.140:8103
spring.cloud.nacos.config.namespace=184ffed2-fa90-4ebc-abf6-fe1ca5c73756
spring.cloud.nacos.config.file-extension=yaml
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
以外部载入指定logback.xml java -jar -Dlogging.config=logback.xml
scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。
debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件的项目名 -->
<springProperty scope="context" name="applicationName" source="spring.application.name"/>
<!-- 定义日志文件的存储地址,默认jar同级目录logs文件夹,如需更改路径加参数: -Dlogging.path=/var/logs 没有设定直接在将日志存放到jar同级目录logs下 -->
<property name="logPath" value="${logging.path:-./logs}"/>
<!-- 定义日志归档大小 单位KB,MB,GB 默认200MB 如需更改大小加参数: -Dlogging.maxFileSize=200MB -->
<property name="maxFileSize" value="${logging.maxFileSize:-200MB}"/>
<!-- 定义日志最多保留天数 默认保留天数60天,如需更改加参数 -Dlogging.maxHistory=60-->
<property name="maxHistory" value="${logging.maxHistory:-60}"/>
<!-- 定义日志最大总大小 默认40GB,如需更改加参数 -Dlogging.totalSizeCap=40GB-->
<property name="totalSizeCap" value="${logging.totalSizeCap:-40GB}"/>
<property name="appName" value="${applicationName}"/>
<!-- 定义日志格式-->
<!--格式化输出:开通已[%d{yyyy-MM-dd HH:mm:ss.SSS}] 为了logstash使用grok遇到堆栈多行异常时匹配合并多行, %d表示日期,${APP_ANME}表示服务名, %thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%ex:堆栈信息 %n是换行符-->
<property name="CONSOLE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] ${appName} [%X{hostIp} %X{hostPort} %X{reqUri} %X{queryString} ] [%thread] %-5level %logger - %msg%n"/>
<!--输出到控制台-->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 输出到文件-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/${appName}.log</file>
<append>true</append>
<!--基于大小以及时间的轮转策略 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 %d表示按天轮转 %i表示在当前时间还没有到达周期轮转之前,日志文件达到了 maxFileSize 指定的大小,会进行归档,递增索引从 0 开始-->
<fileNamePattern>${logPath}/${appName}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- maxFileSize 指定的大小进行归档-->
<maxFileSize>${maxFileSize}</maxFileSize>
<!--这个可选的属性用来控制最多保留多少数量的归档文件,将会异步删除旧的文件 当天按天轮转表示有效期60天-->
<maxHistory>${maxHistory}</maxHistory>
<!--当达到这个大小后,旧的归档文件将会被异步的删除 -->
<totalSizeCap>${totalSizeCap}</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="com.loit" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
以外部载入指定logback.xml java -jar -Dlogging.config=logback.xml
scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。
debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件的项目名 -->
<springProperty scope="context" name="applicationName" source="spring.application.name"/>
<!-- 定义日志文件的存储地址,默认jar同级目录logs文件夹,如需更改路径加参数: -Dlogging.path=/var/logs 没有设定直接在将日志存放到jar同级目录logs下 -->
<property name="logPath" value="${logging.path:-./logs}"/>
<!-- 定义日志归档大小 单位KB,MB,GB 默认200MB 如需更改大小加参数: -Dlogging.maxFileSize=200MB -->
<property name="maxFileSize" value="${logging.maxFileSize:-200MB}"/>
<!-- 定义日志最多保留天数 默认保留天数60天,如需更改加参数 -Dlogging.maxHistory=60-->
<property name="maxHistory" value="${logging.maxHistory:-60}"/>
<!-- 定义日志最大总大小 默认40GB,如需更改加参数 -Dlogging.totalSizeCap=40GB-->
<property name="totalSizeCap" value="${logging.totalSizeCap:-40GB}"/>
<property name="appName" value="${applicationName}"/>
<!-- 定义日志格式-->
<!--格式化输出:开通已[%d{yyyy-MM-dd HH:mm:ss.SSS}] 为了logstash使用grok遇到堆栈多行异常时匹配合并多行, %d表示日期,${APP_ANME}表示服务名, %thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%ex:堆栈信息 %n是换行符-->
<property name="CONSOLE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] ${appName} [%X{hostIp} %X{hostPort} %X{reqUri} %X{queryString} ] [%thread] %-5level %logger - %msg%n"/>
<!--输出到控制台-->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 输出到文件-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/${appName}.log</file>
<append>true</append>
<!--基于大小以及时间的轮转策略 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 %d表示按天轮转 %i表示在当前时间还没有到达周期轮转之前,日志文件达到了 maxFileSize 指定的大小,会进行归档,递增索引从 0 开始-->
<fileNamePattern>${logPath}/${appName}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- maxFileSize 指定的大小进行归档-->
<maxFileSize>${maxFileSize}</maxFileSize>
<!--这个可选的属性用来控制最多保留多少数量的归档文件,将会异步删除旧的文件 当天按天轮转表示有效期60天-->
<maxHistory>${maxHistory}</maxHistory>
<!--当达到这个大小后,旧的归档文件将会被异步的删除 -->
<totalSizeCap>${totalSizeCap}</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="com.loit" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
以外部载入指定logback.xml java -jar -Dlogging.config=logback.xml
scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。
debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件的项目名 -->
<springProperty scope="context" name="applicationName" source="spring.application.name"/>
<!-- 定义日志文件的存储地址,默认jar同级目录logs文件夹,如需更改路径加参数: -Dlogging.path=/var/logs 没有设定直接在将日志存放到jar同级目录logs下 -->
<property name="logPath" value="${logging.path:-./logs}"/>
<!-- 定义日志归档大小 单位KB,MB,GB 默认200MB 如需更改大小加参数: -Dlogging.maxFileSize=200MB -->
<property name="maxFileSize" value="${logging.maxFileSize:-200MB}"/>
<!-- 定义日志最多保留天数 默认保留天数60天,如需更改加参数 -Dlogging.maxHistory=60-->
<property name="maxHistory" value="${logging.maxHistory:-60}"/>
<!-- 定义日志最大总大小 默认40GB,如需更改加参数 -Dlogging.totalSizeCap=40GB-->
<property name="totalSizeCap" value="${logging.totalSizeCap:-40GB}"/>
<property name="appName" value="${applicationName}"/>
<!-- 定义日志格式-->
<!--格式化输出:开通已[%d{yyyy-MM-dd HH:mm:ss.SSS}] 为了logstash使用grok遇到堆栈多行异常时匹配合并多行, %d表示日期,${APP_ANME}表示服务名, %thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%ex:堆栈信息 %n是换行符-->
<property name="CONSOLE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] ${appName} [%X{hostIp} %X{hostPort} %X{reqUri} %X{queryString} ] [%thread] %-5level %logger - %msg%n"/>
<!--输出到控制台-->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 输出到文件-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/${appName}.log</file>
<append>true</append>
<!--基于大小以及时间的轮转策略 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 %d表示按天轮转 %i表示在当前时间还没有到达周期轮转之前,日志文件达到了 maxFileSize 指定的大小,会进行归档,递增索引从 0 开始-->
<fileNamePattern>${logPath}/${appName}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- maxFileSize 指定的大小进行归档-->
<maxFileSize>${maxFileSize}</maxFileSize>
<!--这个可选的属性用来控制最多保留多少数量的归档文件,将会异步删除旧的文件 当天按天轮转表示有效期60天-->
<maxHistory>${maxHistory}</maxHistory>
<!--当达到这个大小后,旧的归档文件将会被异步的删除 -->
<totalSizeCap>${totalSizeCap}</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="com.loit" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
以外部载入指定logback.xml java -jar -Dlogging.config=logback.xml
scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。
debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件的项目名 -->
<springProperty scope="context" name="applicationName" source="spring.application.name"/>
<!-- 定义日志文件的存储地址,默认jar同级目录logs文件夹,如需更改路径加参数: -Dlogging.path=/var/logs 没有设定直接在将日志存放到jar同级目录logs下 -->
<property name="logPath" value="${logging.path:-./logs}"/>
<!-- 定义日志归档大小 单位KB,MB,GB 默认200MB 如需更改大小加参数: -Dlogging.maxFileSize=200MB -->
<property name="maxFileSize" value="${logging.maxFileSize:-200MB}"/>
<!-- 定义日志最多保留天数 默认保留天数60天,如需更改加参数 -Dlogging.maxHistory=60-->
<property name="maxHistory" value="${logging.maxHistory:-60}"/>
<!-- 定义日志最大总大小 默认40GB,如需更改加参数 -Dlogging.totalSizeCap=40GB-->
<property name="totalSizeCap" value="${logging.totalSizeCap:-40GB}"/>
<property name="appName" value="${applicationName}"/>
<!-- 定义日志格式-->
<!--格式化输出:开通已[%d{yyyy-MM-dd HH:mm:ss.SSS}] 为了logstash使用grok遇到堆栈多行异常时匹配合并多行, %d表示日期,${APP_ANME}表示服务名, %thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%ex:堆栈信息 %n是换行符-->
<property name="CONSOLE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] ${appName} [%X{hostIp} %X{hostPort} %X{reqUri} %X{queryString} ] [%thread] %-5level %logger - %msg%n"/>
<!--输出到控制台-->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 输出到文件-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/${appName}.log</file>
<append>true</append>
<!--基于大小以及时间的轮转策略 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 %d表示按天轮转 %i表示在当前时间还没有到达周期轮转之前,日志文件达到了 maxFileSize 指定的大小,会进行归档,递增索引从 0 开始-->
<fileNamePattern>${logPath}/${appName}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- maxFileSize 指定的大小进行归档-->
<maxFileSize>${maxFileSize}</maxFileSize>
<!--这个可选的属性用来控制最多保留多少数量的归档文件,将会异步删除旧的文件 当天按天轮转表示有效期60天-->
<maxHistory>${maxHistory}</maxHistory>
<!--当达到这个大小后,旧的归档文件将会被异步的删除 -->
<totalSizeCap>${totalSizeCap}</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="com.loit" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<!--
以外部载入指定logback.xml java -jar -Dlogging.config=logback.xml
scan:当此属性设置为true时,配置文件如果发生改变,将会被重新加载,默认值为true。
scanPeriod:设置监测配置文件是否有修改的时间间隔,如果没有给出时间单位,默认单位是毫秒当scan为true时,此属性生效。默认的时间间隔为1分钟。
debug:当此属性设置为true时,将打印出logback内部日志信息,实时查看logback运行状态。默认值为false。
-->
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 定义日志文件的项目名 -->
<springProperty scope="context" name="applicationName" source="spring.application.name"/>
<!-- 定义日志文件的存储地址,默认jar同级目录logs文件夹,如需更改路径加参数: -Dlogging.path=/var/logs 没有设定直接在将日志存放到jar同级目录logs下 -->
<property name="logPath" value="${logging.path:-./logs}"/>
<!-- 定义日志归档大小 单位KB,MB,GB 默认200MB 如需更改大小加参数: -Dlogging.maxFileSize=200MB -->
<property name="maxFileSize" value="${logging.maxFileSize:-200MB}"/>
<!-- 定义日志最多保留天数 默认保留天数60天,如需更改加参数 -Dlogging.maxHistory=60-->
<property name="maxHistory" value="${logging.maxHistory:-60}"/>
<!-- 定义日志最大总大小 默认40GB,如需更改加参数 -Dlogging.totalSizeCap=40GB-->
<property name="totalSizeCap" value="${logging.totalSizeCap:-40GB}"/>
<property name="appName" value="${applicationName}"/>
<!-- 定义日志格式-->
<!--格式化输出:开通已[%d{yyyy-MM-dd HH:mm:ss.SSS}] 为了logstash使用grok遇到堆栈多行异常时匹配合并多行, %d表示日期,${APP_ANME}表示服务名, %thread表示线程名,%-5level:级别从左显示5个字符宽度%msg:日志消息,%ex:堆栈信息 %n是换行符-->
<property name="CONSOLE_LOG_PATTERN" value="[%d{yyyy-MM-dd HH:mm:ss.SSS}] ${appName} [%X{hostIp} %X{hostPort} %X{reqUri} %X{queryString} ] [%thread] %-5level %logger - %msg%n"/>
<!--输出到控制台-->
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
<charset>UTF-8</charset>
</encoder>
</appender>
<!-- 输出到文件-->
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${logPath}/${appName}.log</file>
<append>true</append>
<!--基于大小以及时间的轮转策略 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!--日志文件输出的文件名 %d表示按天轮转 %i表示在当前时间还没有到达周期轮转之前,日志文件达到了 maxFileSize 指定的大小,会进行归档,递增索引从 0 开始-->
<fileNamePattern>${logPath}/${appName}-%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- maxFileSize 指定的大小进行归档-->
<maxFileSize>${maxFileSize}</maxFileSize>
<!--这个可选的属性用来控制最多保留多少数量的归档文件,将会异步删除旧的文件 当天按天轮转表示有效期60天-->
<maxHistory>${maxHistory}</maxHistory>
<!--当达到这个大小后,旧的归档文件将会被异步的删除 -->
<totalSizeCap>${totalSizeCap}</totalSizeCap>
</rollingPolicy>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
</encoder>
</appender>
<logger name="com.loit" level="DEBUG" />
<!-- 日志输出级别 -->
<root level="info">
<appender-ref ref="STDOUT"/>
<appender-ref ref="FILE"/>
</root>
</configuration>
\ No newline at end of file
package com.loit.v1.api.controller.feign;
import com.alibaba.fastjson.JSON;
import com.loit.api.dto.ApplicationManage;
import com.loit.api.service.ApplicationManagerApiService;
import com.loit.common.annotation.BeforeAuditAnnotation;
import com.loit.common.json.AjaxJson;
import com.loit.common.persistence.Page;
import com.loit.common.utils.StringUtils;
import com.loit.v1.modules.entity.Message;
import com.loit.v1.modules.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.LinkedHashMap;
import java.util.List;
/**
* 消息管理接口
* Created by WBJ on 2020-04-23.
**/
@RestController
@RequestMapping(value = "api/v1/feign/message")
@Api(tags = "Feign 消息管理", value = "FeignMessageController")
public class FeignMessageController {
/**
* 日志工具
*/
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private MessageService messageService;
@Autowired
private ApplicationManagerApiService appService;
/**
* 消息详情
*/
@ApiOperation(value = "消息详情", notes = "根据id获取消息详情信息")
@ApiImplicitParam(paramType = "path", name = "id", value = "消息id", required = true, dataType = "Long")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public AjaxJson get(@PathVariable("id") Integer id) {
Message notice = messageService.get(id);
AjaxJson json = new AjaxJson();
json.put("obj", notice);
return json;
}
/**
* 消息中心分页列表
*/
@ApiOperation(value = "消息中心分页列表", notes = "消息中心分页列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "pageNo", value = "当前页码", required = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "pageSize", value = "分页大小", required = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeTopic", value = "消息标题", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeType", value = "消息类型", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeSource", value = "消息来源", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeLevel", value = "紧急程度(1一般,2紧急)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeStatus", value = "状态(0未读,1已读)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "showFlag", value = "是否展示所有接收人信息(0 否 1是)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "createTimeStart", value = "开始时间", required = false, dataType = "Date"),
@ApiImplicitParam(paramType = "query", name = "createTimeEnd", value = "结束时间", required = false, dataType = "Date"),
@ApiImplicitParam(paramType = "query", name = "orderByName", value = "排序字段名称", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "orderBy", value = "排序(asc/desc)", required = false, dataType = "String")
})
@RequestMapping(value = "/page", method = RequestMethod.GET)
public AjaxJson findPage(@ApiIgnore Message notice, HttpServletRequest request, HttpServletResponse response) {
AjaxJson json = new AjaxJson();
Page<Message> page = messageService.findPage(new Page<Message>(request, response), notice);
json.put("page", page);
return json;
}
/**
* 消息推送
*/
@ApiOperation(value = "消息推送", notes = "消息推送")
@PostMapping("/propel")
@BeforeAuditAnnotation
public AjaxJson propel(@RequestBody Message notice) {
AjaxJson json = new AjaxJson();
try {
if(notice!=null){
if(notice.getAppId()==null && StringUtils.isNotBlank(notice.getAppCode())){
AjaxJson appJson = appService.getByAppCode(notice.getAppCode());
if (appJson!=null){
Object obj = json.getBody();
if (obj != null) {
LinkedHashMap map = (LinkedHashMap) ((LinkedHashMap)obj).get("manager");
ApplicationManage manager = JSON.parseObject(JSON.toJSONString(map),ApplicationManage.class);
if(manager!=null && manager.getAppId()!=null){
notice.setAppId(manager.getAppId());
}
}
}
}
}
messageService.propel(notice);
json.setMsg("推送成功");
} catch (Exception e) {
e.printStackTrace();
return AjaxJson.returnExceptionInfo("推送异常");
}
return json;
}
/**
* 统计未读消息数量
*/
@ApiOperation(value = "统计未读消息数量", notes = "统计未读消息数量")
@GetMapping("/unread")
public AjaxJson getUnreadList() {
AjaxJson json = new AjaxJson();
List<Message> list = messageService.getUnreadList();
json.put("list", list);
json.put("count", list.size());
return json;
}
/**
* 标记消息为已读
*/
@ApiOperation(value = "标记消息为已读", notes = "标记消息为已读")
@PostMapping("/updateStatus")
public AjaxJson updateStatus(@RequestBody Message notice) {
AjaxJson json = new AjaxJson();
try {
messageService.updateStatus(notice);
json.setMsg("标记成功");
} catch (Exception e) {
e.printStackTrace();
return AjaxJson.returnExceptionInfo("标记异常");
}
return json;
}
}
package com.loit.v1.api.controller.open;
import com.loit.common.annotation.BeforeAuditAnnotation;
import com.loit.common.json.AjaxJson;
import com.loit.v1.modules.entity.Message;
import com.loit.v1.modules.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 消息管理接口
* Created by WBJ on 2020-04-23.
**/
@RestController
@RequestMapping(value = "api/v1/open/message")
@Api(tags = "Open 消息管理", value = "OpenMessageController")
public class OpenMessageController {
/**
* 日志工具
*/
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private MessageService messageService;
/**
* 消息推送
*/
@ApiOperation(value = "消息推送", notes = "消息推送")
@PostMapping("/propel")
public AjaxJson propel(@RequestBody Message notice) {
AjaxJson json = new AjaxJson();
try {
messageService.propel(notice);
json.setMsg("推送成功");
} catch (Exception e) {
e.printStackTrace();
return AjaxJson.returnExceptionInfo("推送异常");
}
return json;
}
}
package com.loit.v1.modules.config;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.websocket.*;
import java.net.URI;
/**
* @description: WebSocketClient
* @date: 2020/5/13 15:26
* @author: wubj
* @version v1.0
*/
@ClientEndpoint
public class WebSocketClient {
private static Logger logger = LoggerFactory.getLogger(WebSocketClient.class);
@OnOpen
public void open(Session session){
logger.info("Client WebSocket is opening...");
this.session = session;
}
@OnMessage
public void onMessage(String message){
logger.info("Server send message: " + message);
}
@OnClose
public void onClose(){
logger.info("Websocket closed");
}
public Session session;
public void start(String uri) {
WebSocketContainer container = null;
try {
container = ContainerProvider.getWebSocketContainer();
URI r = URI.create(uri);
session = container.connectToServer(WebSocketClient.class, r);
} catch (Exception e) {
logger.error("WebSocketClient连接异常: ", e);
}
}
}
package com.loit.v1.modules.constant;
/**
* 常量
* Created by WBJ on 2020-04-23.
**/
public class NoticeConstants {
/**
* 消息类型字典code
*/
public static final String NOTICE_TYPE = "NOTICE_TYPE";
/**
* 消息来源字典code
*/
public static final String NOTICE_SOURCE = "NOTICE_SOURCE";
/**
* 消息定时器
*/
public static final String NOTICE_TASK = "noticeTask";
/**
* 消息等级
*/
public static final String NOTICE_GRADE = "NOTICE_GRADE";
}
package com.loit.v1.modules.controller;
import com.loit.common.annotation.BeforeAuditAnnotation;
import com.loit.common.json.AjaxJson;
import com.loit.common.persistence.Page;
import com.loit.v1.modules.entity.Message;
import com.loit.v1.modules.service.MessageESService;
import com.loit.v1.modules.service.MessageService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.util.Date;
import java.util.List;
/**
* 消息管理
* Created by WBJ on 2020-04-23.
**/
@RestController
@RequestMapping(value = "/api/v1/message")
@Api(tags = "消息接口", value = "MessageController")
public class MessageController {
/**
* 日志工具
*/
private Logger logger = LoggerFactory.getLogger(this.getClass());
@Autowired
private MessageService messageService;
@Autowired
private MessageESService messageESService;
/**
* 消息详情
*/
@ApiOperation(value = "消息详情", notes = "根据id获取消息详情信息")
@ApiImplicitParam(paramType = "path", name = "id", value = "消息id", required = true, dataType = "Long")
@RequestMapping(value = "/{id}", method = RequestMethod.GET)
public AjaxJson get(@PathVariable("id") Integer id) {
Message notice = messageService.get(id);
AjaxJson json = new AjaxJson();
json.put("obj", notice);
return json;
}
/**
* 消息分页列表
*/
@ApiOperation(value = "消息分页列表", notes = "消息分页列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "pageNo", value = "当前页码", required = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "pageSize", value = "分页大小", required = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeTopic", value = "消息标题", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeType", value = "消息类型", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeSource", value = "消息来源", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeLevel", value = "紧急程度(1一般,2紧急)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeStatus", value = "状态(0未读,1已读)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "showFlag", value = "是否展示所有接收人信息(0 否 1是)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "createTimeStart", value = "开始时间", required = false, dataType = "Date"),
@ApiImplicitParam(paramType = "query", name = "createTimeEnd", value = "结束时间", required = false, dataType = "Date"),
@ApiImplicitParam(paramType = "query", name = "orderByName", value = "排序字段名称", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "orderBy", value = "排序(asc/desc)", required = false, dataType = "String")
})
@RequestMapping(value = "/page", method = RequestMethod.GET)
public AjaxJson findPage(@ApiIgnore Message notice, HttpServletRequest request, HttpServletResponse response) {
AjaxJson json = new AjaxJson();
Page<Message> page = messageService.findPage(new Page<Message>(request, response), notice);
json.put("page", page);
return json;
}
/**
* 消息推送
*/
@ApiOperation(value = "消息推送", notes = "消息推送")
@PostMapping("/propel")
@BeforeAuditAnnotation
public AjaxJson propel(@RequestBody Message notice) {
AjaxJson json = new AjaxJson();
try {
messageService.propel(notice);
json.setMsg("推送成功");
} catch (Exception e) {
e.printStackTrace();
return AjaxJson.returnExceptionInfo("推送异常");
}
return json;
}
/**
* 统计未读消息数量
*/
@ApiOperation(value = "统计未读消息数量", notes = "统计未读消息数量")
@GetMapping("/unread")
public AjaxJson getUnreadList() {
AjaxJson json = new AjaxJson();
List<Message> list = messageService.getUnreadList();
json.put("list", list);
json.put("count", list.size());
return json;
}
/**
* 标记消息为已读
*/
@ApiOperation(value = "标记消息为已读", notes = "标记消息为已读")
@PostMapping("/updateStatus")
public AjaxJson updateStatus(@RequestBody Message notice) {
AjaxJson json = new AjaxJson();
try {
messageService.updateStatus(notice);
json.setMsg("标记成功");
} catch (Exception e) {
e.printStackTrace();
return AjaxJson.returnExceptionInfo("标记异常");
}
return json;
}
@ApiOperation(value = "历史消息分页列表", notes = "历史消息分页列表")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", name = "pageNo", value = "当前页码", required = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "pageSize", value = "分页大小", required = true, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeTopic", value = "消息标题", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeType", value = "消息类型", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "noticeLevel", value = "紧急程度(1一般,2紧急)", required = false, dataType = "String"),
@ApiImplicitParam(paramType = "query", name = "createTimeStart", value = "开始时间", required = false, dataType = "Date"),
@ApiImplicitParam(paramType = "query", name = "createTimeEnd", value = "结束时间", required = false, dataType = "Date")
})
@RequestMapping(value = "/historyPage", method = RequestMethod.GET)
public AjaxJson findHistoryPage(@RequestParam(value = "pageNo", required = true) Integer pageNo,
@RequestParam(value = "pageSize", required = true) Integer pageSize,
@RequestParam(value = "noticeTopic", required = false)String noticeTopic,
@RequestParam(value = "noticeType", required = false)String noticeType,
@RequestParam(value = "noticeLevel", required = false)String noticeLevel,
@RequestParam(value = "createTimeStart", required = false)Date createTimeStart,
@RequestParam(value = "createTimeEnd", required = false)Date createTimeEnd,
HttpServletRequest request, HttpServletResponse response
) {
AjaxJson json = new AjaxJson();
try {
json = messageESService.findHistoryPage(pageNo, pageSize, noticeTopic,
noticeType, noticeLevel,createTimeStart, createTimeEnd);
} catch (Exception e) {
Message notice = new Message();
notice.setNoticeTopic(noticeTopic);
notice.setNoticeType(noticeType);
notice.setNoticeLevel(noticeLevel);
notice.setCreateTimeStart(createTimeStart);
notice.setCreateTimeEnd(createTimeEnd);
Page<Message> page = messageService.findPage(new Page<Message>(request, response), notice);
json.put("page", page);
logger.error("es查询消息失败:{}", e.getMessage());
}
return json;
}
}
package com.loit.v1.modules.dao;
import com.loit.common.persistence.CrudDao;
import com.loit.v1.modules.entity.Message;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 消息表数据层数据库操作接口类.
* Created by WBJ on 2020-04-23.
**/
@Mapper
public interface MessageDao extends CrudDao<Message> {
/**
* 获取近期消息ids
* @return
*/
List<Long> getRecentNoticeIds();
/**
* 根据ids删除数据
*/
void deleteByIds(List<Long> list);
/**
* 根据ids获取消息信息
* @param list
* @return
*/
List<Message> findListByIds(List<Long> list);
/**
* 根据接收人ids获取消息
* @param list
* @return
*/
List<Message> findListByReceiveIds(List<String> list);
Long findIdByNoticeTypeId(Integer noticeTypeId);
}
\ No newline at end of file
package com.loit.v1.modules.dao;
import com.loit.v1.modules.entity.MessageES;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
public interface MessageESDao extends ElasticsearchRepository<MessageES, Integer> {
}
package com.loit.v1.modules.dao;
import com.loit.common.persistence.CrudDao;
import com.loit.v1.modules.entity.MessageReceive;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 消息接收表数据层数据库操作接口类.
* Created by YZB on 2020-04-23.
**/
@Mapper
public interface MessageReceiveDao extends CrudDao<MessageReceive> {
/**
* 标记消息为已读
* @param list
*/
void updateStatus(String receiveId, List<Long> list);
/**
* 获取接收人未读消息数量
* @param receiveUser
* @return
*/
int getUnreadCount(String receiveUser);
/**
* 获取近期消息ids
* @return
*/
List<Long> getRecentNoticeIds();
/**
* 根据ids删除数据
*/
void deleteByIds(List<Long> list);
/**
* 根据noticeIds删除数据
*/
void deleteByNoticeIds(List<Long> list);
/**
* 批量插入
* @param list
*/
void insertBatch(List<MessageReceive> list);
}
\ No newline at end of file
差异被折叠。
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论